From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:44:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503815.776123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBVi-0001yb-RS; Wed, 01 Mar 2023 01:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503815.776123; Wed, 01 Mar 2023 01: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 1pXBVi-0001yI-Nv; Wed, 01 Mar 2023 01:44:02 +0000
Received: by outflank-mailman (input) for mailman id 503815;
 Wed, 01 Mar 2023 01: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 1pXBVh-0001wy-Qq
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBVh-0001fF-Q9
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBVh-0000E3-NQ
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=wyiPzBBKtYwwcMAYbxfbe9kEx17wtKyWA6nh0p/HKKU=; b=gajGfRohEspJP1BI/GjiH54iA6
	LYO+XxJvw+rRvs3yCqSA/FylpZW3wxe1p3p0azU8HRW3IJ87LwaJO+n8U7oQV7fCDyUkTyvt6+kQc
	J80iVvyRNuDyZnFQ7DxOc2u2sRxK/LbmYTh8lEJ93xQPfHMdKSZJF+gMVet5dydm59QI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: move dm-mmio handling code in sh_page_fault()
Message-Id: <E1pXBVh-0000E3-NQ@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:44:01 +0000

commit 4e8205f4fdb9a043170439c9c63542ddff816849
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 27 13:34:30 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 27 13:34:30 2023 +0100

    x86/shadow: move dm-mmio handling code in sh_page_fault()
    
    Do away with the partly mis-named "mmio" label there, which really is
    only about emulated MMIO. Move the code to the place where the sole
    "goto" was. Re-order steps slightly: Assertion first, perfc increment
    outside of the locked region, and "gpa" calculation closer to the first
    use of the variable. Also make the HVM conditional cover the entire
    if(), as p2m_mmio_dm isn't applicable to PV; specifically get_gfn()
    won't ever return this type for PV domains.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 43 +++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 5f3e175bbe..be67e9cb62 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2161,8 +2161,8 @@ static int cf_check sh_page_fault(
     gfn_t gfn = _gfn(0);
     mfn_t gmfn, sl1mfn = _mfn(0);
     shadow_l1e_t sl1e, *ptr_sl1e;
-    paddr_t gpa;
 #ifdef CONFIG_HVM
+    paddr_t gpa;
     struct sh_emulate_ctxt emul_ctxt;
     const struct x86_emulate_ops *emul_ops;
     int r;
@@ -2586,13 +2586,33 @@ static int cf_check sh_page_fault(
         goto emulate;
     }
 
+#ifdef CONFIG_HVM
+
     /* Need to hand off device-model MMIO to the device model */
     if ( p2mt == p2m_mmio_dm )
     {
+        ASSERT(is_hvm_vcpu(v));
+        if ( !guest_mode(regs) )
+            goto not_a_shadow_fault;
+
+        sh_audit_gw(v, &gw);
         gpa = guest_walk_to_gpa(&gw);
-        goto mmio;
+        SHADOW_PRINTK("mmio %#"PRIpaddr"\n", gpa);
+        shadow_audit_tables(v);
+        sh_reset_early_unshadow(v);
+
+        paging_unlock(d);
+        put_gfn(d, gfn_x(gfn));
+
+        perfc_incr(shadow_fault_mmio);
+        trace_shadow_gen(TRC_SHADOW_MMIO, va);
+
+        return handle_mmio_with_translation(va, gpa >> PAGE_SHIFT, access)
+               ? EXCRET_fault_fixed : 0;
     }
 
+#endif /* CONFIG_HVM */
+
     /* Ignore attempts to write to read-only memory. */
     if ( p2m_is_readonly(p2mt) && (ft == ft_demand_write) )
         goto emulate_readonly; /* skip over the instruction */
@@ -2865,25 +2885,6 @@ static int cf_check sh_page_fault(
     return EXCRET_fault_fixed;
 #endif /* CONFIG_HVM */
 
- mmio:
-    if ( !guest_mode(regs) )
-        goto not_a_shadow_fault;
-#ifdef CONFIG_HVM
-    ASSERT(is_hvm_vcpu(v));
-    perfc_incr(shadow_fault_mmio);
-    sh_audit_gw(v, &gw);
-    SHADOW_PRINTK("mmio %#"PRIpaddr"\n", gpa);
-    shadow_audit_tables(v);
-    sh_reset_early_unshadow(v);
-    paging_unlock(d);
-    put_gfn(d, gfn_x(gfn));
-    trace_shadow_gen(TRC_SHADOW_MMIO, va);
-    return (handle_mmio_with_translation(va, gpa >> PAGE_SHIFT, access)
-            ? EXCRET_fault_fixed : 0);
-#else
-    BUG();
-#endif
-
  not_a_shadow_fault:
     sh_audit_gw(v, &gw);
     SHADOW_PRINTK("not a shadow fault\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:44:12 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503818.776127 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBVs-00027S-Sc; Wed, 01 Mar 2023 01:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503818.776127; Wed, 01 Mar 2023 01:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBVs-00026n-Pi; Wed, 01 Mar 2023 01:44:12 +0000
Received: by outflank-mailman (input) for mailman id 503818;
 Wed, 01 Mar 2023 01: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 1pXBVs-00025E-1e
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBVs-0001fL-0S
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBVr-0000EY-SU
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=lFviXYkZuTY2n1gEz16AFD5C10gwnv3XLB23bgzB2dI=; b=Jv0kvhFGummtJ/+ezj8BhFRf6V
	OtK809wmImqgPC/QN920gy32tNKNVNvKsdLhJFjS9W/ViiIPV3EGKV56J3HeUVAZkboPE8std0+RI
	jXiPN7lTiH40Ov4H3BBOcKbD/0J544N5HmjCOphIhGdpScsc4nZAQbg4WeB8Y1htpkpQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: mark more of sh_page_fault() HVM-only
Message-Id: <E1pXBVr-0000EY-SU@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:44:11 +0000

commit 1950d8c351c3dd2ba9e4cc283ec91cb580824fd4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 27 13:36:01 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 27 13:36:01 2023 +0100

    x86/shadow: mark more of sh_page_fault() HVM-only
    
    The types p2m_is_readonly() checks for aren't applicable to PV;
    specifically get_gfn() won't ever return any such type for PV domains.
    Extend the HVM-conditional block of code, also past the subsequent HVM-
    only if(). This way the "emulate_readonly" also becomes unreachable when
    !HVM, so move the conditional there upwards as well. Noticing the
    earlier shadow_mode_refcounts() check, move it up even further, right
    after that check. With that, the "done" label also needs marking as
    potentially unused.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index be67e9cb62..38486e245b 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2611,8 +2611,6 @@ static int cf_check sh_page_fault(
                ? EXCRET_fault_fixed : 0;
     }
 
-#endif /* CONFIG_HVM */
-
     /* Ignore attempts to write to read-only memory. */
     if ( p2m_is_readonly(p2mt) && (ft == ft_demand_write) )
         goto emulate_readonly; /* skip over the instruction */
@@ -2631,12 +2629,14 @@ static int cf_check sh_page_fault(
         goto emulate;
     }
 
+#endif /* CONFIG_HVM */
+
     perfc_incr(shadow_fault_fixed);
     d->arch.paging.log_dirty.fault_count++;
     sh_reset_early_unshadow(v);
 
     trace_shadow_fixup(gw.l1e, va);
- done:
+ done: __maybe_unused;
     sh_audit_gw(v, &gw);
     SHADOW_PRINTK("fixed\n");
     shadow_audit_tables(v);
@@ -2648,6 +2648,7 @@ static int cf_check sh_page_fault(
     if ( !shadow_mode_refcounts(d) || !guest_mode(regs) )
         goto not_a_shadow_fault;
 
+#ifdef CONFIG_HVM
     /*
      * We do not emulate user writes. Instead we use them as a hint that the
      * page is no longer a page table. This behaviour differs from native, but
@@ -2675,7 +2676,6 @@ static int cf_check sh_page_fault(
         goto not_a_shadow_fault;
     }
 
-#ifdef CONFIG_HVM
     /* Unshadow if we are writing to a toplevel pagetable that is
      * flagged as a dying process, and that is not currently used. */
     if ( sh_mfn_is_a_page_table(gmfn) && is_hvm_domain(d) &&
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:44:22 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503819.776131 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBW2-0002B1-Tz; Wed, 01 Mar 2023 01:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503819.776131; Wed, 01 Mar 2023 01:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBW2-0002At-RG; Wed, 01 Mar 2023 01:44:22 +0000
Received: by outflank-mailman (input) for mailman id 503819;
 Wed, 01 Mar 2023 01: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 1pXBW2-0002Ah-5c
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBW2-0001fm-3z
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBW2-0000F8-2i
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=y4Rra+arRIdSEAXoe/IDieUjYrwPyJbItAnSRslAWQM=; b=rnNUvFXlPH4lqwyrOkigalQx/p
	QAANQR+OFEReAHZXbu8+woV2gw2xm+nPktByUJusNJF08u55jSmvE7kExJTd3QZN/7AlWQ1uR9Cjj
	8J4+ux+ynXEVB8mh5YSBfGPTkDodVFJvuwbz/PP4jO/Lg4QER+DmXpJ5Do88ZbhDnlzo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: drop dead code from HVM-only sh_page_fault() pieces
Message-Id: <E1pXBW2-0000F8-2i@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:44:22 +0000

commit db3897746cf8a0b77b13c589897237867800b023
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 27 13:36:58 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 27 13:36:58 2023 +0100

    x86/shadow: drop dead code from HVM-only sh_page_fault() pieces
    
    The shadow_mode_refcounts() check immediately ahead of the "emulate"
    label renders redundant two subsequent is_hvm_domain() checks (the
    latter of which was already redundant with the former).
    
    Also guest_mode() checks are pointless when we already know we're
    dealing with a HVM domain.
    
    Finally style-adjust a comment which otherwise would be fully visible as
    patch context anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 38486e245b..f02f100f24 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2592,8 +2592,6 @@ static int cf_check sh_page_fault(
     if ( p2mt == p2m_mmio_dm )
     {
         ASSERT(is_hvm_vcpu(v));
-        if ( !guest_mode(regs) )
-            goto not_a_shadow_fault;
 
         sh_audit_gw(v, &gw);
         gpa = guest_walk_to_gpa(&gw);
@@ -2645,7 +2643,7 @@ static int cf_check sh_page_fault(
     return EXCRET_fault_fixed;
 
  emulate:
-    if ( !shadow_mode_refcounts(d) || !guest_mode(regs) )
+    if ( !shadow_mode_refcounts(d) )
         goto not_a_shadow_fault;
 
 #ifdef CONFIG_HVM
@@ -2670,16 +2668,11 @@ static int cf_check sh_page_fault(
      * caught by user-mode page-table check above.
      */
  emulate_readonly:
-    if ( !is_hvm_domain(d) )
-    {
-        ASSERT_UNREACHABLE();
-        goto not_a_shadow_fault;
-    }
-
-    /* Unshadow if we are writing to a toplevel pagetable that is
-     * flagged as a dying process, and that is not currently used. */
-    if ( sh_mfn_is_a_page_table(gmfn) && is_hvm_domain(d) &&
-         mfn_to_page(gmfn)->pagetable_dying )
+    /*
+     * Unshadow if we are writing to a toplevel pagetable that is
+     * flagged as a dying process, and that is not currently used.
+     */
+    if ( sh_mfn_is_a_page_table(gmfn) && mfn_to_page(gmfn)->pagetable_dying )
     {
         int used = 0;
         struct vcpu *tmp;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:44:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503820.776135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBWD-0002E2-09; Wed, 01 Mar 2023 01:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503820.776135; Wed, 01 Mar 2023 01:44:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBWC-0002Dt-TR; Wed, 01 Mar 2023 01:44:32 +0000
Received: by outflank-mailman (input) for mailman id 503820;
 Wed, 01 Mar 2023 01: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 1pXBWC-0002Di-84
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBWC-0001g0-7I
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBWC-0000Fn-6F
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=XJzu5VWh8KqxPM3rOrxS82zqoTcVGoBetaLer9YCez8=; b=iRabZhpL9Mird5tLvHQuErFZR0
	N6Yax0e722ocH7Wiql7g/fvruq83mJuwejRiTdnhpolh0n09oAQ5ixIxDb7N8b0RGo28dTORKSsz6
	gXkXjbsv1zSJXg7QlTFJnMBseOIqV6hQ/WfCO4ggpfvDTDhpxv2JJdHAOlgR5WAdq78A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/setup: drop stale declarations of __bss_{start,end}[]
Message-Id: <E1pXBWC-0000Fn-6F@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:44:32 +0000

commit 4d6df4ec7544d7c912ffab6b6edb4cbefaa01f4c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 27 13:37:27 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 27 13:37:27 2023 +0100

    x86/setup: drop stale declarations of __bss_{start,end}[]
    
    There are no references anymore as of c9a4a1c419ce ("x86/layout: Correct
    Xen's idea of its own memory layout"). For what's left, switch to
    "unsigned char" as here we're not dealing with strings of any kind.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 23b1834e94..38bf18b087 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -305,7 +305,7 @@ void __init discard_initial_images(void)
     initial_images = NULL;
 }
 
-extern char __init_begin[], __init_end[], __bss_start[], __bss_end[];
+extern unsigned char __init_begin[], __init_end[];
 
 static void __init init_idle_domain(void)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:44:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503821.776139 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBWN-0002Gj-1G; Wed, 01 Mar 2023 01:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503821.776139; Wed, 01 Mar 2023 01: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 1pXBWM-0002Gc-Ut; Wed, 01 Mar 2023 01:44:42 +0000
Received: by outflank-mailman (input) for mailman id 503821;
 Wed, 01 Mar 2023 01: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 1pXBWM-0002GQ-BH
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBWM-0001g7-AY
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBWM-0000GY-9W
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=M3J98eBlj8lKeu3XPMYhAmG7gUka6lRaoQeFOO8D1VY=; b=GHPCCJeLXZX9+827pLFAaY6sPm
	tUChK/zmWYtT38H5xiEDOFUw5uX6fLRRMEn1QVQmSwhPh3XFW1T+npP9rsyPbN8tvJyKQPcgIDiaM
	WqT4IHMBCuKeeEnA9g78Jh5YGDQq5sSPYnVGRKMDxngVcxb5X7d2/kfh5BHR4SXwIPZ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: Decouple types in struct nestedsvm
Message-Id: <E1pXBWM-0000GY-9W@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:44:42 +0000

commit 5f74a1a198a986c566a11a1873ecc1b3c703789f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 24 20:58:25 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 27 15:51:23 2023 +0000

    x86/svm: Decouple types in struct nestedsvm
    
    struct nestedvm uses mostly plain integer types, except for virt_ext_t which
    is a union wrapping two bitfield names.
    
    However, it turns out that this is a write-only variable.  Delete it, allowing
    us to drop the include of vmcb.h
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/nestedsvm.c             | 5 -----
 xen/arch/x86/include/asm/hvm/svm/nestedsvm.h | 5 -----
 2 files changed, 10 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 92316c6624..63ed9fc248 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -164,7 +164,6 @@ int cf_check nsvm_vcpu_reset(struct vcpu *v)
     svm->ns_exception_intercepts = 0;
     svm->ns_general1_intercepts = 0;
     svm->ns_general2_intercepts = 0;
-    svm->ns_virt_ext.bytes = 0;
 
     svm->ns_hap_enabled = 0;
     svm->ns_vmcb_guestcr3 = 0;
@@ -524,10 +523,6 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     /* Pending Interrupts */
     n2vmcb->event_inj = ns_vmcb->event_inj;
 
-    /* LBR and other virtualization */
-    if ( !clean.lbr )
-        svm->ns_virt_ext = ns_vmcb->virt_ext;
-
     n2vmcb->virt_ext.bytes =
         n1vmcb->virt_ext.bytes | ns_vmcb->virt_ext.bytes;
 
diff --git a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
index 94d45d2e8d..230f818df8 100644
--- a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
+++ b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
@@ -20,8 +20,6 @@
 
 #include <xen/types.h>
 
-#include <asm/hvm/svm/vmcb.h>
-
 struct nestedsvm {
     bool ns_gif;
     uint64_t ns_msr_hsavepa; /* MSR HSAVE_PA value */
@@ -43,9 +41,6 @@ struct nestedsvm {
     uint32_t ns_general1_intercepts;
     uint32_t ns_general2_intercepts;
 
-    /* Cached real lbr and other virtual extentions of the l2 guest */
-    virt_ext_t ns_virt_ext;
-
     /* Cached real MSR permission bitmaps of the l2 guest */
     unsigned long *ns_cached_msrpm;
     /* Merged MSR permission bitmap */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:44:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503822.776142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBWX-0002Jb-2b; Wed, 01 Mar 2023 01:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503822.776142; Wed, 01 Mar 2023 01: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 1pXBWX-0002JT-07; Wed, 01 Mar 2023 01:44:53 +0000
Received: by outflank-mailman (input) for mailman id 503822;
 Wed, 01 Mar 2023 01: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 1pXBWW-0002JJ-EK
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBWW-0001hl-DZ
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBWW-0000Jv-Cj
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=Sneqkua+pSXWp3LD2xugZR9jwEhslu9t0Z7CzV73Pzs=; b=67DfNep1xTm8HtdcafmT43Be0B
	iAKbF9lDn6CIohzEPwvPq0nQKeeTcRaSreJn/rb+6C5fuiVGCILR6UjAAI04ITiFFBIHBlhw0Ajs7
	6CmyydU9hNBn0MdR2886hpwUxsRllw6GKqkOXYXwEiD1xBdvzvp7YqWHOUdJFJ6FGdCg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Simplify RISCV smoke testing
Message-Id: <E1pXBWW-0000Jv-Cj@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:44:52 +0000

commit 35b3208a741f182ad95ad252944a82f4899f3816
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 24 15:29:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 27 15:51:23 2023 +0000

    CI: Simplify RISCV smoke testing
    
    Use a single fairly generic string as the "all done" message to look for,
    which avoids the need to patch qemu-smoke-riscv64.sh each time a new feature
    is added.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/scripts/qemu-smoke-riscv64.sh | 2 +-
 xen/arch/riscv/setup.c                   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index e0f06360bc..4008191302 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -16,5 +16,5 @@ qemu-system-riscv64 \
     |& tee smoke.serial
 
 set -e
-(grep -q "Hello from C env" smoke.serial) || exit 1
+(grep -q "All set up" smoke.serial) || exit 1
 exit 0
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index d09ffe1454..1c87899e8e 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -11,6 +11,7 @@ void __init noreturn start_xen(void)
 {
     early_printk("Hello from C env\n");
 
+    early_printk("All set up\n");
     for ( ;; )
         asm volatile ("wfi");
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:45:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503823.776147 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBWi-0002MO-4V; Wed, 01 Mar 2023 01:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503823.776147; Wed, 01 Mar 2023 01: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 1pXBWi-0002ME-1n; Wed, 01 Mar 2023 01:45:04 +0000
Received: by outflank-mailman (input) for mailman id 503823;
 Wed, 01 Mar 2023 01: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 1pXBWg-0002Lu-IK
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBWg-0001iJ-HP
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBWg-0000ZT-Fh
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=DD6GWBhBkTIbwymc/pZyU0bJAQDDac+KT5JNl7iZCUI=; b=s+vDneJSNlewqJ5BZB7g/AMObb
	HUlFjoFtAu91P4XKWjTTca3F8lNXjQrxMKBimN/Oy7op0OhQP4GM8wSfVo8seb2jQLZCrajSRQF81
	72eTa310cSIieQ4H5DnhnRIHPuYXk4eS6kqO7PjeKt3vMXK+jWCGRCXLaMnHdxfMaWiY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: Fix resource leaks in xc_core_arch_map_p2m_tree_rw()
Message-Id: <E1pXBWg-0000ZT-Fh@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:45:02 +0000

commit 1868d7f22660c8980bd0a7e53f044467e8b63bb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 27 14:51:20 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 27 15:51:23 2023 +0000

    libs/guest: Fix resource leaks in xc_core_arch_map_p2m_tree_rw()
    
    Edwin, with the help of GCC's -fanalyzer, identified that p2m_frame_list_list
    gets leaked.  What fanalyzer can't see is that the live_p2m_frame_list_list
    and live_p2m_frame_list foreign mappings are leaked too.
    
    Rework the logic so the out path is executed unconditionally, which cleans up
    all the intermediate allocations/mappings appropriately.
    
    Fixes: bd7a29c3d0b9 ("tools/libs/ctrl: fix xc_core_arch_map_p2m() to support linear p2m table")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/guest/xg_core_x86.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/libs/guest/xg_core_x86.c b/tools/libs/guest/xg_core_x86.c
index 61106b98b8..c5e4542ccc 100644
--- a/tools/libs/guest/xg_core_x86.c
+++ b/tools/libs/guest/xg_core_x86.c
@@ -229,11 +229,11 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
                              uint32_t dom, shared_info_any_t *live_shinfo)
 {
     /* Double and single indirect references to the live P2M table */
-    xen_pfn_t *live_p2m_frame_list_list;
+    xen_pfn_t *live_p2m_frame_list_list = NULL;
     xen_pfn_t *live_p2m_frame_list = NULL;
     /* Copies of the above. */
     xen_pfn_t *p2m_frame_list_list = NULL;
-    xen_pfn_t *p2m_frame_list;
+    xen_pfn_t *p2m_frame_list = NULL;
 
     int err;
     int i;
@@ -297,8 +297,6 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
 
     dinfo->p2m_frames = P2M_FL_ENTRIES;
 
-    return p2m_frame_list;
-
  out:
     err = errno;
 
@@ -312,7 +310,7 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
 
     errno = err;
 
-    return NULL;
+    return p2m_frame_list;
 }
 
 static int
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:45:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503824.776151 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBWs-0002RL-8N; Wed, 01 Mar 2023 01:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503824.776151; Wed, 01 Mar 2023 01:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBWs-0002RC-5Y; Wed, 01 Mar 2023 01:45:14 +0000
Received: by outflank-mailman (input) for mailman id 503824;
 Wed, 01 Mar 2023 01: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 1pXBWq-0002PL-M5
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBWq-0001iQ-LK
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBWq-0000Zs-Jc
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=G53z/DKF7qiJ0/7c8EQ5swqs2FTathw9s4clL9G8R+Q=; b=uR8gKmR3DeJ+v0DlmzwsYMAImQ
	aBg565hyMRNRZIqiXnzli8EVEpLosbvJfSklnc89cvcYMM6UL18jxlyGVnxS9Qcdu2tu8h7f1AUxa
	S/dF0Sy0eQnfdL7P9i2OdEM9f6R72DXARfzUbnkGxE0+/D4+jrCE/03yTPu5bGm/fDeE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: Fix leak on realloc failure in backup_ptes()
Message-Id: <E1pXBWq-0000Zs-Jc@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:45:12 +0000

commit 275d13184cfa52ebe4336ed66526ce93716adbe0
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Fri Feb 24 13:03:44 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 27 15:51:23 2023 +0000

    libs/guest: Fix leak on realloc failure in backup_ptes()
    
    From `man 2 realloc`:
    
      If realloc() fails, the original block is left untouched; it is not freed or moved.
    
    Found using GCC -fanalyzer:
    
      |  184 |         backup->entries = realloc(backup->entries,
      |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |      |         |               | |
      |      |         |               | (91) when ‘realloc’ fails
      |      |         |               (92) ‘old_ptes.entries’ leaks here; was allocated at (44)
      |      |         (90) ...to here
    
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/guest/xg_offline_page.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libs/guest/xg_offline_page.c b/tools/libs/guest/xg_offline_page.c
index c594fdba41..ccd0299f0f 100644
--- a/tools/libs/guest/xg_offline_page.c
+++ b/tools/libs/guest/xg_offline_page.c
@@ -181,10 +181,16 @@ static int backup_ptes(xen_pfn_t table_mfn, int offset,
 
     if (backup->max == backup->cur)
     {
-        backup->entries = realloc(backup->entries,
-                            backup->max * 2 * sizeof(struct pte_backup_entry));
+        void *orig = backup->entries;
+
+        backup->entries = realloc(
+            orig, backup->max * 2 * sizeof(struct pte_backup_entry));
+
         if (backup->entries == NULL)
+        {
+            free(orig);
             return -1;
+        }
         else
             backup->max *= 2;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:45:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503825.776154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBX2-0002V6-9e; Wed, 01 Mar 2023 01:45:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503825.776154; Wed, 01 Mar 2023 01:45:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBX2-0002Uz-74; Wed, 01 Mar 2023 01:45:24 +0000
Received: by outflank-mailman (input) for mailman id 503825;
 Wed, 01 Mar 2023 01: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 1pXBX0-0002UX-PF
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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 1pXBX0-0001iq-OX
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBX0-0000aR-Nl
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01: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=WFMhWmI+8KF5Qom8LC6V/UD5ZWOQC6ESfwyinjU1KgU=; b=TYxABakPIV+j5IUQOWbtSYj7v0
	Up5XpNNTwhyw6VoBdzzcBKZx+iSMGaLSCQCp3pSfa4taoQeBLGJ2iwBdg8yomudxTOaaB9HxrQe0d
	hV9KvYDlpHviSotzVnkbZ7KoipgSyV1yPo7ycRUH2dy4T07IviWlIzrXfDLmwzs7KoqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: move vmx_update_debug_state() in vmcs.c and declare it static
Message-Id: <E1pXBX0-0000aR-Nl@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:45:22 +0000

commit fdc25bd5da5e69e57286c97685ce9f862510253b
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Feb 24 20:50:04 2023 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 27 15:51:23 2023 +0000

    x86/vmx: move vmx_update_debug_state() in vmcs.c and declare it static
    
    Move vmx_update_debug_state() in vmcs.c because it is used only in this
    file and limit its scope to this file by declaring it static and removing
    its declaration from vmx.h.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c            | 12 ++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c             | 12 ------------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h |  1 -
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index ed71ecfb62..d3c75b3803 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1868,6 +1868,18 @@ void vmx_vmentry_failure(void)
 
 void noreturn vmx_asm_do_vmentry(void);
 
+static void vmx_update_debug_state(struct vcpu *v)
+{
+    if ( v->arch.hvm.debug_state_latch )
+        v->arch.hvm.vmx.exception_bitmap |= 1U << TRAP_int3;
+    else
+        v->arch.hvm.vmx.exception_bitmap &= ~(1U << TRAP_int3);
+
+    vmx_vmcs_enter(v);
+    vmx_update_exception_bitmap(v);
+    vmx_vmcs_exit(v);
+}
+
 void cf_check vmx_do_resume(void)
 {
     struct vcpu *v = current;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 0ec33bcc18..294c8490b4 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1613,18 +1613,6 @@ static void cf_check vmx_update_host_cr3(struct vcpu *v)
     vmx_vmcs_exit(v);
 }
 
-void vmx_update_debug_state(struct vcpu *v)
-{
-    if ( v->arch.hvm.debug_state_latch )
-        v->arch.hvm.vmx.exception_bitmap |= 1U << TRAP_int3;
-    else
-        v->arch.hvm.vmx.exception_bitmap &= ~(1U << TRAP_int3);
-
-    vmx_vmcs_enter(v);
-    vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
-}
-
 static void cf_check vmx_update_guest_cr(
     struct vcpu *v, unsigned int cr, unsigned int flags)
 {
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index f6308ed656..82a9487b40 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -88,7 +88,6 @@ void cf_check vmx_vlapic_msr_changed(struct vcpu *v);
 struct hvm_emulate_ctxt;
 void vmx_realmode_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt);
 void vmx_realmode(struct cpu_user_regs *regs);
-void vmx_update_debug_state(struct vcpu *v);
 void vmx_update_exception_bitmap(struct vcpu *v);
 void vmx_update_cpu_exec_control(struct vcpu *v);
 void vmx_update_secondary_exec_control(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:45:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503826.776159 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXC-0002Yo-BC; Wed, 01 Mar 2023 01:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503826.776159; Wed, 01 Mar 2023 01:45:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXC-0002Yg-8X; Wed, 01 Mar 2023 01:45:34 +0000
Received: by outflank-mailman (input) for mailman id 503826;
 Wed, 01 Mar 2023 01:45: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 1pXBXA-0002YI-SR
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45: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 1pXBXA-0001jH-Rg
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBXA-0000b1-Qq
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hglD0olC7sZJArFlJLmLCmOrbAsl5MkZ/XwLff5ug8U=; b=msaWhZJdmLq2b+nFhPfbvKmw33
	HYH47ruOwBCOJAJ6h4WpVWZUVMDfS9CaMvcMYMii1LMpnVQ8ta6aKftrCs0Bi3Tjusiqu0V7SjHe3
	ZVsS19luO1BT9HakS3gBQptX2iQYS2EagUPDTTFf5luzr6zWR7IBIRHGl/kkXcWHMfNE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: declare nvmx_enqueue_n2_exceptions() static
Message-Id: <E1pXBXA-0000b1-Qq@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:45:32 +0000

commit 49b1cb27413034c81023d1faf7af43690e87291a
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Feb 24 20:50:08 2023 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 27 15:51:23 2023 +0000

    x86/vmx: declare nvmx_enqueue_n2_exceptions() static
    
    Reduce the scope of nvmx_enqueue_n2_exceptions() to static because it is used
    only in this file.
    
    Take the opportunity to remove a trailing space.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 294c8490b4..278b829f73 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1899,7 +1899,7 @@ static void cf_check vmx_update_guest_efer(struct vcpu *v)
         vmx_set_msr_intercept(v, MSR_EFER, VMX_MSR_R);
 }
 
-void nvmx_enqueue_n2_exceptions(struct vcpu *v, 
+static void nvmx_enqueue_n2_exceptions(struct vcpu *v,
             unsigned long intr_fields, int error_code, uint8_t source)
 {
     struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:45:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503827.776163 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXM-0002b4-Ch; Wed, 01 Mar 2023 01:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503827.776163; Wed, 01 Mar 2023 01:45:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXM-0002ax-A0; Wed, 01 Mar 2023 01:45:44 +0000
Received: by outflank-mailman (input) for mailman id 503827;
 Wed, 01 Mar 2023 01:45: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 1pXBXK-0002al-V4
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45: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 1pXBXK-0001jQ-UQ
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBXK-0000bS-Tn
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=11sxJLON2dNiVqxTclQf4h/SERCaJ0frR+s+gI/ZcAM=; b=HHPgMmxhVDf00ytLOVyFIkbcMP
	3jUrsv3JnDSo9UR6QdSayxI3hHF8dfF1FtjbKkdGd0M4wmcJATiIraKL0N451V5QfN6S/TOVaapN0
	Id2kRVY5l5oobagnFw2NWXakesGmRfvmib0DRtzbHKhtffp1uUhj/0XK17T1Srq15bsg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: move yocto jobs to build stage
Message-Id: <E1pXBXK-0000bS-Tn@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:45:42 +0000

commit adfb590ec384f92a4b5aebb111af25abbd1e026e
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Feb 17 16:07:45 2023 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Feb 27 13:19:10 2023 -0800

    automation: move yocto jobs to build stage
    
    We are going to use artifacts produced by the Yocto builds in test jobs.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/gitlab-ci/build.yaml | 51 +++++++++++++++++++++++++++++++++++++++++
 automation/gitlab-ci/test.yaml  | 45 ------------------------------------
 2 files changed, 51 insertions(+), 45 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index a2891c5937..8a08052051 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -199,6 +199,41 @@
   variables:
     <<: *gcc
 
+.yocto-test:
+  stage: build
+  image: registry.gitlab.com/xen-project/xen/${CONTAINER}
+  except:
+    - master
+    - smoke
+    - /^coverity-tested\/.*/
+    - /^stable-.*/
+  script:
+    - ./automation/build/yocto/build-yocto.sh -v --log-dir=./logs --xen-dir=`pwd` ${YOCTO_BOARD}
+  variables:
+    YOCTO_VERSION: kirkstone
+    CONTAINER: yocto:${YOCTO_VERSION}-${YOCTO_BOARD}-${YOCTO_HOST}
+  artifacts:
+    paths:
+      - 'logs/*'
+    when: always
+  needs: []
+
+.yocto-test-arm64:
+  extends: .yocto-test
+  variables:
+    YOCTO_HOST: arm64v8
+  tags:
+    - arm64
+
+# This is not used by any test job as we only run Yocto on arm based machines.
+# Keep it here so that someone having x86 hardware can easily add jobs.
+.yocto-test-x86-64:
+  extends: .yocto-test
+  variables:
+    YOCTO_HOST: amd64
+  tags:
+    - x86_64
+
 # Jobs below this line
 
 archlinux-gcc:
@@ -619,6 +654,22 @@ archlinux-current-gcc-riscv64-debug-randconfig:
     EXTRA_FIXED_RANDCONFIG:
       CONFIG_COVERAGE=n
 
+# Yocto test jobs
+yocto-qemuarm64:
+  extends: .yocto-test-arm64
+  variables:
+    YOCTO_BOARD: qemuarm64
+
+yocto-qemuarm:
+  extends: .yocto-test-arm64
+  variables:
+    YOCTO_BOARD: qemuarm
+
+yocto-qemux86-64:
+  extends: .yocto-test-arm64
+  variables:
+    YOCTO_BOARD: qemux86-64
+
 ## Test artifacts common
 
 .test-jobs-artifact-common:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index c0b4a90e0d..00273b21c8 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -67,35 +67,6 @@
   tags:
     - x86_64
 
-.yocto-test:
-  extends: .test-jobs-common
-  script:
-    - ./automation/build/yocto/build-yocto.sh -v --log-dir=./logs --xen-dir=`pwd` ${YOCTO_BOARD}
-  variables:
-    YOCTO_VERSION: kirkstone
-    CONTAINER: yocto:${YOCTO_VERSION}-${YOCTO_BOARD}-${YOCTO_HOST}
-  artifacts:
-    paths:
-      - 'logs/*'
-    when: always
-  needs: []
-
-.yocto-test-arm64:
-  extends: .yocto-test
-  variables:
-    YOCTO_HOST: arm64v8
-  tags:
-    - arm64
-
-# This is not used by any test job as we only run Yocto on arm based machines.
-# Keep it here so that someone having x86 hardware can easily add jobs.
-.yocto-test-x86-64:
-  extends: .yocto-test
-  variables:
-    YOCTO_HOST: amd64
-  tags:
-    - x86_64
-
 # Test jobs
 build-each-commit-gcc:
   extends: .test-jobs-common
@@ -317,19 +288,3 @@ qemu-smoke-riscv64-gcc:
     - ./automation/scripts/qemu-smoke-riscv64.sh 2>&1 | tee ${LOGFILE}
   needs:
     - archlinux-current-gcc-riscv64-debug
-
-# Yocto test jobs
-yocto-qemuarm64:
-  extends: .yocto-test-arm64
-  variables:
-    YOCTO_BOARD: qemuarm64
-
-yocto-qemuarm:
-  extends: .yocto-test-arm64
-  variables:
-    YOCTO_BOARD: qemuarm
-
-yocto-qemux86-64:
-  extends: .yocto-test-arm64
-  variables:
-    YOCTO_BOARD: qemux86-64
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:45:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:45:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503828.776167 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXW-0002do-EF; Wed, 01 Mar 2023 01:45:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503828.776167; Wed, 01 Mar 2023 01:45:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXW-0002dg-BT; Wed, 01 Mar 2023 01:45:54 +0000
Received: by outflank-mailman (input) for mailman id 503828;
 Wed, 01 Mar 2023 01:45: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 1pXBXV-0002dU-1c
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45: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 1pXBXV-0001jd-0u
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBXV-0000bu-0G
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M5x/VOQ9NRgX09+zquB0mgLfArmjksOP/0nHYSBPSZw=; b=ypX/JfrqPkmoUVcJymhS5SzmY7
	hxsXuXPk4H8lzrO1fCOOC7I+VLCpA0A6n6yHo5OvSIopyZuo61eZtOn/7+7j7wZKLjjUJFL/6XAz1
	G0zystjCzPCMrqhfW0oqSMD1TCihStOngLeLAGTi6kNFHcPB0z4PW1ixbf/CDEb478h0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add binaries/ to artifacts for Yocto arm32 job
Message-Id: <E1pXBXV-0000bu-0G@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:45:53 +0000

commit a0c3b87a764bcbd433f5f248c5ae2e2ca60a1321
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Feb 17 16:07:46 2023 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Feb 27 13:19:31 2023 -0800

    automation: add binaries/ to artifacts for Yocto arm32 job
    
    Copy the build output of Yocto builds to binaries/ for the arm32 target,
    and export binaries/ among the jobs artifacts so that they can be reused
    by other jobs.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/build/yocto/build-yocto.sh | 16 ++++++++++++++++
 automation/gitlab-ci/build.yaml       |  4 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/automation/build/yocto/build-yocto.sh b/automation/build/yocto/build-yocto.sh
index 3601cebc3c..93ce81ce82 100755
--- a/automation/build/yocto/build-yocto.sh
+++ b/automation/build/yocto/build-yocto.sh
@@ -18,6 +18,7 @@ CACHEDIR="$HOME/yocto-cache"
 LOGDIR="$HOME/logs"
 XENDIR="$HOME/xen"
 BUILDDIR="$HOME/build"
+OUTPUTDIR=`pwd`/binaries
 
 # what yocto bsp we support
 TARGET_SUPPORTED="qemuarm qemuarm64 qemux86-64"
@@ -31,6 +32,7 @@ do_build="y"
 do_run="y"
 do_localsrc="n"
 do_dump="n"
+do_copy="n"
 build_result=0
 
 # layers to include in the project
@@ -166,6 +168,16 @@ function project_build() {
         source "${YOCTODIR}/poky/oe-init-build-env" "${destdir}"
 
         bitbake "${build_image}" || exit 1
+        if [ $do_copy = "y" ]
+        then
+            if [ $target = "qemuarm" ]
+            then
+                mkdir -p $OUTPUTDIR
+                cp $BUILDDIR/tmp/deploy/images/qemuarm/zImage $OUTPUTDIR
+                cp $BUILDDIR/tmp/deploy/images/qemuarm/xen-qemuarm $OUTPUTDIR
+                cp $BUILDDIR/tmp/deploy/images/qemuarm/xen-image-minimal-qemuarm.tar.bz2 $OUTPUTDIR
+            fi
+        fi
     ) || return 1
 }
 
@@ -235,6 +247,7 @@ Options:
                    Default: ${CACHEDIR}
   --layer-dir=DIR  directory containing the checkout of yocto layers
                    Default: ${YOCTODIR}
+  --copy-output    Copy output binaries to binaries/
 EOF
 }
 
@@ -290,6 +303,9 @@ do
         --layer-dir=*)
             YOCTODIR="${OPTION#*=}"
             ;;
+        --copy-output)
+            do_copy="y"
+            ;;
         --*)
             echo "Invalid option ${OPTION}"
             help
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 8a08052051..9b7425cca8 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -208,13 +208,14 @@
     - /^coverity-tested\/.*/
     - /^stable-.*/
   script:
-    - ./automation/build/yocto/build-yocto.sh -v --log-dir=./logs --xen-dir=`pwd` ${YOCTO_BOARD}
+    - ./automation/build/yocto/build-yocto.sh -v --log-dir=./logs --xen-dir=`pwd` ${YOCTO_BOARD} ${YOCTO_OUTPUT}
   variables:
     YOCTO_VERSION: kirkstone
     CONTAINER: yocto:${YOCTO_VERSION}-${YOCTO_BOARD}-${YOCTO_HOST}
   artifacts:
     paths:
       - 'logs/*'
+      - binaries/
     when: always
   needs: []
 
@@ -664,6 +665,7 @@ yocto-qemuarm:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm
+    YOCTO_OUTPUT: --copy-output
 
 yocto-qemux86-64:
   extends: .yocto-test-arm64
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:46:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:46:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503829.776171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXg-0002hI-GR; Wed, 01 Mar 2023 01:46:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503829.776171; Wed, 01 Mar 2023 01:46: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 1pXBXg-0002hA-D4; Wed, 01 Mar 2023 01:46:04 +0000
Received: by outflank-mailman (input) for mailman id 503829;
 Wed, 01 Mar 2023 01:46: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 1pXBXf-0002h1-4I
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:46: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 1pXBXf-0001jz-3Z
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBXf-0000ce-2w
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qauel8qFaKnBqXgq4vlVSqAPVNVUtm/0ZLn3CuF+9NU=; b=GjNJf02QsRzvSjk22hd3i/Zdq2
	xFMVbTvUSBUo6cc2E37yVvk51Q56K0hOTHDJfl58WJ3dW48dgPhBd67aNSmkKuTaBGaritYklIjvS
	fOWZ0nQt0E2LPMrW2rqCzW2iNf9rbVDrEL3JXjPPU0+2orSgWwmdqzfTAVXVa4jJd60w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: expand arm32 dom0 test adding xl domain creation
Message-Id: <E1pXBXf-0000ce-2w@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:46:03 +0000

commit 6342f96689a5a112c3becedbccecef681e010b5d
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Feb 17 16:07:47 2023 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Feb 27 13:20:19 2023 -0800

    automation: expand arm32 dom0 test adding xl domain creation
    
    As part of the arm32 dom0 test, also create a simple domU using xl. To
    do that, we need the toolstack installed in the dom0 rootfs. We switch
    to using the kernel and rootfs built by the Yocto arm32 job.
    
    Remove the PCI node from the host device tree: it is unused but causes a
    Linux hang at boot.
    
    Use xen-watchdog to trigger the domU creation for convience
    (/etc/local.d is not handled by rootfs.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/gitlab-ci/test.yaml              | 10 +-----
 automation/scripts/qemu-smoke-dom0-arm32.sh | 52 +++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 00273b21c8..1c5f400b68 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -171,15 +171,7 @@ qemu-smoke-dom0-arm32-gcc:
     - ./automation/scripts/qemu-smoke-dom0-arm32.sh 2>&1 | tee ${LOGFILE}
   needs:
     - *arm32-test-needs
-    - debian-unstable-gcc-arm32
-
-qemu-smoke-dom0-arm32-gcc-debug:
-  extends: .qemu-arm32
-  script:
-    - ./automation/scripts/qemu-smoke-dom0-arm32.sh 2>&1 | tee ${LOGFILE}
-  needs:
-    - *arm32-test-needs
-    - debian-unstable-gcc-arm32-debug
+    - yocto-qemuarm
 
 qemu-smoke-dom0less-arm32-gcc:
   extends: .qemu-arm32
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 98e4d481f6..2c80df089f 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -3,14 +3,37 @@
 set -ex
 
 cd binaries
-# Use the kernel from Debian
-curl --fail --silent --show-error --location --output vmlinuz http://http.us.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/netboot/vmlinuz
-# Use a tiny initrd based on busybox from Alpine Linux
-curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/armhf/alpine-minirootfs-3.15.1-armhf.tar.gz
 
+mkdir rootfs
+cd rootfs
+tar xvf ../xen-image-minimal-qemuarm.tar.bz2
+mkdir -p ./root
+echo "name=\"test\"
+memory=400
+vcpus=1
+kernel=\"/root/zImage\"
+ramdisk=\"/root/initrd.cpio.gz\"
+extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\"
+" > root/test.cfg
+echo "#!/bin/bash
+
+xl list
+
+xl create -c /root/test.cfg
+
+" > ./root/xen.start
+echo "bash /root/xen.start" >> ./etc/init.d/xen-watchdog
+
+curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/armhf/alpine-minirootfs-3.15.1-armhf.tar.gz
 mkdir rootfs
 cd rootfs
 tar xvzf ../initrd.tar.gz
+find . | cpio -H newc -o | gzip > ../root/initrd.cpio.gz
+cd ..
+rm -rf rootfs
+rm initrd.tar.gz
+
+cp ../zImage ./root
 find . | cpio -H newc -o | gzip > ../initrd.gz
 cd ..
 
@@ -20,22 +43,25 @@ curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
-   -m 1024 \
+   -m 2048 \
    -serial stdio \
    -monitor none \
    -display none \
    -machine dumpdtb=virt.dtb
 
+# XXX disable pci to avoid Linux hang
+fdtput virt.dtb -p -t s /pcie@10000000 status disabled
+
 # ImageBuilder
 echo 'MEMORY_START="0x40000000"
-MEMORY_END="0x80000000"
+MEMORY_END="0xC0000000"
 
 DEVICE_TREE="virt.dtb"
-XEN="xen"
-DOM0_KERNEL="vmlinuz"
+XEN="xen-qemuarm"
+DOM0_KERNEL="zImage"
 DOM0_RAMDISK="initrd.gz"
-DOM0_CMD="console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/bin/sh"
-XEN_CMD="console=dtuart dom0_mem=512M bootscrub=0"
+DOM0_CMD="console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/sbin/init"
+XEN_CMD="console=dtuart dom0_mem=1024M bootscrub=0"
 
 NUM_DOMUS=0
 
@@ -51,12 +77,12 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 rm -f smoke.serial
 set +e
 echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
+timeout -k 1 720 \
 ./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
-   -m 1024 \
+   -m 2048 \
    -serial stdio \
    -monitor none \
    -display none \
@@ -66,5 +92,5 @@ timeout -k 1 240 \
    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee smoke.serial
 
 set -e
-(grep -q "^/ #" smoke.serial) || exit 1
+(grep -q "Domain-0" smoke.serial && grep -q "^/ #" smoke.serial) || exit 1
 exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 01 01:46:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Mar 2023 01:46:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.503830.776176 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXq-0002kB-Kl; Wed, 01 Mar 2023 01:46:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 503830.776176; Wed, 01 Mar 2023 01:46:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXBXq-0002k3-Hd; Wed, 01 Mar 2023 01:46:14 +0000
Received: by outflank-mailman (input) for mailman id 503830;
 Wed, 01 Mar 2023 01:46: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 1pXBXp-0002jt-7M
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:46: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 1pXBXp-0001k8-6c
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:46:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXBXp-0000d3-5g
 for xen-changelog@lists.xenproject.org; Wed, 01 Mar 2023 01:46:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o+xMGPtIV9w8WVZ9RDqszHtf1WECsb7e9kS8jQp9mrE=; b=DIIeBvjIgZp6wkQHmvFU4rgXSc
	fSawwFiDh2TXePejooYNC+dhVlcQgcqWfbf4IRzv+FrNqyFHD1ldOVfzfYFvkbLRdKYYwvXqgxsOR
	RDbCg6hBOsIt/RhuGTlM84LtqVEmf9irNgmE0D3gOx9xqEcuUDet1dZIxZrXcMk0q5JE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add container and build jobs to run cppcheck analysis
Message-Id: <E1pXBXp-0000d3-5g@xenbits.xenproject.org>
Date: Wed, 01 Mar 2023 01:46:13 +0000

commit bfc3780f23ded229f42a2565783e21c32083bbfd
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Feb 27 14:12:35 2023 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Feb 27 14:12:35 2023 -0800

    automation: Add container and build jobs to run cppcheck analysis
    
    Add a debian container with cppcheck installation routine inside,
    capable of performing cppcheck analysis on Xen-only build including
    cross-builds for arm32 and x86_64.
    
    Populate build jobs making use of that container to run cppcheck
    analysis to produce a text report (xen-cppcheck.txt) containing the list
    of all the findings.
    
    This patch does not aim at performing any sort of bisection. Cppcheck is
    imperfect and for now, our goal is to at least be aware of its reports,
    so that we can compare them with the ones produced by better tools and
    to be able to see how these reports change as a result of further
    infrastructure improvements (e.g. exception list, rules exclusion).
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .../build/debian/unstable-cppcheck.dockerfile      | 53 ++++++++++++++++++++++
 automation/gitlab-ci/build.yaml                    | 43 ++++++++++++++++++
 automation/scripts/build                           | 11 ++++-
 3 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/automation/build/debian/unstable-cppcheck.dockerfile b/automation/build/debian/unstable-cppcheck.dockerfile
new file mode 100644
index 0000000000..adc192cea6
--- /dev/null
+++ b/automation/build/debian/unstable-cppcheck.dockerfile
@@ -0,0 +1,53 @@
+FROM arm64v8/debian:unstable AS builder
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV CPPCHECK_VERSION=2.7
+ENV USER root
+
+# dependencies for cppcheck build
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        curl \
+        build-essential \
+        python-is-python3 \
+        libpcre3-dev
+
+RUN mkdir /build
+WORKDIR /build
+
+# cppcheck release build (see cppcheck readme.md)
+RUN curl -fsSLO https://github.com/danmar/cppcheck/archive/"$CPPCHECK_VERSION".tar.gz && \
+    tar xvzf "$CPPCHECK_VERSION".tar.gz && \
+    cd cppcheck-"$CPPCHECK_VERSION" && \
+    make install -j$(nproc) \
+        MATCHCOMPILER=yes \
+        FILESDIR=/usr/share/cppcheck \
+        HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function"
+
+FROM arm64v8/debian:unstable
+COPY --from=builder /usr/bin/cppcheck /usr/bin/cppcheck
+COPY --from=builder /usr/share/cppcheck /usr/share/cppcheck
+
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# dependencies for cppcheck analysis including Xen-only build/cross-build
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        python-is-python3 \
+        libpcre3-dev \
+        flex \
+        bison \
+        gcc-arm-linux-gnueabihf \
+        gcc-x86-64-linux-gnu \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 9b7425cca8..38bb22d860 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -7,6 +7,7 @@
     paths:
       - binaries/
       - xen-config
+      - xen-cppcheck.txt
       - '*.log'
       - '*/*.log'
     when: always
@@ -235,6 +236,23 @@
   tags:
     - x86_64
 
+.x86-64-cross-build-tmpl:
+  <<: *build
+  variables:
+    XEN_TARGET_ARCH: x86_64
+  tags:
+    - arm64
+
+.x86-64-cross-build:
+  extends: .x86-64-cross-build-tmpl
+  variables:
+    debug: n
+
+.gcc-x86-64-cross-build:
+  extends: .x86-64-cross-build
+  variables:
+    <<: *gcc
+
 # Jobs below this line
 
 archlinux-gcc:
@@ -672,6 +690,31 @@ yocto-qemux86-64:
   variables:
     YOCTO_BOARD: qemux86-64
 
+# Cppcheck analysis jobs
+
+debian-unstable-gcc-cppcheck:
+  extends: .gcc-x86-64-cross-build
+  variables:
+    CONTAINER: debian:unstable-cppcheck
+    CROSS_COMPILE: /usr/bin/x86_64-linux-gnu-
+    CPPCHECK: y
+    HYPERVISOR_ONLY: y
+
+debian-unstable-gcc-arm32-cppcheck:
+  extends: .gcc-arm32-cross-build
+  variables:
+    CONTAINER: debian:unstable-cppcheck
+    CROSS_COMPILE: /usr/bin/arm-linux-gnueabihf-
+    CPPCHECK: y
+    HYPERVISOR_ONLY: y
+
+debian-unstable-gcc-arm64-cppcheck:
+  extends: .gcc-arm64-build
+  variables:
+    CONTAINER: debian:unstable-cppcheck
+    CPPCHECK: y
+    HYPERVISOR_ONLY: y
+
 ## Test artifacts common
 
 .test-jobs-artifact-common:
diff --git a/automation/scripts/build b/automation/scripts/build
index f2f5e55bc0..7d1b19c425 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -38,7 +38,16 @@ cp xen/.config xen-config
 # Directory for the artefacts to be dumped into
 mkdir binaries
 
-if [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
+if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
+    # Cppcheck analysis invokes Xen-only build.
+    # Known limitation: cppcheck generates inconsistent reports when running
+    # in parallel mode, therefore do not specify -j<n>.
+    xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra
+
+    # Preserve artefacts
+    cp xen/xen binaries/xen
+    cp xen/cppcheck-report/xen-cppcheck.txt xen-cppcheck.txt
+elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
     # Xen-only build
     make -j$(nproc) xen
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 02 09:33:06 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Mar 2023 09:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.504800.777174 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXfJ8-0005f9-Vk; Thu, 02 Mar 2023 09:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 504800.777174; Thu, 02 Mar 2023 09:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXfJ8-0005f1-T4; Thu, 02 Mar 2023 09:33:02 +0000
Received: by outflank-mailman (input) for mailman id 504800;
 Thu, 02 Mar 2023 09: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 1pXfJ7-0005ev-RY
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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 1pXfJ7-0004bG-Qh
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXfJ7-0006OF-Pn
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5ZKiwC5yu43yzsbv9vR9N6dfxuH0kr2/Bs8uoAEmfWw=; b=KbuhCL2Z8NMujyFgMyK1fJNFZZ
	LfO2jAPdYIH2CUUb7cEXX4v68PYwWrwPIOzlhzxNbkNoWEvfGCy3vtuUnriCC9NHkRyaTYy8YxwHI
	yz2y/wizvFCY9fCJMRcbSXrMj5QaE6fpM1cugTpsIHbixeZz1D0NpF07tRCuajj60z+Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode/AMD: late load the patch on every logical thread
Message-Id: <E1pXfJ7-0006OF-Pn@xenbits.xenproject.org>
Date: Thu, 02 Mar 2023 09:33:01 +0000

commit f1315e48a03a42f78f9b03c0a384165baf02acae
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Tue Feb 28 14:51:28 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 28 14:51:28 2023 +0100

    x86/ucode/AMD: late load the patch on every logical thread
    
    Currently late ucode loading is performed only on the first core of CPU
    siblings.  But according to the latest recommendation from AMD, late
    ucode loading should happen on every logical thread/core on AMD CPUs.
    
    To achieve that, introduce is_cpu_primary() helper which will consider
    every logical cpu as "primary" when running on AMD CPUs.  Also include
    Hygon in the check for future-proofing.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/core.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index ba6e7b42c6..cfa2d5053a 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -276,6 +276,20 @@ static bool microcode_update_cache(struct microcode_patch *patch)
     return true;
 }
 
+/* Returns true if ucode should be loaded on a given cpu */
+static bool is_cpu_primary(unsigned int cpu)
+{
+    if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
+        /* Load ucode on every logical thread/core */
+        return true;
+
+    /* Intel CPUs should load ucode only on the first core of SMT siblings */
+    if ( cpu == cpumask_first(per_cpu(cpu_sibling_mask, cpu)) )
+        return true;
+
+    return false;
+}
+
 /* Wait for a condition to be met with a timeout (us). */
 static int wait_for_condition(bool (*func)(unsigned int data),
                               unsigned int data, unsigned int timeout)
@@ -382,7 +396,7 @@ static int primary_thread_work(const struct microcode_patch *patch)
 static int cf_check microcode_nmi_callback(
     const struct cpu_user_regs *regs, int cpu)
 {
-    unsigned int primary = cpumask_first(this_cpu(cpu_sibling_mask));
+    bool primary_cpu = is_cpu_primary(cpu);
     int ret;
 
     /* System-generated NMI, leave to main handler */
@@ -395,10 +409,10 @@ static int cf_check microcode_nmi_callback(
      * ucode_in_nmi.
      */
     if ( cpu == cpumask_first(&cpu_online_map) ||
-         (!ucode_in_nmi && cpu == primary) )
+         (!ucode_in_nmi && primary_cpu) )
         return 0;
 
-    if ( cpu == primary )
+    if ( primary_cpu )
         ret = primary_thread_work(nmi_patch);
     else
         ret = secondary_nmi_work();
@@ -549,7 +563,7 @@ static int cf_check do_microcode_update(void *patch)
      */
     if ( cpu == cpumask_first(&cpu_online_map) )
         ret = control_thread_fn(patch);
-    else if ( cpu == cpumask_first(this_cpu(cpu_sibling_mask)) )
+    else if ( is_cpu_primary(cpu) )
         ret = primary_thread_fn(patch);
     else
         ret = secondary_thread_fn();
@@ -642,7 +656,7 @@ static long cf_check microcode_update_helper(void *data)
     /* Calculate the number of online CPU core */
     nr_cores = 0;
     for_each_online_cpu(cpu)
-        if ( cpu == cpumask_first(per_cpu(cpu_sibling_mask, cpu)) )
+        if ( is_cpu_primary(cpu) )
             nr_cores++;
 
     printk(XENLOG_INFO "%u cores are to update their microcode\n", nr_cores);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 02 09:33:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Mar 2023 09:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.504801.777178 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXfJJ-0005gw-16; Thu, 02 Mar 2023 09:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 504801.777178; Thu, 02 Mar 2023 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 1pXfJI-0005gn-Ud; Thu, 02 Mar 2023 09:33:12 +0000
Received: by outflank-mailman (input) for mailman id 504801;
 Thu, 02 Mar 2023 09: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 1pXfJH-0005gd-VE
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXfJH-0004bO-US
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXfJH-0006Ou-Sl
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i7wfbcT8zu0usDXZ9HQhVmdXRYaOMUVBIBXGA/Xmqgs=; b=ULsEonT/72VVDFWL+RekdQssIa
	ZhAgkN0GcqByDPQccrlGBIjcPi/4peZm3jTUW7Gca3QMBvvr1aILQ0MkG7oNLZR4G9Yvn90P8rebl
	g82PA52GEEjhUsJzY6XrkdJa2qIAsDK/otcZFhI648Ed5UI31oi6/b200E0yH0aNQuvU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] change assorted xenbits.xen.org links to HTTPS
Message-Id: <E1pXfJH-0006Ou-Sl@xenbits.xenproject.org>
Date: Thu, 02 Mar 2023 09:33:11 +0000

commit a4557f515fb002010b34b79102278ea03d6b31a3
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Feb 28 14:52:14 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 28 14:52:14 2023 +0100

    change assorted xenbits.xen.org links to HTTPS
    
    Also switch to xenbits.xenproject.org at this occasion.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk        | 2 +-
 tools/misc/mkrpm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Config.mk b/Config.mk
index 10eb443b17..3aba623096 100644
--- a/Config.mk
+++ b/Config.mk
@@ -191,7 +191,7 @@ APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 EMBEDDED_EXTRA_CFLAGS := -fno-pie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
-XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
+XEN_EXTFILES_URL ?= https://xenbits.xenproject.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
 # the internet.  The original download URL is preserved as a comment
 # near the place in the Xen Makefiles where the file is used.
diff --git a/tools/misc/mkrpm b/tools/misc/mkrpm
index 68819b2d73..74f6761bb0 100644
--- a/tools/misc/mkrpm
+++ b/tools/misc/mkrpm
@@ -34,7 +34,7 @@ Version: $version
 Release: $release
 License: GPL
 Group:   System/Hypervisor
-URL: http://xenbits.xenproject.org/xen.git
+URL: https://xenbits.xenproject.org/git-http/xen.git
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 %define _binary_payload w1.gzdio
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 02 09:33:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Mar 2023 09:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.504802.777181 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXfJT-0005jp-2U; Thu, 02 Mar 2023 09:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 504802.777181; Thu, 02 Mar 2023 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 1pXfJS-0005jg-WD; Thu, 02 Mar 2023 09:33:23 +0000
Received: by outflank-mailman (input) for mailman id 504802;
 Thu, 02 Mar 2023 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 1pXfJS-0005jW-1r
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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 1pXfJS-0004bV-18
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXfJS-0006PP-0C
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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=BURe9DoBTkAW9FCLX0PIa9Y+81eQrRyRvMoxsgU7Ypg=; b=XOobj+oD1fd/Xki0+qZIaYG0NS
	M2QpqX1V+YibwspDCh503d/1FwF2wlGaOMWSGjff/ZdtdTRIWMeGcsRc4GfV2ayu42+cMlIluegf9
	6QqKyWOiu2gsT1dXGMgS/Th8KIReJR/091dSC7PJiw+31msJ4cWIwgiKPM/aoxX7NdQA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] half-revert "change assorted xenbits.xen.org links to HTTPS"
Message-Id: <E1pXfJS-0006PP-0C@xenbits.xenproject.org>
Date: Thu, 02 Mar 2023 09:33:22 +0000

commit 1c2cb0b82a777ce8853c083e35997d335400f313
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 28 16:05:48 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 28 16:05:48 2023 +0100

    half-revert "change assorted xenbits.xen.org links to HTTPS"
    
    This reverts the build system relevant half of commit
    a4557f515fb002010b34b79102278ea03d6b31a3, as gitlab CI can't fully cope
    with the change just yet.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-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 3aba623096..10eb443b17 100644
--- a/Config.mk
+++ b/Config.mk
@@ -191,7 +191,7 @@ APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 EMBEDDED_EXTRA_CFLAGS := -fno-pie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
-XEN_EXTFILES_URL ?= https://xenbits.xenproject.org/xen-extfiles
+XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
 # the internet.  The original download URL is preserved as a comment
 # near the place in the Xen Makefiles where the file is used.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 02 09:33:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Mar 2023 09:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.504803.777185 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXfJd-0005mb-4C; Thu, 02 Mar 2023 09:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 504803.777185; Thu, 02 Mar 2023 09: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 1pXfJd-0005mU-1P; Thu, 02 Mar 2023 09:33:33 +0000
Received: by outflank-mailman (input) for mailman id 504803;
 Thu, 02 Mar 2023 09: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 1pXfJc-0005mE-51
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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 1pXfJc-0004bd-4I
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXfJc-0006Pw-3C
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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=fIwyCll/ds6OixjH0Wesqd3VSVujMg4NWz85bscSAJ0=; b=nQ7Owkii2LEre4U8yQxsPiJLCV
	sOzkn7OcT82TQhHcp6HNntvzaSZjNtiu1L1sKIQfsHJ1c/u05m1JxEEE3Kc3Q+FwXazpD9OdzuQ6A
	ZSuhwFwpX3fI79dZEhdIAor4xAqxCw8i3vtQLs9f6Cv5fDMNvxRQHK29ptOugLGQOAgI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpmu: rename {svm,vmx}_vpmu_initialise to {amd,core2}_vpmu_initialise
Message-Id: <E1pXfJc-0006Pw-3C@xenbits.xenproject.org>
Date: Thu, 02 Mar 2023 09:33:32 +0000

commit 976ae57b30d0e9432b51ca2ff408d8e52f40f280
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Feb 28 16:06:06 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 28 16:06:06 2023 +0100

    x86/vpmu: rename {svm,vmx}_vpmu_initialise to {amd,core2}_vpmu_initialise
    
    PMU virtualization is not dependent on the hardware virtualization support.
    Rename {svm,vmx}_vpmu_initialise to {amd,core2}_vpmu_initialise because
    the {svm,vmx} prefix is misleading.
    
    Take the opportunity to remove the also misleading comment stating that
    vpmu is specific to hvm guests, and correct the filename.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/vpmu_amd.c   | 6 +++---
 xen/arch/x86/cpu/vpmu_intel.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
index 58794a16f0..9df739aa3f 100644
--- a/xen/arch/x86/cpu/vpmu_amd.c
+++ b/xen/arch/x86/cpu/vpmu_amd.c
@@ -1,5 +1,5 @@
 /*
- * vpmu.c: PMU virtualization for HVM domain.
+ * vpmu_amd.c: AMD specific PMU virtualization.
  *
  * Copyright (c) 2010, Advanced Micro Devices, Inc.
  * Parts of this code are Copyright (c) 2007, Intel Corporation
@@ -480,7 +480,7 @@ static void cf_check amd_vpmu_dump(const struct vcpu *v)
     }
 }
 
-static int cf_check svm_vpmu_initialise(struct vcpu *v)
+static int cf_check amd_vpmu_initialise(struct vcpu *v)
 {
     struct xen_pmu_amd_ctxt *ctxt;
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
@@ -527,7 +527,7 @@ static int cf_check amd_allocate_context(struct vcpu *v)
 #endif
 
 static const struct arch_vpmu_ops __initconst_cf_clobber amd_vpmu_ops = {
-    .initialise = svm_vpmu_initialise,
+    .initialise = amd_vpmu_initialise,
     .do_wrmsr = amd_vpmu_do_wrmsr,
     .do_rdmsr = amd_vpmu_do_rdmsr,
     .do_interrupt = amd_vpmu_do_interrupt,
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index a8df52579d..bcfa187a14 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -1,5 +1,5 @@
 /*
- * vpmu_core2.c: CORE 2 specific PMU virtualization for HVM domain.
+ * vpmu_intel.c: CORE 2 specific PMU virtualization.
  *
  * Copyright (c) 2007, Intel Corporation.
  *
@@ -833,7 +833,7 @@ static void cf_check core2_vpmu_destroy(struct vcpu *v)
     vpmu_clear(vpmu);
 }
 
-static int cf_check vmx_vpmu_initialise(struct vcpu *v)
+static int cf_check core2_vpmu_initialise(struct vcpu *v)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     u64 msr_content;
@@ -898,7 +898,7 @@ static int cf_check vmx_vpmu_initialise(struct vcpu *v)
 }
 
 static const struct arch_vpmu_ops __initconst_cf_clobber core2_vpmu_ops = {
-    .initialise = vmx_vpmu_initialise,
+    .initialise = core2_vpmu_initialise,
     .do_wrmsr = core2_vpmu_do_wrmsr,
     .do_rdmsr = core2_vpmu_do_rdmsr,
     .do_interrupt = core2_vpmu_do_interrupt,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 02 09:33:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Mar 2023 09:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.504804.777189 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXfJn-0005pH-5R; Thu, 02 Mar 2023 09:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 504804.777189; Thu, 02 Mar 2023 09:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXfJn-0005p9-2w; Thu, 02 Mar 2023 09:33:43 +0000
Received: by outflank-mailman (input) for mailman id 504804;
 Thu, 02 Mar 2023 09: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 1pXfJm-0005p1-7z
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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 1pXfJm-0004c3-7L
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXfJm-0006Qb-6K
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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=oO0M7N/BZyx9fVgm4EazFvzElIfl5fSxUyZIDjlWXeI=; b=MSKzaz4auuUAF5fSvIAyCdxJ87
	TDVeXGWMQ64dURr1W6AnDutIKXpqjgjgxuSw7tSP92NOksMySXmMGyD+MrqdeWPNpRd+4+V4FXdHR
	ReQ8rs3qS4zN9f5MRB4cJDbB4MmNM64dtNAgRlsbsSyKM4PelKFF3gC65J2SQ/twZxdw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Always pull base image when building a container
Message-Id: <E1pXfJm-0006Qb-6K@xenbits.xenproject.org>
Date: Thu, 02 Mar 2023 09:33:42 +0000

commit 26ecc08b98fce0d927386058404961768d7830ca
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 28 18:22:26 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 28 18:54:52 2023 +0000

    automation: Always pull base image when building a container
    
    Ask docker to check if there's an update of the base image to avoid
    using an old container cached locally.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/build/Makefile b/automation/build/Makefile
index f1d56ce532..4df43b0407 100644
--- a/automation/build/Makefile
+++ b/automation/build/Makefile
@@ -16,7 +16,7 @@ help:
 include yocto/yocto.inc
 
 %: %.dockerfile ## Builds containers
-	$(DOCKER_CMD) build -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
+	$(DOCKER_CMD) build --pull -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
 	@if [ ! -z $${PUSH+x} ]; then \
 		$(DOCKER_CMD) push $(REGISTRY)/$(@D):$(@F); \
 	fi
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 02 09:33:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Mar 2023 09:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.504805.777194 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pXfJx-0005rp-76; Thu, 02 Mar 2023 09:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 504805.777194; Thu, 02 Mar 2023 09: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 1pXfJx-0005rh-4Q; Thu, 02 Mar 2023 09:33:53 +0000
Received: by outflank-mailman (input) for mailman id 504805;
 Thu, 02 Mar 2023 09: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 1pXfJw-0005rZ-BD
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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 1pXfJw-0004cB-AO
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pXfJw-0006R7-9M
 for xen-changelog@lists.xenproject.org; Thu, 02 Mar 2023 09: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=Mcrc3mU5ZaTMfBrexnnW3Q77sgyK7v7XVT8KRUywo6g=; b=exTQNBfTLDEc2oHHw+qtGjlMxq
	AXZ7tnEeJRUrBDj1YT2Qfsgi6oHWdFcqgstbzw/pW1JpbFgiC0ze9lxlRXf7XBaQvES+MB8bvxlpJ
	2CoFrrEbThBZQIXEt7fuiA4hNuGV65eDt4zCIMjR8/PK4gl4UVX0xCLAvipasr9jSLEE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Rework archlinux container
Message-Id: <E1pXfJw-0006R7-9M@xenbits.xenproject.org>
Date: Thu, 02 Mar 2023 09:33:52 +0000

commit b84fdf521b306cce64388fe57ee6c7c00f9d3e76
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 28 18:16:49 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 28 18:54:52 2023 +0000

    automation: Rework archlinux container
    
    Base image "archlinux/base" isn't available anymore,
        https://lists.archlinux.org/pipermail/arch-dev-public/2020-November/030181.html
    
    But instead of switching to archlinux/archlinux, we will use the
    official image from Docker. Main difference is that the first one is
    updated daily while the second is updated weekly.
    
    Also, as we will install the packages from "base-devel" anyway, switch
    to the "base-devel" tag.
    
    "dev86" package is now available from the main repo, no need for
    multilib repo anymore.
    
    It is recommended to initialise local signing key used by pacman, so
    let's do that.
    
    Replace "markdown" by "discount" as the former isn't available anymore
    and has been replaced by the later.
    
    Also, clean pacman's cache.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/archlinux/current.dockerfile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/automation/build/archlinux/current.dockerfile b/automation/build/archlinux/current.dockerfile
index d46fc9d9ca..13fb472d9e 100644
--- a/automation/build/archlinux/current.dockerfile
+++ b/automation/build/archlinux/current.dockerfile
@@ -1,16 +1,15 @@
-FROM archlinux/base
+FROM archlinux:base-devel
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
-# Enable multilib repo, for dev86 package
-RUN echo $'[multilib]\nInclude = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf
+RUN pacman-key --init
 
 RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
-        base-devel \
         bin86 \
         bridge-utils \
         bzip2 \
         dev86 \
+        discount \
         dtc \
         e2fsprogs \
         ghostscript \
@@ -29,7 +28,6 @@ RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
         libnl \
         libpng \
         libseccomp \
-        markdown \
         net-tools \
         nss \
         perl \
@@ -46,7 +44,8 @@ RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
         wget \
         xz \
         yajl \
-        zlib
+        zlib \
+    && yes | pacman -S --clean --clean
 
 ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 07:55:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 07:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.505607.778468 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pY0Fr-0002po-Nx; Fri, 03 Mar 2023 07:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 505607.778468; Fri, 03 Mar 2023 07:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pY0Fr-0002pg-Ka; Fri, 03 Mar 2023 07:55:03 +0000
Received: by outflank-mailman (input) for mailman id 505607;
 Fri, 03 Mar 2023 07:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pY0Fp-0002pW-Vc
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 07:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pY0Fp-0004Ns-UV
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 07:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pY0Fp-000257-TP
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 07:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7Je47Y3BgX4XQ/hgLN2kCNzBUwaFBl81sveRhmSC+eI=; b=gd+KUzMGU9rRAvHEymc9PiPA3x
	QfXTf6sWIAJjNdWwH2MtnrzCaIRmxCDbMg67wPy87zX4CFrrsKf8aR5fRaaBiTrhDcVvGkox+nJv4
	hRDUFdbkwGX5r4Y1Gh3KABsxDLZMlKEzocCRZwvThKl+YHJ0aDlEyuMIPSKMRTAh+/E8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Ensure the start *(.proc.info) of is 4-byte aligned
Message-Id: <E1pY0Fp-000257-TP@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 07:55:01 +0000

commit 380a8c0c65bfb84dab54ab4641cca1387cc41edb
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Mar 1 18:14:07 2023 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Mar 2 14:48:12 2023 +0000

    xen/arm: Ensure the start *(.proc.info) of is 4-byte aligned
    
    The entries in *(.proc.info) are expected to be 4-byte aligned and the
    compiler will access them using 4-byte load instructions. On Arm32, the
    alignment is strictly enforced by the processor and will result to a data
    abort if it is not correct.
    
    However, the linker script doesn't encode this requirement. So we are at
    the mercy of the compiler/linker to have padded the previous sections
    suitably.
    
    This was spotted when trying to use the upcoming generic bug
    infrastructure with the compiler provided by Yocto.
    
    Link: https://lore.kernel.org/xen-devel/6735859208c6dcb7320f89664ae298005f70827b.camel@gmail.com/
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/xen.lds.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 3f7ebd19f3..1b392345bc 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -67,6 +67,7 @@ SECTIONS
        *(.data.rel.ro)
        *(.data.rel.ro.*)
 
+       . = ALIGN(4);
        __proc_info_start = .;
        *(.proc.info)
        __proc_info_end = .;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:33:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506177.779229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYB9M-0006qL-6S; Fri, 03 Mar 2023 19:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506177.779229; Fri, 03 Mar 2023 19: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 1pYB9M-0006qD-3d; Fri, 03 Mar 2023 19:33:04 +0000
Received: by outflank-mailman (input) for mailman id 506177;
 Fri, 03 Mar 2023 19: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 1pYB9K-0006q1-DK
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYB9K-0004zi-CY
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYB9K-0003f5-Bd
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sCMw6BrL6SfdFHUvi7cAxfIfmW99o3tMqdU1tU8RQe8=; b=yeBq9Dz+jwLL11MD0LHQj/89c6
	6CL+KafG9zZNZUya/0q/5r1x5QudAj1dQP8kOR50mLCOusz7Wq2Ua2ODZmlHT2KKBo0Wxb1ExIdKG
	AmM3sI60vXUJfn3MiFb+HJ5J60/bKt/OyWavcUwt48qZB7Zrgqg/Fj3xMO9m7S+mHYA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] libs/util: Fix parallel build between flex/bison and CC rules
Message-Id: <E1pYB9K-0003f5-Bd@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:33:02 +0000

commit c622b8ace93cc38c73f47f5044dc3663ef93f815
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Mar 3 07:55:24 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 07:55:24 2023 +0100

    libs/util: Fix parallel build between flex/bison and CC rules
    
    flex/bison generate two targets, and when those targets are
    prerequisite of other rules they are considered independently by make.
    
    We can have a situation where the .c file is out-of-date but not the
    .h, git checkout for example. In this case, if a rule only have the .h
    file as prerequiste, make will procced and start to build the object.
    In parallel, another target can have the .c file as prerequisite and
    make will find out it need re-generating and do so, changing the .h at
    the same time. This parallel task breaks the first one.
    
    To avoid this scenario, we put both the header and the source as
    prerequisite for all object even if they only need the header.
    
    Reported-by: Andrew Cooper <Andrew.Cooper3@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: bf652a50fb3bb3b1b3d93db6fb79bc28f978fe75
    master date: 2023-02-09 18:26:17 +0000
---
 tools/libs/util/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index 493d2e00be..fee4ea0dc7 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -40,6 +40,14 @@ include $(XEN_ROOT)/tools/libs/libs.mk
 
 $(OBJS-y) $(PIC_OBJS): $(AUTOINCS)
 
+# Adding the .c conterparts of the headers generated by flex/bison as
+# prerequisite of all objects.
+# This is to tell make that if only the .c file is out-of-date but not the
+# header, it should still wait for the .c file to be rebuilt.
+# Otherwise, make doesn't considered "%.c %.h" as grouped targets, and will run
+# the flex/bison rules in parallel of CC rules which only need the header.
+$(OBJS-y) $(PIC_OBJS): libxlu_cfg_l.c libxlu_cfg_y.c libxlu_disk_l.c
+
 %.c %.h:: %.y
 	@rm -f $*.[ch]
 	$(BISON) --output=$*.c $<
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:33:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506178.779233 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYB9W-0006sX-7u; Fri, 03 Mar 2023 19:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506178.779233; Fri, 03 Mar 2023 19:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYB9W-0006sQ-5C; Fri, 03 Mar 2023 19:33:14 +0000
Received: by outflank-mailman (input) for mailman id 506178;
 Fri, 03 Mar 2023 19: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 1pYB9U-0006sA-GL
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYB9U-0004zq-Fc
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYB9U-0003fn-Ek
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KZb51C10xeUCkPW7Ty5OHYKgHBzJqd1CCMaZU7mRs/w=; b=mvtfDrGFu2HTxNacmZKqHLlVMT
	WLlqLTyHJPybTVBHp+Ov5GGdwe08sBp8QASH8SWqriZ0ZoEKwFqwFySjKUBXWcE2njg6cI/PNXwmc
	XlMjn7jQkxXJ3MuWNeB7XDkg9UDWseuRz0LWdgCGbrcAGegKoPn+5iY2oGuVzOdz2xcA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/cpuid: Infrastructure for leaves 7:1{ecx,edx}
Message-Id: <E1pYB9U-0003fn-Ek@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:33:12 +0000

commit cdc23d47ad85e756540eaa8655ebc2a0445612ed
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 07:55:54 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 07:55:54 2023 +0100

    x86/cpuid: Infrastructure for leaves 7:1{ecx,edx}
    
    We don't actually need ecx yet, but adding it in now will reduce the amount to
    which leaf 7 is out of order in a featureset.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b4a23bf6293aadecfd03bf9e83974443e2eac9cb
    master date: 2023-02-09 18:26:17 +0000
---
 tools/misc/xen-cpuid.c                      | 10 ++++++++++
 xen/arch/x86/cpu/common.c                   |  3 ++-
 xen/include/public/arch-x86/cpufeatureset.h |  4 ++++
 xen/include/xen/lib/x86/cpuid.h             | 15 ++++++++++++++-
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index d5833e9ce8..addb3a39a1 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -202,6 +202,14 @@ static const char *const str_7b1[32] =
     [ 0] = "ppin",
 };
 
+static const char *const str_7c1[32] =
+{
+};
+
+static const char *const str_7d1[32] =
+{
+};
+
 static const char *const str_7d2[32] =
 {
     [ 0] = "intel-psfd",
@@ -229,6 +237,8 @@ static const struct {
     { "0x80000021.eax",  "e21a", str_e21a },
     { "0x00000007:1.ebx", "7b1", str_7b1 },
     { "0x00000007:2.edx", "7d2", str_7d2 },
+    { "0x00000007:1.ecx", "7c1", str_7c1 },
+    { "0x00000007:1.edx", "7d1", str_7d1 },
 };
 
 #define COL_ALIGN "18"
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 0412dbc915..b3fcf4680f 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -450,7 +450,8 @@ static void generic_identify(struct cpuinfo_x86 *c)
 			cpuid_count(7, 1,
 				    &c->x86_capability[FEATURESET_7a1],
 				    &c->x86_capability[FEATURESET_7b1],
-				    &tmp, &tmp);
+				    &c->x86_capability[FEATURESET_7c1],
+				    &c->x86_capability[FEATURESET_7d1]);
 		if (max_subleaf >= 2)
 			cpuid_count(7, 2,
 				    &tmp, &tmp, &tmp,
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 7915f5826f..f43cdcd0f9 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -295,6 +295,10 @@ XEN_CPUFEATURE(RRSBA_CTRL,         13*32+ 2) /*   MSR_SPEC_CTRL.RRSBA_DIS_* */
 XEN_CPUFEATURE(BHI_CTRL,           13*32+ 4) /*   MSR_SPEC_CTRL.BHI_DIS_S */
 XEN_CPUFEATURE(MCDT_NO,            13*32+ 5) /*A  MCDT_NO */
 
+/* Intel-defined CPU features, CPUID level 0x00000007:1.ecx, word 14 */
+
+/* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
+
 #endif /* XEN_CPUFEATURE */
 
 /* Clean up from a default include.  Close the enum (for C). */
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index 73a5c33036..fa98b371ee 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -18,6 +18,8 @@
 #define FEATURESET_e21a  11 /* 0x80000021.eax      */
 #define FEATURESET_7b1   12 /* 0x00000007:1.ebx    */
 #define FEATURESET_7d2   13 /* 0x00000007:2.edx    */
+#define FEATURESET_7c1   14 /* 0x00000007:1.ecx    */
+#define FEATURESET_7d1   15 /* 0x00000007:1.edx    */
 
 struct cpuid_leaf
 {
@@ -194,7 +196,14 @@ struct cpuid_policy
                 uint32_t _7b1;
                 struct { DECL_BITFIELD(7b1); };
             };
-            uint32_t /* c */:32, /* d */:32;
+            union {
+                uint32_t _7c1;
+                struct { DECL_BITFIELD(7c1); };
+            };
+            union {
+                uint32_t _7d1;
+                struct { DECL_BITFIELD(7d1); };
+            };
 
             /* Subleaf 2. */
             uint32_t /* a */:32, /* b */:32, /* c */:32;
@@ -343,6 +352,8 @@ static inline void cpuid_policy_to_featureset(
     fs[FEATURESET_e21a] = p->extd.e21a;
     fs[FEATURESET_7b1] = p->feat._7b1;
     fs[FEATURESET_7d2] = p->feat._7d2;
+    fs[FEATURESET_7c1] = p->feat._7c1;
+    fs[FEATURESET_7d1] = p->feat._7d1;
 }
 
 /* Fill in a CPUID policy from a featureset bitmap. */
@@ -363,6 +374,8 @@ static inline void cpuid_featureset_to_policy(
     p->extd.e21a  = fs[FEATURESET_e21a];
     p->feat._7b1  = fs[FEATURESET_7b1];
     p->feat._7d2  = fs[FEATURESET_7d2];
+    p->feat._7c1  = fs[FEATURESET_7c1];
+    p->feat._7d1  = fs[FEATURESET_7d1];
 }
 
 static inline uint64_t cpuid_policy_xcr0_max(const struct cpuid_policy *p)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:33:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506179.779237 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYB9g-0006us-9T; Fri, 03 Mar 2023 19:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506179.779237; Fri, 03 Mar 2023 19: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 1pYB9g-0006ui-6h; Fri, 03 Mar 2023 19:33:24 +0000
Received: by outflank-mailman (input) for mailman id 506179;
 Fri, 03 Mar 2023 19: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 1pYB9e-0006uY-Jk
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYB9e-0004zz-Iu
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYB9e-0003gM-I5
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ivFIECzcr95xGaH5Emy3wIeVcaafs7gFfDKs6CDerB4=; b=er6LyKX/QQlU4ZqVHQzpENeE7a
	qtcHeg/2dvvYs5XCiZOoCNRozzephGAnZkL6keTQFLRlTfUej8uFcRFyrQdKMAEXn7MICUIFX3Oo7
	043icXSFYtUTBwis3eebTI30BUdRN2vsC58MdXwbZDP1b97isyLWa95z46FVhNnhldVE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/shskt: Disable CET-SS on parts susceptible to fractured updates
Message-Id: <E1pYB9e-0003gM-I5@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:33:22 +0000

commit 8202b9cf84674c5b23a89c4b8722afbb9787f917
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 07:56:16 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 07:56:16 2023 +0100

    x86/shskt: Disable CET-SS on parts susceptible to fractured updates
    
    Refer to Intel SDM Rev 70 (Dec 2022), Vol3 17.2.3 "Supervisor Shadow Stack
    Token".
    
    Architecturally, an event delivery which starts in CPL<3 and switches shadow
    stack will first validate the Supervisor Shadow Stack Token (setting the busy
    bit), then pushes CS/LIP/SSP.  One example of this is an NMI interrupting Xen.
    
    Some CPUs suffer from an issue called fracturing, whereby a fault/vmexit/etc
    between setting the busy bit and completing the event injection renders the
    action non-restartable, because when it comes time to restart, the busy bit is
    found to be already set.
    
    This is far more easily encountered under virt, yet it is not the fault of the
    hypervisor, nor the fault of the guest kernel.  The fault lies somewhere
    between the architectural specification, and the uarch behaviour.
    
    Intel have allocated CPUID.7[1].ecx[18] CET_SSS to enumerate that supervisor
    shadow stacks are safe to use.  Because of how Xen lays out its shadow stacks,
    fracturing is not expected to be a problem on native.
    
    Detect this case on boot and default to not using shstk if virtualised.
    Specifying `cet=shstk` on the command line will override this heuristic and
    enable shadow stacks irrespective.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 01e7477d1b081cff4288ff9f51ec59ee94c03ee0
    master date: 2023-02-09 18:26:17 +0000
---
 docs/misc/xen-command-line.pandoc           |  7 ++++-
 tools/libs/light/libxl_cpuid.c              |  2 ++
 tools/misc/xen-cpuid.c                      |  1 +
 xen/arch/x86/cpu/common.c                   | 11 +++++--
 xen/arch/x86/setup.c                        | 46 ++++++++++++++++++++++++-----
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 6 files changed, 57 insertions(+), 11 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index e7fe8b0cc9..807ca51fb2 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -287,10 +287,15 @@ can be maintained with the pv-shim mechanism.
     protection.
 
     The option is available when `CONFIG_XEN_SHSTK` is compiled in, and
-    defaults to `true` on hardware supporting CET-SS.  Specifying
+    generally defaults to `true` on hardware supporting CET-SS.  Specifying
     `cet=no-shstk` will cause Xen not to use Shadow Stacks even when support
     is available in hardware.
 
+    Some hardware suffers from an issue known as Supervisor Shadow Stack
+    Fracturing.  On such hardware, Xen will default to not using Shadow Stacks
+    when virtualised.  Specifying `cet=shstk` will override this heuristic and
+    enable Shadow Stacks unilaterally.
+
 *   The `ibt=` boolean controls whether Xen uses Indirect Branch Tracking for
     its own protection.
 
diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 2aa23225f4..d97a2f3338 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -235,6 +235,8 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"fsrs",         0x00000007,  1, CPUID_REG_EAX, 11,  1},
         {"fsrcs",        0x00000007,  1, CPUID_REG_EAX, 12,  1},
 
+        {"cet-sss",      0x00000007,  1, CPUID_REG_EDX, 18,  1},
+
         {"intel-psfd",   0x00000007,  2, CPUID_REG_EDX,  0,  1},
         {"mcdt-no",      0x00000007,  2, CPUID_REG_EDX,  5,  1},
 
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index addb3a39a1..0248eaef44 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -208,6 +208,7 @@ static const char *const str_7c1[32] =
 
 static const char *const str_7d1[32] =
 {
+    [18] = "cet-sss",
 };
 
 static const char *const str_7d2[32] =
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index b3fcf4680f..27f73d3bbe 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -346,11 +346,18 @@ void __init early_cpu_init(void)
 	       x86_cpuid_vendor_to_str(c->x86_vendor), c->x86, c->x86,
 	       c->x86_model, c->x86_model, c->x86_mask, eax);
 
-	if (c->cpuid_level >= 7)
-		cpuid_count(7, 0, &eax, &ebx,
+	if (c->cpuid_level >= 7) {
+		uint32_t max_subleaf;
+
+		cpuid_count(7, 0, &max_subleaf, &ebx,
 			    &c->x86_capability[FEATURESET_7c0],
 			    &c->x86_capability[FEATURESET_7d0]);
 
+		if (max_subleaf >= 1)
+			cpuid_count(7, 1, &eax, &ebx, &ecx,
+				    &c->x86_capability[FEATURESET_7d1]);
+	}
+
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
 		ebx = eax >= 0x8000001f ? cpuid_ebx(0x8000001f) : 0;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index e05189f649..09c17b1016 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -95,11 +95,7 @@ unsigned long __initdata highmem_start;
 size_param("highmem-start", highmem_start);
 #endif
 
-#ifdef CONFIG_XEN_SHSTK
-static bool __initdata opt_xen_shstk = true;
-#else
-#define opt_xen_shstk false
-#endif
+static int8_t __initdata opt_xen_shstk = -IS_ENABLED(CONFIG_XEN_SHSTK);
 
 #ifdef CONFIG_XEN_IBT
 static bool __initdata opt_xen_ibt = true;
@@ -1104,11 +1100,45 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     early_cpu_init();
 
     /* Choose shadow stack early, to set infrastructure up appropriately. */
-    if ( opt_xen_shstk && boot_cpu_has(X86_FEATURE_CET_SS) )
+    if ( !boot_cpu_has(X86_FEATURE_CET_SS) )
+        opt_xen_shstk = 0;
+
+    if ( opt_xen_shstk )
     {
-        printk("Enabling Supervisor Shadow Stacks\n");
+        /*
+         * Some CPUs suffer from Shadow Stack Fracturing, an issue whereby a
+         * fault/VMExit/etc between setting a Supervisor Busy bit and the
+         * event delivery completing renders the operation non-restartable.
+         * On restart, event delivery will find the Busy bit already set.
+         *
+         * This is a problem on bare metal, but outside of synthetic cases or
+         * a very badly timed #MC, it's not believed to be a problem.  It is a
+         * much bigger problem under virt, because we can VMExit for a number
+         * of legitimate reasons and tickle this bug.
+         *
+         * CPUs with this addressed enumerate CET-SSS to indicate that
+         * supervisor shadow stacks are now safe to use.
+         */
+        bool cpu_has_bug_shstk_fracture =
+            boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+            !boot_cpu_has(X86_FEATURE_CET_SSS);
 
-        setup_force_cpu_cap(X86_FEATURE_XEN_SHSTK);
+        /*
+         * On bare metal, assume that Xen won't be impacted by shstk
+         * fracturing problems.  Under virt, be more conservative and disable
+         * shstk by default.
+         */
+        if ( opt_xen_shstk == -1 )
+            opt_xen_shstk =
+                cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
+                                   : true;
+
+        if ( opt_xen_shstk )
+        {
+            printk("Enabling Supervisor Shadow Stacks\n");
+
+            setup_force_cpu_cap(X86_FEATURE_XEN_SHSTK);
+        }
     }
 
     if ( opt_xen_ibt && boot_cpu_has(X86_FEATURE_CET_IBT) )
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index f43cdcd0f9..08600cfdc7 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -298,6 +298,7 @@ XEN_CPUFEATURE(MCDT_NO,            13*32+ 5) /*A  MCDT_NO */
 /* Intel-defined CPU features, CPUID level 0x00000007:1.ecx, word 14 */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
+XEN_CPUFEATURE(CET_SSS,            15*32+18) /*   CET Supervisor Shadow Stacks safe to use */
 
 #endif /* XEN_CPUFEATURE */
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:33:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506180.779240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYB9q-0006xt-As; Fri, 03 Mar 2023 19:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506180.779240; Fri, 03 Mar 2023 19: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 1pYB9q-0006xl-8C; Fri, 03 Mar 2023 19:33:34 +0000
Received: by outflank-mailman (input) for mailman id 506180;
 Fri, 03 Mar 2023 19: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 1pYB9o-0006xY-Mm
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYB9o-00050A-M4
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYB9o-0003h0-LH
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Frih7pF6J/86QHmhG0xSshkE0drkV3s+Jhtb7rb1szQ=; b=BCbu79ia7SvwnBEVLo7nyZujdq
	AVPzPmhJ88XxxM2fDNt0W+GiHiePWkYQPU+EHGxqthTXhcqVcI5mtKmE/0C/Dz4pJS4XFl/5KUVUL
	0bIU3lR3omyea+S7mAXdp49eYxFQRfzKCSBKmZDcRh5LZcWJ3AIRxWhURCxVJGA1+5xE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] credit2: respect credit2_runqueue=all when arranging runqueues
Message-Id: <E1pYB9o-0003h0-LH@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:33:32 +0000

commit 74b76704fd4059e9133e84c1384501858e9663b7
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Mar 3 07:57:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 07:57:39 2023 +0100

    credit2: respect credit2_runqueue=all when arranging runqueues
    
    Documentation for credit2_runqueue=all says it should create one queue
    for all pCPUs on the host. But since introduction
    sched_credit2_max_cpus_runqueue, it actually created separate runqueue
    per socket, even if the CPUs count is below
    sched_credit2_max_cpus_runqueue.
    
    Adjust the condition to skip syblink check in case of
    credit2_runqueue=all.
    
    Fixes: 8e2aa76dc167 ("xen: credit2: limit the max number of CPUs in a runqueue")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 1f5747ee929fbbcae58d7234c6c38a77495d0cfe
    master date: 2023-02-15 16:12:42 +0100
---
 docs/misc/xen-command-line.pandoc | 5 +++++
 xen/common/sched/credit2.c        | 9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 807ca51fb2..5be5ce10c6 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -726,6 +726,11 @@ Available alternatives, with their meaning, are:
 * `all`: just one runqueue shared by all the logical pCPUs of
          the host
 
+Regardless of the above choice, Xen attempts to respect
+`sched_credit2_max_cpus_runqueue` limit, which may mean more than one runqueue
+for the `all` value. If that isn't intended, raise
+the `sched_credit2_max_cpus_runqueue` value.
+
 ### dbgp
 > `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]`
 > `= xhci[ <integer> | @pci<bus>:<slot>.<func> ][,share=<bool>|hwdom]`
diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 0e3f89e537..ae55feea34 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -996,9 +996,14 @@ cpu_add_to_runqueue(const struct scheduler *ops, unsigned int cpu)
              *
              * Otherwise, let's try to make sure that siblings stay in the
              * same runqueue, pretty much under any cinrcumnstances.
+             *
+             * Furthermore, try to respect credit2_runqueue=all, as long as
+             * max_cpus_runq isn't violated.
              */
-            if ( rqd->refcnt < max_cpus_runq && (ops->cpupool->gran != SCHED_GRAN_cpu ||
-                  cpu_runqueue_siblings_match(rqd, cpu, max_cpus_runq)) )
+            if ( rqd->refcnt < max_cpus_runq &&
+                 (ops->cpupool->gran != SCHED_GRAN_cpu ||
+                  cpu_runqueue_siblings_match(rqd, cpu, max_cpus_runq) ||
+                  opt_runqueue == OPT_RUNQUEUE_ALL) )
             {
                 /*
                  * This runqueue is ok, but as we said, we also want an even
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:33:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506181.779244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBA0-00071I-CK; Fri, 03 Mar 2023 19:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506181.779244; Fri, 03 Mar 2023 19: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 1pYBA0-00071A-9e; Fri, 03 Mar 2023 19:33:44 +0000
Received: by outflank-mailman (input) for mailman id 506181;
 Fri, 03 Mar 2023 19: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 1pYB9y-000710-Ph
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYB9y-00050N-P7
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYB9y-0003hR-O9
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wxwbxPG8zGChPMrdB8D6/6uPh9tCYkI80ZZ2dGkftfk=; b=thnkFLkYxflcCS8TjsQ8sfIAJO
	nygt6guRe3OxD0F7fHEe6b2AoqsafaOx4ZnvWLKPzmSgsyPGZCRG3DwgJm3XtGV2RrkrLiLZdNMBZ
	79ObRttlqlpdybeV7uped2395g3gcCALqm9rXP5PCr5yeeOdk6Yfi73WQaYMoQ5PwNr0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] build: make FILE symbol paths consistent
Message-Id: <E1pYB9y-0003hR-O9@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:33:42 +0000

commit 46c104cce0bf340193cb1eacaee5dcd75e264c8f
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Fri Mar 3 07:58:12 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 07:58:12 2023 +0100

    build: make FILE symbol paths consistent
    
    The FILE symbols in out-of-tree builds may be either a relative path to
    the object dir or an absolute path depending on how the build is
    invoked. Fix the paths for C files so that they are consistent with
    in-tree builds - the path is relative to the "xen" directory (e.g.
    common/irq.c).
    
    This fixes livepatch builds when the original Xen build was out-of-tree
    since livepatch-build always does in-tree builds. Note that this doesn't
    fix the behaviour for Clang < 6 which always embeds full paths.
    
    Fixes: 7115fa562fe7 ("build: adding out-of-tree support to the xen build")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 5b9bb91abba7c983def3b4bef71ab08ad360a242
    master date: 2023-02-15 16:13:49 +0100
---
 xen/Rules.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 70b7489ea8..d6b7cec0a8 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -228,8 +228,9 @@ quiet_cmd_cc_o_c = CC      $@
 ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y)
     cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $(dot-target).tmp -MQ $@
     ifneq ($(CONFIG_CC_IS_CLANG)$(call clang-ifversion,-lt,600,y),yy)
+        rel-path = $(patsubst $(abs_srctree)/%,%,$(call realpath,$(1)))
         cmd_objcopy_fix_sym = \
-	    $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@ && rm -f $(dot-target).tmp
+           $(OBJCOPY) --redefine-sym $(<F)=$(call rel-path,$<) $(dot-target).tmp $@ && rm -f $(dot-target).tmp
     else
         cmd_objcopy_fix_sym = mv -f $(dot-target).tmp $@
     endif
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:33:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506182.779249 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBAA-00074F-Fg; Fri, 03 Mar 2023 19:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506182.779249; Fri, 03 Mar 2023 19: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 1pYBAA-000748-Cx; Fri, 03 Mar 2023 19:33:54 +0000
Received: by outflank-mailman (input) for mailman id 506182;
 Fri, 03 Mar 2023 19: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 1pYBA8-000740-T2
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYBA8-00050q-SE
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYBA8-0003hw-RG
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nh7GH5xPNVa3FlDB1S0JAd3R8e9UA76ZgnlFD8GhXUM=; b=nQnH9qeU9+tTv5aNOkwVRoGEiq
	xE0p2NNIpRUhb5O7UVIhvBhcUBUgu6k5ylrQGps+yU7VhGfEvK7rp8hC44i0CWGEXTIm5UZP5TEge
	4bhyZjvrFtdV/glhJ84HTRsExi1zL+fk2ID1Dw6fCWgq0JOqrJUVujeTyA8KFGrHocAk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/ucode/AMD: apply the patch early on every logical thread
Message-Id: <E1pYBA8-0003hw-RG@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:33:52 +0000

commit e9a7942f6c1638c668605fbf6d6e02bc7bff2582
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Fri Mar 3 07:58:35 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 07:58:35 2023 +0100

    x86/ucode/AMD: apply the patch early on every logical thread
    
    The original issue has been reported on AMD Bulldozer-based CPUs where
    ucode loading loses the LWP feature bit in order to gain the IBPB bit.
    LWP disabling is per-SMT/CMT core modification and needs to happen on
    each sibling thread despite the shared microcode engine. Otherwise,
    logical CPUs will end up with different cpuid capabilities.
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216211
    
    Guests running under Xen happen to be not affected because of levelling
    logic for the feature masking/override MSRs which causes the LWP bit to
    fall out and hides the issue. The latest recommendation from AMD, after
    discussing this bug, is to load ucode on every logical CPU.
    
    In Linux kernel this issue has been addressed by e7ad18d1169c
    ("x86/microcode/AMD: Apply the patch early on every logical thread").
    Follow the same approach in Xen.
    
    Introduce SAME_UCODE match result and use it for early AMD ucode
    loading. Take this opportunity and move opt_ucode_allow_same out of
    compare_revisions() to the relevant callers and also modify the warning
    message based on it. Intel's side of things is modified for consistency
    but provides no functional change.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f4ef8a41b80831db2136bdaff9f946a1a4b051e7
    master date: 2023-02-21 15:08:05 +0100
---
 xen/arch/x86/cpu/microcode/amd.c     | 11 ++++++++---
 xen/arch/x86/cpu/microcode/core.c    | 26 +++++++++++++++++---------
 xen/arch/x86/cpu/microcode/intel.c   | 10 +++++++---
 xen/arch/x86/cpu/microcode/private.h |  3 ++-
 4 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 8195707ee1..ded8fe90e6 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -176,8 +176,8 @@ static enum microcode_match_result compare_revisions(
     if ( new_rev > old_rev )
         return NEW_UCODE;
 
-    if ( opt_ucode_allow_same && new_rev == old_rev )
-        return NEW_UCODE;
+    if ( new_rev == old_rev )
+        return SAME_UCODE;
 
     return OLD_UCODE;
 }
@@ -220,8 +220,13 @@ static int cf_check apply_microcode(const struct microcode_patch *patch)
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
     uint32_t rev, old_rev = sig->rev;
+    enum microcode_match_result result = microcode_fits(patch);
 
-    if ( microcode_fits(patch) != NEW_UCODE )
+    /*
+     * Allow application of the same revision to pick up SMT-specific changes
+     * even if the revision of the other SMT thread is already up-to-date.
+     */
+    if ( result != NEW_UCODE && result != SAME_UCODE )
         return -EINVAL;
 
     if ( check_final_patch_levels(sig) )
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 452a7ca773..57ecc5358b 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -610,17 +610,25 @@ static long cf_check microcode_update_helper(void *data)
      * that ucode revision.
      */
     spin_lock(&microcode_mutex);
-    if ( microcode_cache &&
-         alternative_call(ucode_ops.compare_patch,
-                          patch, microcode_cache) != NEW_UCODE )
+    if ( microcode_cache )
     {
-        spin_unlock(&microcode_mutex);
-        printk(XENLOG_WARNING "microcode: couldn't find any newer revision "
-                              "in the provided blob!\n");
-        microcode_free_patch(patch);
-        ret = -ENOENT;
+        enum microcode_match_result result;
 
-        goto put;
+        result = alternative_call(ucode_ops.compare_patch, patch,
+                                  microcode_cache);
+
+        if ( result != NEW_UCODE &&
+             !(opt_ucode_allow_same && result == SAME_UCODE) )
+        {
+            spin_unlock(&microcode_mutex);
+            printk(XENLOG_WARNING
+                   "microcode: couldn't find any newer%s revision in the provided blob!\n",
+                   opt_ucode_allow_same ? " (or the same)" : "");
+            microcode_free_patch(patch);
+            ret = -ENOENT;
+
+            goto put;
+        }
     }
     spin_unlock(&microcode_mutex);
 
diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index f5ba6d76d7..cb08f63d2e 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -232,8 +232,8 @@ static enum microcode_match_result compare_revisions(
     if ( new_rev > old_rev )
         return NEW_UCODE;
 
-    if ( opt_ucode_allow_same && new_rev == old_rev )
-        return NEW_UCODE;
+    if ( new_rev == old_rev )
+        return SAME_UCODE;
 
     /*
      * Treat pre-production as always applicable - anyone using pre-production
@@ -290,8 +290,12 @@ static int cf_check apply_microcode(const struct microcode_patch *patch)
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &this_cpu(cpu_sig);
     uint32_t rev, old_rev = sig->rev;
+    enum microcode_match_result result;
+
+    result = microcode_update_match(patch);
 
-    if ( microcode_update_match(patch) != NEW_UCODE )
+    if ( result != NEW_UCODE &&
+         !(opt_ucode_allow_same && result == SAME_UCODE) )
         return -EINVAL;
 
     wbinvd();
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index c085a10268..feafab0677 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -6,7 +6,8 @@
 extern bool opt_ucode_allow_same;
 
 enum microcode_match_result {
-    OLD_UCODE, /* signature matched, but revision id is older or equal */
+    OLD_UCODE, /* signature matched, but revision id is older */
+    SAME_UCODE, /* signature matched, but revision id is the same */
     NEW_UCODE, /* signature matched, but revision id is newer */
     MIS_UCODE, /* signature mismatched */
 };
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:34:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506183.779253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBAK-000777-Hk; Fri, 03 Mar 2023 19:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506183.779253; Fri, 03 Mar 2023 19:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBAK-000770-Ey; Fri, 03 Mar 2023 19:34:04 +0000
Received: by outflank-mailman (input) for mailman id 506183;
 Fri, 03 Mar 2023 19: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 1pYBAI-00076k-Vw
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYBAI-00051V-VF
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYBAI-0003ia-UJ
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xe9CLTtgSSEy78Sq8OaUFmu+0msEucKBl5gc9XLiYJA=; b=YMpfvFfF4FeXsh9zkXVpnT3dqf
	H200YqsJRFEsAIvPqLONW9eXVCCI09VWpurN06C+j3yGJoLhQRBV8qR1cszyLwils1Nc4BFGiVN1V
	ite2+L6X8HTolcWlW4AeUnhUxP4903Bzp0WuYtu6ud54FUoHf9YzMDYxh8F1l/EZ8Ms8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86: perform mem_sharing teardown before paging teardown
Message-Id: <E1pYBAI-0003ia-UJ@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:34:02 +0000

commit e8f28e129d23c940749c66150a89c4ed683a0fb9
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Fri Mar 3 07:59:08 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 07:59:08 2023 +0100

    x86: perform mem_sharing teardown before paging teardown
    
    An assert failure has been observed in p2m_teardown when performing vm
    forking and then destroying the forked VM (p2m-basic.c:173). The assert
    checks whether the domain's shared pages counter is 0. According to the
    patch that originally added the assert (7bedbbb5c31) the p2m_teardown
    should only happen after mem_sharing already relinquished all shared pages.
    
    In this patch we flip the order in which relinquish ops are called to avoid
    tripping the assert. Conceptually sharing being torn down makes sense to
    happen before paging is torn down.
    
    Fixes: e7aa55c0aab3 ("x86/p2m: free the paging memory pool preemptively")
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2869349f0cb3a89dcbf1f1b30371f58df6309312
    master date: 2023-02-23 12:35:48 +0100
---
 xen/arch/x86/domain.c | 56 ++++++++++++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 5a119eec3a..e546c98322 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2347,9 +2347,9 @@ int domain_relinquish_resources(struct domain *d)
 
         enum {
             PROG_iommu_pagetables = 1,
+            PROG_shared,
             PROG_paging,
             PROG_vcpu_pagetables,
-            PROG_shared,
             PROG_xen,
             PROG_l4,
             PROG_l3,
@@ -2368,6 +2368,34 @@ int domain_relinquish_resources(struct domain *d)
         if ( ret )
             return ret;
 
+#ifdef CONFIG_MEM_SHARING
+    PROGRESS(shared):
+
+        if ( is_hvm_domain(d) )
+        {
+            /*
+             * If the domain has shared pages, relinquish them allowing
+             * for preemption.
+             */
+            ret = relinquish_shared_pages(d);
+            if ( ret )
+                return ret;
+
+            /*
+             * If the domain is forked, decrement the parent's pause count
+             * and release the domain.
+             */
+            if ( mem_sharing_is_fork(d) )
+            {
+                struct domain *parent = d->parent;
+
+                d->parent = NULL;
+                domain_unpause(parent);
+                put_domain(parent);
+            }
+        }
+#endif
+
     PROGRESS(paging):
 
         /* Tear down paging-assistance stuff. */
@@ -2408,32 +2436,6 @@ int domain_relinquish_resources(struct domain *d)
             d->arch.auto_unmask = 0;
         }
 
-#ifdef CONFIG_MEM_SHARING
-    PROGRESS(shared):
-
-        if ( is_hvm_domain(d) )
-        {
-            /* If the domain has shared pages, relinquish them allowing
-             * for preemption. */
-            ret = relinquish_shared_pages(d);
-            if ( ret )
-                return ret;
-
-            /*
-             * If the domain is forked, decrement the parent's pause count
-             * and release the domain.
-             */
-            if ( mem_sharing_is_fork(d) )
-            {
-                struct domain *parent = d->parent;
-
-                d->parent = NULL;
-                domain_unpause(parent);
-                put_domain(parent);
-            }
-        }
-#endif
-
         spin_lock(&d->page_alloc_lock);
         page_list_splice(&d->arch.relmem_list, &d->page_list);
         INIT_PAGE_LIST_HEAD(&d->arch.relmem_list);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:34:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506184.779257 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBAU-00079s-JH; Fri, 03 Mar 2023 19:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506184.779257; Fri, 03 Mar 2023 19:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBAU-00079l-GW; Fri, 03 Mar 2023 19:34:14 +0000
Received: by outflank-mailman (input) for mailman id 506184;
 Fri, 03 Mar 2023 19: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 1pYBAT-00079V-2w
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYBAT-00051e-28
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYBAT-0003jM-16
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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=etdf3S8zeTWVXweaacuHWLZlNOjKhLIwJ3mDmVMteKI=; b=ZMI0jrM8bn8/Q50QLZvvAP6PKV
	eKHcd4HoAG2yL8YvFu7SbXPSCdgl+HBODDPBDHJAEhVFHoJPO95YCogGqSz1+PiAxBAACOncutT++
	HxG3nwhXb6LCvrtp7itX4tA+1SnScg5nlu4p28ZUNwj8y7K1J5YYvbnmjhOEy8/Arn+w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] xen: Work around Clang-IAS macro \@ expansion bug
Message-Id: <E1pYBAT-0003jM-16@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:34:13 +0000

commit 837bdc6eb2df796e832302347f363afc820694fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 08:00:04 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:00:04 2023 +0100

    xen: Work around Clang-IAS macro \@ expansion bug
    
    https://github.com/llvm/llvm-project/issues/60792
    
    It turns out that Clang-IAS does not expand \@ uniquely in a translaition
    unit, and the XSA-426 change tickles this bug:
    
      <instantiation>:4:1: error: invalid symbol redefinition
      .L1_fill_rsb_loop:
      ^
      make[3]: *** [Rules.mk:247: arch/x86/acpi/cpu_idle.o] Error 1
    
    Extend DO_OVERWRITE_RSB with an optional parameter so C callers can mix %= in
    too, which Clang does seem to expand properly.
    
    Fixes: 63305e5392ec ("x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a2adacff0b91cc7b977abb209dc419a2ef15963f
    master date: 2023-02-24 17:44:29 +0000
---
 xen/arch/x86/include/asm/spec_ctrl.h     |  4 ++--
 xen/arch/x86/include/asm/spec_ctrl_asm.h | 19 ++++++++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/spec_ctrl.h b/xen/arch/x86/include/asm/spec_ctrl.h
index 391973ef6a..a431fea587 100644
--- a/xen/arch/x86/include/asm/spec_ctrl.h
+++ b/xen/arch/x86/include/asm/spec_ctrl.h
@@ -83,7 +83,7 @@ static always_inline void spec_ctrl_new_guest_context(void)
     wrmsrl(MSR_PRED_CMD, PRED_CMD_IBPB);
 
     /* (ab)use alternative_input() to specify clobbers. */
-    alternative_input("", "DO_OVERWRITE_RSB", X86_BUG_IBPB_NO_RET,
+    alternative_input("", "DO_OVERWRITE_RSB xu=%=", X86_BUG_IBPB_NO_RET,
                       : "rax", "rcx");
 }
 
@@ -172,7 +172,7 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
      *
      * (ab)use alternative_input() to specify clobbers.
      */
-    alternative_input("", "DO_OVERWRITE_RSB", X86_FEATURE_SC_RSB_IDLE,
+    alternative_input("", "DO_OVERWRITE_RSB xu=%=", X86_FEATURE_SC_RSB_IDLE,
                       : "rax", "rcx");
 }
 
diff --git a/xen/arch/x86/include/asm/spec_ctrl_asm.h b/xen/arch/x86/include/asm/spec_ctrl_asm.h
index fab27ff553..f23bb105c5 100644
--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -117,11 +117,16 @@
 .L\@_done:
 .endm
 
-.macro DO_OVERWRITE_RSB tmp=rax
+.macro DO_OVERWRITE_RSB tmp=rax xu
 /*
  * Requires nothing
  * Clobbers \tmp (%rax by default), %rcx
  *
+ * xu is an optional parameter to add eXtra Uniqueness.  It is intended for
+ * passing %= in from an asm() block, in order to work around
+ * https://github.com/llvm/llvm-project/issues/60792 where Clang-IAS doesn't
+ * expand \@ uniquely.
+ *
  * Requires 256 bytes of {,shadow}stack space, but %rsp/SSP has no net
  * change. Based on Google's performance numbers, the loop is unrolled to 16
  * iterations and two calls per iteration.
@@ -136,27 +141,27 @@
     mov $16, %ecx                   /* 16 iterations, two calls per loop */
     mov %rsp, %\tmp                 /* Store the current %rsp */
 
-.L\@_fill_rsb_loop:
+.L\@_fill_rsb_loop\xu:
 
     .irp n, 1, 2                    /* Unrolled twice. */
-    call .L\@_insert_rsb_entry_\n   /* Create an RSB entry. */
+    call .L\@_insert_rsb_entry\xu\n /* Create an RSB entry. */
     int3                            /* Halt rogue speculation. */
 
-.L\@_insert_rsb_entry_\n:
+.L\@_insert_rsb_entry\xu\n:
     .endr
 
     sub $1, %ecx
-    jnz .L\@_fill_rsb_loop
+    jnz .L\@_fill_rsb_loop\xu
     mov %\tmp, %rsp                 /* Restore old %rsp */
 
 #ifdef CONFIG_XEN_SHSTK
     mov $1, %ecx
     rdsspd %ecx
     cmp $1, %ecx
-    je .L\@_shstk_done
+    je .L\@_shstk_done\xu
     mov $64, %ecx                   /* 64 * 4 bytes, given incsspd */
     incsspd %ecx                    /* Restore old SSP */
-.L\@_shstk_done:
+.L\@_shstk_done\xu:
 #endif
 .endm
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:34:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:34:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506185.779262 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBAd-0007Cv-ME; Fri, 03 Mar 2023 19:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506185.779262; Fri, 03 Mar 2023 19: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 1pYBAd-0007Cn-I9; Fri, 03 Mar 2023 19:34:23 +0000
Received: by outflank-mailman (input) for mailman id 506185;
 Fri, 03 Mar 2023 19: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 1pYBAd-0007Cf-5q
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYBAd-00051n-5A
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYBAd-0003kH-4H
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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=i36tshHzg8fg8CL4rYP4P3Ij06ii0LJkmVx5aVL5DFw=; b=eowMcXjMQaS4dmQL1w8SGGOzkV
	DTnx6yLUQrhQXT8Ba7t1ppMC8vc4KX8d5XK4ZyLgFcqy1VJscfXNKAaz4pl48Lg/Vfljim/wljtEc
	HevT7H7//PO0kZ2lOzvZQT0jDjpV+PND3WJUQk+KJtX7fHC9qz5JOKm+rhKcC8PfJ/Co=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] xen: Fix Clang -Wunicode diagnostic when building asm-macros
Message-Id: <E1pYBAd-0003kH-4H@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:34:23 +0000

commit b10cf1561a638c835481ae923b571cb8f7350a89
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 08:01:21 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:01:21 2023 +0100

    xen: Fix Clang -Wunicode diagnostic when building asm-macros
    
    While trying to work around a different Clang-IAS bug (parent changeset), I
    stumbled onto:
    
      In file included from arch/x86/asm-macros.c:3:
      ./arch/x86/include/asm/spec_ctrl_asm.h:144:19: error: \u used with
      no following hex digits; treating as '\' followed by identifier [-Werror,-Wunicode]
      .L\@_fill_rsb_loop\uniq:
                        ^
    
    It turns out that Clang -E is sensitive to the file extension of the source
    file it is processing.  Furthermore, C explicitly permits the use of \u
    escapes in identifier names, so the diagnostic would be reasonable in
    principle if we trying to compile the result.
    
    asm-macros should really have been .S from the outset, as it is ultimately
    generating assembly, not C.  Rename it, which causes Clang not to complain.
    
    We need to introduce rules for generating a .i file from .S, and substituting
    c_flags for a_flags lets us drop the now-redundant -D__ASSEMBLY__.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 53f0d02040b1df08f0589f162790ca376e1c2040
    master date: 2023-02-24 17:44:29 +0000
---
 xen/Rules.mk              | 6 ++++++
 xen/arch/x86/Makefile     | 2 +-
 xen/arch/x86/asm-macros.S | 3 +++
 xen/arch/x86/asm-macros.c | 3 ---
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index d6b7cec0a8..59072ae8df 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -273,6 +273,9 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): $(obj)/%.init.o: $(obj)/%.o
 quiet_cmd_cpp_i_c = CPP     $@
 cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<
 
+quiet_cmd_cpp_i_S = CPP     $@
+cmd_cpp_i_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
+
 quiet_cmd_cc_s_c = CC      $@
 cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 
@@ -282,6 +285,9 @@ cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 $(obj)/%.i: $(src)/%.c FORCE
 	$(call if_changed_dep,cpp_i_c)
 
+$(obj)/%.i: $(src)/%.S FORCE
+	$(call if_changed_dep,cpp_i_S)
+
 $(obj)/%.s: $(src)/%.c FORCE
 	$(call if_changed_dep,cc_s_c)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 177a2ff742..5accbe4c67 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -240,7 +240,7 @@ $(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
 .PHONY: include
 include: $(objtree)/arch/x86/include/asm/asm-macros.h
 
-$(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
+$(obj)/asm-macros.i: CFLAGS-y += -P
 
 $(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile
 	$(call filechk,asm-macros.h)
diff --git a/xen/arch/x86/asm-macros.S b/xen/arch/x86/asm-macros.S
new file mode 100644
index 0000000000..891d86c765
--- /dev/null
+++ b/xen/arch/x86/asm-macros.S
@@ -0,0 +1,3 @@
+#include <asm/asm-defns.h>
+#include <asm/alternative-asm.h>
+#include <asm/spec_ctrl_asm.h>
diff --git a/xen/arch/x86/asm-macros.c b/xen/arch/x86/asm-macros.c
deleted file mode 100644
index 891d86c765..0000000000
--- a/xen/arch/x86/asm-macros.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <asm/asm-defns.h>
-#include <asm/alternative-asm.h>
-#include <asm/spec_ctrl_asm.h>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:34:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:34:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506186.779265 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBAn-0007FV-Mb; Fri, 03 Mar 2023 19:34:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506186.779265; Fri, 03 Mar 2023 19: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 1pYBAn-0007FN-Jj; Fri, 03 Mar 2023 19:34:33 +0000
Received: by outflank-mailman (input) for mailman id 506186;
 Fri, 03 Mar 2023 19: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 1pYBAn-0007FG-8k
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYBAn-00051z-7y
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYBAn-0003lX-7B
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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=ivw5yrZ2NY0Y38achh6a2geaopJsE4LL6Kj2VYKkxzU=; b=eJHP71269YXp0we//jvpiZ9458
	wiooJe0fzJ5eQEkg2iCjw7KRqDo1jG6AN/k58ZzPQzl9saeP18/OdVCdo6UpndrHZOQJLBQcsB0Lx
	bW2A3+BB5JxRvTYyDmtVrJYGng44n8Mqoy7t0lIV87lHzrohxPM66XKS0qOnPLpufp+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools: Use PKG_CONFIG_FILE instead of PKG_CONFIG variable
Message-Id: <E1pYBAn-0003lX-7B@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:34:33 +0000

commit 53bd16bcc0d0f5ed5d1ac6d6dc14bf6ecf2e2c43
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Mar 3 08:02:30 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:02:30 2023 +0100

    tools: Use PKG_CONFIG_FILE instead of PKG_CONFIG variable
    
    Replace PKG_CONFIG variable name with PKG_CONFIG_FILE for the name of
    the pkg-config file.
    This is preventing a conflict in some build systems where PKG_CONFIG
    actually contains the path to the pkg-config executable to use, as the
    default assignment in libs.mk is using a weak assignment (?=).
    
    This problem has been found when trying to build the latest version of
    Xen tools using buildroot.
    
    Fixes: d400dc5729e4 ("tools: tweak tools/libs/libs.mk for being able to support libxenctrl")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: b97e2fe7b9e1f4706693552697239ac2b71efee4
    master date: 2023-02-24 17:44:29 +0000
---
 tools/libs/ctrl/Makefile |  2 +-
 tools/libs/libs.mk       | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 93442ab389..15d0ae8e4e 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 include Makefile.common
 
 LIBHEADER := xenctrl.h xenctrl_compat.h
-PKG_CONFIG := xencontrol.pc
+PKG_CONFIG_FILE := xencontrol.pc
 PKG_CONFIG_NAME := Xencontrol
 
 NO_HEADERS_CHK := y
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 3eb91fc8f3..3fab5aecff 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -1,7 +1,7 @@
 # Common Makefile for building a lib.
 #
 # Variables taken as input:
-#   PKG_CONFIG: name of pkg-config file (xen$(LIBNAME).pc if empty)
+#   PKG_CONFIG_FILE: name of pkg-config file (xen$(LIBNAME).pc if empty)
 #   MAJOR:   major version of lib (Xen version if empty)
 #   MINOR:   minor version of lib (0 if empty)
 
@@ -26,7 +26,7 @@ ifneq ($(nosharedlibs),y)
 TARGETS += lib$(LIB_FILE_NAME).so
 endif
 
-PKG_CONFIG ?= $(LIB_FILE_NAME).pc
+PKG_CONFIG_FILE ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
@@ -35,13 +35,13 @@ PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
 ifneq ($(CONFIG_LIBXC_MINIOS),y)
-TARGETS += $(PKG_CONFIG)
-$(PKG_CONFIG): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG): PKG_CONFIG_LIBDIR = $(libdir)
+TARGETS += $(PKG_CONFIG_FILE)
+$(PKG_CONFIG_FILE): PKG_CONFIG_PREFIX = $(prefix)
+$(PKG_CONFIG_FILE): PKG_CONFIG_INCDIR = $(includedir)
+$(PKG_CONFIG_FILE): PKG_CONFIG_LIBDIR = $(libdir)
 endif
 
-PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
+PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG_FILE)
 
 LIBHEADER ?= $(LIB_FILE_NAME).h
 LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h))
@@ -103,7 +103,7 @@ install:: all
 	$(SYMLINK_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR)
 	$(SYMLINK_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR) $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so
 	for i in $(LIBHEADERS); do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); done
-	$(INSTALL_DATA) $(PKG_CONFIG) $(DESTDIR)$(PKG_INSTALLDIR)
+	$(INSTALL_DATA) $(PKG_CONFIG_FILE) $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: uninstall
 uninstall::
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:34:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:34:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506187.779269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBAx-0007J0-Pd; Fri, 03 Mar 2023 19:34:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506187.779269; Fri, 03 Mar 2023 19: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 1pYBAx-0007Is-Mf; Fri, 03 Mar 2023 19:34:43 +0000
Received: by outflank-mailman (input) for mailman id 506187;
 Fri, 03 Mar 2023 19: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 1pYBAx-0007Im-Be
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYBAx-000528-Ax
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYBAx-0003mT-A2
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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=Nb3P5wURk24UvTqlWgwt1pTH7Cga2GuSjtujUQB4eXo=; b=PHUWxj6q+yFmrpI8jMvtK3FwbV
	02P5N8DjPNUemCV8deAYw95QGDiXEQtqxlRi5OCiA1nTsFsE3pTJQLvY0EyCIItThUI96Dao05Lyo
	W/E0sC0AC9PhmQxoNliVS8avBUIeNOWdJX62IlxLvdSZoTwqkD3I0G5xk/pixPm9fdI0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] libs/guest: Fix resource leaks in xc_core_arch_map_p2m_tree_rw()
Message-Id: <E1pYBAx-0003mT-A2@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:34:43 +0000

commit 01f85d835bb10d18bdab2cc780ea5ad47004516d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 08:02:59 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:02:59 2023 +0100

    libs/guest: Fix resource leaks in xc_core_arch_map_p2m_tree_rw()
    
    Edwin, with the help of GCC's -fanalyzer, identified that p2m_frame_list_list
    gets leaked.  What fanalyzer can't see is that the live_p2m_frame_list_list
    and live_p2m_frame_list foreign mappings are leaked too.
    
    Rework the logic so the out path is executed unconditionally, which cleans up
    all the intermediate allocations/mappings appropriately.
    
    Fixes: bd7a29c3d0b9 ("tools/libs/ctrl: fix xc_core_arch_map_p2m() to support linear p2m table")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 1868d7f22660c8980bd0a7e53f044467e8b63bb5
    master date: 2023-02-27 15:51:23 +0000
---
 tools/libs/guest/xg_core_x86.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/libs/guest/xg_core_x86.c b/tools/libs/guest/xg_core_x86.c
index 61106b98b8..c5e4542ccc 100644
--- a/tools/libs/guest/xg_core_x86.c
+++ b/tools/libs/guest/xg_core_x86.c
@@ -229,11 +229,11 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
                              uint32_t dom, shared_info_any_t *live_shinfo)
 {
     /* Double and single indirect references to the live P2M table */
-    xen_pfn_t *live_p2m_frame_list_list;
+    xen_pfn_t *live_p2m_frame_list_list = NULL;
     xen_pfn_t *live_p2m_frame_list = NULL;
     /* Copies of the above. */
     xen_pfn_t *p2m_frame_list_list = NULL;
-    xen_pfn_t *p2m_frame_list;
+    xen_pfn_t *p2m_frame_list = NULL;
 
     int err;
     int i;
@@ -297,8 +297,6 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
 
     dinfo->p2m_frames = P2M_FL_ENTRIES;
 
-    return p2m_frame_list;
-
  out:
     err = errno;
 
@@ -312,7 +310,7 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
 
     errno = err;
 
-    return NULL;
+    return p2m_frame_list;
 }
 
 static int
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:34:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:34:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506188.779273 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBB7-0007M0-Ql; Fri, 03 Mar 2023 19:34:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506188.779273; Fri, 03 Mar 2023 19: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 1pYBB7-0007Ls-OB; Fri, 03 Mar 2023 19:34:53 +0000
Received: by outflank-mailman (input) for mailman id 506188;
 Fri, 03 Mar 2023 19: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 1pYBB7-0007Lm-ES
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYBB7-00053q-Dm
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYBB7-0003nE-D0
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:34:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A/m1JKyjoOF0FMjAMovOsfZipp8GKAUA8PlB9u+OvUE=; b=QSmDi77z1EmlkaThVstZmvPwzK
	I7rf1952mQI+jRKKUehFRm2fGO5vnrLqQuoNz14Za4rIMAnnuthvBBaryvJw2lj/RDUzxTpqa/vyv
	OjXMDsx6qKs9wyD0H/fkU0ihoTaFGELw3lFZ8Bvsxkl6p2OCha2JvFcSNjTRAkMJIK68=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] libs/guest: Fix leak on realloc failure in backup_ptes()
Message-Id: <E1pYBB7-0003nE-D0@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:34:53 +0000

commit fa8250f1920413f02b63551a6a4d8ef0b47891a8
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Fri Mar 3 08:03:19 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:03:19 2023 +0100

    libs/guest: Fix leak on realloc failure in backup_ptes()
    
    From `man 2 realloc`:
    
      If realloc() fails, the original block is left untouched; it is not freed or moved.
    
    Found using GCC -fanalyzer:
    
      |  184 |         backup->entries = realloc(backup->entries,
      |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |      |         |               | |
      |      |         |               | (91) when ‘realloc’ fails
      |      |         |               (92) ‘old_ptes.entries’ leaks here; was allocated at (44)
      |      |         (90) ...to here
    
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 275d13184cfa52ebe4336ed66526ce93716adbe0
    master date: 2023-02-27 15:51:23 +0000
---
 tools/libs/guest/xg_offline_page.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libs/guest/xg_offline_page.c b/tools/libs/guest/xg_offline_page.c
index c594fdba41..ccd0299f0f 100644
--- a/tools/libs/guest/xg_offline_page.c
+++ b/tools/libs/guest/xg_offline_page.c
@@ -181,10 +181,16 @@ static int backup_ptes(xen_pfn_t table_mfn, int offset,
 
     if (backup->max == backup->cur)
     {
-        backup->entries = realloc(backup->entries,
-                            backup->max * 2 * sizeof(struct pte_backup_entry));
+        void *orig = backup->entries;
+
+        backup->entries = realloc(
+            orig, backup->max * 2 * sizeof(struct pte_backup_entry));
+
         if (backup->entries == NULL)
+        {
+            free(orig);
             return -1;
+        }
         else
             backup->max *= 2;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 19:35:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 19:35:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506189.779277 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBBI-0007Oq-SR; Fri, 03 Mar 2023 19:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506189.779277; Fri, 03 Mar 2023 19:35:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYBBI-0007Oi-Ph; Fri, 03 Mar 2023 19:35:04 +0000
Received: by outflank-mailman (input) for mailman id 506189;
 Fri, 03 Mar 2023 19: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 1pYBBH-0007OT-HO
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19: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 1pYBBH-00054T-Ge
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYBBH-0003on-Fn
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 19:35:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nRu/7JKX7t8fVHJPwRP82icQOH70KLYar/AZMZGgtug=; b=N4p80/kOB5NQFqMQFUFIpDwmWG
	7vlUWhqVbwMVoLJ/gLWG1E7P529rs90wzIFhhKeFjMZ3VWQo48lFfNJF1FlaEJ4Fn4Jyvd0YCBQV4
	jJTkwUBW+07Bqwfr86CigQbTw/h/N7cdcHiMIyrEeNSxHR+JrvrnuZxR15P1KGP6316g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/ucode/AMD: late load the patch on every logical thread
Message-Id: <E1pYBBH-0003on-Fn@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 19:35:03 +0000

commit ec5b058d2a6436a2e180315522fcf1645a8153b4
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Fri Mar 3 08:03:43 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:03:43 2023 +0100

    x86/ucode/AMD: late load the patch on every logical thread
    
    Currently late ucode loading is performed only on the first core of CPU
    siblings.  But according to the latest recommendation from AMD, late
    ucode loading should happen on every logical thread/core on AMD CPUs.
    
    To achieve that, introduce is_cpu_primary() helper which will consider
    every logical cpu as "primary" when running on AMD CPUs.  Also include
    Hygon in the check for future-proofing.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f1315e48a03a42f78f9b03c0a384165baf02acae
    master date: 2023-02-28 14:51:28 +0100
---
 xen/arch/x86/cpu/microcode/core.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 57ecc5358b..2497630bbe 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -274,6 +274,20 @@ static bool microcode_update_cache(struct microcode_patch *patch)
     return true;
 }
 
+/* Returns true if ucode should be loaded on a given cpu */
+static bool is_cpu_primary(unsigned int cpu)
+{
+    if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
+        /* Load ucode on every logical thread/core */
+        return true;
+
+    /* Intel CPUs should load ucode only on the first core of SMT siblings */
+    if ( cpu == cpumask_first(per_cpu(cpu_sibling_mask, cpu)) )
+        return true;
+
+    return false;
+}
+
 /* Wait for a condition to be met with a timeout (us). */
 static int wait_for_condition(bool (*func)(unsigned int data),
                               unsigned int data, unsigned int timeout)
@@ -380,7 +394,7 @@ static int primary_thread_work(const struct microcode_patch *patch)
 static int cf_check microcode_nmi_callback(
     const struct cpu_user_regs *regs, int cpu)
 {
-    unsigned int primary = cpumask_first(this_cpu(cpu_sibling_mask));
+    bool primary_cpu = is_cpu_primary(cpu);
     int ret;
 
     /* System-generated NMI, leave to main handler */
@@ -393,10 +407,10 @@ static int cf_check microcode_nmi_callback(
      * ucode_in_nmi.
      */
     if ( cpu == cpumask_first(&cpu_online_map) ||
-         (!ucode_in_nmi && cpu == primary) )
+         (!ucode_in_nmi && primary_cpu) )
         return 0;
 
-    if ( cpu == primary )
+    if ( primary_cpu )
         ret = primary_thread_work(nmi_patch);
     else
         ret = secondary_nmi_work();
@@ -547,7 +561,7 @@ static int cf_check do_microcode_update(void *patch)
      */
     if ( cpu == cpumask_first(&cpu_online_map) )
         ret = control_thread_fn(patch);
-    else if ( cpu == cpumask_first(this_cpu(cpu_sibling_mask)) )
+    else if ( is_cpu_primary(cpu) )
         ret = primary_thread_fn(patch);
     else
         ret = secondary_thread_fn();
@@ -640,7 +654,7 @@ static long cf_check microcode_update_helper(void *data)
     /* Calculate the number of online CPU core */
     nr_cores = 0;
     for_each_online_cpu(cpu)
-        if ( cpu == cpumask_first(per_cpu(cpu_sibling_mask, cpu)) )
+        if ( is_cpu_primary(cpu) )
             nr_cores++;
 
     printk(XENLOG_INFO "%u cores are to update their microcode\n", nr_cores);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:44:10 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506237.779337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4F-0008DE-LJ; Fri, 03 Mar 2023 23:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506237.779337; Fri, 03 Mar 2023 23:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4F-0008D6-Ib; Fri, 03 Mar 2023 23:44:03 +0000
Received: by outflank-mailman (input) for mailman id 506237;
 Fri, 03 Mar 2023 23: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 1pYF4D-0008D0-KY
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23: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 1pYF4D-0002RQ-IM
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF4D-0005e7-HH
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ey9+Rw+XsRvEGohssQ105NcNHAydiN0D69PBLaPIZLQ=; b=BLo6IodV7YPtORP0/4894v7Vvy
	UA54XaFOq/n4eCMBu/XYbaFHI1eWhneWHBSw/Gr9aGqFydz056rJL06rwDSxYtQ1uGpWbqwhAxY65
	HAHDMX0OuIlahvapNWoVojndRc8pQvsol0BM25/7P8gMabIFBBoWVPfDV7R2/TkKn+5Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] libs/util: Fix parallel build between flex/bison and CC rules
Message-Id: <E1pYF4D-0005e7-HH@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:44:01 +0000

commit e4b5dff3d06421847761669a3676bef1f23e705a
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Mar 3 08:06:23 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:06:23 2023 +0100

    libs/util: Fix parallel build between flex/bison and CC rules
    
    flex/bison generate two targets, and when those targets are
    prerequisite of other rules they are considered independently by make.
    
    We can have a situation where the .c file is out-of-date but not the
    .h, git checkout for example. In this case, if a rule only have the .h
    file as prerequiste, make will procced and start to build the object.
    In parallel, another target can have the .c file as prerequisite and
    make will find out it need re-generating and do so, changing the .h at
    the same time. This parallel task breaks the first one.
    
    To avoid this scenario, we put both the header and the source as
    prerequisite for all object even if they only need the header.
    
    Reported-by: Andrew Cooper <Andrew.Cooper3@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: bf652a50fb3bb3b1b3d93db6fb79bc28f978fe75
    master date: 2023-02-09 18:26:17 +0000
---
 tools/libs/util/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index b739360be7..977849c056 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -41,6 +41,14 @@ include $(XEN_ROOT)/tools/libs/libs.mk
 
 $(LIB_OBJS) $(PIC_OBJS): $(AUTOINCS) _paths.h
 
+# Adding the .c conterparts of the headers generated by flex/bison as
+# prerequisite of all objects.
+# This is to tell make that if only the .c file is out-of-date but not the
+# header, it should still wait for the .c file to be rebuilt.
+# Otherwise, make doesn't considered "%.c %.h" as grouped targets, and will run
+# the flex/bison rules in parallel of CC rules which only need the header.
+$(LIB_OBJS) $(PIC_OBJS): libxlu_cfg_l.c libxlu_cfg_y.c libxlu_disk_l.c
+
 %.c %.h:: %.y
 	@rm -f $*.[ch]
 	$(BISON) --output=$*.c $<
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:44:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506238.779341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4P-0008Ep-Mw; Fri, 03 Mar 2023 23:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506238.779341; Fri, 03 Mar 2023 23:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4P-0008Eh-KD; Fri, 03 Mar 2023 23:44:13 +0000
Received: by outflank-mailman (input) for mailman id 506238;
 Fri, 03 Mar 2023 23:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF4N-0008EV-Nc
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF4N-0002RU-MO
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF4N-0005ec-KW
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vhZHNudFXHroXbuNEl3GEqMkm598Q5dLr/ZfAKWMvw8=; b=4OtSL7HGv7uGxBlvxIpVThefU/
	C15Kduhe6FxEo0JfQVus5ssreHYi3HpraBzwHufvXI4GR2PewdLeabArOM7F5luhxsChbexOjKt/S
	Am7WOyrNo9x0gNhYTuR+yUd/jBf3Ay8beUtmIB4iJXZFJuU1rASO8DDBCZ3O3PEFDiFQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/cpuid: Infrastructure for leaves 7:1{ecx,edx}
Message-Id: <E1pYF4N-0005ec-KW@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:44:11 +0000

commit 2094f834b85d32233c76763b014bc8764c3e36b1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 08:06:44 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:06:44 2023 +0100

    x86/cpuid: Infrastructure for leaves 7:1{ecx,edx}
    
    We don't actually need ecx yet, but adding it in now will reduce the amount to
    which leaf 7 is out of order in a featureset.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b4a23bf6293aadecfd03bf9e83974443e2eac9cb
    master date: 2023-02-09 18:26:17 +0000
---
 tools/misc/xen-cpuid.c                      | 10 ++++++++++
 xen/arch/x86/cpu/common.c                   |  3 ++-
 xen/include/public/arch-x86/cpufeatureset.h |  4 ++++
 xen/include/xen/lib/x86/cpuid.h             | 17 +++++++++++++++--
 4 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index cd094427dd..3cfbbf043f 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -198,6 +198,14 @@ static const char *const str_7b1[32] =
 {
 };
 
+static const char *const str_7c1[32] =
+{
+};
+
+static const char *const str_7d1[32] =
+{
+};
+
 static const char *const str_7d2[32] =
 {
     [ 0] = "intel-psfd",
@@ -223,6 +231,8 @@ static const struct {
     { "0x80000021.eax",  "e21a", str_e21a },
     { "0x00000007:1.ebx", "7b1", str_7b1 },
     { "0x00000007:2.edx", "7d2", str_7d2 },
+    { "0x00000007:1.ecx", "7c1", str_7c1 },
+    { "0x00000007:1.edx", "7d1", str_7d1 },
 };
 
 #define COL_ALIGN "18"
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 9ce148a666..8222de6461 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -448,7 +448,8 @@ static void generic_identify(struct cpuinfo_x86 *c)
 			cpuid_count(7, 1,
 				    &c->x86_capability[FEATURESET_7a1],
 				    &c->x86_capability[FEATURESET_7b1],
-				    &tmp, &tmp);
+				    &c->x86_capability[FEATURESET_7c1],
+				    &c->x86_capability[FEATURESET_7d1]);
 		if (max_subleaf >= 2)
 			cpuid_count(7, 2,
 				    &tmp, &tmp, &tmp,
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index e073122140..0b01ca5e8f 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -304,6 +304,10 @@ XEN_CPUFEATURE(NSCB,               11*32+ 6) /*A  Null Selector Clears Base (and
 /* Intel-defined CPU features, CPUID level 0x00000007:2.edx, word 13 */
 XEN_CPUFEATURE(INTEL_PSFD,         13*32+ 0) /*A  MSR_SPEC_CTRL.PSFD */
 
+/* Intel-defined CPU features, CPUID level 0x00000007:1.ecx, word 14 */
+
+/* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
+
 #endif /* XEN_CPUFEATURE */
 
 /* Clean up from a default include.  Close the enum (for C). */
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index 50be07c0eb..fa98b371ee 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -17,7 +17,9 @@
 #define FEATURESET_7a1   10 /* 0x00000007:1.eax    */
 #define FEATURESET_e21a  11 /* 0x80000021.eax      */
 #define FEATURESET_7b1   12 /* 0x00000007:1.ebx    */
-#define FEATURESET_7d2   13 /* 0x80000007:2.edx    */
+#define FEATURESET_7d2   13 /* 0x00000007:2.edx    */
+#define FEATURESET_7c1   14 /* 0x00000007:1.ecx    */
+#define FEATURESET_7d1   15 /* 0x00000007:1.edx    */
 
 struct cpuid_leaf
 {
@@ -194,7 +196,14 @@ struct cpuid_policy
                 uint32_t _7b1;
                 struct { DECL_BITFIELD(7b1); };
             };
-            uint32_t /* c */:32, /* d */:32;
+            union {
+                uint32_t _7c1;
+                struct { DECL_BITFIELD(7c1); };
+            };
+            union {
+                uint32_t _7d1;
+                struct { DECL_BITFIELD(7d1); };
+            };
 
             /* Subleaf 2. */
             uint32_t /* a */:32, /* b */:32, /* c */:32;
@@ -343,6 +352,8 @@ static inline void cpuid_policy_to_featureset(
     fs[FEATURESET_e21a] = p->extd.e21a;
     fs[FEATURESET_7b1] = p->feat._7b1;
     fs[FEATURESET_7d2] = p->feat._7d2;
+    fs[FEATURESET_7c1] = p->feat._7c1;
+    fs[FEATURESET_7d1] = p->feat._7d1;
 }
 
 /* Fill in a CPUID policy from a featureset bitmap. */
@@ -363,6 +374,8 @@ static inline void cpuid_featureset_to_policy(
     p->extd.e21a  = fs[FEATURESET_e21a];
     p->feat._7b1  = fs[FEATURESET_7b1];
     p->feat._7d2  = fs[FEATURESET_7d2];
+    p->feat._7c1  = fs[FEATURESET_7c1];
+    p->feat._7d1  = fs[FEATURESET_7d1];
 }
 
 static inline uint64_t cpuid_policy_xcr0_max(const struct cpuid_policy *p)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:44:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506239.779344 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4Z-0008HX-OX; Fri, 03 Mar 2023 23:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506239.779344; Fri, 03 Mar 2023 23:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4Z-0008HP-Lm; Fri, 03 Mar 2023 23:44:23 +0000
Received: by outflank-mailman (input) for mailman id 506239;
 Fri, 03 Mar 2023 23:44: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 1pYF4X-0008H8-Ro
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44: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 1pYF4X-0002Rh-R1
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF4X-0005f8-Oz
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fOEXVuF2ol1xvzFU6T8z19a3x6KmCzcimAIgkGaLkog=; b=EAoqtYiTa89CqpPASaOPqQR+5v
	Js/o75jjqnzBJdZyd1CQTKvNEJCow88eIEVAPZ06onAYanPCRjMI6rD6pGBzGUAUhAkAdIlaUlV49
	SLJCJDYQ4bROH+i3UTzZVzwXbLPpNt3WTJ4m3MDw8mX8vSbMJpWBC8u3Ln2VItyKc7cc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/shskt: Disable CET-SS on parts susceptible to fractured updates
Message-Id: <E1pYF4X-0005f8-Oz@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:44:21 +0000

commit 5857cc632b884711c172c5766b8fbba59f990b47
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 08:12:24 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:12:24 2023 +0100

    x86/shskt: Disable CET-SS on parts susceptible to fractured updates
    
    Refer to Intel SDM Rev 70 (Dec 2022), Vol3 17.2.3 "Supervisor Shadow Stack
    Token".
    
    Architecturally, an event delivery which starts in CPL<3 and switches shadow
    stack will first validate the Supervisor Shadow Stack Token (setting the busy
    bit), then pushes CS/LIP/SSP.  One example of this is an NMI interrupting Xen.
    
    Some CPUs suffer from an issue called fracturing, whereby a fault/vmexit/etc
    between setting the busy bit and completing the event injection renders the
    action non-restartable, because when it comes time to restart, the busy bit is
    found to be already set.
    
    This is far more easily encountered under virt, yet it is not the fault of the
    hypervisor, nor the fault of the guest kernel.  The fault lies somewhere
    between the architectural specification, and the uarch behaviour.
    
    Intel have allocated CPUID.7[1].ecx[18] CET_SSS to enumerate that supervisor
    shadow stacks are safe to use.  Because of how Xen lays out its shadow stacks,
    fracturing is not expected to be a problem on native.
    
    Detect this case on boot and default to not using shstk if virtualised.
    Specifying `cet=shstk` on the command line will override this heuristic and
    enable shadow stacks irrespective.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 01e7477d1b081cff4288ff9f51ec59ee94c03ee0
    master date: 2023-02-09 18:26:17 +0000
---
 docs/misc/xen-command-line.pandoc           |  7 ++++-
 tools/libs/light/libxl_cpuid.c              |  2 ++
 tools/misc/xen-cpuid.c                      |  1 +
 xen/arch/x86/cpu/common.c                   |  8 ++++-
 xen/arch/x86/setup.c                        | 46 ++++++++++++++++++++++++-----
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 6 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index b3f60cd923..a6018fd5c3 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -287,10 +287,15 @@ can be maintained with the pv-shim mechanism.
     protection.
 
     The option is available when `CONFIG_XEN_SHSTK` is compiled in, and
-    defaults to `true` on hardware supporting CET-SS.  Specifying
+    generally defaults to `true` on hardware supporting CET-SS.  Specifying
     `cet=no-shstk` will cause Xen not to use Shadow Stacks even when support
     is available in hardware.
 
+    Some hardware suffers from an issue known as Supervisor Shadow Stack
+    Fracturing.  On such hardware, Xen will default to not using Shadow Stacks
+    when virtualised.  Specifying `cet=shstk` will override this heuristic and
+    enable Shadow Stacks unilaterally.
+
 *   The `ibt=` boolean controls whether Xen uses Indirect Branch Tracking for
     its own protection.
 
diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 691d5c6b2a..b4eacc2bd5 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -234,6 +234,8 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"fsrs",         0x00000007,  1, CPUID_REG_EAX, 11,  1},
         {"fsrcs",        0x00000007,  1, CPUID_REG_EAX, 12,  1},
 
+        {"cet-sss",      0x00000007,  1, CPUID_REG_EDX, 18,  1},
+
         {"intel-psfd",   0x00000007,  2, CPUID_REG_EDX,  0,  1},
 
         {"lahfsahf",     0x80000001, NA, CPUID_REG_ECX,  0,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 3cfbbf043f..db9c4ed8fc 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -204,6 +204,7 @@ static const char *const str_7c1[32] =
 
 static const char *const str_7d1[32] =
 {
+    [18] = "cet-sss",
 };
 
 static const char *const str_7d2[32] =
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 8222de6461..e1fc034ce6 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -344,9 +344,15 @@ void __init early_cpu_init(void)
 	       c->x86_model, c->x86_model, c->x86_mask, eax);
 
 	if (c->cpuid_level >= 7) {
-		cpuid_count(7, 0, &eax, &ebx, &ecx, &edx);
+		uint32_t max_subleaf;
+
+		cpuid_count(7, 0, &max_subleaf, &ebx, &ecx, &edx);
 		c->x86_capability[cpufeat_word(X86_FEATURE_CET_SS)] = ecx;
 		c->x86_capability[cpufeat_word(X86_FEATURE_CET_IBT)] = edx;
+
+		if (max_subleaf >= 1)
+			cpuid_count(7, 1, &eax, &ebx, &ecx,
+				    &c->x86_capability[FEATURESET_7d1]);
 	}
 
 	eax = cpuid_eax(0x80000000);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 70b37d8afe..f0de805780 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -98,11 +98,7 @@ unsigned long __initdata highmem_start;
 size_param("highmem-start", highmem_start);
 #endif
 
-#ifdef CONFIG_XEN_SHSTK
-static bool __initdata opt_xen_shstk = true;
-#else
-#define opt_xen_shstk false
-#endif
+static int8_t __initdata opt_xen_shstk = -IS_ENABLED(CONFIG_XEN_SHSTK);
 
 #ifdef CONFIG_XEN_IBT
 static bool __initdata opt_xen_ibt = true;
@@ -1113,11 +1109,45 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     early_cpu_init();
 
     /* Choose shadow stack early, to set infrastructure up appropriately. */
-    if ( opt_xen_shstk && boot_cpu_has(X86_FEATURE_CET_SS) )
+    if ( !boot_cpu_has(X86_FEATURE_CET_SS) )
+        opt_xen_shstk = 0;
+
+    if ( opt_xen_shstk )
     {
-        printk("Enabling Supervisor Shadow Stacks\n");
+        /*
+         * Some CPUs suffer from Shadow Stack Fracturing, an issue whereby a
+         * fault/VMExit/etc between setting a Supervisor Busy bit and the
+         * event delivery completing renders the operation non-restartable.
+         * On restart, event delivery will find the Busy bit already set.
+         *
+         * This is a problem on bare metal, but outside of synthetic cases or
+         * a very badly timed #MC, it's not believed to be a problem.  It is a
+         * much bigger problem under virt, because we can VMExit for a number
+         * of legitimate reasons and tickle this bug.
+         *
+         * CPUs with this addressed enumerate CET-SSS to indicate that
+         * supervisor shadow stacks are now safe to use.
+         */
+        bool cpu_has_bug_shstk_fracture =
+            boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+            !boot_cpu_has(X86_FEATURE_CET_SSS);
 
-        setup_force_cpu_cap(X86_FEATURE_XEN_SHSTK);
+        /*
+         * On bare metal, assume that Xen won't be impacted by shstk
+         * fracturing problems.  Under virt, be more conservative and disable
+         * shstk by default.
+         */
+        if ( opt_xen_shstk == -1 )
+            opt_xen_shstk =
+                cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
+                                   : true;
+
+        if ( opt_xen_shstk )
+        {
+            printk("Enabling Supervisor Shadow Stacks\n");
+
+            setup_force_cpu_cap(X86_FEATURE_XEN_SHSTK);
+        }
     }
 
     if ( opt_xen_ibt && boot_cpu_has(X86_FEATURE_CET_IBT) )
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 0b01ca5e8f..4832ad09df 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -307,6 +307,7 @@ XEN_CPUFEATURE(INTEL_PSFD,         13*32+ 0) /*A  MSR_SPEC_CTRL.PSFD */
 /* Intel-defined CPU features, CPUID level 0x00000007:1.ecx, word 14 */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
+XEN_CPUFEATURE(CET_SSS,            15*32+18) /*   CET Supervisor Shadow Stacks safe to use */
 
 #endif /* XEN_CPUFEATURE */
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:44:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506240.779350 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4j-0008Kx-S1; Fri, 03 Mar 2023 23:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506240.779350; Fri, 03 Mar 2023 23:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4j-0008Kp-Oi; Fri, 03 Mar 2023 23:44:33 +0000
Received: by outflank-mailman (input) for mailman id 506240;
 Fri, 03 Mar 2023 23: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 1pYF4h-0008KS-VJ
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44: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 1pYF4h-0002Rw-UX
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF4h-0005fd-TX
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=esvQTx91SYD4a8ulUNNVQLDttPq+ubl9Sm6hmfwQIa0=; b=II7mkuf2A89UfzXN2r31ATMcOr
	pIhU8NmV+Za3LGZAH02AujnHInigxmFS0K1cpRg75dxZOvlKILRfuueH3YawRCIRiHqxqU3U/pjmY
	5MEreQq3sIsmtoyR8dWGQT/zVXACFq2rhdXm78wHXg/PsQ+jmr4CyGsts+uK5jJMiWcg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] credit2: respect credit2_runqueue=all when arranging runqueues
Message-Id: <E1pYF4h-0005fd-TX@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:44:31 +0000

commit 366693226ce025e8721626609b4b43b9061b55f5
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Mar 3 08:13:20 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:13:20 2023 +0100

    credit2: respect credit2_runqueue=all when arranging runqueues
    
    Documentation for credit2_runqueue=all says it should create one queue
    for all pCPUs on the host. But since introduction
    sched_credit2_max_cpus_runqueue, it actually created separate runqueue
    per socket, even if the CPUs count is below
    sched_credit2_max_cpus_runqueue.
    
    Adjust the condition to skip syblink check in case of
    credit2_runqueue=all.
    
    Fixes: 8e2aa76dc167 ("xen: credit2: limit the max number of CPUs in a runqueue")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 1f5747ee929fbbcae58d7234c6c38a77495d0cfe
    master date: 2023-02-15 16:12:42 +0100
---
 docs/misc/xen-command-line.pandoc | 5 +++++
 xen/common/sched/credit2.c        | 9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a6018fd5c3..7b7a619c1b 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -724,6 +724,11 @@ Available alternatives, with their meaning, are:
 * `all`: just one runqueue shared by all the logical pCPUs of
          the host
 
+Regardless of the above choice, Xen attempts to respect
+`sched_credit2_max_cpus_runqueue` limit, which may mean more than one runqueue
+for the `all` value. If that isn't intended, raise
+the `sched_credit2_max_cpus_runqueue` value.
+
 ### dbgp
 > `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]`
 
diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 6396b38e04..1a240f417a 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -996,9 +996,14 @@ cpu_add_to_runqueue(const struct scheduler *ops, unsigned int cpu)
              *
              * Otherwise, let's try to make sure that siblings stay in the
              * same runqueue, pretty much under any cinrcumnstances.
+             *
+             * Furthermore, try to respect credit2_runqueue=all, as long as
+             * max_cpus_runq isn't violated.
              */
-            if ( rqd->refcnt < max_cpus_runq && (ops->cpupool->gran != SCHED_GRAN_cpu ||
-                  cpu_runqueue_siblings_match(rqd, cpu, max_cpus_runq)) )
+            if ( rqd->refcnt < max_cpus_runq &&
+                 (ops->cpupool->gran != SCHED_GRAN_cpu ||
+                  cpu_runqueue_siblings_match(rqd, cpu, max_cpus_runq) ||
+                  opt_runqueue == OPT_RUNQUEUE_ALL) )
             {
                 /*
                  * This runqueue is ok, but as we said, we also want an even
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:44:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506241.779353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF4t-0008NQ-Sv; Fri, 03 Mar 2023 23:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506241.779353; Fri, 03 Mar 2023 23: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 1pYF4t-0008NJ-QC; Fri, 03 Mar 2023 23:44:43 +0000
Received: by outflank-mailman (input) for mailman id 506241;
 Fri, 03 Mar 2023 23: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 1pYF4s-0008NB-1u
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23: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 1pYF4s-0002S6-1D
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF4s-0005g5-0Q
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=epwOrYbZlXk8dTd5Xb3v3kawPViaHQEFHWmm18VQVM8=; b=UwL5c6dQLdh89xeSrnk/abwdua
	CqnrRHKsd2VeXd0Mr1INxSJcENBiOiSRQ5cXIv4nUvtaS3m5E3WUig5DyMXuSrg620uQfUeRYsr0r
	HVrtcpwGq+KkbMM8qTO3w7H0Vv3iKfMptUuE7iGErMwRUzjn3o7VCT/JJC9hgKyXlexQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/ucode/AMD: apply the patch early on every logical thread
Message-Id: <E1pYF4s-0005g5-0Q@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:44:42 +0000

commit d1c6934b41f8288ea3169e63bce8a7eea9d9c549
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Fri Mar 3 08:14:01 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:14:01 2023 +0100

    x86/ucode/AMD: apply the patch early on every logical thread
    
    The original issue has been reported on AMD Bulldozer-based CPUs where
    ucode loading loses the LWP feature bit in order to gain the IBPB bit.
    LWP disabling is per-SMT/CMT core modification and needs to happen on
    each sibling thread despite the shared microcode engine. Otherwise,
    logical CPUs will end up with different cpuid capabilities.
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216211
    
    Guests running under Xen happen to be not affected because of levelling
    logic for the feature masking/override MSRs which causes the LWP bit to
    fall out and hides the issue. The latest recommendation from AMD, after
    discussing this bug, is to load ucode on every logical CPU.
    
    In Linux kernel this issue has been addressed by e7ad18d1169c
    ("x86/microcode/AMD: Apply the patch early on every logical thread").
    Follow the same approach in Xen.
    
    Introduce SAME_UCODE match result and use it for early AMD ucode
    loading. Take this opportunity and move opt_ucode_allow_same out of
    compare_revisions() to the relevant callers and also modify the warning
    message based on it. Intel's side of things is modified for consistency
    but provides no functional change.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f4ef8a41b80831db2136bdaff9f946a1a4b051e7
    master date: 2023-02-21 15:08:05 +0100
---
 xen/arch/x86/cpu/microcode/amd.c     | 11 ++++++++---
 xen/arch/x86/cpu/microcode/core.c    | 24 ++++++++++++++++--------
 xen/arch/x86/cpu/microcode/intel.c   | 10 +++++++---
 xen/arch/x86/cpu/microcode/private.h |  3 ++-
 4 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index fe92e594f1..52182c1a23 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -176,8 +176,8 @@ static enum microcode_match_result compare_revisions(
     if ( new_rev > old_rev )
         return NEW_UCODE;
 
-    if ( opt_ucode_allow_same && new_rev == old_rev )
-        return NEW_UCODE;
+    if ( new_rev == old_rev )
+        return SAME_UCODE;
 
     return OLD_UCODE;
 }
@@ -220,8 +220,13 @@ static int apply_microcode(const struct microcode_patch *patch)
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
     uint32_t rev, old_rev = sig->rev;
+    enum microcode_match_result result = microcode_fits(patch);
 
-    if ( microcode_fits(patch) != NEW_UCODE )
+    /*
+     * Allow application of the same revision to pick up SMT-specific changes
+     * even if the revision of the other SMT thread is already up-to-date.
+     */
+    if ( result != NEW_UCODE && result != SAME_UCODE )
         return -EINVAL;
 
     if ( check_final_patch_levels(sig) )
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index ac3ceb567c..ceec1f1edc 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -608,16 +608,24 @@ static long microcode_update_helper(void *data)
      * that ucode revision.
      */
     spin_lock(&microcode_mutex);
-    if ( microcode_cache &&
-         microcode_ops->compare_patch(patch, microcode_cache) != NEW_UCODE )
+    if ( microcode_cache )
     {
-        spin_unlock(&microcode_mutex);
-        printk(XENLOG_WARNING "microcode: couldn't find any newer revision "
-                              "in the provided blob!\n");
-        microcode_free_patch(patch);
-        ret = -ENOENT;
+        enum microcode_match_result result;
 
-        goto put;
+        result = microcode_ops->compare_patch(patch, microcode_cache);
+
+        if ( result != NEW_UCODE &&
+             !(opt_ucode_allow_same && result == SAME_UCODE) )
+        {
+            spin_unlock(&microcode_mutex);
+            printk(XENLOG_WARNING
+                   "microcode: couldn't find any newer%s revision in the provided blob!\n",
+                   opt_ucode_allow_same ? " (or the same)" : "");
+            microcode_free_patch(patch);
+            ret = -ENOENT;
+
+            goto put;
+        }
     }
     spin_unlock(&microcode_mutex);
 
diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index f6d01490e0..c26fbb8cc7 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -232,8 +232,8 @@ static enum microcode_match_result compare_revisions(
     if ( new_rev > old_rev )
         return NEW_UCODE;
 
-    if ( opt_ucode_allow_same && new_rev == old_rev )
-        return NEW_UCODE;
+    if ( new_rev == old_rev )
+        return SAME_UCODE;
 
     /*
      * Treat pre-production as always applicable - anyone using pre-production
@@ -290,8 +290,12 @@ static int apply_microcode(const struct microcode_patch *patch)
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &this_cpu(cpu_sig);
     uint32_t rev, old_rev = sig->rev;
+    enum microcode_match_result result;
+
+    result = microcode_update_match(patch);
 
-    if ( microcode_update_match(patch) != NEW_UCODE )
+    if ( result != NEW_UCODE &&
+         !(opt_ucode_allow_same && result == SAME_UCODE) )
         return -EINVAL;
 
     wbinvd();
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index c085a10268..feafab0677 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -6,7 +6,8 @@
 extern bool opt_ucode_allow_same;
 
 enum microcode_match_result {
-    OLD_UCODE, /* signature matched, but revision id is older or equal */
+    OLD_UCODE, /* signature matched, but revision id is older */
+    SAME_UCODE, /* signature matched, but revision id is the same */
     NEW_UCODE, /* signature matched, but revision id is newer */
     MIS_UCODE, /* signature mismatched */
 };
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:44:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506242.779357 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF53-0008Po-UY; Fri, 03 Mar 2023 23:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506242.779357; Fri, 03 Mar 2023 23: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 1pYF53-0008Pg-Rs; Fri, 03 Mar 2023 23:44:53 +0000
Received: by outflank-mailman (input) for mailman id 506242;
 Fri, 03 Mar 2023 23: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 1pYF52-0008PW-51
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23: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 1pYF52-0002TV-4K
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF52-0005gU-3O
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pYsMApDiUfetykzyIXfgOUFpkFZHVyCNdFbobm+x/ho=; b=dxpurR6U4WRNxtiYWu2ivcOm2J
	0ZHf+xl/DFO44T97f3ot29YmyrQB+uA6I47DOHQQZ9514KuSU50EdkCGc8BrArXf6QQeD57HgVf2I
	S1oojfwe5sgN5vvJe+suLyMpM8xRKOUj8U4FyiDfyG7clc3QKt+3V7u2iibZQ+LELyP0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86: perform mem_sharing teardown before paging teardown
Message-Id: <E1pYF52-0005gU-3O@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:44:52 +0000

commit 700320a79297fb5087f7dd540424c468b2d2cffe
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Fri Mar 3 08:14:25 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:14:25 2023 +0100

    x86: perform mem_sharing teardown before paging teardown
    
    An assert failure has been observed in p2m_teardown when performing vm
    forking and then destroying the forked VM (p2m-basic.c:173). The assert
    checks whether the domain's shared pages counter is 0. According to the
    patch that originally added the assert (7bedbbb5c31) the p2m_teardown
    should only happen after mem_sharing already relinquished all shared pages.
    
    In this patch we flip the order in which relinquish ops are called to avoid
    tripping the assert. Conceptually sharing being torn down makes sense to
    happen before paging is torn down.
    
    Fixes: e7aa55c0aab3 ("x86/p2m: free the paging memory pool preemptively")
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2869349f0cb3a89dcbf1f1b30371f58df6309312
    master date: 2023-02-23 12:35:48 +0100
---
 xen/arch/x86/domain.c | 56 ++++++++++++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 3080cde62b..6eeb248908 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2343,9 +2343,9 @@ int domain_relinquish_resources(struct domain *d)
 
         enum {
             PROG_iommu_pagetables = 1,
+            PROG_shared,
             PROG_paging,
             PROG_vcpu_pagetables,
-            PROG_shared,
             PROG_xen,
             PROG_l4,
             PROG_l3,
@@ -2364,6 +2364,34 @@ int domain_relinquish_resources(struct domain *d)
         if ( ret )
             return ret;
 
+#ifdef CONFIG_MEM_SHARING
+    PROGRESS(shared):
+
+        if ( is_hvm_domain(d) )
+        {
+            /*
+             * If the domain has shared pages, relinquish them allowing
+             * for preemption.
+             */
+            ret = relinquish_shared_pages(d);
+            if ( ret )
+                return ret;
+
+            /*
+             * If the domain is forked, decrement the parent's pause count
+             * and release the domain.
+             */
+            if ( mem_sharing_is_fork(d) )
+            {
+                struct domain *parent = d->parent;
+
+                d->parent = NULL;
+                domain_unpause(parent);
+                put_domain(parent);
+            }
+        }
+#endif
+
     PROGRESS(paging):
 
         /* Tear down paging-assistance stuff. */
@@ -2404,32 +2432,6 @@ int domain_relinquish_resources(struct domain *d)
             d->arch.auto_unmask = 0;
         }
 
-#ifdef CONFIG_MEM_SHARING
-    PROGRESS(shared):
-
-        if ( is_hvm_domain(d) )
-        {
-            /* If the domain has shared pages, relinquish them allowing
-             * for preemption. */
-            ret = relinquish_shared_pages(d);
-            if ( ret )
-                return ret;
-
-            /*
-             * If the domain is forked, decrement the parent's pause count
-             * and release the domain.
-             */
-            if ( mem_sharing_is_fork(d) )
-            {
-                struct domain *parent = d->parent;
-
-                d->parent = NULL;
-                domain_unpause(parent);
-                put_domain(parent);
-            }
-        }
-#endif
-
         spin_lock(&d->page_alloc_lock);
         page_list_splice(&d->arch.relmem_list, &d->page_list);
         INIT_PAGE_LIST_HEAD(&d->arch.relmem_list);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:45:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506243.779361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF5E-0008SW-03; Fri, 03 Mar 2023 23:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506243.779361; Fri, 03 Mar 2023 23: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 1pYF5D-0008SP-TY; Fri, 03 Mar 2023 23:45:03 +0000
Received: by outflank-mailman (input) for mailman id 506243;
 Fri, 03 Mar 2023 23: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 1pYF5C-0008S9-8T
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23: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 1pYF5C-0002Ua-7c
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF5C-0005hC-6b
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c/DKL3prwppBHN+/kcg8vHxCeM1ssBaknCcoregPLKg=; b=atQxpcO+wrpueIJ7W9NyN1I+xe
	x7WOQYTWfdz9MIDhFJzr58Q7grC0HNQuTOeG9HfdnbTbtDWVPPdTIoVhEe3Y+ru+qCErjWOAF5pNG
	FuRY0y1JTFXVSw2HO3DbTcTC2kXRmP+p3LQ80lvUaw/R620luJ4/MUKLyH149p7JVDV8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen: Work around Clang-IAS macro \@ expansion bug
Message-Id: <E1pYF5C-0005hC-6b@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:45:02 +0000

commit 2b8f72a6b40dafc3fb40bce100cd62c4a377535a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 08:14:57 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:14:57 2023 +0100

    xen: Work around Clang-IAS macro \@ expansion bug
    
    https://github.com/llvm/llvm-project/issues/60792
    
    It turns out that Clang-IAS does not expand \@ uniquely in a translaition
    unit, and the XSA-426 change tickles this bug:
    
      <instantiation>:4:1: error: invalid symbol redefinition
      .L1_fill_rsb_loop:
      ^
      make[3]: *** [Rules.mk:247: arch/x86/acpi/cpu_idle.o] Error 1
    
    Extend DO_OVERWRITE_RSB with an optional parameter so C callers can mix %= in
    too, which Clang does seem to expand properly.
    
    Fixes: 63305e5392ec ("x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a2adacff0b91cc7b977abb209dc419a2ef15963f
    master date: 2023-02-24 17:44:29 +0000
---
 xen/include/asm-x86/spec_ctrl.h     |  4 ++--
 xen/include/asm-x86/spec_ctrl_asm.h | 23 ++++++++++++++---------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 391973ef6a..a431fea587 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -83,7 +83,7 @@ static always_inline void spec_ctrl_new_guest_context(void)
     wrmsrl(MSR_PRED_CMD, PRED_CMD_IBPB);
 
     /* (ab)use alternative_input() to specify clobbers. */
-    alternative_input("", "DO_OVERWRITE_RSB", X86_BUG_IBPB_NO_RET,
+    alternative_input("", "DO_OVERWRITE_RSB xu=%=", X86_BUG_IBPB_NO_RET,
                       : "rax", "rcx");
 }
 
@@ -172,7 +172,7 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
      *
      * (ab)use alternative_input() to specify clobbers.
      */
-    alternative_input("", "DO_OVERWRITE_RSB", X86_FEATURE_SC_RSB_IDLE,
+    alternative_input("", "DO_OVERWRITE_RSB xu=%=", X86_FEATURE_SC_RSB_IDLE,
                       : "rax", "rcx");
 }
 
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index 9eb4ad9ab7..b61a5571ae 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -117,11 +117,16 @@
 .L\@_done:
 .endm
 
-.macro DO_OVERWRITE_RSB tmp=rax
+.macro DO_OVERWRITE_RSB tmp=rax xu
 /*
  * Requires nothing
  * Clobbers \tmp (%rax by default), %rcx
  *
+ * xu is an optional parameter to add eXtra Uniqueness.  It is intended for
+ * passing %= in from an asm() block, in order to work around
+ * https://github.com/llvm/llvm-project/issues/60792 where Clang-IAS doesn't
+ * expand \@ uniquely.
+ *
  * Requires 256 bytes of {,shadow}stack space, but %rsp/SSP has no net
  * change. Based on Google's performance numbers, the loop is unrolled to 16
  * iterations and two calls per iteration.
@@ -137,31 +142,31 @@
     mov $16, %ecx                   /* 16 iterations, two calls per loop */
     mov %rsp, %\tmp                 /* Store the current %rsp */
 
-.L\@_fill_rsb_loop:
+.L\@_fill_rsb_loop\xu:
 
     .irp n, 1, 2                    /* Unrolled twice. */
-    call .L\@_insert_rsb_entry_\n   /* Create an RSB entry. */
+    call .L\@_insert_rsb_entry\xu\n /* Create an RSB entry. */
 
-.L\@_capture_speculation_\n:
+.L\@_capture_speculation\xu\n:
     pause
     lfence
-    jmp .L\@_capture_speculation_\n /* Capture rogue speculation. */
+    jmp .L\@_capture_speculation\xu\n /* Capture rogue speculation. */
 
-.L\@_insert_rsb_entry_\n:
+.L\@_insert_rsb_entry\xu\n:
     .endr
 
     sub $1, %ecx
-    jnz .L\@_fill_rsb_loop
+    jnz .L\@_fill_rsb_loop\xu
     mov %\tmp, %rsp                 /* Restore old %rsp */
 
 #ifdef CONFIG_XEN_SHSTK
     mov $1, %ecx
     rdsspd %ecx
     cmp $1, %ecx
-    je .L\@_shstk_done
+    je .L\@_shstk_done\xu
     mov $64, %ecx                   /* 64 * 4 bytes, given incsspd */
     incsspd %ecx                    /* Restore old SSP */
-.L\@_shstk_done:
+.L\@_shstk_done\xu:
 #endif
 .endm
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:45:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506244.779365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF5N-0008WO-2t; Fri, 03 Mar 2023 23:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506244.779365; Fri, 03 Mar 2023 23: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 1pYF5M-0008WC-VF; Fri, 03 Mar 2023 23:45:12 +0000
Received: by outflank-mailman (input) for mailman id 506244;
 Fri, 03 Mar 2023 23: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 1pYF5M-0008UT-Bk
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23: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 1pYF5M-0002Uh-B3
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF5M-0005hi-9k
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ns4Z3pYHnXGd2z6YMXPMn6UmXA4T9wcXtpmRjvNLFC4=; b=T/vARd4QlUNt5z9+MtT1OvRnK4
	oxK4cUByYUwesCxSn4m2HvVnC9Jg2PScS1W2qT/yOrlFramFl1GHmgokdqa9ERRZ+YJZnHvOtNO5d
	nYN81tIk5xJkDmO3yrJLSZs0XHz5Xuthl+TMsGmLpMzyF6JxbtDnWDa/DXoF8iwEyLTc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen: Fix Clang -Wunicode diagnostic when building asm-macros
Message-Id: <E1pYF5M-0005hi-9k@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:45:12 +0000

commit f073db0a07c5f6800a70c91819c4b8c2ba359451
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 08:15:50 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:15:50 2023 +0100

    xen: Fix Clang -Wunicode diagnostic when building asm-macros
    
    While trying to work around a different Clang-IAS bug (parent changeset), I
    stumbled onto:
    
      In file included from arch/x86/asm-macros.c:3:
      ./arch/x86/include/asm/spec_ctrl_asm.h:144:19: error: \u used with
      no following hex digits; treating as '\' followed by identifier [-Werror,-Wunicode]
      .L\@_fill_rsb_loop\uniq:
                        ^
    
    It turns out that Clang -E is sensitive to the file extension of the source
    file it is processing.  Furthermore, C explicitly permits the use of \u
    escapes in identifier names, so the diagnostic would be reasonable in
    principle if we trying to compile the result.
    
    asm-macros should really have been .S from the outset, as it is ultimately
    generating assembly, not C.  Rename it, which causes Clang not to complain.
    
    We need to introduce rules for generating a .i file from .S, and substituting
    c_flags for a_flags lets us drop the now-redundant -D__ASSEMBLY__.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 53f0d02040b1df08f0589f162790ca376e1c2040
    master date: 2023-02-24 17:44:29 +0000
---
 xen/Rules.mk              | 6 ++++++
 xen/arch/x86/Makefile     | 2 +-
 xen/arch/x86/asm-macros.S | 3 +++
 xen/arch/x86/asm-macros.c | 3 ---
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 5e0699e58b..1f171f88e2 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -223,6 +223,9 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
 quiet_cmd_cpp_i_c = CPP     $@
 cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<
 
+quiet_cmd_cpp_i_S = CPP     $@
+cmd_cpp_i_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
+
 quiet_cmd_cc_s_c = CC      $@
 cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 
@@ -232,6 +235,9 @@ cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 %.i: %.c FORCE
 	$(call if_changed,cpp_i_c)
 
+%.i: %.S FORCE
+	$(call if_changed,cpp_i_S)
+
 %.s: %.c FORCE
 	$(call if_changed,cc_s_c)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 69b6cfaded..8e975f472d 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -273,7 +273,7 @@ efi/buildid.o efi/relocs-dummy.o: ;
 .PHONY: include
 include: $(BASEDIR)/include/asm-x86/asm-macros.h
 
-asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
+asm-macros.i: CFLAGS-y += -P
 
 $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 	echo '#if 0' >$@.new
diff --git a/xen/arch/x86/asm-macros.S b/xen/arch/x86/asm-macros.S
new file mode 100644
index 0000000000..891d86c765
--- /dev/null
+++ b/xen/arch/x86/asm-macros.S
@@ -0,0 +1,3 @@
+#include <asm/asm-defns.h>
+#include <asm/alternative-asm.h>
+#include <asm/spec_ctrl_asm.h>
diff --git a/xen/arch/x86/asm-macros.c b/xen/arch/x86/asm-macros.c
deleted file mode 100644
index 891d86c765..0000000000
--- a/xen/arch/x86/asm-macros.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <asm/asm-defns.h>
-#include <asm/alternative-asm.h>
-#include <asm/spec_ctrl_asm.h>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:45:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506246.779370 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF5X-00009F-4z; Fri, 03 Mar 2023 23:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506246.779370; Fri, 03 Mar 2023 23:45:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF5X-000097-1t; Fri, 03 Mar 2023 23:45:23 +0000
Received: by outflank-mailman (input) for mailman id 506246;
 Fri, 03 Mar 2023 23: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 1pYF5W-00008z-EV
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23: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 1pYF5W-0002Ul-Ds
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF5W-0005iB-D3
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OHcvAVPtCm5H36bFszj7TiqE2ee6ijPIBJ3qno7tvxw=; b=UizL1QZ4Xeozw9OptYvf1m9hrC
	NER9Clc0/8CSKlV/ZFS/128o68FYX1idYxU8rj2t9ELdRxYocV8w7rCDZUmLghjtnJ3p/0457w95n
	rKkLmcIhQVhr5hpXCcJW5+Hb2r/QAI+bqvG+30gzWFBvmuSdoyduWaWirinfjfx8xsbM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools: Use PKG_CONFIG_FILE instead of PKG_CONFIG variable
Message-Id: <E1pYF5W-0005iB-D3@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:45:22 +0000

commit a2adc7fcc22405e81dc11290416e6140bb0244ca
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Fri Mar 3 08:16:45 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:16:45 2023 +0100

    tools: Use PKG_CONFIG_FILE instead of PKG_CONFIG variable
    
    Replace PKG_CONFIG variable name with PKG_CONFIG_FILE for the name of
    the pkg-config file.
    This is preventing a conflict in some build systems where PKG_CONFIG
    actually contains the path to the pkg-config executable to use, as the
    default assignment in libs.mk is using a weak assignment (?=).
    
    This problem has been found when trying to build the latest version of
    Xen tools using buildroot.
    
    Fixes: d400dc5729e4 ("tools: tweak tools/libs/libs.mk for being able to support libxenctrl")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: b97e2fe7b9e1f4706693552697239ac2b71efee4
    master date: 2023-02-24 17:44:29 +0000
---
 tools/libs/ctrl/Makefile |  2 +-
 tools/libs/libs.mk       | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 6ff5918798..d3666ae7ff 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -47,7 +47,7 @@ CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
 
 LIBHEADER := xenctrl.h xenctrl_compat.h
-PKG_CONFIG := xencontrol.pc
+PKG_CONFIG_FILE := xencontrol.pc
 PKG_CONFIG_NAME := Xencontrol
 
 NO_HEADERS_CHK := y
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index f1554462fb..0e005218e2 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -1,7 +1,7 @@
 # Common Makefile for building a lib.
 #
 # Variables taken as input:
-#   PKG_CONFIG: name of pkg-config file (xen$(LIBNAME).pc if empty)
+#   PKG_CONFIG_FILE: name of pkg-config file (xen$(LIBNAME).pc if empty)
 #   MAJOR:   major version of lib (Xen version if empty)
 #   MINOR:   minor version of lib (0 if empty)
 
@@ -29,7 +29,8 @@ endif
 comma:= ,
 empty:=
 space:= $(empty) $(empty)
-PKG_CONFIG ?= $(LIB_FILE_NAME).pc
+
+PKG_CONFIG_FILE ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
@@ -38,13 +39,13 @@ PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
 ifneq ($(CONFIG_LIBXC_MINIOS),y)
-PKG_CONFIG_INST := $(PKG_CONFIG)
+PKG_CONFIG_INST := $(PKG_CONFIG_FILE)
 $(PKG_CONFIG_INST): PKG_CONFIG_PREFIX = $(prefix)
 $(PKG_CONFIG_INST): PKG_CONFIG_INCDIR = $(includedir)
 $(PKG_CONFIG_INST): PKG_CONFIG_LIBDIR = $(libdir)
 endif
 
-PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
+PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG_FILE)
 
 LIBHEADER ?= $(LIB_FILE_NAME).h
 LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h))
@@ -114,7 +115,7 @@ install: build
 	$(SYMLINK_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR)
 	$(SYMLINK_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR) $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so
 	for i in $(LIBHEADERS); do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); done
-	$(INSTALL_DATA) $(PKG_CONFIG) $(DESTDIR)$(PKG_INSTALLDIR)
+	$(INSTALL_DATA) $(PKG_CONFIG_FILE) $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: uninstall
 uninstall:
@@ -134,7 +135,7 @@ clean:
 	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk headers.lst
-	rm -f $(PKG_CONFIG)
+	rm -f $(PKG_CONFIG_FILE)
 	rm -f _paths.h
 
 .PHONY: distclean
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:45:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:45:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506247.779373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF5h-0000Cj-63; Fri, 03 Mar 2023 23:45:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506247.779373; Fri, 03 Mar 2023 23:45:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF5h-0000Cb-3L; Fri, 03 Mar 2023 23:45:33 +0000
Received: by outflank-mailman (input) for mailman id 506247;
 Fri, 03 Mar 2023 23:45: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 1pYF5g-0000CT-HT
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45: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 1pYF5g-0002Uv-Gg
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF5g-0005il-Fu
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=a4obJnXS9IqU+wsQXrKD9xXtM/6vIuoH8bnJOUzi3bg=; b=ufppmdTYyL8ZlEAZqgA8oeKlgG
	upXXTk6jPjujDDqY0X2gvz/3NfxIW1M7mlEaJAOp8xJtjK4Q7FhBwuGGsWn2iT9nW9zWtXglRlxKj
	IhYfqMwCDjIiCkMTI3bNBaEPpOIiF02m8y+KA9L5s6qjmf1oy5d6UgPO5wxWpCAvluiM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] libs/guest: Fix resource leaks in xc_core_arch_map_p2m_tree_rw()
Message-Id: <E1pYF5g-0005il-Fu@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:45:32 +0000

commit b181a3a5532574d2163408284bcd785ec87fe046
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 3 08:17:04 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:17:04 2023 +0100

    libs/guest: Fix resource leaks in xc_core_arch_map_p2m_tree_rw()
    
    Edwin, with the help of GCC's -fanalyzer, identified that p2m_frame_list_list
    gets leaked.  What fanalyzer can't see is that the live_p2m_frame_list_list
    and live_p2m_frame_list foreign mappings are leaked too.
    
    Rework the logic so the out path is executed unconditionally, which cleans up
    all the intermediate allocations/mappings appropriately.
    
    Fixes: bd7a29c3d0b9 ("tools/libs/ctrl: fix xc_core_arch_map_p2m() to support linear p2m table")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 1868d7f22660c8980bd0a7e53f044467e8b63bb5
    master date: 2023-02-27 15:51:23 +0000
---
 tools/libs/guest/xg_core_x86.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/libs/guest/xg_core_x86.c b/tools/libs/guest/xg_core_x86.c
index 61106b98b8..c5e4542ccc 100644
--- a/tools/libs/guest/xg_core_x86.c
+++ b/tools/libs/guest/xg_core_x86.c
@@ -229,11 +229,11 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
                              uint32_t dom, shared_info_any_t *live_shinfo)
 {
     /* Double and single indirect references to the live P2M table */
-    xen_pfn_t *live_p2m_frame_list_list;
+    xen_pfn_t *live_p2m_frame_list_list = NULL;
     xen_pfn_t *live_p2m_frame_list = NULL;
     /* Copies of the above. */
     xen_pfn_t *p2m_frame_list_list = NULL;
-    xen_pfn_t *p2m_frame_list;
+    xen_pfn_t *p2m_frame_list = NULL;
 
     int err;
     int i;
@@ -297,8 +297,6 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
 
     dinfo->p2m_frames = P2M_FL_ENTRIES;
 
-    return p2m_frame_list;
-
  out:
     err = errno;
 
@@ -312,7 +310,7 @@ xc_core_arch_map_p2m_tree_rw(xc_interface *xch, struct domain_info_context *dinf
 
     errno = err;
 
-    return NULL;
+    return p2m_frame_list;
 }
 
 static int
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:45:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:45:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506248.779377 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF5r-0000Fr-7O; Fri, 03 Mar 2023 23:45:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506248.779377; Fri, 03 Mar 2023 23:45:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF5r-0000Fj-4m; Fri, 03 Mar 2023 23:45:43 +0000
Received: by outflank-mailman (input) for mailman id 506248;
 Fri, 03 Mar 2023 23:45: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 1pYF5q-0000Fc-KH
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45: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 1pYF5q-0002V3-Ja
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF5q-0005jA-Il
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OUP5AryWWMlO2mrC1QpkHT8L62QxIsZEW0KJ7F7YIOw=; b=tk6gzzBa+AXdBlJA69SCZg9Wi2
	Xxq8EdsX83Px345GUCjyn6m2RJvS/cXdHI8o1W4QMeFlKMWgbplcQoIlhtr7pIGP5iy8qQ44cyclc
	7tW+drC/hcq2qc2PJZJAdZ/sLRDBP4d/LbvN7SPl6BmBu90kRar02dH1jn6IsW6F4sOA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] libs/guest: Fix leak on realloc failure in backup_ptes()
Message-Id: <E1pYF5q-0005jA-Il@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:45:42 +0000

commit 25d103f2eb59f021cce61f07a0bf0bfa696b4416
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Fri Mar 3 08:17:23 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:17:23 2023 +0100

    libs/guest: Fix leak on realloc failure in backup_ptes()
    
    From `man 2 realloc`:
    
      If realloc() fails, the original block is left untouched; it is not freed or moved.
    
    Found using GCC -fanalyzer:
    
      |  184 |         backup->entries = realloc(backup->entries,
      |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |      |         |               | |
      |      |         |               | (91) when ‘realloc’ fails
      |      |         |               (92) ‘old_ptes.entries’ leaks here; was allocated at (44)
      |      |         (90) ...to here
    
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 275d13184cfa52ebe4336ed66526ce93716adbe0
    master date: 2023-02-27 15:51:23 +0000
---
 tools/libs/guest/xg_offline_page.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libs/guest/xg_offline_page.c b/tools/libs/guest/xg_offline_page.c
index cfe0e2d537..c42b973363 100644
--- a/tools/libs/guest/xg_offline_page.c
+++ b/tools/libs/guest/xg_offline_page.c
@@ -181,10 +181,16 @@ static int backup_ptes(xen_pfn_t table_mfn, int offset,
 
     if (backup->max == backup->cur)
     {
-        backup->entries = realloc(backup->entries,
-                            backup->max * 2 * sizeof(struct pte_backup_entry));
+        void *orig = backup->entries;
+
+        backup->entries = realloc(
+            orig, backup->max * 2 * sizeof(struct pte_backup_entry));
+
         if (backup->entries == NULL)
+        {
+            free(orig);
             return -1;
+        }
         else
             backup->max *= 2;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 03 23:45:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Mar 2023 23:45:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.506249.779380 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF61-0000IW-94; Fri, 03 Mar 2023 23:45:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 506249.779380; Fri, 03 Mar 2023 23:45:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pYF61-0000IP-6P; Fri, 03 Mar 2023 23:45:53 +0000
Received: by outflank-mailman (input) for mailman id 506249;
 Fri, 03 Mar 2023 23:45: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 1pYF60-0000IH-NC
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45: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 1pYF60-0002VE-MQ
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pYF60-0005jc-Ll
 for xen-changelog@lists.xenproject.org; Fri, 03 Mar 2023 23:45:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VoNj0jm1YhvgR71Hjx3zcXWvHUzUiXZ6ZcsVaAgTjHU=; b=qVZJpW79rTIRzXLweYiyw/MoiO
	USTAPx2K9+ToGZ+7f34X7VbQvkyJ8pnknZeuKIJa9gsSJp5zZL0T6zFGJuIGkx+06tevY5GyCS0MY
	NDVKoj902cRnEn6qtahcOOGsWAS5NaOHxrkmBzPo4ozpHDWos1K2xkC2srsfTPSEGTuM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/ucode/AMD: late load the patch on every logical thread
Message-Id: <E1pYF60-0005jc-Ll@xenbits.xenproject.org>
Date: Fri, 03 Mar 2023 23:45:52 +0000

commit 84dfe7a56f04a7412fa4869b3e756c49e1cfbe75
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Fri Mar 3 08:17:40 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 3 08:17:40 2023 +0100

    x86/ucode/AMD: late load the patch on every logical thread
    
    Currently late ucode loading is performed only on the first core of CPU
    siblings.  But according to the latest recommendation from AMD, late
    ucode loading should happen on every logical thread/core on AMD CPUs.
    
    To achieve that, introduce is_cpu_primary() helper which will consider
    every logical cpu as "primary" when running on AMD CPUs.  Also include
    Hygon in the check for future-proofing.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f1315e48a03a42f78f9b03c0a384165baf02acae
    master date: 2023-02-28 14:51:28 +0100
---
 xen/arch/x86/cpu/microcode/core.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index ceec1f1edc..ee7df9a591 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -273,6 +273,20 @@ static bool microcode_update_cache(struct microcode_patch *patch)
     return true;
 }
 
+/* Returns true if ucode should be loaded on a given cpu */
+static bool is_cpu_primary(unsigned int cpu)
+{
+    if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
+        /* Load ucode on every logical thread/core */
+        return true;
+
+    /* Intel CPUs should load ucode only on the first core of SMT siblings */
+    if ( cpu == cpumask_first(per_cpu(cpu_sibling_mask, cpu)) )
+        return true;
+
+    return false;
+}
+
 /* Wait for a condition to be met with a timeout (us). */
 static int wait_for_condition(bool (*func)(unsigned int data),
                               unsigned int data, unsigned int timeout)
@@ -378,7 +392,7 @@ static int primary_thread_work(const struct microcode_patch *patch)
 
 static int microcode_nmi_callback(const struct cpu_user_regs *regs, int cpu)
 {
-    unsigned int primary = cpumask_first(this_cpu(cpu_sibling_mask));
+    bool primary_cpu = is_cpu_primary(cpu);
     int ret;
 
     /* System-generated NMI, leave to main handler */
@@ -391,10 +405,10 @@ static int microcode_nmi_callback(const struct cpu_user_regs *regs, int cpu)
      * ucode_in_nmi.
      */
     if ( cpu == cpumask_first(&cpu_online_map) ||
-         (!ucode_in_nmi && cpu == primary) )
+         (!ucode_in_nmi && primary_cpu) )
         return 0;
 
-    if ( cpu == primary )
+    if ( primary_cpu )
         ret = primary_thread_work(nmi_patch);
     else
         ret = secondary_nmi_work();
@@ -545,7 +559,7 @@ static int do_microcode_update(void *patch)
      */
     if ( cpu == cpumask_first(&cpu_online_map) )
         ret = control_thread_fn(patch);
-    else if ( cpu == cpumask_first(this_cpu(cpu_sibling_mask)) )
+    else if ( is_cpu_primary(cpu) )
         ret = primary_thread_fn(patch);
     else
         ret = secondary_thread_fn();
@@ -637,7 +651,7 @@ static long microcode_update_helper(void *data)
     /* Calculate the number of online CPU core */
     nr_cores = 0;
     for_each_online_cpu(cpu)
-        if ( cpu == cpumask_first(per_cpu(cpu_sibling_mask, cpu)) )
+        if ( is_cpu_primary(cpu) )
             nr_cores++;
 
     printk(XENLOG_INFO "%u cores are to update their microcode\n", nr_cores);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Mar 07 00:11:11 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Mar 2023 00:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.507173.780410 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pZKv1-0003ha-Q2; Tue, 07 Mar 2023 00:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 507173.780410; Tue, 07 Mar 2023 00:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pZKv1-0003hS-N3; Tue, 07 Mar 2023 00:11:03 +0000
Received: by outflank-mailman (input) for mailman id 507173;
 Tue, 07 Mar 2023 00: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 1pZKuz-0003hM-Vp
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00: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 1pZKuz-0006DR-EF
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pZKuz-0004mI-DD
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00: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=C/1Mwp9P/IW253X3m9eahjn9XtmSGub75+C6s6/5QUU=; b=mP73dmA+iDIXNURXc1CHMuUbqI
	AUGLQRIITifuPkwnYYrfeqfQqe1ue3k4Kf5OCzi8pDz75EMckzCeOjM28xcurZJbAWY4FcSTlB4PE
	26A0R8HqJxmcXcDHj0k0Fgz7+vV5zULVgFfItO2xE191lQ0FNdwV3MNQDYIYgwr4cH78=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] cppcheck: add a way to exclude files from the scan
Message-Id: <E1pZKuz-0004mI-DD@xenbits.xenproject.org>
Date: Tue, 07 Mar 2023 00:11:01 +0000

commit e81c9fdd7c9328de68921d7d9ef9e9db10693a94
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Mon Mar 6 10:32:01 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 6 10:32:01 2023 +0100

    cppcheck: add a way to exclude files from the scan
    
    Add a way to exclude files from the scan, in this way we can skip
    some findings from the report on those files that Xen doesn't own.
    
    To do that, introduce the exclude-list.json file under docs/misra,
    this file will be populated with relative path to the files/folder
    to be excluded.
    Introduce a new module, exclusion_file_list.py, to deal with the
    exclusion list file and use the new module in cppcheck_analysis.py
    to take a list of excluded paths to update the suppression list of
    cppcheck.
    Modified --suppress flag for cppcheck tool to remove
    unmatchedSuppression findings for those external file that are
    listed but for example not built for the current architecture.
    
    Add documentation for the file.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/misra/exclude-list.json                    |  4 ++
 docs/misra/exclude-list.rst                     | 46 ++++++++++++++++
 xen/scripts/xen_analysis/cppcheck_analysis.py   | 20 ++++++-
 xen/scripts/xen_analysis/exclusion_file_list.py | 70 +++++++++++++++++++++++++
 4 files changed, 138 insertions(+), 2 deletions(-)

diff --git a/docs/misra/exclude-list.json b/docs/misra/exclude-list.json
new file mode 100644
index 0000000000..1fb0ac6774
--- /dev/null
+++ b/docs/misra/exclude-list.json
@@ -0,0 +1,4 @@
+{
+    "version": "1.0",
+    "content": []
+}
diff --git a/docs/misra/exclude-list.rst b/docs/misra/exclude-list.rst
new file mode 100644
index 0000000000..c97431a861
--- /dev/null
+++ b/docs/misra/exclude-list.rst
@@ -0,0 +1,46 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Exclude file list for xen-analysis script
+=========================================
+
+The code analysis is performed on the Xen codebase for both MISRA
+checkers and static analysis checkers, there are some files however that
+needs to be removed from the findings report for various reasons (e.g.
+they are imported from external sources, they generate too many false
+positive results, etc.).
+
+For this reason the file docs/misra/exclude-list.json is used to exclude every
+entry listed in that file from the final report.
+Currently only the cppcheck analysis will use this file.
+
+Here is an example of the exclude-list.json file::
+
+|{
+|    "version": "1.0",
+|    "content": [
+|        {
+|            "rel_path": "relative/path/from/xen/file",
+|            "comment": "This file is originated from ..."
+|        },
+|        {
+|            "rel_path": "relative/path/from/xen/folder/*",
+|            "comment": "This folder is a library"
+|        },
+|        {
+|            "rel_path": "relative/path/from/xen/mem*.c",
+|            "comment": "memcpy.c, memory.c and memcmp.c are from the outside"
+|        }
+|    ]
+|}
+
+Here is an explanation of the fields inside an object of the "content" array:
+ - rel_path: it is the relative path from the Xen folder to the file/folder that
+   needs to be excluded from the analysis report, it can contain a wildcard to
+   match more than one file/folder at the time. This field is mandatory.
+ - comment: an optional comment to explain why the file is removed from the
+   analysis.
+
+To ease the review and the modifications of the entries, they shall be listed in
+alphabetical order referring to the rel_path field.
+Excluded folder paths shall end with '/*' in order to match everything on that
+folder.
diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
index cc1f403d31..e385e2c8f5 100644
--- a/xen/scripts/xen_analysis/cppcheck_analysis.py
+++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
@@ -1,7 +1,8 @@
 #!/usr/bin/env python3
 
 import os, re, shutil
-from . import settings, utils, cppcheck_report_utils
+from . import settings, utils, cppcheck_report_utils, exclusion_file_list
+from .exclusion_file_list import ExclusionFileListError
 
 class GetMakeVarsPhaseError(Exception):
     pass
@@ -50,6 +51,21 @@ def __generate_suppression_list(out_file):
             # header for cppcheck
             supplist_file.write("*:*generated/compiler-def.h\n")
 
+            try:
+                exclusion_file = \
+                    "{}/docs/misra/exclude-list.json".format(settings.repo_dir)
+                exclusion_list = \
+                    exclusion_file_list.load_exclusion_file_list(exclusion_file)
+            except ExclusionFileListError as e:
+                raise CppcheckDepsPhaseError(
+                    "Issue with reading file {}: {}".format(exclusion_file, e)
+                )
+
+            # Append excluded files to the suppression list, using * as error id
+            # to suppress every findings on that file
+            for path in exclusion_list:
+                supplist_file.write("*:{}\n".format(path))
+
             for entry in headers:
                 filename = entry["file"]
                 try:
@@ -128,7 +144,7 @@ def generate_cppcheck_deps():
  --relative-paths={}
  --inline-suppr
  --suppressions-list={}/suppression-list.txt
- --suppress='unmatchedSuppression:*generated/compiler-def.h'
+ --suppress='unmatchedSuppression:*'
  --include={}/include/xen/config.h
  -DCPPCHECK
 """.format(settings.outdir, CPPCHECK_BUILD_DIR, settings.xen_dir,
diff --git a/xen/scripts/xen_analysis/exclusion_file_list.py b/xen/scripts/xen_analysis/exclusion_file_list.py
new file mode 100644
index 0000000000..871e480586
--- /dev/null
+++ b/xen/scripts/xen_analysis/exclusion_file_list.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+
+import os, glob, json
+from . import settings
+
+class ExclusionFileListError(Exception):
+    pass
+
+
+def __cppcheck_path_exclude_syntax(path):
+    # Prepending * to the relative path to match every path where the Xen
+    # codebase could be
+    path = "*" + path
+
+    return path
+
+
+# Reads the exclusion file list and returns a list of relative path to be
+# excluded.
+def load_exclusion_file_list(input_file):
+    ret = []
+    try:
+        with open(input_file, "rt") as handle:
+            content = json.load(handle)
+            entries = content['content']
+    except json.JSONDecodeError as e:
+        raise ExclusionFileListError(
+                "JSON decoding error in file {}: {}".format(input_file, e)
+        )
+    except KeyError:
+        raise ExclusionFileListError(
+            "Malformed JSON file: content field not found!"
+        )
+    except Exception as e:
+        raise ExclusionFileListError(
+                "Can't open file {}: {}".format(input_file, e)
+        )
+
+    for entry in entries:
+        try:
+            path = entry['rel_path']
+        except KeyError:
+            raise ExclusionFileListError(
+                "Malformed JSON entry: rel_path field not found!"
+            )
+        abs_path = settings.xen_dir + "/" + path
+        check_path = [abs_path]
+
+        # If the path contains wildcards, solve them
+        if '*' in abs_path:
+            check_path = glob.glob(abs_path)
+
+        # Check that the path exists
+        for filepath_object in check_path:
+            if not os.path.exists(filepath_object):
+                raise ExclusionFileListError(
+                    "Malformed path: {} refers to {} that does not exists"
+                    .format(path, filepath_object)
+                )
+
+        if settings.analysis_tool == "cppcheck":
+            path = __cppcheck_path_exclude_syntax(path)
+        else:
+            raise ExclusionFileListError(
+                "Unimplemented for {}!".format(settings.analysis_tool)
+            )
+
+        ret.append(path)
+
+    return ret
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 07 00:11:11 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Mar 2023 00:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.507174.780414 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pZKv9-0003j5-RQ; Tue, 07 Mar 2023 00:11:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 507174.780414; Tue, 07 Mar 2023 00:11: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 1pZKv9-0003iw-Od; Tue, 07 Mar 2023 00:11:11 +0000
Received: by outflank-mailman (input) for mailman id 507174;
 Tue, 07 Mar 2023 00:11: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 1pZKv9-0003iq-Hn
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11: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 1pZKv9-0006DV-H5
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pZKv9-0004mn-GI
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/K7ItYBvuRXuf3ycpEmIcrN10/nC7VAb867OSUmymVQ=; b=0jhgkCMLefeX/lR6d0X8d9JL8W
	U1oTAjlnBzWAWOu8rlOhMgI5FKDq+c4bdK7bHN+Pvtybcc0XZwEhx1+STaaE7VOVqLyFYibhdAe08
	3n0pm5zwGqXKog8r1wzs2D3TmfbZ0XNvK7yCTYUuYNzoRgSWIvDD73tUGWSUQu2+RI1w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] misra: add entries to exclude-list.json
Message-Id: <E1pZKv9-0004mn-GI@xenbits.xenproject.org>
Date: Tue, 07 Mar 2023 00:11:11 +0000

commit 88f605316626c7be338f52764d91c5a26e1b0292
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Mon Mar 6 10:32:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 6 10:32:39 2023 +0100

    misra: add entries to exclude-list.json
    
    Add entries to the exclude-list.json for those files that need to be
    excluded from the analysis scan.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/misra/exclude-list.json | 199 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 198 insertions(+), 1 deletion(-)

diff --git a/docs/misra/exclude-list.json b/docs/misra/exclude-list.json
index 1fb0ac6774..ca1e2dd678 100644
--- a/docs/misra/exclude-list.json
+++ b/docs/misra/exclude-list.json
@@ -1,4 +1,201 @@
 {
     "version": "1.0",
-    "content": []
+    "content": [
+        {
+            "rel_path": "arch/arm/arm64/cpufeature.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/arm/arm64/insn.c",
+            "comment": "Imported on Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/arm/arm64/lib/find_next_bit.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/acpi/boot.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/acpi/cpu_idle.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/acpi/cpufreq/cpufreq.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/acpi/cpuidle_menu.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/acpi/lib.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/amd.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/centaur.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/common.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/hygon.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/intel.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/intel_cacheinfo.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/mcheck/non-fatal.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/mtrr/*",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/cpu/mwait-idle.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/delay.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/dmi_scan.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/mpparse.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/srat.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/time.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "arch/x86/x86_64/mmconf-fam10h.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/bitmap.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/bunzip2.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/earlycpio.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/inflate.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/libfdt/*",
+            "comment": "External library"
+        },
+        {
+            "rel_path": "common/livepatch_elf.c",
+            "comment": "Not in scope initially as it generates many violations and it is not enabled in safety configurations"
+        },
+        {
+            "rel_path": "common/lzo.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/lz4/decompress.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/radix-tree.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/ubsan/ubsan.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/un*.c",
+            "comment": "unlz4.c implementation by Yann Collet, the others un* are from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/xz/*",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "common/zstd/*",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "crypto/*",
+            "comment": "Origin is external and documented in crypto/README.source"
+        },
+        {
+            "rel_path": "drivers/acpi/apei/*",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "drivers/acpi/hwregs.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "drivers/acpi/numa.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "drivers/acpi/osl.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "drivers/acpi/tables.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "drivers/acpi/tables/*",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "drivers/acpi/utilities/*",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "drivers/video/font_*",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "lib/list-sort.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "lib/rbtree.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "lib/xxhash*.c",
+            "comment": "Imported from Linux, ignore for now"
+        },
+        {
+            "rel_path": "xsm/flask/*",
+            "comment": "Not in scope initially as it generates many violations and it is not enabled in safety configurations"
+        }
+    ]
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 07 00:11:22 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Mar 2023 00:11:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.507175.780418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pZKvK-0003lJ-Ss; Tue, 07 Mar 2023 00:11:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 507175.780418; Tue, 07 Mar 2023 00:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pZKvK-0003lC-QA; Tue, 07 Mar 2023 00:11:22 +0000
Received: by outflank-mailman (input) for mailman id 507175;
 Tue, 07 Mar 2023 00:11: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 1pZKvJ-0003ky-Ky
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11: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 1pZKvJ-0006Dk-KD
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pZKvJ-0004nG-JD
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=La8wShWXp/qU0hzzS3RJXweL0sXHRxl03hOjwUHH/qY=; b=RoAF6gruAwjXwTGru3hA4Eqb6A
	9PpKAwnLTuyM3VOzWDKr5yu2rbPH9k0Vwvr11jOU5qU07g9hOvofAJ98qgfEHxwcRCZ9F9DyRwv2D
	Ug3aat93xZ6If3ACQjm/SMu9PwgMoLdbshcDfahQHkVLFaaurvcadEC2jTeqcLjdtpYI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] cppcheck: globally suppress unusedStructMember
Message-Id: <E1pZKvJ-0004nG-JD@xenbits.xenproject.org>
Date: Tue, 07 Mar 2023 00:11:21 +0000

commit 068314888c31a3c2a1ad92e1a4f7674cd6c22faf
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Mon Mar 6 10:32:47 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 6 10:32:47 2023 +0100

    cppcheck: globally suppress unusedStructMember
    
    unusedStructMember warnings from cppcheck are not reliable and
    are causing a lot of false positives, suppress the checker
    globally for now.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/scripts/xen_analysis/cppcheck_analysis.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
index e385e2c8f5..ab52ce38d5 100644
--- a/xen/scripts/xen_analysis/cppcheck_analysis.py
+++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
@@ -133,6 +133,8 @@ def generate_cppcheck_deps():
     # - Explicitly suppress warnings on compiler-def.h because cppcheck throws
     #   an unmatchedSuppression due to the rule we put in suppression-list.txt
     #   to skip every finding in the file.
+    # - Explicitly suppress findings for unusedStructMember that is not very
+    #   reliable and causes lots of false positives.
     #
     # Compiler defines are in compiler-def.h which is included in config.h
     #
@@ -145,6 +147,7 @@ def generate_cppcheck_deps():
  --inline-suppr
  --suppressions-list={}/suppression-list.txt
  --suppress='unmatchedSuppression:*'
+ --suppress='unusedStructMember:*'
  --include={}/include/xen/config.h
  -DCPPCHECK
 """.format(settings.outdir, CPPCHECK_BUILD_DIR, settings.xen_dir,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 07 00:11:32 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Mar 2023 00:11:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.507176.780422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pZKvU-0003oj-UM; Tue, 07 Mar 2023 00:11:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 507176.780422; Tue, 07 Mar 2023 00:11:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pZKvU-0003ob-Rn; Tue, 07 Mar 2023 00:11:32 +0000
Received: by outflank-mailman (input) for mailman id 507176;
 Tue, 07 Mar 2023 00:11: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 1pZKvT-0003oS-Og
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11: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 1pZKvT-0006E0-NZ
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pZKvT-0004nj-MX
 for xen-changelog@lists.xenproject.org; Tue, 07 Mar 2023 00:11:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eIMJFnTscZ/XnaJ8mARdKXKFRbNpSENdVeIV+AVjaMw=; b=2Zn2lFOKsP0Fr4tLbZ7hHLmDxN
	ZuSD3gA2sKFfNNRMaBW7hNHEks69JY6kz2VMmZ2wodc/WqPzaBl1ixH0GAiYADpO4EQFP3xVs8583
	i1GcFF6fktpkBE/+wIN/cPRVTSt7D5NaodGefjdjAZpCIyOTNTJeKa79+y7J2NC4jIiI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: purge dubious lastpage diagnostic
Message-Id: <E1pZKvT-0004nj-MX@xenbits.xenproject.org>
Date: Tue, 07 Mar 2023 00:11:31 +0000

commit 31270f11a96ebb875cd70661e2df9e5c6edd7564
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 6 10:33:28 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 6 10:33:28 2023 +0100

    x86/HVM: purge dubious lastpage diagnostic
    
    Quoting b5d8b03db136 ("x86/shadow: Drop dubious lastpage diagnostic"):
    
    "This is a global variable (actually 3, one per GUEST_PAGING_LEVEL), operated
     on using atomics only (with no regard to what else shares the same cacheline),
     which emits a diagnostic (in debug builds only) without changing any program
     behaviour.
    
     It is presumably left-over debugging, as it interlinks the behaviour of all
     vCPUs in chronological order.  Based on the read-only p2m types, this
     diagnostic can be tripped by entirely legitimate guest behaviour."
    
    The same applies here (it's only a single variable of course).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hvm.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5c1e641896..0c81e2afc7 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3354,16 +3354,7 @@ static enum hvm_translation_result __hvm_copy(
                 memcpy(buf, p, count);
                 hvmemul_write_cache(v, gfn_to_gaddr(gfn) | pgoff, buf, count);
             }
-            else if ( p2m_is_discard_write(p2mt) )
-            {
-                static unsigned long lastpage;
-
-                if ( xchg(&lastpage, gfn_x(gfn)) != gfn_x(gfn) )
-                    dprintk(XENLOG_G_DEBUG,
-                            "%pv attempted write to read-only gfn %#lx (mfn=%#"PRI_mfn")\n",
-                            v, gfn_x(gfn), mfn_x(page_to_mfn(page)));
-            }
-            else
+            else if ( !p2m_is_discard_write(p2mt) )
             {
                 if ( buf )
                     memcpy(p, buf, count);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 10 04:22:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Mar 2023 04:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.508387.783033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1paUGZ-0006Bc-Gg; Fri, 10 Mar 2023 04:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 508387.783033; Fri, 10 Mar 2023 04: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 1paUGZ-0006BU-Db; Fri, 10 Mar 2023 04:22:03 +0000
Received: by outflank-mailman (input) for mailman id 508387;
 Fri, 10 Mar 2023 04: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 1paUGY-0006BO-H9
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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 1paUGY-0006cr-5U
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1paUGY-0007sa-2a
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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=4lW5svxGz71zI+9pKPssTGB5drimzK3oZhlvMb+fc9I=; b=HusjiU0Hs7pH8fZcSaW9+A8ut0
	F4HJilVO8kw82iw6oo5eHIZN2NANTlIfQsaTWFGGyzHcv9a/xTEFWqqHWKTCtwBOfw9vZ4zK6xUzg
	+894BqwDkGQYKl8u0EE+mDWRon5zEcee5fHSRkJMnD+VWhh0s7mYQBzWZS6VBLS8h95w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: check max_init_domid validity
Message-Id: <E1paUGY-0007sa-2a@xenbits.xenproject.org>
Date: Fri, 10 Mar 2023 04:22:02 +0000

commit 002641a8b76dd560f425dca636ae17149cc6b379
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Feb 28 08:08:10 2023 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Mar 7 15:31:00 2023 -0800

    xen/arm: check max_init_domid validity
    
    Before trying to create a dom0less guest, check that max_init_domid
    increment will generate a valid domain ID, lower than
    DOMID_FIRST_RESERVED.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index edca23b986..9707eb7b1b 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3879,6 +3879,9 @@ void __init create_domUs(void)
         if ( !dt_device_is_compatible(node, "xen,domain") )
             continue;
 
+        if ( (max_init_domid + 1) >= DOMID_FIRST_RESERVED )
+            panic("No more domain IDs available\n");
+
         if ( dt_find_property(node, "xen,static-mem", NULL) )
             flags |= CDF_staticmem;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 10 04:22:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Mar 2023 04:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.508388.783038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1paUGj-0006DH-I8; Fri, 10 Mar 2023 04:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 508388.783038; Fri, 10 Mar 2023 04: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 1paUGj-0006D9-FL; Fri, 10 Mar 2023 04:22:13 +0000
Received: by outflank-mailman (input) for mailman id 508388;
 Fri, 10 Mar 2023 04: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 1paUGi-0006Cz-9W
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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 1paUGi-0006cw-8Y
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1paUGi-0007tD-7c
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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=AB/BbfmOItB+ho6fdbW/pIqL5+4VaF59xVn8qY9qJX0=; b=CCUHLDNNLKf0lsgRJGHcTduBzm
	+sEW8auinKWUlop71ztYOSOYzZ/qcJHU5TrbyiPIDwAtN2hzzot5w1Qu0So+8ypEXXFGXNdHGpM0s
	nsrrh2yil/LaVqJcm5Ajm4NMMxi9OCp4nZx4ZuFXLkDI5lyeSYOjo6jmpwHUajKMmO1c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add missing and drop obsoleted aliases from containerize
Message-Id: <E1paUGi-0007tD-7c@xenbits.xenproject.org>
Date: Fri, 10 Mar 2023 04:22:12 +0000

commit dd0f000aafd91ff674a11d6d5623d345fa8f91a6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Mar 1 10:06:44 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Mar 7 15:31:55 2023 -0800

    automation: Add missing and drop obsoleted aliases from containerize
    
    Add missing aliases for:
     - debian:unstable-cppcheck
     - debian:unstable-arm64v8-arm32-gcc
     - ubuntu:bionic
    
    Remove aliases for no longer used containers:
     - centos:7.2
     - debian:unstable-arm32-gcc
    
    Modify docs to refer to CentOS 7 instead of 7.2 not to create confusion.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/README.md      | 4 ++--
 automation/scripts/containerize | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index 4cc1acb6b4..2d07cafe0e 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -44,10 +44,10 @@ understands.
   DOCKER_CMD=podman ./automation/scripts/containerize make
   ```
 
-- CONTAINER: This overrides the container to use. For CentOS 7.2, use:
+- CONTAINER: This overrides the container to use. For CentOS 7, use:
 
   ```
-  CONTAINER=centos72 ./automation/scripts/containerize make
+  CONTAINER=centos7 ./automation/scripts/containerize make
   ```
 
 - CONTAINER_PATH: This overrides the path that will be available under the
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 9b1a302d05..5476ff0ea1 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -29,7 +29,6 @@ case "_${CONTAINER}" in
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
     _riscv64) CONTAINER="${BASE}/archlinux:current-riscv64" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
-    _centos72) CONTAINER="${BASE}/centos:7.2" ;;
     _fedora) CONTAINER="${BASE}/fedora:29";;
     _focal) CONTAINER="${BASE}/ubuntu:focal" ;;
     _jessie) CONTAINER="${BASE}/debian:jessie" ;;
@@ -39,8 +38,10 @@ case "_${CONTAINER}" in
     _buster-gcc-ibt) CONTAINER="${BASE}/debian:buster-gcc-ibt" ;;
     _unstable|_) CONTAINER="${BASE}/debian:unstable" ;;
     _unstable-i386) CONTAINER="${BASE}/debian:unstable-i386" ;;
-    _unstable-arm32-gcc) CONTAINER="${BASE}/debian:unstable-arm32-gcc" ;;
+    _unstable-arm64v8-arm32-gcc) CONTAINER="${BASE}/debian:unstable-arm64v8-arm32-gcc" ;;
     _unstable-arm64v8) CONTAINER="${BASE}/debian:unstable-arm64v8" ;;
+    _unstable-cppcheck) CONTAINER="${BASE}/debian:unstable-cppcheck" ;;
+    _bionic) CONTAINER="${BASE}/ubuntu:bionic" ;;
     _trusty) CONTAINER="${BASE}/ubuntu:trusty" ;;
     _xenial) CONTAINER="${BASE}/ubuntu:xenial" ;;
     _opensuse-leap|_leap) CONTAINER="${BASE}/suse:opensuse-leap" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 10 04:22:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Mar 2023 04:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.508389.783041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1paUGt-0006Fs-JW; Fri, 10 Mar 2023 04:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 508389.783041; Fri, 10 Mar 2023 04: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 1paUGt-0006Fk-Gp; Fri, 10 Mar 2023 04:22:23 +0000
Received: by outflank-mailman (input) for mailman id 508389;
 Fri, 10 Mar 2023 04: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 1paUGs-0006FW-CM
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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 1paUGs-0006d6-BO
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1paUGs-0007td-Aa
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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=jb65PxWPIWLBrBM1sgQ7BJVxctSgnK/4Cq8UOHrhjbs=; b=kWq6Z06u1fMtKZMKoA+TOrcCHq
	uYnHJIo24MXItYfABL+E3jMi4Da75VnJ2s/mUunCHI3khzwVsWefESSNepwsiOyCp4B29ZJdAvODP
	3/noXkU2+lwubLdAyPaomQDuveaoaOxkQTg5vQxyt4+OeUFYkyZAof/zHrDweUopAQpw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add Ubuntu container for Xilinx hardware tests
Message-Id: <E1paUGs-0007td-Aa@xenbits.xenproject.org>
Date: Fri, 10 Mar 2023 04:22:22 +0000

commit 3c55057bab0e992a6fc25cd498d6aca72034a8b5
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Mon Mar 6 15:33:09 2023 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Mar 7 16:34:29 2023 -0800

    automation: add Ubuntu container for Xilinx hardware tests
    
    This container is only run on the controller PC (x86) to trigger the
    test on a connected Xilinx ZCU102 physical board.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/build/ubuntu/xenial-xilinx.dockerfile | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/automation/build/ubuntu/xenial-xilinx.dockerfile b/automation/build/ubuntu/xenial-xilinx.dockerfile
new file mode 100644
index 0000000000..5f70871352
--- /dev/null
+++ b/automation/build/ubuntu/xenial-xilinx.dockerfile
@@ -0,0 +1,25 @@
+FROM ubuntu:16.04
+LABEL maintainer.name="The Xen Project " \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# board bringup depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        snmp \
+        snmp-mibs-downloader \
+        u-boot-tools \
+        device-tree-compiler \
+        cpio \
+        git \
+        gzip \
+        file \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 10 04:22:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Mar 2023 04:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.508390.783045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1paUH3-0006Ie-Lg; Fri, 10 Mar 2023 04:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 508390.783045; Fri, 10 Mar 2023 04: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 1paUH3-0006IX-IH; Fri, 10 Mar 2023 04:22:33 +0000
Received: by outflank-mailman (input) for mailman id 508390;
 Fri, 10 Mar 2023 04: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 1paUH2-0006IM-Fy
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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 1paUH2-0006dF-Es
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1paUH2-0007u9-Dd
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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=hKXMJEtNvJ1WPScgf4S1bFNnGJq/T5RP9la6sayiqs0=; b=7BI0E2AcC4ugdy0X2ixfvIf+mh
	/qMg9f728ESgduYRvmSOZbq639f2q9KeG6LpjuMZbkrKZo4gwcphI2hVjj+NEOxM4o78FNsvxNR1U
	bTvfn2Zr6FBots7Ej7OM00f75ojNsYr8BUfRUEovfbANpNESQMO/Ob+/jnG7qO4K4qS4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: introduce a dom0less test run on Xilinx hardware
Message-Id: <E1paUH2-0007u9-Dd@xenbits.xenproject.org>
Date: Fri, 10 Mar 2023 04:22:32 +0000

commit 746774cd1786b13dc67020efb6496477535dcb26
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Mon Mar 6 15:33:10 2023 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Mar 7 16:35:14 2023 -0800

    automation: introduce a dom0less test run on Xilinx hardware
    
    The test prepares dom0 and domU binaries and boot artifacts, similarly
    to the existing QEMU test. (TBD: share preparation steps with the
    regular QEMU tests.)
    
    However, instead of running the test inside QEMU as usual, it copies
    the binaries to the tftp server root, triggers a Xilinx ZCU102 board
    reboot, and connects to the real serial of the board.
    
    Only run the job on protected branches with XILINX_JOBS set to true (the
    "master" and "staging" on gitlab.com/xen-project/xen qualify).
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/gitlab-ci/test.yaml                    |  25 +++++
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 122 ++++++++++++++++++++++
 2 files changed, 147 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1c5f400b68..2e1a6886df 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -67,6 +67,23 @@
   tags:
     - x86_64
 
+.xilinx-arm64:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: ubuntu:xenial-xilinx
+    LOGFILE: qemu-smoke-xilinx.log
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+      - '*.dtb'
+    when: always
+  only:
+    variables:
+      - $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+  tags:
+    - xilinx
+
 # Test jobs
 build-each-commit-gcc:
   extends: .test-jobs-common
@@ -85,6 +102,14 @@ build-each-commit-gcc:
   tags:
     - x86_64
 
+xilinx-smoke-dom0less-arm64-gcc:
+  extends: .xilinx-arm64
+  script:
+    - ./automation/scripts/xilinx-smoke-dom0less-arm64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - alpine-3.12-gcc-arm64
+
 qemu-smoke-dom0-arm64-gcc:
   extends: .qemu-arm64
   script:
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
new file mode 100755
index 0000000000..82158ab7ea
--- /dev/null
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -0,0 +1,122 @@
+#!/bin/bash
+
+set -ex
+
+test_variant=$1
+
+if [ -z "${test_variant}" ]; then
+    passed="ping test passed"
+    domU_check="
+until ifconfig eth0 192.168.0.2 &> /dev/null && ping -c 10 192.168.0.1; do
+    sleep 30
+done
+echo \"${passed}\"
+"
+fi
+
+# DomU
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+echo "#!/bin/sh
+
+${domU_check}
+/bin/sh" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+cd ..
+rm -rf rootfs
+
+# DOM0 rootfs
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+/usr/local/lib/xen/bin/init-dom0less
+
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+
+xl network-attach 1 type=vif
+${dom0_check}
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cd ..
+
+
+TFTP=/scratch/gitlab-runner/tftp
+START=`pwd`
+
+# ImageBuilder
+echo 'MEMORY_START="0"
+MEMORY_END="0x7ff00000"
+
+DEVICE_TREE="mpsoc_smmu.dtb"
+XEN="xen"
+DOM0_KERNEL="Image"
+DOM0_RAMDISK="dom0-rootfs.cpio.gz"
+XEN_CMD="console=dtuart dtuart=serial0 dom0_mem=1024M"
+
+NUM_DOMUS=1
+DOMU_KERNEL[0]="Image"
+DOMU_RAMDISK[0]="domU-rootfs.cpio.gz"
+DOMU_MEM[0]="1024"
+
+LOAD_CMD="tftpb"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > $TFTP/config
+
+cp -f binaries/xen $TFTP/
+cp -f binaries/Image $TFTP/
+cp -f binaries/dom0-rootfs.cpio.gz $TFTP/
+cp -f binaries/domU-rootfs.cpio.gz $TFTP/
+# export dtb to artifacts
+cp $TFTP/mpsoc_smmu.dtb .
+
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d $TFTP/ -c $TFTP/config
+
+# restart the board
+cd /scratch/gitlab-runner
+bash zcu102.sh 2
+sleep 5
+bash zcu102.sh 1
+sleep 5
+cd $START
+
+# connect to serial
+set +e
+stty -F /dev/ttyUSB0 115200
+timeout -k 1 120 nohup sh -c "cat /dev/ttyUSB0 | tee smoke.serial"
+
+# stop the board
+cd /scratch/gitlab-runner
+bash zcu102.sh 2
+cd $START
+
+set -e
+(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
+exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 10 04:22:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Mar 2023 04:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.508391.783048 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1paUHD-0006LJ-Mm; Fri, 10 Mar 2023 04:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 508391.783048; Fri, 10 Mar 2023 04: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 1paUHD-0006LC-K2; Fri, 10 Mar 2023 04:22:43 +0000
Received: by outflank-mailman (input) for mailman id 508391;
 Fri, 10 Mar 2023 04: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 1paUHC-0006L6-J2
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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 1paUHC-0006dS-I0
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1paUHC-0007uc-H1
 for xen-changelog@lists.xenproject.org; Fri, 10 Mar 2023 04: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=YkwoLBHKzHxj+aATIivzPZIp7TKcjUheEuTW/lWqo1M=; b=E5bSnfoWXishWhqg0WVQj6bN8J
	/jIAlQNHkOduwzIItsiCvDFO9vY/wigju5ADH1kTep9t7KSXUe3IGLKhjWQ+PjfayzwwboTolBZu0
	mybu5YtAJue4tGyGXB6MxPNnRBMZOzv+5LuyXc0QPBOQR7al5MwOyoKL/Y0Ta7HV5bA8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/tests: remove vhpet tests
Message-Id: <E1paUHC-0007uc-H1@xenbits.xenproject.org>
Date: Fri, 10 Mar 2023 04:22:42 +0000

commit 7a59096258fb9e9679538da8851fe00656841980
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Mar 6 17:29:04 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 8 13:20:06 2023 +0000

    tools/tests: remove vhpet tests
    
    tools/tests/vhpet tests don't build since ages (at least since 4.10)
    and they can't be activated from outside of tools/tests/vhpet.
    
    Remove them as they seem to be irrelevant.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/vhpet/.gitignore |   4 -
 tools/tests/vhpet/Makefile   |  39 ---
 tools/tests/vhpet/emul.h     | 414 -----------------------
 tools/tests/vhpet/main.c     | 776 -------------------------------------------
 4 files changed, 1233 deletions(-)

diff --git a/tools/tests/vhpet/.gitignore b/tools/tests/vhpet/.gitignore
deleted file mode 100644
index 4cefa62218..0000000000
--- a/tools/tests/vhpet/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-test_vhpet
-test_vhpet.out
-hpet.h
-hpet.c
diff --git a/tools/tests/vhpet/Makefile b/tools/tests/vhpet/Makefile
deleted file mode 100644
index 2d56ffdfd9..0000000000
--- a/tools/tests/vhpet/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-
-XEN_ROOT=$(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-TARGET := test_vhpet
-
-.PHONY: all
-all: $(TARGET)
-
-.PHONY: run
-run: $(TARGET)
-	./$(TARGET) > $(TARGET).out
-	./$(TARGET) 0 > $(TARGET).0.out
-	./$(TARGET) 0 1 0 20 > $(TARGET).0.1.0.20.out
-	./$(TARGET) 200 > $(TARGET).200.out
-	./$(TARGET) 200 1 0 20 > $(TARGET).200.1.0.20.out
-	./$(TARGET) 300 5 > $(TARGET).200.5.out
-	./$(TARGET) 400 4 2000 > $(TARGET).200.4.2000.out
-	./$(TARGET) 0 1 0 20 0x0103 > $(TARGET).0.1.0.20.0x0103.out
-	./$(TARGET) 200 1 0 20 0x0103 > $(TARGET).200.1.0.20.0x0103.out
-
-$(TARGET): hpet.c main.c hpet.h emul.h Makefile
-	$(HOSTCC) -g -o $@ hpet.c main.c
-
-.PHONY: clean
-clean:
-	rm -rf $(TARGET) $(TARGET).out *.o *~ core* hpet.h hpet.c
-
-.PHONY: distclean
-distclean: clean
-
-.PHONY: install
-install:
-
-hpet.h: $(XEN_ROOT)/xen/arch/x86/include/asm/hpet.h
-	cp $< $@
-
-hpet.c: $(XEN_ROOT)/xen/arch/x86/hvm/hpet.c
-	sed -e "/#include/d" -e "1i#include \"emul.h\"\n" <$< >$@
diff --git a/tools/tests/vhpet/emul.h b/tools/tests/vhpet/emul.h
deleted file mode 100644
index b022cc0eab..0000000000
--- a/tools/tests/vhpet/emul.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Xen emulation for hpet
- *
- * Copyright (C) 2014 Verizon Corporation
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License Version 2 (GPLv2)
- * as published by the Free Software Foundation.
- *
- * This file 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. <http://www.gnu.org/licenses/>.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <string.h>
-
-#define PCI_HAVE_64BIT_ADDRESS
-#include <pci/types.h>
-
-#include "hpet.h"
-
-#include <xen-tools/libs.h>
-
-#define NR_CPUS 8
-
-typedef int64_t s_time_t;
-typedef int spinlock_t;
-typedef int bool_t;
-
-#define BITS_PER_LONG __WORDSIZE
-#define BITS_TO_LONGS(bits) \
-    (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG)
-#define DECLARE_BITMAP(name, bits) \
-    unsigned long name[BITS_TO_LONGS(bits)]
-typedef struct cpumask
-{
-    DECLARE_BITMAP(bits, NR_CPUS);
-} cpumask_t;
-typedef cpumask_t *cpumask_var_t;
-struct msi_desc
-{
-    struct msi_attrib
-    {
-        u8    type    : 5;    /* {0: unused, 5h:MSI, 11h:MSI-X} */
-        u8    maskbit : 1;    /* mask-pending bit supported ?   */
-        u8    masked  : 1;
-        u8    is_64   : 1;    /* Address size: 0=32bit 1=64bit  */
-        u8    pos;            /* Location of the msi capability */
-        u16   entry_nr;       /* specific enabled entry         */
-    } msi_attrib;
-};
-
-struct msi_msg
-{
-    u32     address_lo;     /* low 32 bits of msi message address */
-    u32     address_hi;     /* high 32 bits of msi message address */
-    u32     data;           /* 16 bits of msi message data */
-    u32     dest32;         /* used when Interrupt Remapping with EIM is enabled */
-};
-
-#define X86EMUL_OKAY 100
-#define EINVAL 101
-
-#define DBG_LEVEL_PIT 200
-
-#define TRC_HW_VCHIP_HPET_START_TIMER 300
-#define TRC_HW_VCHIP_HPET_STOP_TIMER 301
-#define TRC_HW_VCHIP_PIT_STOP_TIMER 302
-
-#define TRC_HVM_VCHIP_HPET_START_TIMER 400
-#define TRC_HVM_VCHIP_HPET_STOP_TIMER 401
-#define TRC_HVM_VCHIP_PIT_STOP_TIMER 402
-
-#define TRC_HVM_EMUL_HPET_START_TIMER 400
-#define TRC_HVM_EMUL_HPET_STOP_TIMER 401
-#define TRC_HVM_EMUL_PIT_STOP_TIMER 402
-
-#define __read_mostly
-#define __initdata
-#define __init
-#define __maybe_unused
-#define __cacheline_aligned
-#define boolean_param(a, b)
-#define fix_to_virt(a) a
-#define xmalloc_array(_type, _num) (void *)(_type)(_num)
-#define DEFINE_PER_CPU(_type, _name) _type _name
-
-#define KERN_DEBUG
-#define KERN_INFO
-
-#define XENLOG_WARNING
-#define XENLOG_INFO
-#define XENLOG_ERR
-#define XENLOG_GUEST
-
-#define MSI_TYPE_UNKNOWN 0
-#define MSI_TYPE_HPET    1
-#define MSI_TYPE_IOMMU   2
-
-#define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1))
-
-/* Low-latency softirqs come first in the following list. */
-enum
-{
-    TIMER_SOFTIRQ = 0,
-    SCHEDULE_SOFTIRQ,
-    NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ,
-    RCU_SOFTIRQ,
-    TASKLET_SOFTIRQ,
-    NR_COMMON_SOFTIRQS
-};
-/*
- * ..and if you can't take the strict
- * types, you can specify one yourself.
- *
- * Or not use min/max at all, of course.
- */
-#define min_t(type, x, y) \
-    ({ type __x = (x); type __y = (y); __x < __y ? __x : __y; })
-#define max_t(type, x, y) \
-    ({ type __x = (x); type __y = (y); __x > __y ? __x : __y; })
-#define offsetof(t, m) ((unsigned long )&((t *)0)->m)
-#define container_of(ptr, type, member) ({              \
-        typeof( ((type *)0)->member ) *__mptr = (ptr);  \
-        (type *)( (char *)__mptr - offsetof(type,member) ); })
-
-struct domain;
-
-struct vcpu
-{
-    int vcpu_id;
-    struct domain *domain;
-};
-
-typedef void time_cb(struct vcpu *v, void *opaque);
-
-struct periodic_time
-{
-#define PTSRC_isa    1 /* ISA time source */
-#define PTSRC_lapic  2 /* LAPIC time source */
-    u8 source;                  /* PTSRC_ */
-};
-
-void destroy_periodic_time(struct periodic_time *pt);
-void create_periodic_time(
-    struct vcpu *v, struct periodic_time *pt, uint64_t delta,
-    uint64_t period, uint8_t irq, time_cb *cb, void *data);
-
-#define HPET_TIMER_NUM 3
-
-struct hpet_registers
-{
-    /* Memory-mapped, software visible registers */
-    uint64_t capability;        /* capabilities */
-    uint64_t config;            /* configuration */
-    uint64_t isr;               /* interrupt status reg */
-    uint64_t mc64;              /* main counter */
-    struct                      /* timers */
-    {
-        uint64_t config;        /* configuration/cap */
-        uint64_t cmp;           /* comparator */
-        uint64_t fsb;           /* FSB route, not supported now */
-    } timers[HPET_TIMER_NUM];
-
-    /* Hidden register state */
-    uint64_t period[HPET_TIMER_NUM]; /* Last value written to comparator */
-    uint64_t comparator64[HPET_TIMER_NUM]; /* 64 bit running comparator */
-    uint64_t offset64[HPET_TIMER_NUM]; /* offset so comparator calc "works" */
-    uint64_t first_mc64[HPET_TIMER_NUM]; /* 1st interval main counter */
-    bool_t first_enabled[HPET_TIMER_NUM]; /* In 1st interval */
-};
-
-typedef struct HPETState
-{
-    struct hpet_registers hpet;
-    uint64_t stime_freq;
-    uint64_t hpet_to_ns_scale; /* hpet ticks to ns (multiplied by 2^10) */
-    uint64_t hpet_to_ns_limit; /* max hpet ticks convertable to ns      */
-    uint64_t mc_offset;
-    struct periodic_time pt[HPET_TIMER_NUM];
-    spinlock_t lock;
-} HPETState;
-
-typedef struct PITState
-{
-    struct periodic_time pt0;
-    spinlock_t lock;
-} PITState;
-
-
-struct pl_time      /* platform time */
-{
-    struct HPETState vhpet;
-    /* guest_time = Xen sys time + stime_offset */
-    int64_t stime_offset;
-    /* Ensures monotonicity in appropriate timer modes. */
-    uint64_t last_guest_time;
-    spinlock_t pl_time_lock;
-};
-
-#define HVM_PARAM_HPET_ENABLED 11
-
-struct hvm_domain
-{
-    struct pl_time         pl_time;
-    long params[20];
-};
-
-struct arch_domain
-{
-    struct hvm_domain hvm_domain;
-    struct PITState vpit;
-};
-
-struct domain
-{
-    int domain_id;
-    struct arch_domain arch;
-    struct vcpu *vcpu[NR_CPUS];
-};
-
-typedef int (*hvm_mmio_read_t)(struct vcpu *v,
-                               unsigned long addr,
-                               unsigned long length,
-                               unsigned long *val);
-typedef int (*hvm_mmio_write_t)(struct vcpu *v,
-                                unsigned long addr,
-                                unsigned long length,
-                                unsigned long val);
-typedef int (*hvm_mmio_check_t)(struct vcpu *v, unsigned long addr);
-
-
-struct hvm_mmio_ops
-{
-    hvm_mmio_check_t check;
-    hvm_mmio_read_t  read;
-    hvm_mmio_write_t write;
-};
-
-/* Marshalling and unmarshalling uses a buffer with size and cursor. */
-typedef struct hvm_domain_context
-{
-    uint32_t cur;
-    uint32_t size;
-    uint8_t *data;
-} hvm_domain_context_t;
-
-int current_domain_id(void);
-#define dprintk(_l, _f, _a...)                  \
-    printk(_l "%s:%d: " _f, __FILE__ , __LINE__ , ## _a )
-#define gdprintk(_l, _f, _a...)                         \
-    printk(XENLOG_GUEST _l "%s:%d:d%d " _f, __FILE__,   \
-           __LINE__, current_domain_id() , ## _a )
-struct vcpu *get_current();
-#define current get_current()
-
-#define HVM_SAVE_CODE(_x) HVM_SAVE_CODE_##_x
-#define HVM_SAVE_LENGTH(_x) HVM_SAVE_LENGTH_##_x
-
-/*
- * HPET
- */
-
-uint64_t hvm_get_guest_time(struct vcpu *v);
-
-#define HPET_TIMER_NUM     3    /* 3 timers supported now */
-struct hvm_hw_hpet
-{
-    /* Memory-mapped, software visible registers */
-    uint64_t capability;        /* capabilities */
-    uint64_t res0;              /* reserved */
-    uint64_t config;            /* configuration */
-    uint64_t res1;              /* reserved */
-    uint64_t isr;               /* interrupt status reg */
-    uint64_t res2[25];          /* reserved */
-    uint64_t mc64;              /* main counter */
-    uint64_t res3;              /* reserved */
-    struct                      /* timers */
-    {
-        uint64_t config;        /* configuration/cap */
-        uint64_t cmp;           /* comparator */
-        uint64_t fsb;           /* FSB route, not supported now */
-        uint64_t res4;          /* reserved */
-    } timers[HPET_TIMER_NUM];
-    uint64_t res5[4 * (24 - HPET_TIMER_NUM)]; /* reserved, up to 0x3ff */
-
-    /* Hidden register state */
-    uint64_t period[HPET_TIMER_NUM]; /* Last value written to comparator */
-};
-
-typedef int (*hvm_save_handler)(struct domain *d,
-                                hvm_domain_context_t *h);
-typedef int (*hvm_load_handler)(struct domain *d,
-                                hvm_domain_context_t *h);
-
-struct hvm_save_descriptor
-{
-    uint16_t typecode;          /* Used to demux the various types below */
-    uint16_t instance;          /* Further demux within a type */
-    uint32_t length;            /* In bytes, *not* including this descriptor */
-};
-
-void hvm_register_savevm(uint16_t typecode,
-                         const char *name,
-                         hvm_save_handler save_state,
-                         hvm_load_handler load_state,
-                         size_t size, int kind);
-
-#define HVMSR_PER_DOM 1
-
-#define HVM_REGISTER_SAVE_RESTORE(_x, _save, _load, _num, _k)       \
-    int __init __hvm_register_##_x##_save_and_restore(void)     \
-    {                                                                   \
-        hvm_register_savevm(HVM_SAVE_CODE(_x),                          \
-                            #_x,                                        \
-                            &_save,                                     \
-                            &_load,                                     \
-                            (_num) * (HVM_SAVE_LENGTH(_x)               \
-                                 + sizeof(struct hvm_save_descriptor)), \
-                            _k);                                        \
-        return 0;                                                       \
-    }                                                                   \
-
-#define HVM_SAVE_CODE_HPET 0
-#define HVM_SAVE_LENGTH_HPET sizeof(struct hvm_hw_hpet)
-
-#define printk printf
-
-#define spin_lock(a)
-#define spin_unlock(a)
-#define spin_lock_init(a)
-#define spin_is_locked(a) 1
-#define ASSERT(a)
-
-#define ADDR (*(volatile long *) addr)
-
-static inline void __set_bit(int nr, volatile void *addr)
-{
-    asm volatile(
-        "btsl %1,%0"
-        : "=m"(ADDR)
-        : "Ir"(nr), "m"(ADDR) : "memory");
-}
-
-static inline void __clear_bit(int nr, volatile void *addr)
-{
-    asm volatile(
-        "btrl %1,%0"
-        : "=m"(ADDR)
-        : "Ir"(nr), "m"(ADDR) : "memory");
-}
-
-static inline unsigned int find_first_set_bit(unsigned long word)
-{
-    asm("bsf %1,%0" : "=r"(word) : "r"(word));
-    return (unsigned int)word;
-}
-
-#define HVM_DBG_LOG(level, _f, _a...)                   \
-    do {                                \
-        printf("[HVM:%d.%d] <%s> " _f "\n",                             \
-               current->domain->domain_id, current->vcpu_id, __func__,  \
-               ## _a);                                                  \
-    } while ( 0 )
-
-void __domain_crash(struct domain *d);
-#define domain_crash(d) do {                        \
-        printf("domain_crash called from %s:%d\n", __FILE__, __LINE__); \
-        __domain_crash(d);                                              \
-    } while ( 0 )
-
-#define MICROSECS(_us) ((s_time_t)((_us) * 1000ULL))
-
-#define pt_global_vcpu_target(d)        \
-    ((d)->vcpu ? (d)->vcpu[0] : NULL)
-
-#define TRACE_0D(a)
-#define TRACE_1D(a, b)
-#define TRACE_2D(a, b, c)
-#define TRACE_3D(a, b, c, d)
-#define TRACE_4D(a, b, c, d, e)
-#define TRACE_5D(a, b, c, d, e, f)
-#define TRACE_6D(a, b, c, d, e, f, g)
-
-#define TRC_PAR_LONG(par) ((par)&0xFFFFFFFF),((par)>>32)
-
-#define TRACE_2_LONG_2D(_e, d1, d2, ...) \
-    TRACE_4D(_e, d1, d2)
-#define TRACE_2_LONG_3D(_e, d1, d2, d3, ...) \
-    TRACE_5D(_e, d1, d2, d3)
-#define TRACE_2_LONG_4D(_e, d1, d2, d3, d4, ...) \
-    TRACE_6D(_e, d1, d2, d3, d4)
-
-/* debug */
-
-extern int __read_mostly hpet_debug;
-extern uint64_t __read_mostly hpet_force_diff;
-extern uint64_t __read_mostly hpet_force_mc64;
-extern uint64_t __read_mostly hpet_force_cmp;
-extern uint64_t __read_mostly hpet_force_period;
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/tools/tests/vhpet/main.c b/tools/tests/vhpet/main.c
deleted file mode 100644
index 6fe65ea808..0000000000
--- a/tools/tests/vhpet/main.c
+++ /dev/null
@@ -1,776 +0,0 @@
-/*
- * Xen emulation for hpet
- *
- * Copyright (C) 2014 Verizon Corporation
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License Version 2 (GPLv2)
- * as published by the Free Software Foundation.
- *
- * This file 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. <http://www.gnu.org/licenses/>.
- */
-
-/*
- * http://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/software-developers-hpet-spec-1-0a.pdf
- *
- * xen_source is a directory that has all xen source below it.
- *
- * Usage:
- *
-
-
-  xen_source=../../..
-  sed -e "/#include/d" -e "1i#include \"emul.h\"\n" <$xen_source/xen/arch/x86/hvm/hpet.c >hpet.c
-  cp $xen_source/xen/include/asm-x86/hpet.h .
-
-  gcc -g -o test_vhpet hpet.c main.c
-  ./test_vhpet >test_vhpet.out
-
- *
- *
- * This is almost the same as
- *
-
-  make run
-
- *
- * Or
- *
- * make -C tools/tests/vhpet run
- *
- * From a xen source tree.  The differance
- * is that you need to be in a xen source tree
- * and normal make rules apply.
- *
- */
-
-#define FORCE_THOUSANDS_SEP
-
-#include <locale.h>
-#include <langinfo.h>
-#include <stdarg.h>
-#include "emul.h"
-#include "hpet.h"
-
-#define S_TO_NS    1000000000ULL           /* 1s  = 10^9  ns */
-
-#define START_MC64 0x108a8
-
-static int hpet_mult = 1;
-static int hpet_add;
-static int hvm_clock_cost = 1234567;
-static int tick_count = 1;
-static int debug = 3;
-
-static int skip_load;
-static int skip_error_on_load;
-
-static char *global_thousep;
-
-extern const struct hvm_mmio_ops hpet_mmio_ops;
-
-struct domain dom1;
-struct vcpu vcpu0;
-struct hvm_hw_hpet hpet_save;
-
-
-uint64_t hvm_guest_time;
-
-static struct
-{
-    hvm_save_handler save;
-    hvm_load_handler load;
-    const char *name;
-    size_t size;
-    int kind;
-} hvm_sr_handlers[3] = {{NULL, NULL, "<?>"},};
-
-static uint64_t new_guest_time[] = {
-    0x20,
-    0x2a840,
-    0xf4200,
-    0x10000000000ULL,
-    0x0fffffffffefff00ULL,
-    0x20,
-    0xffffffff00000000ULL,
-    0x20,
-};
-
-static int print_error(const char *fmt, ...)
-{
-    va_list args;
-    int i = 0;
-
-    if ( (debug & 0x0100) && skip_error_on_load )
-        return i;
-
-    va_start(args, fmt);
-    if ( debug & 0x0001 )
-        i = vfprintf(stdout, fmt, args);
-    va_end(args);
-    va_start(args, fmt);
-    if ( debug & 0x0002 )
-        i = vfprintf(stderr, fmt, args);
-    va_end(args);
-    return i;
-}
-
-
-int current_domain_id(void)
-{
-    return current->domain->domain_id;
-}
-
-struct vcpu *get_current()
-{
-    return &vcpu0;
-}
-
-void __domain_crash(struct domain *d)
-{
-    exit(42);
-}
-
-uint64_t hvm_get_guest_time(struct vcpu *v)
-{
-    uint64_t ret = hvm_guest_time;
-
-    hvm_guest_time += hvm_clock_cost;
-    return ret;
-}
-
-int _hvm_init_entry(struct hvm_domain_context *h,
-                    uint16_t tc, uint16_t inst, uint32_t len)
-{
-    h->cur = 0;
-    h->size = sizeof(hpet_save);
-    h->data = (void *)&hpet_save;
-
-    return 0;
-}
-
-int _hvm_check_entry(struct hvm_domain_context *h,
-                     uint16_t type, uint32_t len, bool_t strict_length)
-{
-    h->cur = 0;
-    h->size = sizeof(hpet_save);
-    h->data = (void *)&hpet_save;
-
-    return 0;
-}
-
-void __init hvm_register_savevm(uint16_t typecode,
-                                const char *name,
-                                hvm_save_handler save_state,
-                                hvm_load_handler load_state,
-                                size_t size, int kind)
-{
-    hvm_sr_handlers[typecode].save = save_state;
-    hvm_sr_handlers[typecode].load = load_state;
-    hvm_sr_handlers[typecode].name = name;
-    hvm_sr_handlers[typecode].size = size;
-    hvm_sr_handlers[typecode].kind = kind;
-}
-
-int do_save(uint16_t typecode, struct domain *d, hvm_domain_context_t *h)
-{
-    return hvm_sr_handlers[typecode].save(d, h);
-}
-
-int do_load(uint16_t typecode, struct domain *d, hvm_domain_context_t *h)
-{
-    if (skip_load & 0x1)
-    {
-        printf("skip_load=%#x\n", skip_load);
-    }
-    else
-    {
-        int ret;
-
-        printf("do_load\n");
-        skip_error_on_load = 1;
-        ret = hvm_sr_handlers[typecode].load(d, h);
-        skip_error_on_load = 0;
-    }
-}
-
-static void dump_hpet(void)
-{
-    int i;
-    unsigned long long conf;
-    struct hvm_hw_hpet h = hpet_save;
-    conf = (unsigned long long) h.config;
-    printf("    HPET: capability %#llx config %#llx(%s%s)\n",
-           (unsigned long long) h.capability,
-           conf,
-           conf & HPET_CFG_ENABLE ? "E" : "",
-           conf & HPET_CFG_LEGACY ? "L" : "");
-    printf("          isr %#llx counter %#llx(%'lld)\n",
-           (unsigned long long) h.isr,
-           (unsigned long long) h.mc64,
-           (unsigned long long) h.mc64);
-    for (i = 0; i < HPET_TIMER_NUM; i++)
-    {
-        conf = (unsigned long long) h.timers[i].config;
-        printf("          timer%i config %#llx(%s%s%s) cmp %#llx(%'lld)\n", i,
-               conf,
-               conf & HPET_TN_ENABLE ? "E" : "",
-               conf & HPET_TN_PERIODIC ? "P" : "",
-               conf & HPET_TN_32BIT ? "32" : "",
-               (unsigned long long) h.timers[i].cmp,
-               (unsigned long long) h.timers[i].cmp);
-        printf("          timer%i period %#llx(%'lld) fsb %#llx\n", i,
-               (unsigned long long) h.period[i],
-               (unsigned long long) h.period[i],
-               (unsigned long long) h.timers[i].fsb);
-    }
-}
-
-void pit_stop_channel0_irq(PITState *pit)
-{
-    printf("pit_stop_channel0_irq: pit=%p\n", pit);
-
-    TRACE_1D(TRC_HVM_VCHIP_PIT_STOP_TIMER, get_cycles());
-    spin_lock(&pit->lock);
-    destroy_periodic_time(&pit->pt0);
-    spin_unlock(&pit->lock);
-}
-
-void destroy_periodic_time(struct periodic_time *pt)
-{
-    int idx = ((long)pt) & 0x7;
-
-    printf("destroy_periodic_time: pt=%d\n", idx);
-}
-
-void create_periodic_time(struct vcpu *v, struct periodic_time *pt,
-                          uint64_t delta, uint64_t period, uint8_t irq,
-                          time_cb *cb, void *data)
-{
-    int idx = ((long)pt) & 0x7;
-
-    if ( debug & 0x0010 )
-    {
-        int i;
-
-        printf("create_periodic_time: "
-               "mc64=%#lx(%'ld) mc_offset=%#lx(%'ld)\n",
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.mc64,
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.mc64,
-               dom1.arch.hvm_domain.pl_time.vhpet.mc_offset,
-               dom1.arch.hvm_domain.pl_time.vhpet.mc_offset);
-        for (i = 0; i < 3; i++)
-        {
-            printf("                 "
-                   "[%d] cmp64=%#lx(%'ld) cmp=%#lx(%'ld)\n", i,
-                   dom1.arch.hvm_domain.pl_time.vhpet.hpet.comparator64[i],
-                   dom1.arch.hvm_domain.pl_time.vhpet.hpet.comparator64[i],
-                   dom1.arch.hvm_domain.pl_time.vhpet.hpet.timers[i].cmp,
-                   dom1.arch.hvm_domain.pl_time.vhpet.hpet.timers[i].cmp);
-        }
-    }
-    if ( period )
-    {
-        printf("create_periodic_time: pt=%d delta=%'"PRId64" period=%'"PRIu64
-               " - %'"PRIu64".%02d Hz irq=%d\n",
-               idx, delta, period, (uint64_t)(S_TO_NS / period),
-               (int)((S_TO_NS / (period / 100ULL)) % 100), irq);
-        /* +160 is for hpet_tick_to_ns() not simple. */
-        if ( delta > (period * (hpet_mult + hpet_add + 160)) )
-            print_error("%s(%ld): Possible ..MP-BIOS bug: 8254 timer...: delta=%'"PRId64
-                        " period=%'"PRIu64"\n", __func__, __LINE__,
-                        delta, period);
-    }
-    else
-        printf("create_periodic_time: pt=%d delta=%'"PRId64
-               " period=%'"PRIu64" irq=%d\n",
-               idx, delta, period, irq);
-}
-
-void udelay(int w)
-{
-}
-
-unsigned int hpet_readl(unsigned long a)
-{
-    unsigned long ret = 0;
-    hpet_mmio_ops.read(current, a, 4, &ret);
-    return ret;
-}
-
-void hpet_writel(unsigned long d, unsigned long a)
-{
-    hpet_mmio_ops.write(current, a, 4, d);
-    return;
-}
-
-static void _hpet_print_config(const char *function, int line)
-{
-    u32 i, timers, l, h;
-    printk(KERN_INFO "hpet: %s(%d):\n", function, line);
-    l = hpet_readl(HPET_ID);
-    h = hpet_readl(HPET_PERIOD);
-    timers = ((l & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT) + 1;
-    printk(KERN_INFO "hpet: ID: 0x%x, PERIOD: 0x%x\n", l, h);
-    l = hpet_readl(HPET_CFG);
-    h = hpet_readl(HPET_STATUS);
-    printk(KERN_INFO "hpet: CFG: 0x%x, STATUS: 0x%x\n", l, h);
-    l = hpet_readl(HPET_COUNTER);
-    h = hpet_readl(HPET_COUNTER + 4);
-    printk(KERN_INFO "hpet: COUNTER_l: 0x%x, COUNTER_h: 0x%x\n", l, h);
-
-    for (i = 0; i < timers; i++)
-    {
-        l = hpet_readl(HPET_Tn_CFG(i));
-        h = hpet_readl(HPET_Tn_CFG(i) + 4);
-        printk(KERN_INFO "hpet: T%d: CFG_l: 0x%x, CFG_h: 0x%x\n",
-               i, l, h);
-        l = hpet_readl(HPET_Tn_CMP(i));
-        h = hpet_readl(HPET_Tn_CMP(i) + 4);
-        printk(KERN_INFO "hpet: T%d: CMP_l: 0x%x, CMP_h: 0x%x\n",
-               i, l, h);
-        l = hpet_readl(HPET_Tn_ROUTE(i));
-        h = hpet_readl(HPET_Tn_ROUTE(i) + 4);
-        printk(KERN_INFO "hpet: T%d ROUTE_l: 0x%x, ROUTE_h: 0x%x\n",
-               i, l, h);
-    }
-}
-
-#define hpet_print_config()                     \
-    do {                                        \
-        _hpet_print_config(__func__, __LINE__); \
-    } while ( 0 )
-
-static void hpet_stop_counter(void)
-{
-    unsigned long cfg = hpet_readl(HPET_CFG);
-    cfg &= ~HPET_CFG_ENABLE;
-    hpet_writel(cfg, HPET_CFG);
-}
-
-static void hpet_reset_counter(unsigned long low, unsigned long high)
-{
-    hpet_writel(low, HPET_COUNTER);
-    hpet_writel(high, HPET_COUNTER + 4);
-}
-
-static void hpet_start_counter(void)
-{
-    unsigned long cfg = hpet_readl(HPET_CFG);
-    cfg |= HPET_CFG_ENABLE;
-    hpet_writel(cfg, HPET_CFG);
-}
-
-static void hpet_restart_counter(void)
-{
-    hpet_stop_counter();
-    hpet_reset_counter(0, 0);
-    hpet_start_counter();
-}
-
-static void hpet_set_mode(uint64_t delta, int timer)
-{
-    unsigned long cfg, cmp, cmp2, now;
-
-    hpet_stop_counter();
-    now = hpet_readl(HPET_COUNTER);
-    cmp = now + (unsigned long)(hpet_mult * delta) + hpet_add;
-    cfg = hpet_readl(HPET_Tn_CFG(timer));
-    /* Make sure we use edge triggered interrupts */
-    cfg &= ~HPET_TN_LEVEL;
-    cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
-           HPET_TN_SETVAL | HPET_TN_32BIT;
-    /* Mask to 32 bits just like the hardware */
-    cmp = (uint32_t)cmp;
-    delta = (uint32_t)delta;
-    /* Do the config */
-    hpet_writel(cfg, HPET_Tn_CFG(timer));
-    hpet_writel(cmp, HPET_Tn_CMP(timer));
-    printf("%s(%ld): HPET_TN_SETVAL cmp=%#lx(%'ld) timer=%d\n",
-           __func__, __LINE__, cmp, cmp, timer);
-    udelay(1);
-    /*
-     * HPET on AMD 81xx needs a second write (with HPET_TN_SETVAL
-     * cleared) to T0_CMP to set the period. The HPET_TN_SETVAL
-     * bit is automatically cleared after the first write.
-     * (See AMD-8111 HyperTransport I/O Hub Data Sheet,
-     * Publication # 24674)
-     */
-    hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer));
-    printf("%s(%ld): period=%#lx(%'ld) timer=%d\n", __func__, __LINE__,
-           (unsigned long) delta, (unsigned long) delta, timer);
-    cmp2 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp2 != cmp )
-        print_error("%s(%ld): T%d Error: Set %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp2, cmp2);
-
-    hpet_start_counter();
-    hpet_print_config();
-}
-
-
-hpet_check_stopped(uint64_t old_delta, int timer)
-{
-    unsigned long mc_low, mc_high, old_cmp, now;
-    unsigned long cfg, cmp, delta, cmp2, cmp3;
-
-    if (skip_load & 0x2)
-    {
-        printf("Skip hpet_check_stopped. skip_load=%#x\n", skip_load);
-        return;
-    }
-    hpet_stop_counter();
-    mc_low = hpet_readl(HPET_COUNTER);
-    mc_high = hpet_readl(HPET_COUNTER + 4);
-    old_cmp = hpet_readl(HPET_Tn_CMP(timer));
-
-    hpet_reset_counter(67752, 0);
-    cmp = 255252;
-    delta = 62500;
-
-    now = hpet_readl(HPET_COUNTER);
-    if ( now != 67752 )
-        print_error("%s(%ld): T%d Error: Set mc %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, 67752, 67752, now, now);
-    cfg = hpet_readl(HPET_Tn_CFG(timer));
-    cfg |= HPET_TN_SETVAL;
-    hpet_writel(cfg, HPET_Tn_CFG(timer));
-    hpet_writel(cmp, HPET_Tn_CMP(timer));
-    printf("%s(%ld): HPET_TN_SETVAL cmp=%#lx(%'ld) timer=%d\n",
-           __func__, __LINE__, cmp, cmp, timer);
-    cmp2 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp2 != cmp )
-        print_error("%s(%ld): T%d Error: Set cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp2, cmp2);
-
-    hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer));
-    printf("%s(%ld): period=%#lx(%'ld) timer=%d\n", __func__, __LINE__,
-           (unsigned long) delta, (unsigned long) delta, timer);
-    cmp3 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp3 != cmp )
-        print_error("%s(%ld): T%d Error: Set period, cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp3, cmp3);
-
-    if ( dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer] != delta )
-        printf("%s(%ld): T%d Warning: Set period %#lx(%'ld) != %#lx(%'ld)\n",
-               __func__, __LINE__, timer, delta, delta,
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer],
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer]);
-
-    hpet_reset_counter(67752, 0);
-    cmp = 255252;
-    delta = 62500;
-
-    now = hpet_readl(HPET_COUNTER);
-    if ( now != 67752 )
-        print_error("%s(%ld): T%d Error: Set mc %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, 67752, 67752, now, now);
-    cfg = hpet_readl(HPET_Tn_CFG(timer));
-    cfg |= HPET_TN_SETVAL;
-    hpet_writel(cfg, HPET_Tn_CFG(timer));
-    hpet_writel(cmp, HPET_Tn_CMP(timer));
-    printf("%s(%ld): HPET_TN_SETVAL cmp=%#lx(%'ld) timer=%d\n",
-           __func__, __LINE__, cmp, cmp, timer);
-    cmp2 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp2 != cmp )
-        print_error("%s(%ld): T%d Error: Set cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp2, cmp2);
-
-    hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer));
-    printf("%s(%ld): period=%#lx(%'ld) timer=%d\n", __func__, __LINE__,
-           (unsigned long) delta, (unsigned long) delta, timer);
-    cmp3 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp3 != cmp )
-        print_error("%s(%ld): T%d Error: Set period, cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp3, cmp3);
-
-    if ( dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer] != delta )
-        printf("%s(%ld): T%d Warning: Set period %#lx(%'ld) != %#lx(%'ld)\n",
-               __func__, __LINE__, timer, delta, delta,
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer],
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer]);
-
-    hpet_reset_counter(67700, 0);
-
-    now = hpet_readl(HPET_COUNTER);
-    if ( now != 67700 )
-        print_error("%s(%ld): T%d Error: Set mc %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, 67752, 67752, now, now);
-    cmp2 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp2 != cmp )
-        print_error("%s(%ld): T%d Error: Set mc, cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp2, cmp2);
-
-    cmp3 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp3 != cmp )
-        print_error("%s(%ld): T%d Error: Set mc, cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp3, cmp3);
-
-    if ( dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer] != delta )
-        printf("%s(%ld): T%d Warning: Set mc, period %#lx(%'ld) != %#lx(%'ld)\n",
-               __func__, __LINE__, timer, delta, delta,
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer],
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer]);
-
-    cmp = 67701;
-
-    now = hpet_readl(HPET_COUNTER);
-    if ( now != 67700 )
-        print_error("%s(%ld): T%d Error: Set cmp, mc %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, 67752, 67752, now, now);
-    cfg = hpet_readl(HPET_Tn_CFG(timer));
-    cfg |= HPET_TN_SETVAL;
-    hpet_writel(cfg, HPET_Tn_CFG(timer));
-    hpet_writel(cmp, HPET_Tn_CMP(timer));
-    printf("%s(%ld): HPET_TN_SETVAL cmp=%#lx(%'ld) timer=%d\n",
-           __func__, __LINE__, cmp, cmp, timer);
-    cmp2 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp2 != cmp )
-        print_error("%s(%ld): T%d Error: Set cmp, cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp2, cmp2);
-
-    cmp3 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp3 != cmp )
-        print_error("%s(%ld): T%d Error: Set cmp, cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp3, cmp3);
-
-    if ( dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer] != delta )
-        printf("%s(%ld): T%d Warning: Set cmp, period %#lx(%'ld) != %#lx(%'ld)\n",
-               __func__, __LINE__, timer, delta, delta,
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer],
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer]);
-
-    delta = 500;
-
-    now = hpet_readl(HPET_COUNTER);
-    if ( now != 67700 )
-        print_error("%s(%ld): T%d Error: Set period, mc %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, 67752, 67752, now, now);
-    cmp2 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp2 != cmp )
-        print_error("%s(%ld): T%d Error: Set period, cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp2, cmp2);
-
-    hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer));
-    printf("%s(%ld): period=%#lx(%'ld) timer=%d\n", __func__, __LINE__,
-           (unsigned long) delta, (unsigned long) delta, timer);
-    cmp3 = hpet_readl(HPET_Tn_CMP(timer));
-    if ( cmp3 != cmp )
-        print_error("%s(%ld): T%d Error: Set period, cmp %#lx(%'ld) != %#lx(%'ld)\n",
-                    __func__, __LINE__, timer, cmp, cmp, cmp3, cmp3);
-
-    if ( dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer] != delta )
-        printf("%s(%ld): T%d Warning: Set period, period %#lx(%'ld) != %#lx(%'ld)\n",
-               __func__, __LINE__, timer, delta, delta,
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer],
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.period[timer]);
-
-    hpet_reset_counter(mc_low, mc_high);
-    cfg = hpet_readl(HPET_Tn_CFG(timer));
-    cfg |= HPET_TN_SETVAL;
-    hpet_writel(cfg, HPET_Tn_CFG(timer));
-    hpet_writel(old_cmp, HPET_Tn_CMP(timer));
-    hpet_writel(old_delta, HPET_Tn_CMP(timer));
-    hpet_start_counter();
-}
-
-
-int
-main(int argc, char **argv)
-{
-    hvm_domain_context_t hdc;
-    struct hvm_hw_hpet hpet0;
-    struct hvm_hw_hpet hpet1;
-    struct hvm_hw_hpet hpet2;
-    int i, k;
-
-    setlocale(LC_ALL, "");
-
-#ifdef FORCE_THOUSANDS_SEP
-    setlocale(LC_NUMERIC, "en_US.utf8");
-#endif
-    global_thousep = nl_langinfo(THOUSEP);
-
-    printf("test_vhpet 1.0\n");
-
-    if ( argc > 1 )
-        hvm_clock_cost = atoi(argv[1]);
-    if ( argc > 2 )
-        hpet_mult = atoi(argv[2]);
-    if ( argc > 3 )
-        hpet_add = atoi(argv[3]);
-    if ( argc > 4 )
-        tick_count = atoi(argv[4]);
-    if ( argc > 5 )
-        debug = strtol(argv[5], NULL, 0);
-
-    printf("hvm_clock_cost=%'d hpet_mult=%'d hpet_add=%'d tick_count=%d debug=%#x\n",
-           hvm_clock_cost, hpet_mult, hpet_add, tick_count, debug);
-
-    dom1.domain_id = 1;
-    dom1.vcpu[0] = &vcpu0;
-    vcpu0.vcpu_id = 0;
-    vcpu0.domain = &dom1;
-
-    __hvm_register_HPET_save_and_restore();
-
-    for (skip_load = 3; skip_load >= 0; skip_load--)
-    {
-
-        printf("\nskip_load=%d\n", skip_load);
-
-        hvm_guest_time = 16;
-
-        hpet_init(&vcpu0);
-
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet0 = hpet_save;
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet1 = hpet_save;
-        if (hpet0.mc64 != hpet1.mc64)
-            print_error("%s(%ld): With clock stopped mc64 changed: %'ld to %'ld\n",
-                        __func__, __LINE__, hpet0.mc64, hpet1.mc64);
-
-        do_load(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet2 = hpet_save;
-        if (hpet1.mc64 != hpet2.mc64)
-            print_error("%s(%ld): With clock stopped mc64 changed: %'ld to %'ld\n",
-                        __func__, __LINE__, hpet1.mc64, hpet2.mc64);
-
-        dom1.arch.hvm_domain.pl_time.vhpet.hpet.mc64 = START_MC64;
-        dom1.arch.hvm_domain.pl_time.vhpet.mc_offset = START_MC64
-            - hvm_guest_time - hvm_clock_cost;
-        printf("\n"
-               "mc64=%#lx(%'ld) mc_offset=%#lx(%'ld)\n",
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.mc64,
-               dom1.arch.hvm_domain.pl_time.vhpet.hpet.mc64,
-               dom1.arch.hvm_domain.pl_time.vhpet.mc_offset,
-               dom1.arch.hvm_domain.pl_time.vhpet.mc_offset);
-
-        printf("\nhvm_guest_time=%#lx(%'ld)\n",
-               hvm_guest_time, hvm_guest_time);
-
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet0 = hpet_save;
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet1 = hpet_save;
-        if (hpet0.mc64 != hpet1.mc64)
-            print_error("%s(%ld): With clock stopped mc64 changed: %'ld to %'ld\n",
-                        __func__, __LINE__, hpet0.mc64, hpet1.mc64);
-
-        do_load(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet2 = hpet_save;
-        if (hpet1.mc64 != hpet2.mc64)
-            print_error("%s(%ld): With clock stopped mc64 changed: %'ld to %'ld\n",
-                        __func__, __LINE__, hpet1.mc64, hpet2.mc64);
-
-        hpet_set_mode(0xf424, 0);
-        hpet_check_stopped(0xf424, 0);
-
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet0 = hpet_save;
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet1 = hpet_save;
-        do_load(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet2 = hpet_save;
-
-        hpet_set_mode(0, 1);
-        hpet_check_stopped(0, 1);
-
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet0 = hpet_save;
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet1 = hpet_save;
-
-        do_load(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet2 = hpet_save;
-
-        hpet_set_mode(~0ULL, 2);
-        hpet_check_stopped(~0ULL, 2);
-
-        hpet_set_mode(0x80000000, 2);
-        hpet_check_stopped(0x80000000, 2);
-
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet0 = hpet_save;
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet1 = hpet_save;
-
-        do_load(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-        dump_hpet();
-        hpet2 = hpet_save;
-
-
-        for (k = 0; k < ARRAY_SIZE(new_guest_time); k++)
-        {
-            hvm_guest_time = new_guest_time[k];
-            printf("\nhvm_guest_time=%#lx(%'ld)\n",
-                   hvm_guest_time, hvm_guest_time);
-
-            do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-            dump_hpet();
-            hpet0 = hpet_save;
-            do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-            dump_hpet();
-            hpet1 = hpet_save;
-
-            do_load(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-            do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-            dump_hpet();
-            hpet2 = hpet_save;
-
-            for (i = 0; i < tick_count; i++)
-            {
-                hvm_guest_time += 0x10;
-                printf("\nhvm_guest_time=%#lx(%'ld)\n",
-                       hvm_guest_time, hvm_guest_time);
-
-                do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-                dump_hpet();
-                hpet0 = hpet_save;
-                do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-                dump_hpet();
-                hpet1 = hpet_save;
-
-                do_load(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-                do_save(HVM_SAVE_CODE(HPET), &dom1, &hdc);
-                dump_hpet();
-                hpet2 = hpet_save;
-
-            }
-        }
-    }
-
-    return 0;
-}
-
-/*
- * 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 Tue Mar 14 08:11:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509483.785298 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzkN-0002YY-DL; Tue, 14 Mar 2023 08:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509483.785298; Tue, 14 Mar 2023 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 1pbzkN-0002YO-AL; Tue, 14 Mar 2023 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 509483;
 Tue, 14 Mar 2023 08:11: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 1pbzkL-0002Y0-QU
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzkL-0006bG-PR
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzkL-0006Hu-MY
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=35AGcleXbaTeDqrsPBikTV05SR7YqJoxzy6UbzeAf/I=; b=BK3/Kp4BK8CM4Pr9RnTH4V15uQ
	rShA47UrB+zNUKfnJ9//1MrlhnUKytXbE/PPQla24Npf0q2Ezaab43SYjI6CcfdhVTLGvUshjMaNZ
	h+NB6q/0zUHLxAFGme4tsED9Eq4lRALXoU6WKBKSquZfbEMurkR1xoDanZN+PxfapQ54=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Add BHI controls to userspace components
Message-Id: <E1pbzkL-0006Hu-MY@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:11:01 +0000

commit 9276e832aef60437da13d91e66fc259fd94d6f91
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 10 15:45:47 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 13 11:26:26 2023 +0000

    x86/spec-ctrl: Add BHI controls to userspace components
    
    This was an oversight when adding the Xen parts.
    
    Fixes: cea9ae062295 ("x86/spec-ctrl: Enumeration for new Intel BHI controls")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/light/libxl_cpuid.c | 3 +++
 tools/misc/xen-cpuid.c         | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 06b1227a2f..1d4e8a6b00 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -240,6 +240,9 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"cet-sss",      0x00000007,  1, CPUID_REG_EDX, 18,  1},
 
         {"intel-psfd",   0x00000007,  2, CPUID_REG_EDX,  0,  1},
+        {"ipred-ctrl",   0x00000007,  2, CPUID_REG_EDX,  1,  1},
+        {"rrsba-ctrl",   0x00000007,  2, CPUID_REG_EDX,  2,  1},
+        {"bhi-ctrl",     0x00000007,  2, CPUID_REG_EDX,  4,  1},
         {"mcdt-no",      0x00000007,  2, CPUID_REG_EDX,  5,  1},
 
         {"lahfsahf",     0x80000001, NA, CPUID_REG_ECX,  0,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 3ab820571d..4f4261f4aa 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -215,9 +215,9 @@ static const char *const str_7d1[32] =
 
 static const char *const str_7d2[32] =
 {
-    [ 0] = "intel-psfd",
-
-    /* 4 */                 [ 5] = "mcdt-no",
+    [ 0] = "intel-psfd",    [ 1] = "ipred-ctrl",
+    [ 2] = "rrsba-ctrl",
+    [ 4] = "bhi-ctrl",      [ 5] = "mcdt-no",
 };
 
 static const struct {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 14 08:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509484.785302 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzkX-0002aM-Ev; Tue, 14 Mar 2023 08:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509484.785302; Tue, 14 Mar 2023 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 1pbzkX-0002aE-Bt; Tue, 14 Mar 2023 08:11:13 +0000
Received: by outflank-mailman (input) for mailman id 509484;
 Tue, 14 Mar 2023 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 1pbzkV-0002a2-Vo
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11: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 1pbzkV-0006bY-Uk
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzkV-0006IP-Th
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KtmFviPsaZgw7LkXMbVizn02KblRtt7tdDJBcHKgrz8=; b=ZhbSITes5hXHbWb7G9O1NYWzQx
	ElgzUouCJpdYVxx8n92ttnm3GChH2ylkvh+vMF39rLkvB0REr70mvp8+ispRLGGLtCnDb6oHaPdAe
	EJKT8IVbaw61zJcT+6ebfA9wWccFUZCzPx727QJ0V9JxvU1ff19O2Hl0Cs3WcZVhnBQU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Enumerations for DDP controls
Message-Id: <E1pbzkV-0006IP-Th@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:11:11 +0000

commit d04ae78c34e7e21d9be79301cad7dc085873656a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 10 15:54:28 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 13 11:26:26 2023 +0000

    x86/spec-ctrl: Enumerations for DDP controls
    
    https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/data-dependent-prefetcher.html
    
    We should offer DDP-CTRL to guests, but I'm not sure when it is appearing in
    hardware, and it's not massively urgent - the DDP behaviour is mostly sane
    (having been designed in a post-spectre world) and this is a just-in-case
    control.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/light/libxl_cpuid.c              | 1 +
 tools/misc/xen-cpuid.c                      | 2 +-
 xen/arch/x86/include/asm/msr-index.h        | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 1d4e8a6b00..9686359810 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -242,6 +242,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"intel-psfd",   0x00000007,  2, CPUID_REG_EDX,  0,  1},
         {"ipred-ctrl",   0x00000007,  2, CPUID_REG_EDX,  1,  1},
         {"rrsba-ctrl",   0x00000007,  2, CPUID_REG_EDX,  2,  1},
+        {"ddp-ctrl",     0x00000007,  2, CPUID_REG_EDX,  3,  1},
         {"bhi-ctrl",     0x00000007,  2, CPUID_REG_EDX,  4,  1},
         {"mcdt-no",      0x00000007,  2, CPUID_REG_EDX,  5,  1},
 
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 4f4261f4aa..868054ab96 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -216,7 +216,7 @@ static const char *const str_7d1[32] =
 static const char *const str_7d2[32] =
 {
     [ 0] = "intel-psfd",    [ 1] = "ipred-ctrl",
-    [ 2] = "rrsba-ctrl",
+    [ 2] = "rrsba-ctrl",    [ 3] = "ddp-ctrl",
     [ 4] = "bhi-ctrl",      [ 5] = "mcdt-no",
 };
 
diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h
index 7615d8087f..fa771ed0b5 100644
--- a/xen/arch/x86/include/asm/msr-index.h
+++ b/xen/arch/x86/include/asm/msr-index.h
@@ -41,6 +41,7 @@
 #define  SPEC_CTRL_RRSBA_DIS_U              (_AC(1, ULL) <<  5)
 #define  SPEC_CTRL_RRSBA_DIS_S              (_AC(1, ULL) <<  6)
 #define  SPEC_CTRL_PSFD                     (_AC(1, ULL) <<  7)
+#define  SPEC_CTRL_DDP_DIS_U                (_AC(1, ULL) <<  8)
 #define  SPEC_CTRL_BHI_DIS_S                (_AC(1, ULL) << 10)
 
 #define MSR_PRED_CMD                        0x00000049
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 336744b471..0888519087 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -294,6 +294,7 @@ XEN_CPUFEATURE(INTEL_PPIN,         12*32+ 0) /*   Protected Processor Inventory
 XEN_CPUFEATURE(INTEL_PSFD,         13*32+ 0) /*A  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(IPRED_CTRL,         13*32+ 1) /*   MSR_SPEC_CTRL.IPRED_DIS_* */
 XEN_CPUFEATURE(RRSBA_CTRL,         13*32+ 2) /*   MSR_SPEC_CTRL.RRSBA_DIS_* */
+XEN_CPUFEATURE(DDP_CTRL,           13*32+ 3) /*   MSR_SPEC_CTRL.DDP_DIS_U */
 XEN_CPUFEATURE(BHI_CTRL,           13*32+ 4) /*   MSR_SPEC_CTRL.BHI_DIS_S */
 XEN_CPUFEATURE(MCDT_NO,            13*32+ 5) /*A  MCDT_NO */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 14 08:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509485.785306 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzkh-0002dO-GI; Tue, 14 Mar 2023 08:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509485.785306; Tue, 14 Mar 2023 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 1pbzkh-0002dG-DL; Tue, 14 Mar 2023 08:11:23 +0000
Received: by outflank-mailman (input) for mailman id 509485;
 Tue, 14 Mar 2023 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 1pbzkg-0002ct-3T
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 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 1pbzkg-0006bn-2G
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzkg-0006Iu-1H
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 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=MFsPoDfS+YMTB1ggPYdZ+2WuUGN1y8/e/tH/JCJh3ws=; b=tAAADhne1cydp4ZpkH3FkNETZ0
	KBc7RMSVxq+mAoXMR0F0N/I8CYtveE5TkGnV5GID06A3lTrhikzDZ6+GPEk/INkav4qJ+1j+9+fYl
	dSby960+5GdKIy8UL47jmdFXeMhhE4z80ZoW4OoOWEEAA/gk+/9GhHn8Hc5/pO3AV9h8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xen-cpuid: Support dash as a bitmap separator
Message-Id: <E1pbzkg-0006Iu-1H@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:11:22 +0000

commit 4a55779402404ea75aa4e83cd612ac0563e9e1bc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 10 18:14:13 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 13 11:26:26 2023 +0000

    tools/xen-cpuid: Support dash as a bitmap separator
    
    Xapi chose to render its featureset bitmaps with dashes rather than colons as
    a separator.  Have xen-cpuid support both forms, for convenience.
    
    Fix a trivial style issue in the vicinity while here.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/misc/xen-cpuid.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 868054ab96..361102d8cf 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -607,9 +607,10 @@ int main(int argc, char **argv)
                 if ( i == nr_features )
                     break;
 
-                if ( *ptr == ':' )
+                if ( *ptr == ':' || *ptr == '-' )
                 {
-                    ptr++; continue;
+                    ptr++;
+                    continue;
                 }
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 14 08:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509486.785310 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzkr-0002fv-HO; Tue, 14 Mar 2023 08:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509486.785310; Tue, 14 Mar 2023 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 1pbzkr-0002fn-En; Tue, 14 Mar 2023 08:11:33 +0000
Received: by outflank-mailman (input) for mailman id 509486;
 Tue, 14 Mar 2023 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 1pbzkq-0002fT-6n
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 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 1pbzkq-0006cD-5l
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzkq-0006JN-4x
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 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=VvL4VAUvmZdmfPe/N1lKhGIFTKfF4O7VPP0Ug0N/niw=; b=m01i0raMt+8onD62uhGFJAUPdo
	oefIDJWnXYIQudGS6JzSdpvbiyVWhQfXR9tjp8/7uC7xcFi3J0N/qbD+sVade4rK2IZAF+zXNwtVw
	vWCopeN2DMdf5Yd3DTK+uqE0k2cZPQtnaVpNb+0nOu8iPtCzkmO538LqzNgpKrVIcuhw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xen-cpuid: Rework the handling of dynamic featuresets
Message-Id: <E1pbzkq-0006JN-4x@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:11:32 +0000

commit ec3474e1dd42e6f410601f50b6e74fb7c442cfb9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 10 19:04:22 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 13 11:26:26 2023 +0000

    tools/xen-cpuid: Rework the handling of dynamic featuresets
    
    struct fsinfo is the vestigial remnant of an older internal design which
    didn't survive very long.
    
    Simplify things by inlining get_featureset() and having a single memory
    allocation that gets reused.  This in turn changes featuresets[] to be a
    simple list of names, so rename it to fs_names[].
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/misc/xen-cpuid.c | 53 +++++++++++++++++++++-----------------------------
 1 file changed, 22 insertions(+), 31 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 361102d8cf..227df7352e 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -246,16 +246,11 @@ static const struct {
 
 #define COL_ALIGN "18"
 
-static struct fsinfo {
-    const char *name;
-    uint32_t len;
-    uint32_t *fs;
-} featuresets[] =
-{
-    [XEN_SYSCTL_cpu_featureset_host] = { "Host", 0, NULL },
-    [XEN_SYSCTL_cpu_featureset_raw]  = { "Raw",  0, NULL },
-    [XEN_SYSCTL_cpu_featureset_pv]   = { "PV",   0, NULL },
-    [XEN_SYSCTL_cpu_featureset_hvm]  = { "HVM",  0, NULL },
+static const char *const fs_names[] = {
+    [XEN_SYSCTL_cpu_featureset_host] = "Host",
+    [XEN_SYSCTL_cpu_featureset_raw]  = "Raw",
+    [XEN_SYSCTL_cpu_featureset_pv]   = "PV",
+    [XEN_SYSCTL_cpu_featureset_hvm]  = "HVM",
 };
 
 static void dump_leaf(uint32_t leaf, const char *const *strs)
@@ -302,22 +297,10 @@ static void decode_featureset(const uint32_t *features,
     }
 }
 
-static int get_featureset(xc_interface *xch, unsigned int idx)
-{
-    struct fsinfo *f = &featuresets[idx];
-
-    f->len = nr_features;
-    f->fs = calloc(nr_features, sizeof(*f->fs));
-
-    if ( !f->fs )
-        err(1, "calloc(, featureset)");
-
-    return xc_get_cpu_featureset(xch, idx, &f->len, f->fs);
-}
-
 static void dump_info(xc_interface *xch, bool detail)
 {
     unsigned int i;
+    uint32_t *fs;
 
     printf("nr_features: %u\n", nr_features);
 
@@ -348,26 +331,34 @@ static void dump_info(xc_interface *xch, bool detail)
                       nr_features, "HVM Hap Default", detail);
 
     printf("\nDynamic sets:\n");
-    for ( i = 0; i < ARRAY_SIZE(featuresets); ++i )
+
+    fs = malloc(sizeof(*fs) * nr_features);
+    if ( !fs )
+        err(1, "malloc(featureset)");
+
+    for ( i = 0; i < ARRAY_SIZE(fs_names); ++i )
     {
-        if ( get_featureset(xch, i) )
+        uint32_t len = nr_features;
+        int ret;
+
+        memset(fs, 0, sizeof(*fs) * nr_features);
+
+        ret = xc_get_cpu_featureset(xch, i, &len, fs);
+        if ( ret )
         {
             if ( errno == EOPNOTSUPP )
             {
-                printf("%s featureset not supported by Xen\n",
-                       featuresets[i].name);
+                printf("%s featureset not supported by Xen\n", fs_names[i]);
                 continue;
             }
 
             err(1, "xc_get_featureset()");
         }
 
-        decode_featureset(featuresets[i].fs, featuresets[i].len,
-                          featuresets[i].name, detail);
+        decode_featureset(fs, len, fs_names[i], detail);
     }
 
-    for ( i = 0; i < ARRAY_SIZE(featuresets); ++i )
-        free(featuresets[i].fs);
+    free(fs);
 }
 
 static void print_policy(const char *name,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 14 08:11:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509487.785315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzl1-0002iA-JH; Tue, 14 Mar 2023 08:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509487.785315; Tue, 14 Mar 2023 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 1pbzl1-0002i2-GE; Tue, 14 Mar 2023 08:11:43 +0000
Received: by outflank-mailman (input) for mailman id 509487;
 Tue, 14 Mar 2023 08:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzl0-0002hq-B4
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzl0-0006cK-AH
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzl0-0006Jq-8Y
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=49ONsTn6kvIXlTW5D8fgTh4I29QXxa+VkqM7XOyWszc=; b=vrq0c/7xVOo2xx+w7TJSZZxLrt
	NmF3uIG5A2u+NoJgEFFiCyDRW+2JwHny9RIgCRkoEdUJ4hDRTgmkyLheqaprLrFxU1bFNiv4SWLLy
	a0yOcz8C7qBqZF0KLe9HHBqFJyrC1EaEtcJ/j3GM02M2ur2sRP4hfHQCBUvY6+qOFmEM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/sysctl: Retrofit XEN_SYSCTL_cpu_featureset_{pv,hvm}_max
Message-Id: <E1pbzl0-0006Jq-8Y@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:11:42 +0000

commit 433d012c6c2737ad5a9aaa994355a4140d601852
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 10 19:37:56 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 13 11:26:26 2023 +0000

    x86/sysctl: Retrofit XEN_SYSCTL_cpu_featureset_{pv,hvm}_max
    
    Featuresets are supposed to be disappearing when the CPU policy infrastructure
    is complete, but that has taken longer than expected, and isn't going to be
    complete imminently either.
    
    In the meantime, Xen does have proper default/max featuresets, and xen-cpuid
    can even get them via the XEN_SYSCTL_cpu_policy_* interface, but only knows
    now to render them nicely via the featureset interface.
    
    Differences between default and max are a frequent source of errors,
    frequently too in secret leading up to an embargo, so extend the featureset
    sysctl to allow xen-cpuid to render them all nicely.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/misc/xen-cpuid.c          | 10 ++++++----
 tools/ocaml/libs/xc/xenctrl.ml  |  8 +++++++-
 tools/ocaml/libs/xc/xenctrl.mli |  8 +++++++-
 xen/arch/x86/sysctl.c           |  4 +++-
 xen/include/public/sysctl.h     |  2 ++
 5 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 227df7352e..37a7eaa8ed 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -247,10 +247,12 @@ static const struct {
 #define COL_ALIGN "18"
 
 static const char *const fs_names[] = {
-    [XEN_SYSCTL_cpu_featureset_host] = "Host",
-    [XEN_SYSCTL_cpu_featureset_raw]  = "Raw",
-    [XEN_SYSCTL_cpu_featureset_pv]   = "PV",
-    [XEN_SYSCTL_cpu_featureset_hvm]  = "HVM",
+    [XEN_SYSCTL_cpu_featureset_raw]     = "Raw",
+    [XEN_SYSCTL_cpu_featureset_host]    = "Host",
+    [XEN_SYSCTL_cpu_featureset_pv]      = "PV Default",
+    [XEN_SYSCTL_cpu_featureset_hvm]     = "HVM Default",
+    [XEN_SYSCTL_cpu_featureset_pv_max]  = "PV Max",
+    [XEN_SYSCTL_cpu_featureset_hvm_max] = "HVM Max",
 };
 
 static void dump_leaf(uint32_t leaf, const char *const *strs)
diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index a59dee0938..e4096bf92c 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -370,7 +370,13 @@ external version_changeset: handle -> string = "stub_xc_version_changeset"
 external version_capabilities: handle -> string =
   "stub_xc_version_capabilities"
 
-type featureset_index = Featureset_raw | Featureset_host | Featureset_pv | Featureset_hvm
+type featureset_index =
+  | Featureset_raw
+  | Featureset_host
+  | Featureset_pv
+  | Featureset_hvm
+  | Featureset_pv_max
+  | Featureset_hvm_max
 external get_cpu_featureset : handle -> featureset_index -> int64 array = "stub_xc_get_cpu_featureset"
 
 external watchdog : handle -> int -> int32 -> int
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 3154e90f4f..ef22545374 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -297,7 +297,13 @@ external version_changeset : handle -> string = "stub_xc_version_changeset"
 external version_capabilities : handle -> string
   = "stub_xc_version_capabilities"
 
-type featureset_index = Featureset_raw | Featureset_host | Featureset_pv | Featureset_hvm
+type featureset_index =
+  | Featureset_raw
+  | Featureset_host
+  | Featureset_pv
+  | Featureset_hvm
+  | Featureset_pv_max
+  | Featureset_hvm_max
 external get_cpu_featureset : handle -> featureset_index -> int64 array = "stub_xc_get_cpu_featureset"
 
 external pages_to_kib : int64 -> int64 = "stub_pages_to_kib"
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index f42a3b843b..6600eb4347 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -323,14 +323,16 @@ long arch_do_sysctl(
 
     case XEN_SYSCTL_get_cpu_featureset:
     {
-        static const struct cpuid_policy *const policy_table[4] = {
+        static const struct cpuid_policy *const policy_table[6] = {
             [XEN_SYSCTL_cpu_featureset_raw]  = &raw_cpuid_policy,
             [XEN_SYSCTL_cpu_featureset_host] = &host_cpuid_policy,
 #ifdef CONFIG_PV
             [XEN_SYSCTL_cpu_featureset_pv]   = &pv_def_cpuid_policy,
+            [XEN_SYSCTL_cpu_featureset_pv_max] = &pv_max_cpuid_policy,
 #endif
 #ifdef CONFIG_HVM
             [XEN_SYSCTL_cpu_featureset_hvm]  = &hvm_def_cpuid_policy,
+            [XEN_SYSCTL_cpu_featureset_hvm_max] = &hvm_max_cpuid_policy,
 #endif
         };
         const struct cpuid_policy *p = NULL;
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 001a4de273..e8dded9fb9 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -796,6 +796,8 @@ struct xen_sysctl_cpu_featureset {
 #define XEN_SYSCTL_cpu_featureset_host     1
 #define XEN_SYSCTL_cpu_featureset_pv       2
 #define XEN_SYSCTL_cpu_featureset_hvm      3
+#define XEN_SYSCTL_cpu_featureset_pv_max   4
+#define XEN_SYSCTL_cpu_featureset_hvm_max  5
     uint32_t index;       /* IN: Which featureset to query? */
     uint32_t nr_features; /* IN/OUT: Number of entries in/written to
                            * 'features', or the maximum number of features if
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 14 08:11:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509488.785318 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzlB-0002kc-Kk; Tue, 14 Mar 2023 08:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509488.785318; Tue, 14 Mar 2023 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 1pbzlB-0002kU-Hg; Tue, 14 Mar 2023 08:11:53 +0000
Received: by outflank-mailman (input) for mailman id 509488;
 Tue, 14 Mar 2023 08: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 1pbzlA-0002kM-Eq
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08: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 1pbzlA-0006cR-Du
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzlA-0006Kj-Cv
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08: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=BPrPLcn7PHrP/+wgk77AYolCcSW3zyT/ndfchM05KMo=; b=WNqBvUUr3EI/snbZNhldwhknkV
	5d+JZhKdQhAfhQODLq/+BMIsVE9pk/LKluDJldr+/yTIaIFNxbVF+uBWKg55AYE4HW3tqCWHgBfX3
	9vUdFsU4Dq8hSXjNcU8WRih/n8AZG0S2mUJgWzeJdBmyKfn3qdpVT0qTU+dPix5uDQ2E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pvh: report ACPI VFCT table to dom0 if present
Message-Id: <E1pbzlA-0006Kj-Cv@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:11:52 +0000

commit f69c5991595c92756860d038346569464c1b9ea1
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Sun Mar 12 15:54:50 2023 +0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 13 11:56:42 2023 +0000

    x86/pvh: report ACPI VFCT table to dom0 if present
    
    The VFCT ACPI table is used by AMD GPUs to expose the vbios ROM image
    from the firmware instead of doing it on the PCI ROM on the physical
    device.
    
    As such, this needs to be available for PVH dom0 to access, or else
    the GPU won't work.
    
    Reported-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-and-Tested-by: Huang Rui <ray.huang@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/dom0_build.c | 1 +
 xen/include/acpi/actbl3.h     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 3ac6b7b423..d44de7f2b2 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -892,6 +892,7 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
         ACPI_SIG_DSDT, ACPI_SIG_FADT, ACPI_SIG_FACS, ACPI_SIG_PSDT,
         ACPI_SIG_SSDT, ACPI_SIG_SBST, ACPI_SIG_MCFG, ACPI_SIG_SLIC,
         ACPI_SIG_MSDM, ACPI_SIG_WDAT, ACPI_SIG_FPDT, ACPI_SIG_S3PT,
+        ACPI_SIG_VFCT,
     };
     unsigned int i;
 
diff --git a/xen/include/acpi/actbl3.h b/xen/include/acpi/actbl3.h
index 0a6778421f..6858d3e60f 100644
--- a/xen/include/acpi/actbl3.h
+++ b/xen/include/acpi/actbl3.h
@@ -79,6 +79,7 @@
 #define ACPI_SIG_MATR           "MATR"	/* Memory Address Translation Table */
 #define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
 #define ACPI_SIG_WPBT           "WPBT"	/* Windows Platform Binary Table */
+#define ACPI_SIG_VFCT           "VFCT"	/* AMD Video BIOS */
 
 /*
  * All tables must be byte-packed to match the ACPI specification, since
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 14 08:12:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509490.785321 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzlM-0002no-Oa; Tue, 14 Mar 2023 08:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509490.785321; Tue, 14 Mar 2023 08: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 1pbzlM-0002ng-Lm; Tue, 14 Mar 2023 08:12:04 +0000
Received: by outflank-mailman (input) for mailman id 509490;
 Tue, 14 Mar 2023 08: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 1pbzlK-0002nR-IM
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08: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 1pbzlK-0006cm-HP
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzlK-0006N8-GY
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08: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=JM/FHHS4cNfTTyXRn6gZPmlO/KJS7RNw2OPUWXaD+jk=; b=b0iwoFxWttNx1SmV0ScEnWecQ7
	Do3rUem7lWB0jv8YhSEyAW4I2/rtFAS2VhSS2vOrP84i0Rtp3+lq0gbBNjgMNDjnyqnfyJ+o2kkWD
	Eb7Nm+nezFaaZ98BYSNO0TGTsCNEY1w20EmwskE/ZD3pUz8RaJ2yV36CiPGFZflCVqio=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/platform: make XENPF_get_dom0_console actually usable
Message-Id: <E1pbzlK-0006N8-GY@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:12:02 +0000

commit 7d43e4b2aa42b826e3d373b8e802ba925cc73088
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 13 15:14:38 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 13 15:14:38 2023 +0100

    x86/platform: make XENPF_get_dom0_console actually usable
    
    struct dom0_vga_console_info has been extended in the past, and it may
    be extended again. The use in PV Dom0's start info already covers for
    that by supplying the size of the provided data. For the recently
    introduced platform-op size needs providing similarly. Go the easiest
    available route and simply supply size via the hypercall return value.
    
    While there also add a build-time check that possibly future growth of
    the struct won't affect xen_platform_op_t's size.
    
    Fixes: 4dd160583c79 ("x86/platform: introduce hypercall to get initial video console settings")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/platform_hypercall.c | 2 ++
 xen/include/public/platform.h     | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 08ab2fea62..85c69c5be5 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -841,6 +841,8 @@ ret_t do_platform_op(
 
 #ifdef CONFIG_VIDEO
     case XENPF_get_dom0_console:
+        BUILD_BUG_ON(sizeof(op->u.dom0_console) > sizeof(op->u.pad));
+        ret = sizeof(op->u.dom0_console);
         if ( !fill_console_start_info(&op->u.dom0_console) )
         {
             ret = -ENODEV;
diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h
index 14784dfa77..60caa5ce7e 100644
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -605,7 +605,11 @@ struct xenpf_symdata {
 typedef struct xenpf_symdata xenpf_symdata_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_symdata_t);
 
-/* Fetch the video console information and mode setup by Xen. */
+/*
+ * Fetch the video console information and mode setup by Xen.  A non-
+ * negative return value indicates the size of the (part of the) structure
+ * which was filled.
+ */
 #define XENPF_get_dom0_console 64
 typedef struct dom0_vga_console_info xenpf_dom0_console_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_dom0_console_t);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 14 08:12:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509491.785326 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzlW-0002qP-QI; Tue, 14 Mar 2023 08:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509491.785326; Tue, 14 Mar 2023 08: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 1pbzlW-0002qH-NN; Tue, 14 Mar 2023 08:12:14 +0000
Received: by outflank-mailman (input) for mailman id 509491;
 Tue, 14 Mar 2023 08: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 1pbzlU-0002q2-M6
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08: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 1pbzlU-0006d0-L8
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzlU-0006O8-KI
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08: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=tzyEHzM+eHpORtmd7PEKSGaoaheNgBcNZdXVQ5IpptY=; b=2tir44bEiDXmTTOeAHlxFSpvHY
	iZ1bWDdxQnhEY2g0QUXKuoNkJndCqeph4NuKPQhYyZoc2culN8KdkxzFlj6y2HXSm8pBqUflPsY2D
	dGDU9lDIZ4z/ymph8krVJB9+7GokyYP2GNuu0DDTneY2DK+siyRl9ZpmVqrGHix7clGw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] core-parking: fix build with gcc12 and NR_CPUS=1
Message-Id: <E1pbzlU-0006O8-KI@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:12:12 +0000

commit 4b0422f70feb4b1cd04598ffde805fc224f3812e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 13 15:15:42 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 13 15:15:42 2023 +0100

    core-parking: fix build with gcc12 and NR_CPUS=1
    
    Gcc12 takes issue with core_parking_remove()'s
    
        for ( ; i < cur_idle_nums; ++i )
            core_parking_cpunum[i] = core_parking_cpunum[i + 1];
    
    complaining that the right hand side array access is past the bounds of
    1. Clearly the compiler can't know that cur_idle_nums can only ever be
    zero in this case (as the sole CPU cannot be parked).
    
    Arrange for core_parking.c's contents to not be needed altogether, and
    then disable its building when NR_CPUS == 1.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/Kconfig              |  2 +-
 xen/arch/x86/platform_hypercall.c | 11 ++++++++---
 xen/arch/x86/sysctl.c             |  3 +++
 xen/common/Kconfig                |  1 +
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 6a7825f4ba..2a5c3304e2 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -10,7 +10,7 @@ config X86
 	select ALTERNATIVE_CALL
 	select ARCH_MAP_DOMAIN_PAGE
 	select ARCH_SUPPORTS_INT128
-	select CORE_PARKING
+	imply CORE_PARKING
 	select HAS_ALTERNATIVE
 	select HAS_COMPAT
 	select HAS_CPUFREQ
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 85c69c5be5..a2d9526355 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -727,12 +727,17 @@ ret_t do_platform_op(
         case XEN_CORE_PARKING_SET:
             idle_nums = min_t(uint32_t,
                     op->u.core_parking.idle_nums, num_present_cpus() - 1);
-            ret = continue_hypercall_on_cpu(
-                    0, core_parking_helper, (void *)(unsigned long)idle_nums);
+            if ( CONFIG_NR_CPUS > 1 )
+                ret = continue_hypercall_on_cpu(
+                        0, core_parking_helper,
+                        (void *)(unsigned long)idle_nums);
+            else if ( idle_nums )
+                ret = -EINVAL;
             break;
 
         case XEN_CORE_PARKING_GET:
-            op->u.core_parking.idle_nums = get_cur_idle_nums();
+            op->u.core_parking.idle_nums = CONFIG_NR_CPUS > 1
+                                           ? get_cur_idle_nums() : 0;
             ret = __copy_field_to_guest(u_xenpf_op, op, u.core_parking) ?
                   -EFAULT : 0;
             break;
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 6600eb4347..16625b57f0 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -178,6 +178,9 @@ long arch_do_sysctl(
                 ret = -EBUSY;
                 break;
             }
+            if ( CONFIG_NR_CPUS <= 1 )
+                /* Mimic behavior of smt_up_down_helper(). */
+                return 0;
             plug = op == XEN_SYSCTL_CPU_HOTPLUG_SMT_ENABLE;
             fn = smt_up_down_helper;
             hcpu = _p(plug);
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index f1ea3199c8..855c843113 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -10,6 +10,7 @@ config COMPAT
 
 config CORE_PARKING
 	bool
+	depends on NR_CPUS > 1
 
 config GRANT_TABLE
 	bool "Grant table support" if EXPERT
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 14 08:12:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Mar 2023 08:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.509492.785332 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pbzlf-0002tZ-Sf; Tue, 14 Mar 2023 08:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 509492.785332; Tue, 14 Mar 2023 08: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 1pbzlf-0002tS-Os; Tue, 14 Mar 2023 08:12:23 +0000
Received: by outflank-mailman (input) for mailman id 509492;
 Tue, 14 Mar 2023 08: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 1pbzle-0002sx-Pc
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08: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 1pbzle-0006d7-Ol
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pbzle-0006Oe-O0
 for xen-changelog@lists.xenproject.org; Tue, 14 Mar 2023 08: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=Z1Y/Gd/jJKdpaQYMXSadQVDheyLSs2g9lgLjImqjyg4=; b=RoBIBiL+4F4ttOFbTbAIFUwQ/O
	D8DxotMKtNz+JG5p/rcOIloGqCOuVwN5gfMUezyxG8V07XzKwQ+0sjq+fU+9Tbl51ljRMTfGGArew
	nVu5M905/yGuxhN4QZdURyDqmeCEm1D4PeUU9s/0hVGtt24zp1f2cTj97VDkzNsMFUoU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/altp2m: help gcc13 to avoid it emitting a warning
Message-Id: <E1pbzle-0006Oe-O0@xenbits.xenproject.org>
Date: Tue, 14 Mar 2023 08:12:22 +0000

commit be62b1fc2aa7375d553603fca07299da765a89fe
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 13 15:16:21 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 13 15:16:21 2023 +0100

    x86/altp2m: help gcc13 to avoid it emitting a warning
    
    Switches of altp2m-s always expect a valid altp2m to be in place (and
    indeed altp2m_vcpu_initialise() sets the active one to be at index 0).
    The compiler, however, cannot know that, and hence it cannot eliminate
    p2m_get_altp2m()'s case of returnin (literal) NULL. If then the compiler
    decides to special case that code path in the caller, the dereference in
    instances of
    
        atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
    
    can, to the code generator, appear to be NULL dereferences, leading to
    
    In function 'atomic_dec',
        inlined from '...' at ...:
    ./arch/x86/include/asm/atomic.h:182:5: error: array subscript 0 is outside array bounds of 'int[0]' [-Werror=array-bounds=]
    
    Aid the compiler by adding a BUG_ON() checking the return value of the
    problematic p2m_get_altp2m(). Since with the use of the local variable
    the 2nd p2m_get_altp2m() each will look questionable at the first glance
    (Why is the local variable not used here?), open-code the only relevant
    piece of p2m_get_altp2m() there.
    
    To avoid repeatedly doing these transformations, and also to limit how
    "bad" the open-coding really is, convert the entire operation to an
    inline helper, used by all three instances (and accepting the redundant
    BUG_ON(idx >= MAX_ALTP2M) in two of the three cases).
    
    Reported-by: Charles Arnold <carnold@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmx.c     |  8 +-------
 xen/arch/x86/include/asm/p2m.h | 20 ++++++++++++++++++++
 xen/arch/x86/mm/p2m.c          | 14 ++------------
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 278b829f73..00b531f76c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4128,13 +4128,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
             }
         }
 
-        if ( idx != vcpu_altp2m(v).p2midx )
-        {
-            BUG_ON(idx >= MAX_ALTP2M);
-            atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-            vcpu_altp2m(v).p2midx = idx;
-            atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
-        }
+        p2m_set_altp2m(v, idx);
     }
 
     if ( unlikely(currd->arch.monitor.vmexit_enabled) )
diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index bd684d02f3..cd43d8621a 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -879,6 +879,26 @@ static inline struct p2m_domain *p2m_get_altp2m(struct vcpu *v)
     return v->domain->arch.altp2m_p2m[index];
 }
 
+/* set current alternate p2m table */
+static inline bool p2m_set_altp2m(struct vcpu *v, unsigned int idx)
+{
+    struct p2m_domain *orig;
+
+    BUG_ON(idx >= MAX_ALTP2M);
+
+    if ( idx == vcpu_altp2m(v).p2midx )
+        return false;
+
+    orig = p2m_get_altp2m(v);
+    BUG_ON(!orig);
+    atomic_dec(&orig->active_vcpus);
+
+    vcpu_altp2m(v).p2midx = idx;
+    atomic_inc(&v->domain->arch.altp2m_p2m[idx]->active_vcpus);
+
+    return true;
+}
+
 /* Switch alternate p2m for a single vcpu */
 bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx);
 
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index c5561fe221..7e481aec38 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1789,13 +1789,8 @@ bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx)
 
     if ( d->arch.altp2m_eptp[idx] != mfn_x(INVALID_MFN) )
     {
-        if ( idx != vcpu_altp2m(v).p2midx )
-        {
-            atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-            vcpu_altp2m(v).p2midx = idx;
-            atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
+        if ( p2m_set_altp2m(v, idx) )
             altp2m_vcpu_update_p2m(v);
-        }
         rc = 1;
     }
 
@@ -2072,13 +2067,8 @@ int p2m_switch_domain_altp2m_by_id(struct domain *d, unsigned int idx)
     if ( d->arch.altp2m_visible_eptp[idx] != mfn_x(INVALID_MFN) )
     {
         for_each_vcpu( d, v )
-            if ( idx != vcpu_altp2m(v).p2midx )
-            {
-                atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-                vcpu_altp2m(v).p2midx = idx;
-                atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
+            if ( p2m_set_altp2m(v, idx) )
                 altp2m_vcpu_update_p2m(v);
-            }
 
         rc = 0;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 15 13:33:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Mar 2023 13:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510061.787063 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pcRFX-0004tg-CR; Wed, 15 Mar 2023 13:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510061.787063; Wed, 15 Mar 2023 13:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pcRFX-0004tY-8w; Wed, 15 Mar 2023 13:33:03 +0000
Received: by outflank-mailman (input) for mailman id 510061;
 Wed, 15 Mar 2023 13: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 1pcRFV-0004sx-UP
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13: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 1pcRFV-0006IA-TF
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pcRFV-0005eH-RL
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=01N/bG70R7HH+2LbZzFu9OVhTErmNso8WyxYh0gPzyU=; b=Ld6EAOyoGMCszVen0zjDo9MfIv
	WAcCMEI1q/yId8mJcm9YHtDoRD4FRiP6C2+s47f8VRbLxM9h8DfgIysDeE1j8ZfhcSwbKM6qPTd5R
	br6aNpcrjMLjHh5iHpYB9oi0gXkB8nKRxLueue0n/AE9EInVumqIvfTaSaA4SwQFU/Qg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul/test: suppress GNU ld 2.39 warning about RWX load segments
Message-Id: <E1pcRFV-0005eH-RL@xenbits.xenproject.org>
Date: Wed, 15 Mar 2023 13:33:01 +0000

commit 4252432be883a72e154dc6302e434e8d4812fc95
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 14 10:42:51 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 14 10:42:51 2023 +0100

    x86emul/test: suppress GNU ld 2.39 warning about RWX load segments
    
    Commit 68f5aac012b9 ("build: suppress future GNU ld warning about RWX
    load segments") didn't quite cover all the cases: I missed ones in the
    building of the test code blobs. Clone the workaround to the helper
    Makefile in question, kind of open-coding the hypervisor build system's
    ld-option macro.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/x86_emulator/testcase.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index d4aa82e3f3..fc95e24589 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -6,6 +6,8 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
 CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags)
 
+LDFLAGS_DIRECT += $(shell { $(LD) -v --warn-rwx-segments; } >/dev/null 2>&1 && echo --no-warn-rwx-segments)
+
 .PHONY: all
 all: $(TESTCASE).bin
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 15 13:33:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Mar 2023 13:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510062.787067 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pcRFh-00050L-E8; Wed, 15 Mar 2023 13:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510062.787067; Wed, 15 Mar 2023 13:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pcRFh-00050D-AO; Wed, 15 Mar 2023 13:33:13 +0000
Received: by outflank-mailman (input) for mailman id 510062;
 Wed, 15 Mar 2023 13: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 1pcRFg-0004zs-1e
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13: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 1pcRFg-0006IH-0h
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pcRFf-0005f7-Vm
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EIZkQN7aSYGXnJPV8cSltdNAgULdFLcOo4u5CtW2rtM=; b=PX5ISUHSkIfHuib441J9twnmqD
	HkXWWJJFeePb+SVcsDLus+XeK9UA1wryru007w6ZS3D0AgeM+m9oEgzGBkyGGkwHVbIyu1CJ6un2f
	Y44SPaW4Lx77u5ON1l/9Qs/07t4hgGmsJr1Ytj5C2Qz53Lvmy4YYDIxgmHhiuCZu/6Qo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: constrain IGD check
Message-Id: <E1pcRFf-0005f7-Vm@xenbits.xenproject.org>
Date: Wed, 15 Mar 2023 13:33:11 +0000

commit f8c4317295fa1cde1a81779b7e362651c084efb8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 14 10:44:08 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 14 10:44:08 2023 +0100

    VT-d: constrain IGD check
    
    Marking a DRHD as controlling an IGD isn't very sensible without
    checking that at the very least it's a graphics device that lives at
    0000:00:02.0. Re-use the reading of the class-code to control both the
    clearing of "gfx_only" and the setting of "igd_drhd_address".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/dmar.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 78c8bad151..78d4526446 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -391,15 +391,12 @@ static int __init acpi_parse_dev_scope(
 
             if ( drhd )
             {
-                if ( (seg == 0) && (bus == 0) && (path->dev == 2) &&
-                     (path->fn == 0) )
-                    igd_drhd_address = drhd->address;
-
-                if ( gfx_only &&
-                     pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
+                if ( pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
                                     PCI_CLASS_DEVICE + 1) != 0x03
                                     /* PCI_BASE_CLASS_DISPLAY */ )
                     gfx_only = false;
+                else if ( !seg && !bus && path->dev == 2 && !path->fn )
+                    igd_drhd_address = drhd->address;
             }
 
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 15 13:33:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Mar 2023 13:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510065.787070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pcRFr-000540-Eq; Wed, 15 Mar 2023 13:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510065.787070; Wed, 15 Mar 2023 13: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 1pcRFr-00053s-Bq; Wed, 15 Mar 2023 13:33:23 +0000
Received: by outflank-mailman (input) for mailman id 510065;
 Wed, 15 Mar 2023 13: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 1pcRFq-00053J-4x
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13: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 1pcRFq-0006IQ-44
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pcRFq-0005fW-39
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q9F7ZD8zwckT0eO9vkctSWcy27V5J0Y+TCkwaLFMbM4=; b=WTaya9e4PN1KDO0fieFBQ7PtB5
	giVk94tqiSi/nuZYeNaRTUwpl8ns7x9XT0s/R2wljemwjPevODIyKa6SGKxDH4iapfW6k0BeAf41z
	Z2pNmJMQwRr1s8i1zYFNP9ObW2MnbnHFCeml/i7HlZDbYzGajUeYnQHuiW6qvbOJicCs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: run targets cscope,tags,... using tree-wide approach
Message-Id: <E1pcRFq-0005fW-39@xenbits.xenproject.org>
Date: Wed, 15 Mar 2023 13:33:22 +0000

commit e6e92adf47bf50a9e944efdc123f0bc2e3cb0790
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Mar 14 10:44:47 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 14 10:44:47 2023 +0100

    build: run targets cscope,tags,... using tree-wide approach
    
    Despite being a matter of taste, in general, there are two main approaches
    when dealing with code tagging: tree-wide, where all the sources are taken
    into account or config-wide, when considering Kconfig options and actually
    built files. At the moment, all_sources variable is defined using SUBDIRS,
    which lists all the directories except arch/, where only $(TARGET_ARCH)
    is taken into account. This makes it difficult to reason about and creates
    fuzzy boundaries being a blocker when considering new directories that
    might be config-dependent (like crypto/ which is missing in SUBDIRS).
    
    For now, switch to the intermediate solution to list all the directories
    in SUBDIRS without exceptions (also include crypto/). This way, the
    approach taken is clear allowing new directories to be listed right away
    without waiting to fix the infrastructure first. In the future, we can
    then add support for config-wide approach.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 2d55bb9401..2710d7327e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -589,7 +589,7 @@ $(TARGET): outputmakefile FORCE
 	$(Q)$(MAKE) $(build)=. arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
 	$(Q)$(MAKE) $(build)=. MKRELOC=$(MKRELOC) 'ALL_OBJS=$(ALL_OBJS-y)' 'ALL_LIBS=$(ALL_LIBS-y)' $@
 
-SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
+SUBDIRS = xsm arch common crypto drivers lib test
 define all_sources
     ( find include -type f -name '*.h' -print; \
       find $(SUBDIRS) -type f -name '*.[chS]' -print )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 15 13:33:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Mar 2023 13:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510068.787074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pcRG1-0005Et-GO; Wed, 15 Mar 2023 13:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510068.787074; Wed, 15 Mar 2023 13: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 1pcRG1-0005Ek-DZ; Wed, 15 Mar 2023 13:33:33 +0000
Received: by outflank-mailman (input) for mailman id 510068;
 Wed, 15 Mar 2023 13: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 1pcRG0-0005DH-8i
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13: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 1pcRG0-0006Ia-7n
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pcRG0-0005gJ-6f
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p3JaTkvRxgKLfLd4SBqT6gl759sVBW6FuYPeD/AQt3c=; b=1vcwqZJB6vpi9h3/MuBSJVPuf3
	/IszRf0mp3E8Hw+bZ3N3xSszsnWkP3PNHANNPJZMGbK5wochfRFP91bGBgJ5b7AcXJRV1fqKuTI7O
	FpDYTvsV95jJuTAtlp0PUQWHmq7QhuxXWdw0wW6/Jo9T6lxSwhIcLwLq2VMfZqCFjSHk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] bunzip: work around gcc13 warning
Message-Id: <E1pcRG0-0005gJ-6f@xenbits.xenproject.org>
Date: Wed, 15 Mar 2023 13:33:32 +0000

commit 402195e56de0aacf97e05c80ed367d464ca6938b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 14 10:45:28 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 14 10:45:28 2023 +0100

    bunzip: work around gcc13 warning
    
    While provable that length[0] is always initialized (because symCount
    cannot be zero), upcoming gcc13 fails to recognize this and warns about
    the unconditional use of the value immediately following the loop.
    
    See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106511.
    
    Reported-by: Martin Liška <martin.liska@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/bunzip2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 61b80aff1b..4466426941 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -233,6 +233,11 @@ static int __init get_next_block(struct bunzip_data *bd)
 		   becomes negative, so an unsigned inequality catches
 		   it.) */
 		t = get_bits(bd, 5)-1;
+		/* GCC 13 has apparently improved use-before-set detection, but
+		   it can't figure out that length[0] is always intialized by
+		   virtue of symCount always being positive when making it here.
+		   See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106511. */
+		length[0] = 0;
 		for (i = 0; i < symCount; i++) {
 			for (;;) {
 				if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 15 13:33:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Mar 2023 13:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510069.787078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pcRGB-0005K4-Hn; Wed, 15 Mar 2023 13:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510069.787078; Wed, 15 Mar 2023 13:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pcRGB-0005Jw-F5; Wed, 15 Mar 2023 13:33:43 +0000
Received: by outflank-mailman (input) for mailman id 510069;
 Wed, 15 Mar 2023 13: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 1pcRGA-0005Jm-Dw
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13: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 1pcRGA-0006Ii-Cz
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pcRGA-0005gm-AK
 for xen-changelog@lists.xenproject.org; Wed, 15 Mar 2023 13:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=J8wVje08SPK09jKhnIDvvwwNvFSdhnICvmJvyS/SPzI=; b=INjOZoJmwDVGC845w99QVKu859
	ucqppWOE/5ZxmW5lW/xYZevYy4L4PkublowhZlv4BPpiX233Hml85cst69gTDdORyirbT5Bumy7vV
	lyqoWQL2BdjoF3jajGbL6eGOqSY3msX3IfPo/db1odKpuYOkPIPBRyPKk70iN9KzxVjY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] flask/label-pci: Allow specifying optional irq label
Message-Id: <E1pcRGA-0005gm-AK@xenbits.xenproject.org>
Date: Wed, 15 Mar 2023 13:33:42 +0000

commit de819c96c863467b6e625cd7197d17682f6c6122
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Mar 14 10:46:00 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 14 10:46:00 2023 +0100

    flask/label-pci: Allow specifying optional irq label
    
    IRQs can be shared between devices, so using the same label as the PCI
    device can create conflicts where the IRQ is labeled with one of the
    device labels preventing assignment of the second device to the second
    domain.  Add the ability to specify an irq label distinct from the PCI
    device, so a shared irq label can be specified.  The policy would then
    be written such that the two domains can each use the shared IRQ type in
    addition to their labeled PCI device.  That way we can still label most
    of the PCI device resources and assign devices in the face of shared
    IRQs.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 docs/misc/xsm-flask.txt       | 16 ++++++++++++++++
 tools/flask/utils/label-pci.c | 13 ++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/docs/misc/xsm-flask.txt b/docs/misc/xsm-flask.txt
index 2419c5cf29..ba89ebbfd8 100644
--- a/docs/misc/xsm-flask.txt
+++ b/docs/misc/xsm-flask.txt
@@ -205,6 +205,22 @@ parameter, which can also be changed using xl setenforce).  When using the
 default types for domains (domU_t), the example policy shipped with Xen should
 allow the same operations on or between domains as when not using FLASK.
 
+By default, flask-label-pci labels the device, I/O ports, memory and IRQ with
+the provided label.  These are all unique per-device, except for IRQs which
+can be shared between devices.  This leads to assignment problems since vmA_t
+can't access the IRQ devB_t.  To work around this issue, flask-label-pci
+takes an optional 3rd argument to label the IRQ:
+
+    flask-label-pci 0000:03:02.0 system_u:object_r:nic_dev_t \
+        system_u:object_r:shared_irq_t
+
+The IRQ labeling only applies to the PIRQ - MSI/MSI-X interrupts are labeled
+with the main device label.
+
+The policy needs to define the shared_irq_t with:
+    type shared_irq_t, resource_type;
+
+And the policy needs to be updated to allow domains appropriate access.
 
 MLS/MCS policy
 --------------
diff --git a/tools/flask/utils/label-pci.c b/tools/flask/utils/label-pci.c
index 9ddb713cf4..897b772804 100644
--- a/tools/flask/utils/label-pci.c
+++ b/tools/flask/utils/label-pci.c
@@ -28,7 +28,7 @@
 
 static void usage (int argCnt, char *argv[])
 {
-	fprintf(stderr, "Usage: %s SBDF label\n", argv[0]);
+	fprintf(stderr, "Usage: %s SBDF label <irq_label>\n", argv[0]);
 	exit(1);
 }
 
@@ -39,12 +39,19 @@ int main (int argCnt, char *argv[])
 	int seg, bus, dev, fn;
 	uint32_t sbdf;
 	uint64_t start, end, flags;
+	char *pirq_label;
 	char buf[1024];
 	FILE *f;
 
-	if (argCnt != 3)
+	if (argCnt < 3 || argCnt > 4)
 		usage(argCnt, argv);
 
+	if (argCnt == 4) {
+	    pirq_label = argv[3];
+	} else {
+	    pirq_label = argv[2];
+	}
+
 	xch = xc_interface_open(0,0,0);
 	if ( !xch )
 	{
@@ -107,7 +114,7 @@ int main (int argCnt, char *argv[])
 	if (fscanf(f, "%" SCNu64, &start) != 1)
 		start = 0;
 	if (start) {
-		ret = xc_flask_add_pirq(xch, start, argv[2]);
+		ret = xc_flask_add_pirq(xch, start, pirq_label);
 		if (ret) {
 			fprintf(stderr, "xc_flask_add_pirq %"PRIu64" failed: %d\n",
 					start, ret);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 16 20:11:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Mar 2023 20:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510816.789215 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctwF-0007AC-FA; Thu, 16 Mar 2023 20:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510816.789215; Thu, 16 Mar 2023 20:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctwF-0007A4-B8; Thu, 16 Mar 2023 20:11:03 +0000
Received: by outflank-mailman (input) for mailman id 510816;
 Thu, 16 Mar 2023 20:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwE-00078i-F1
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwE-0001C0-CR
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwE-0007Vp-BD
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cUhk3lGFUrfFcR/RpcjxvD5LnEYNFfn0Oewr0wVi/W8=; b=YxiCD/68aafYeWc/5fcb0NfZ6k
	1inzfNeASvE1MQ5sNTVxzimMhQYvs3hWATJjGbAQS5P3Po0nCgP38jILaFdH49+DMAsHRrl7RY1D7
	6p0KQrcnI8+pHYgVkHhCBxNaHcxeK0L4rBki1x+pSbm/y8vrizbzlTHMlsxdmwax5e/U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arch/arm: irq: Add platform_get_irq_byname() implementation
Message-Id: <E1pctwE-0007Vp-BD@xenbits.xenproject.org>
Date: Thu, 16 Mar 2023 20:11:02 +0000

commit 91cecd4efcdbce70d6f207b6850eccbd1a171c1d
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Mon Mar 13 15:08:02 2023 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Mar 14 17:03:22 2023 -0700

    arch/arm: irq: Add platform_get_irq_byname() implementation
    
    Moved implementation for the function which parses the IRQs of a DT
    node by the "interrupt-names" property from the SMMU-v3 driver
    to the IRQ core code and made it non-static to be used as helper.
    
    Also changed it to receive a "struct dt_device_node*" as parameter,
    like its counterpart, platform_get_irq(). Updated its usage inside
    the SMMU-v3 driver accordingly.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/irq.h        |  2 ++
 xen/arch/arm/irq.c                    | 14 ++++++++++++++
 xen/drivers/passthrough/arm/smmu-v3.c | 35 ++++++-----------------------------
 3 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index 245f49dcba..af94f41994 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -89,6 +89,8 @@ int irq_set_type(unsigned int irq, unsigned int type);
 
 int platform_get_irq(const struct dt_device_node *device, int index);
 
+int platform_get_irq_byname(struct dt_device_node *np, const char *name);
+
 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);
 
 /*
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 79718f68e7..ded495792b 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -718,6 +718,20 @@ int platform_get_irq(const struct dt_device_node *device, int index)
     return irq;
 }
 
+int platform_get_irq_byname(struct dt_device_node *np, const char *name)
+{
+	int index;
+
+	if ( unlikely(!name) )
+		return -EINVAL;
+
+	index = dt_property_match_string(np, "interrupt-names", name);
+	if ( index < 0 )
+		return index;
+
+	return platform_get_irq(np, index);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index d58c5cd0bf..bfdb62b395 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -200,30 +200,6 @@ static inline void dev_iommu_priv_set(struct device *dev, void *priv)
 	fwspec->iommu_priv = priv;
 }
 
-static int platform_get_irq_byname_optional(struct device *dev,
-				const char *name)
-{
-	int index, ret;
-	struct dt_device_node *np  = dev_to_dt(dev);
-
-	if (unlikely(!name))
-		return -EINVAL;
-
-	index = dt_property_match_string(np, "interrupt-names", name);
-	if (index < 0) {
-		dev_info(dev, "IRQ %s not found\n", name);
-		return index;
-	}
-
-	ret = platform_get_irq(np, index);
-	if (ret < 0) {
-		dev_err(dev, "failed to get irq index %d\n", index);
-		return -ENODEV;
-	}
-
-	return ret;
-}
-
 /* Start of Linux SMMUv3 code */
 static bool disable_bypass = 1;
 
@@ -2434,6 +2410,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
 	int irq, ret;
 	paddr_t ioaddr, iosize;
 	struct arm_smmu_device *smmu;
+	struct dt_device_node *np = dev_to_dt(pdev);
 
 	smmu = xzalloc(struct arm_smmu_device);
 	if (!smmu)
@@ -2451,7 +2428,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
 	}
 
 	/* Base address */
-	ret = dt_device_get_address(dev_to_dt(pdev), 0, &ioaddr, &iosize);
+	ret = dt_device_get_address(np, 0, &ioaddr, &iosize);
 	if (ret)
 		goto out_free_smmu;
 
@@ -2484,19 +2461,19 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
 
 	/* Interrupt lines */
 
-	irq = platform_get_irq_byname_optional(pdev, "combined");
+	irq = platform_get_irq_byname(np, "combined");
 	if (irq > 0)
 		smmu->combined_irq = irq;
 	else {
-		irq = platform_get_irq_byname_optional(pdev, "eventq");
+		irq = platform_get_irq_byname(np, "eventq");
 		if (irq > 0)
 			smmu->evtq.q.irq = irq;
 
-		irq = platform_get_irq_byname_optional(pdev, "priq");
+		irq = platform_get_irq_byname(np, "priq");
 		if (irq > 0)
 			smmu->priq.q.irq = irq;
 
-		irq = platform_get_irq_byname_optional(pdev, "gerror");
+		irq = platform_get_irq_byname(np, "gerror");
 		if (irq > 0)
 			smmu->gerr_irq = irq;
 	}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 16 20:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Mar 2023 20:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510817.789217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctwP-0007Gk-FT; Thu, 16 Mar 2023 20:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510817.789217; Thu, 16 Mar 2023 20:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctwP-0007Gc-Cq; Thu, 16 Mar 2023 20:11:13 +0000
Received: by outflank-mailman (input) for mailman id 510817;
 Thu, 16 Mar 2023 20:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwO-0007GC-HG
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwO-0001C4-GJ
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwO-0007WI-Ez
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KX/gg3+TaxkSAkX89DGA6PbM664ZF4dmL8zbEOJWR78=; b=qyOeVVmJm+kT50qcKv81UklcVk
	C/r+jpzkN5cctudw9ljiaXhQ5hvvWTlFfVnpj10wgDo7+hAZpJbbLUlkger4EFIQlEcqrxTs6W6sC
	5E32Kl6JJX0j5NzzefD9zAMQAT2GVRksw6jFKDCNvHrR451YuiXDYY6u/3f8SVWMKbGo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arch/arm: time: Add support for parsing interrupts by names
Message-Id: <E1pctwO-0007WI-Ez@xenbits.xenproject.org>
Date: Thu, 16 Mar 2023 20:11:12 +0000

commit 391f1e135fc121ce8cd5d864eb856988e1562e58
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Mon Mar 13 15:08:03 2023 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Mar 14 17:03:23 2023 -0700

    arch/arm: time: Add support for parsing interrupts by names
    
    Added support for parsing the ARM generic timer interrupts DT
    node by the "interrupt-names" property, if it is available.
    
    If not available, the usual parsing based on the expected
    IRQ order is performed.
    
    Also treated returning 0 as an error case for the
    platform_get_irq() calls, since it is not a valid PPI ID and
    treating it as a valid case would only cause Xen to BUG() later,
    when trying to reserve vIRQ being SGI.
    
    Added the "hyp-virt" PPI to the timer PPI list, even
    though it's currently not in use. If the "hyp-virt" PPI is
    not found, the hypervisor won't panic.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/time.h |  3 ++-
 xen/arch/arm/time.c             | 26 ++++++++++++++++++++++----
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/include/asm/time.h b/xen/arch/arm/include/asm/time.h
index 4b401c1110..49ad8c1a6d 100644
--- a/xen/arch/arm/include/asm/time.h
+++ b/xen/arch/arm/include/asm/time.h
@@ -82,7 +82,8 @@ enum timer_ppi
     TIMER_PHYS_NONSECURE_PPI = 1,
     TIMER_VIRT_PPI = 2,
     TIMER_HYP_PPI = 3,
-    MAX_TIMER_PPI = 4,
+    TIMER_HYP_VIRT_PPI = 4,
+    MAX_TIMER_PPI = 5,
 };
 
 /*
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index 433d7be909..0b482d7db3 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -149,15 +149,33 @@ static void __init init_dt_xen_time(void)
 {
     int res;
     unsigned int i;
+    bool has_names;
+    static const char * const timer_irq_names[MAX_TIMER_PPI] __initconst = {
+        [TIMER_PHYS_SECURE_PPI] = "sec-phys",
+        [TIMER_PHYS_NONSECURE_PPI] = "phys",
+        [TIMER_VIRT_PPI] = "virt",
+        [TIMER_HYP_PPI] = "hyp-phys",
+        [TIMER_HYP_VIRT_PPI] = "hyp-virt",
+    };
+
+    has_names = dt_property_read_bool(timer, "interrupt-names");
 
     /* Retrieve all IRQs for the timer */
     for ( i = TIMER_PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ )
     {
-        res = platform_get_irq(timer, i);
-
-        if ( res < 0 )
+        if ( has_names )
+            res = platform_get_irq_byname(timer, timer_irq_names[i]);
+        else
+            res = platform_get_irq(timer, i);
+
+        if ( res > 0 )
+            timer_irq[i] = res;
+        /*
+         * Do not panic if "hyp-virt" PPI is not found, since it's not
+         * currently used.
+         */
+        else if ( i != TIMER_HYP_VIRT_PPI )
             panic("Timer: Unable to retrieve IRQ %u from the device tree\n", i);
-        timer_irq[i] = res;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 16 20:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Mar 2023 20:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510818.789221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctwZ-0007Pp-H2; Thu, 16 Mar 2023 20:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510818.789221; Thu, 16 Mar 2023 20: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 1pctwZ-0007Ph-EM; Thu, 16 Mar 2023 20:11:23 +0000
Received: by outflank-mailman (input) for mailman id 510818;
 Thu, 16 Mar 2023 20:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwY-0007PR-Kw
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwY-0001Cg-Jn
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwY-0007Wj-Ip
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dys4Bv+xvsR8IZwzZWOWI7rxoqf+k+DQ4/pmhTHmS+A=; b=P1GNi8h8BPe6xH2iWWG6t/U5X2
	dRiio0Uo9bHdOXeSUA+jPiEN2+0dyg6Wwbf2mw5u1arOpVNV1ktL3b+2hT9dnH+0Q8RpcbD0r2hxL
	420j4elkea7CfcodGosipyCuq8QEkIGcARYPzrOTxTIOAWaQRrVPJIVzOu8+/HrDJKKg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] golang/xenlight: Extend KeyedUnion to support Arrays
Message-Id: <E1pctwY-0007Wj-Ip@xenbits.xenproject.org>
Date: Thu, 16 Mar 2023 20:11:22 +0000

commit d03246206ceb5d7e93308bb79f9611fbe65dec2b
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Mon Mar 6 15:40:22 2023 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 15 18:41:46 2023 +0000

    golang/xenlight: Extend KeyedUnion to support Arrays
    
    Generation for KeyedUnion types doesn't support Arrays.  The smbios
    support will place an smbios array inside the hvm KeyedUnion, and
    gentotypes doesn't generate buildable Go code.
    
    Have KeyedUnion add an idl.Array check and issue the approriate
    xenlight_golang_array_to_C and xenlight_golang_array_from_C calls when
    needed.  This matches how it is done in xenlight_golang_define_to_C &
    xenlight_golang_define_from_C
    
    xenlight_golang_array_to_C and xenlight_golang_array_from_C need to be
    extended to set the cvarname and govarname as approriate for the
    KeyedUnion cases to match the surrounding code.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 tools/golang/xenlight/gengotypes.py | 41 ++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index 9fec60602d..e4eb7ca1c1 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -376,6 +376,10 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
         s += 'tmp := (*C.{0})(unsafe.Pointer(&xc.{1}[0]))\n'.format(typename,union_name)
 
         for nf in f.type.fields:
+            if isinstance(nf.type, idl.Array):
+                s += xenlight_golang_array_from_C(nf,cvarname='tmp')
+                continue
+
             s += xenlight_golang_convert_from_C(nf,cvarname='tmp')
 
         s += 'return nil\n'
@@ -416,7 +420,7 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
 
     return (s,extras)
 
-def xenlight_golang_array_from_C(ty = None):
+def xenlight_golang_array_from_C(ty = None, cvarname = 'xc'):
     """
     Convert C array to Go slice using the method
     described here:
@@ -433,9 +437,9 @@ def xenlight_golang_array_from_C(ty = None):
     clenvar    = ty.type.lenvar.name
 
     s += 'x.{0} = nil\n'.format(goname)
-    s += 'if n := int(xc.{0}); n > 0 {{\n'.format(clenvar)
+    s += 'if n := int({0}.{1}); n > 0 {{\n'.format(cvarname,clenvar)
     s += '{0} := '.format(cslice)
-    s +='(*[1<<28]C.{0})(unsafe.Pointer(xc.{1}))[:n:n]\n'.format(ctypename, cname)
+    s +='(*[1<<28]C.{0})(unsafe.Pointer({1}.{2}))[:n:n]\n'.format(ctypename, cvarname, cname)
     s += 'x.{0} = make([]{1}, n)\n'.format(goname, gotypename)
     s += 'for i, v := range {0} {{\n'.format(cslice)
 
@@ -579,6 +583,11 @@ def xenlight_golang_union_to_C(ty = None, union_name = '',
 
         s += 'var {0} C.{1}\n'.format(f.name,cgotype)
         for uf in f.type.fields:
+            if isinstance(uf.type, idl.Array):
+                s += xenlight_golang_array_to_C(uf, cvarname=f.name,
+                                                govarname="tmp")
+                continue
+
             s += xenlight_golang_convert_to_C(uf,cvarname=f.name,
                                               govarname='tmp')
 
@@ -596,7 +605,7 @@ def xenlight_golang_union_to_C(ty = None, union_name = '',
 
     return s
 
-def xenlight_golang_array_to_C(ty = None):
+def xenlight_golang_array_to_C(ty = None, cvarname="xc", govarname="x"):
     s = ''
 
     gotypename = xenlight_golang_fmt_name(ty.type.elem_type.typename)
@@ -608,27 +617,27 @@ def xenlight_golang_array_to_C(ty = None):
 
     is_enum = isinstance(ty.type.elem_type,idl.Enumeration)
     if gotypename in go_builtin_types or is_enum:
-        s += 'if {0} := len(x.{1}); {2} > 0 {{\n'.format(golenvar,goname,golenvar)
-        s += 'xc.{0} = (*C.{1})(C.malloc(C.size_t({2}*{3})))\n'.format(cname,ctypename,
+        s += 'if {0} := len({1}.{2}); {3} > 0 {{\n'.format(golenvar,govarname,goname,golenvar)
+        s += '{0}.{1} = (*C.{2})(C.malloc(C.size_t({3}*{4})))\n'.format(cvarname,cname,ctypename,
                                                                    golenvar,golenvar)
-        s += 'xc.{0} = C.int({1})\n'.format(clenvar,golenvar)
-        s += 'c{0} := (*[1<<28]C.{1})(unsafe.Pointer(xc.{2}))[:{3}:{4}]\n'.format(goname,
-                                                                      ctypename,cname,
+        s += '{0}.{1} = C.int({2})\n'.format(cvarname,clenvar,golenvar)
+        s += 'c{0} := (*[1<<28]C.{1})(unsafe.Pointer({2}.{3}))[:{4}:{5}]\n'.format(goname,
+                                                                      ctypename,cvarname,cname,
                                                                       golenvar,golenvar)
-        s += 'for i,v := range x.{0} {{\n'.format(goname)
+        s += 'for i,v := range {0}.{1} {{\n'.format(govarname,goname)
         s += 'c{0}[i] = C.{1}(v)\n'.format(goname,ctypename)
         s += '}\n}\n'
 
         return s
 
-    s += 'if {0} := len(x.{1}); {2} > 0 {{\n'.format(golenvar,goname,golenvar)
-    s += 'xc.{0} = (*C.{1})(C.malloc(C.ulong({2})*C.sizeof_{3}))\n'.format(cname,ctypename,
+    s += 'if {0} := len({1}.{2}); {3} > 0 {{\n'.format(golenvar,govarname,goname,golenvar)
+    s += '{0}.{1} = (*C.{2})(C.malloc(C.ulong({3})*C.sizeof_{4}))\n'.format(cvarname,cname,ctypename,
                                                                    golenvar,ctypename)
-    s += 'xc.{0} = C.int({1})\n'.format(clenvar,golenvar)
-    s += 'c{0} := (*[1<<28]C.{1})(unsafe.Pointer(xc.{2}))[:{3}:{4}]\n'.format(goname,
-                                                                         ctypename,cname,
+    s += '{0}.{1} = C.int({2})\n'.format(cvarname,clenvar,golenvar)
+    s += 'c{0} := (*[1<<28]C.{1})(unsafe.Pointer({2}.{3}))[:{4}:{5}]\n'.format(goname,
+                                                                         ctypename,cvarname,cname,
                                                                          golenvar,golenvar)
-    s += 'for i,v := range x.{0} {{\n'.format(goname)
+    s += 'for i,v := range {0}.{1} {{\n'.format(govarname,goname)
     s += 'if err := v.toC(&c{0}[i]); err != nil {{\n'.format(goname)
     s += 'return fmt.Errorf("converting field {0}: %v", err)\n'.format(goname)
     s += '}\n}\n}\n'
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 16 20:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Mar 2023 20:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510819.789226 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctwj-0007ZA-Ic; Thu, 16 Mar 2023 20:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510819.789226; Thu, 16 Mar 2023 20: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 1pctwj-0007Z2-Fv; Thu, 16 Mar 2023 20:11:33 +0000
Received: by outflank-mailman (input) for mailman id 510819;
 Thu, 16 Mar 2023 20:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwi-0007Xp-P0
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwi-0001Cn-OB
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctwi-0007XJ-N1
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FVYXrRDJItiutlz5K5FOVfxa3BEqMCTtn8GWu4mCsU0=; b=MQDbqIM03ICKH/hkKDU/q4L3+h
	D98x/Irlt/7HdeD7hKvNjLqmWDbsj/dJTtEP8las3EUJ4ROIPEImOqTGJ9rB7nxFS4VGC0fAbUk+H
	c8vMW+VP3INXuK2wtbiCpWn6O54/hLA4a0ksqivHsAbXSK1zI3jzdD2t+1Hv0ryY9+FM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xl/libxl: Add ability to specify SMBIOS strings
Message-Id: <E1pctwi-0007XJ-N1@xenbits.xenproject.org>
Date: Thu, 16 Mar 2023 20:11:32 +0000

commit 9aeb3a20c4bf42f449f8d7a517bb1fd339bd690f
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Mon Mar 6 15:40:23 2023 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 15 18:41:46 2023 +0000

    xl/libxl: Add ability to specify SMBIOS strings
    
    hvm_xs_strings.h specifies xenstore entries which can be used to set or
    override smbios strings.  hvmloader has support for reading them, but
    xl/libxl support is not wired up.
    
    Allow specifying the strings with the new xl.cfg option:
    smbios=["bios_vendor=Xen Project","system_version=1.0"]
    
    In terms of strings, the SMBIOS specification 3.5 says:
    https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.5.0.pdf
    """
    Strings must be encoded as UTF-8 with no byte order mark (BOM). For
    compatibility with older SMBIOS parsers, US-ASCII characters should be
    used.  NOTE There is no limit on the length of each individual text
    string. However, the length of the entire structure table (including all
    strings) must be reported in the Structure Table Length field of the
    32-bit Structure Table Entry Point (see 5.2.1) and/or the Structure
    Table Maximum Size field of the 64-bit Structure Table Entry Point (see
    5.2.2).
    """
    
    The strings aren't checked for utf-8 or length.  hvmloader has a sanity
    check on the overall length.
    
    The libxl_smbios_type enum starts at 1 since otherwise the 0th key is
    not printed in the json output.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.cfg.5.pod.in             | 45 ++++++++++++++++++++++++++++
 tools/golang/xenlight/helpers.gen.go | 51 +++++++++++++++++++++++++++++++
 tools/golang/xenlight/types.gen.go   | 27 +++++++++++++++++
 tools/include/libxl.h                |  5 ++++
 tools/libs/light/libxl_dom.c         | 21 +++++++++++++
 tools/libs/light/libxl_types.idl     | 26 ++++++++++++++++
 tools/xl/xl_parse.c                  | 58 +++++++++++++++++++++++++++++++++++-
 7 files changed, 232 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 024bceeb61..bc4386ee96 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -2079,6 +2079,51 @@ number of vendor defined SMBIOS structures (type 128 - 255). Since SMBIOS
 structures do not present their overall size, each entry in the file must be
 preceded by a 32b integer indicating the size of the following structure.
 
+=item B<smbios=[ "SMBIOS_SPEC_STRING", "SMBIOS_SPEC_STRING", ...]>
+
+Specifies the SMBIOS values to be provided to the guest.  These set or
+override specific entries in the tables provided to the guest.
+
+Each B<SMBIOS_SPEC_STRING> is a C<KEY=VALUE> string from the following list:
+
+=over 4
+
+=item B<bios_vendor=STRING>
+
+=item B<bios_version=STRING>
+
+=item B<system_manufacturer=STRING>
+
+=item B<system_product_name=STRING>
+
+=item B<system_version=STRING>
+
+=item B<system_serial_number=STRING>
+
+=item B<baseboard_manufacturer=STRING>
+
+=item B<baseboard_product_name=STRING>
+
+=item B<baseboard_version=STRING>
+
+=item B<baseboard_serial_number=STRING>
+
+=item B<baseboard_asset_tag=STRING>
+
+=item B<baseboard_location_in_chassis=STRING>
+
+=item B<enclosure_manufacturer=STRING>
+
+=item B<enclosure_serial_number=STRING>
+
+=item B<enclosure_asset_tag=STRING>
+
+=item B<battery_manufacturer=STRING>
+
+=item B<battery_device_name=STRING>
+
+=back
+
 =item B<ms_vm_genid="OPTION">
 
 Provide a VM generation ID to the guest.
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 3ac4938858..0a203d2232 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -589,6 +589,38 @@ xc.build_id = C.CString(x.BuildId)}
  return nil
  }
 
+// NewSmbios returns an instance of Smbios initialized with defaults.
+func NewSmbios() (*Smbios, error) {
+var (
+x Smbios
+xc C.libxl_smbios)
+
+C.libxl_smbios_init(&xc)
+defer C.libxl_smbios_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *Smbios) fromC(xc *C.libxl_smbios) error {
+ x.Key = SmbiosType(xc.key)
+x.Value = C.GoString(xc.value)
+
+ return nil}
+
+func (x *Smbios) toC(xc *C.libxl_smbios) (err error){defer func(){
+if err != nil{
+C.libxl_smbios_dispose(xc)}
+}()
+
+xc.key = C.libxl_smbios_type(x.Key)
+if x.Value != "" {
+xc.value = C.CString(x.Value)}
+
+ return nil
+ }
+
 // NewDomainCreateInfo returns an instance of DomainCreateInfo initialized with defaults.
 func NewDomainCreateInfo() (*DomainCreateInfo, error) {
 var (
@@ -1183,6 +1215,15 @@ return fmt.Errorf("converting field Altp2M: %v", err)
 }
 x.SystemFirmware = C.GoString(tmp.system_firmware)
 x.SmbiosFirmware = C.GoString(tmp.smbios_firmware)
+x.Smbios = nil
+if n := int(tmp.num_smbios); n > 0 {
+cSmbios := (*[1<<28]C.libxl_smbios)(unsafe.Pointer(tmp.smbios))[:n:n]
+x.Smbios = make([]Smbios, n)
+for i, v := range cSmbios {
+if err := x.Smbios[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Smbios: %v", err) }
+}
+}
 x.AcpiFirmware = C.GoString(tmp.acpi_firmware)
 x.Hdtype = Hdtype(tmp.hdtype)
 if err := x.Nographic.fromC(&tmp.nographic);err != nil {
@@ -1495,6 +1536,16 @@ if tmp.SystemFirmware != "" {
 hvm.system_firmware = C.CString(tmp.SystemFirmware)}
 if tmp.SmbiosFirmware != "" {
 hvm.smbios_firmware = C.CString(tmp.SmbiosFirmware)}
+if numSmbios := len(tmp.Smbios); numSmbios > 0 {
+hvm.smbios = (*C.libxl_smbios)(C.malloc(C.ulong(numSmbios)*C.sizeof_libxl_smbios))
+hvm.num_smbios = C.int(numSmbios)
+cSmbios := (*[1<<28]C.libxl_smbios)(unsafe.Pointer(hvm.smbios))[:numSmbios:numSmbios]
+for i,v := range tmp.Smbios {
+if err := v.toC(&cSmbios[i]); err != nil {
+return fmt.Errorf("converting field Smbios: %v", err)
+}
+}
+}
 if tmp.AcpiFirmware != "" {
 hvm.acpi_firmware = C.CString(tmp.AcpiFirmware)}
 hvm.hdtype = C.libxl_hdtype(tmp.Hdtype)
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index 16ce879e3f..2d8bc7654a 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -392,6 +392,32 @@ Commandline string
 BuildId string
 }
 
+type SmbiosType int
+const(
+SmbiosTypeBiosVendor SmbiosType = 1
+SmbiosTypeBiosVersion SmbiosType = 2
+SmbiosTypeSystemManufacturer SmbiosType = 3
+SmbiosTypeSystemProductName SmbiosType = 4
+SmbiosTypeSystemVersion SmbiosType = 5
+SmbiosTypeSystemSerialNumber SmbiosType = 6
+SmbiosTypeBaseboardManufacturer SmbiosType = 7
+SmbiosTypeBaseboardProductName SmbiosType = 8
+SmbiosTypeBaseboardVersion SmbiosType = 9
+SmbiosTypeBaseboardSerialNumber SmbiosType = 10
+SmbiosTypeBaseboardAssetTag SmbiosType = 11
+SmbiosTypeBaseboardLocationInChassis SmbiosType = 12
+SmbiosTypeEnclosureManufacturer SmbiosType = 13
+SmbiosTypeEnclosureSerialNumber SmbiosType = 14
+SmbiosTypeEnclosureAssetTag SmbiosType = 15
+SmbiosTypeBatteryManufacturer SmbiosType = 16
+SmbiosTypeBatteryDeviceName SmbiosType = 17
+)
+
+type Smbios struct {
+Key SmbiosType
+Value string
+}
+
 type DomainCreateInfo struct {
 Type DomainType
 Hap Defbool
@@ -572,6 +598,7 @@ NestedHvm Defbool
 Altp2M Defbool
 SystemFirmware string
 SmbiosFirmware string
+Smbios []Smbios
 AcpiFirmware string
 Hdtype Hdtype
 Nographic Defbool
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index d652895075..5c65222f1e 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -174,6 +174,11 @@
  */
 #define LIBXL_HAVE_BUILDINFO_HVM_MS_VM_GENID 1
 
+/*
+ * libxl_domain_build_info has the u.hvm.smbios field.
+ */
+#define LIBXL_HAVE_BUILDINFO_HVM_SMBIOS 1
+
 /*
  * LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY indicates that a 'cpumap_soft'
  * field (of libxl_bitmap type) is present in libxl_vcpuinfo,
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index f6311eea6e..5433301f70 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -773,6 +773,27 @@ static int hvm_build_set_xs_values(libxl__gc *gc,
             goto err;
     }
 
+    for (int i = 0; i < info->u.hvm.num_smbios; i++) {
+        char *p;
+        path = GCSPRINTF("/local/domain/%d/"HVM_XS_BIOS_STRINGS"/%s", domid,
+                   libxl_smbios_type_to_string(info->u.hvm.smbios[i].key));
+
+        /* Convert libxl_smbios_type string to xenstore path that hvmloader
+         * will use, as defined by HVM_XS_*. That is convert the '_' to '-'. */
+        p = strrchr(path, '/');
+        for ( ; *p; p++) {
+            if (*p == '_')
+                *p = '-';
+        }
+
+        LOGD(DEBUG, domid, "Writing %s = \"%s\"", path,
+             info->u.hvm.smbios[i].value);
+        ret = libxl__xs_printf(gc, XBT_NULL, path, "%s",
+                               info->u.hvm.smbios[i].value);
+        if (ret)
+            goto err;
+    }
+
     /* Only one module can be passed. PVHv2 guests do not support this. */
     if (dom->acpi_modules[0].guest_addr_out && 
         info->type == LIBXL_DOMAIN_TYPE_HVM) {
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 0cfad8508d..df4dd36697 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -423,6 +423,31 @@ libxl_version_info = Struct("version_info", [
     ("build_id",          string),
     ], dir=DIR_OUT)
 
+libxl_smbios_type = Enumeration("smbios_type", [
+    (1,  "bios_vendor"),
+    (2,  "bios_version"),
+    (3,  "system_manufacturer"),
+    (4,  "system_product_name"),
+    (5,  "system_version"),
+    (6,  "system_serial_number"),
+    (7,  "baseboard_manufacturer"),
+    (8,  "baseboard_product_name"),
+    (9,  "baseboard_version"),
+    (10, "baseboard_serial_number"),
+    (11, "baseboard_asset_tag"),
+    (12, "baseboard_location_in_chassis"),
+    (13, "enclosure_manufacturer"),
+    (14, "enclosure_serial_number"),
+    (15, "enclosure_asset_tag"),
+    (16, "battery_manufacturer"),
+    (17, "battery_device_name"),
+    ])
+
+libxl_smbios = Struct("smbios", [
+    ("key",          libxl_smbios_type),
+    ("value",        string),
+    ], dir=DIR_IN)
+
 libxl_domain_create_info = Struct("domain_create_info",[
     ("type",         libxl_domain_type),
     ("hap",          libxl_defbool),
@@ -609,6 +634,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                        ("altp2m",           libxl_defbool),
                                        ("system_firmware",  string),
                                        ("smbios_firmware",  string),
+                                       ("smbios",           Array(libxl_smbios, "num_smbios")),
                                        ("acpi_firmware",    string),
                                        ("hdtype",           libxl_hdtype),
                                        ("nographic",        libxl_defbool),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 853e9f357a..ba219024b6 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1297,8 +1297,9 @@ void parse_config_data(const char *config_source,
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
                    *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcallsifs_devs;
     XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
-                   *mca_caps;
+                   *mca_caps, *smbios;
     int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
+    int num_smbios;
     int pci_power_mgmt = 0;
     int pci_msitranslate = 0;
     int pci_permissive = 0;
@@ -1860,6 +1861,61 @@ void parse_config_data(const char *config_source,
         xlu_cfg_replace_string(config, "acpi_firmware",
                                &b_info->u.hvm.acpi_firmware, 0);
 
+        switch (xlu_cfg_get_list(config, "smbios", &smbios, &num_smbios, 0))
+        {
+        case 0: /* Success */
+            b_info->u.hvm.num_smbios = num_smbios;
+            b_info->u.hvm.smbios = xcalloc(num_smbios, sizeof(libxl_smbios));
+            for (i = 0; i < num_smbios; i++) {
+                libxl_smbios_type type;
+                char *option;
+                char *value;
+
+                buf = xlu_cfg_get_listitem(smbios, i);
+                if (!buf) {
+                    fprintf(stderr,
+                            "xl: Unable to get element #%d in smbios list\n",
+                            i);
+                    exit(EXIT_FAILURE);
+                }
+
+                option = xstrdup(buf);
+                value = strchr(option, '=');
+                if (value == NULL) {
+                    fprintf(stderr, "xl: failed to split \"%s\" at '='\n",
+                            option);
+                    exit(EXIT_FAILURE);
+                }
+
+                *value = '\0';
+                value++;
+
+                if (*value == '\0') {
+                    fprintf(stderr,
+                            "xl: empty value not allowed for smbios \"%s=\"\n",
+                            option);
+                    exit(EXIT_FAILURE);
+                }
+
+                e = libxl_smbios_type_from_string(option, &type);
+                if (e) {
+                    fprintf(stderr, "xl: unknown smbios type '%s'\n", option);
+                    exit(EXIT_FAILURE);
+                }
+
+                b_info->u.hvm.smbios[i].key = type;
+                b_info->u.hvm.smbios[i].value = xstrdup(value);
+
+                free(option);
+            }
+            break;
+        case ESRCH: /* Option not present */
+            break;
+        default:
+            fprintf(stderr,"xl: Unable to parse smbios options.\n");
+            exit(EXIT_FAILURE);
+        }
+
         if (!xlu_cfg_get_string(config, "ms_vm_genid", &buf, 0)) {
             if (!strcmp(buf, "generate")) {
                 e = libxl_ms_vm_genid_generate(ctx, &b_info->u.hvm.ms_vm_genid);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 16 20:11:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Mar 2023 20:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510820.789230 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctwt-0007hz-Ln; Thu, 16 Mar 2023 20:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510820.789230; Thu, 16 Mar 2023 20: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 1pctwt-0007hs-J9; Thu, 16 Mar 2023 20:11:43 +0000
Received: by outflank-mailman (input) for mailman id 510820;
 Thu, 16 Mar 2023 20: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 1pctws-0007hj-T0
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20: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 1pctws-0001Cy-S4
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctws-0007Xn-R8
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20: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=EFNxYFyg5JFqY+PY1hmHb9eWS+Br6POfAoJvB2lF78E=; b=RVoQz0GQa6vMwDKdxvvkzSQPwq
	NbmXEf8D9AIc9R+NzxOwy+GYs0ZiOchxoxWUwklbTIWznIgHUWP7O6ew+DP+J48q0JQW9mA/z7K+T
	+iDTMAszFOo5Pf2abgeCvPyNEJsx/TMKzy9zaEXlAtj1BYxMbJckPOG6SKF5zOIX4l9Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xl/libxl: Add OEM string support to smbios
Message-Id: <E1pctws-0007Xn-R8@xenbits.xenproject.org>
Date: Thu, 16 Mar 2023 20:11:42 +0000

commit 38bdfa44cc0d99acefa5f7a1cc2a8a02311a76c4
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Mon Mar 6 15:40:24 2023 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 15 18:41:46 2023 +0000

    xl/libxl: Add OEM string support to smbios
    
    Add support for OEM strings in the SMBIOS type 11.
    
    hvmloader checks them sequentially, so hide the implementation detail.
    Allow multiple plain oem= items and assign the numeric values
    internally.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 docs/man/xl.cfg.5.pod.in           |  4 ++++
 tools/golang/xenlight/types.gen.go |  1 +
 tools/libs/light/libxl_dom.c       | 16 ++++++++++++++--
 tools/libs/light/libxl_types.idl   |  1 +
 tools/xl/xl_parse.c                | 13 +++++++++++++
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index bc4386ee96..10f37990be 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -2122,6 +2122,10 @@ Each B<SMBIOS_SPEC_STRING> is a C<KEY=VALUE> string from the following list:
 
 =item B<battery_device_name=STRING>
 
+=item B<oem=STRING>
+
+oem= can be specified up to 99 times.
+
 =back
 
 =item B<ms_vm_genid="OPTION">
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index 2d8bc7654a..a7c17699f8 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -411,6 +411,7 @@ SmbiosTypeEnclosureSerialNumber SmbiosType = 14
 SmbiosTypeEnclosureAssetTag SmbiosType = 15
 SmbiosTypeBatteryManufacturer SmbiosType = 16
 SmbiosTypeBatteryDeviceName SmbiosType = 17
+SmbiosTypeOem SmbiosType = 18
 )
 
 type Smbios struct {
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 5433301f70..25fb716084 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -755,6 +755,7 @@ static int hvm_build_set_xs_values(libxl__gc *gc,
                                    const libxl_domain_build_info *info)
 {
     char *path = NULL;
+    int num_oem = 1;
     int ret = 0;
 
     if (dom->smbios_module.guest_addr_out) {
@@ -775,8 +776,19 @@ static int hvm_build_set_xs_values(libxl__gc *gc,
 
     for (int i = 0; i < info->u.hvm.num_smbios; i++) {
         char *p;
-        path = GCSPRINTF("/local/domain/%d/"HVM_XS_BIOS_STRINGS"/%s", domid,
-                   libxl_smbios_type_to_string(info->u.hvm.smbios[i].key));
+        if (info->u.hvm.smbios[i].key == LIBXL_SMBIOS_TYPE_OEM) {
+            if (num_oem > 99) {
+                LOGD(ERROR, domid, "More than 99 SMBIOS OEM strings specified");
+                ret = ERROR_INVAL;
+                goto err;
+            }
+            path = GCSPRINTF("/local/domain/%d/"HVM_XS_OEM_STRINGS, domid,
+                             num_oem);
+            num_oem++;
+        } else {
+            path = GCSPRINTF("/local/domain/%d/"HVM_XS_BIOS_STRINGS"/%s", domid,
+                       libxl_smbios_type_to_string(info->u.hvm.smbios[i].key));
+        }
 
         /* Convert libxl_smbios_type string to xenstore path that hvmloader
          * will use, as defined by HVM_XS_*. That is convert the '_' to '-'. */
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index df4dd36697..c10292e0d7 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -441,6 +441,7 @@ libxl_smbios_type = Enumeration("smbios_type", [
     (15, "enclosure_asset_tag"),
     (16, "battery_manufacturer"),
     (17, "battery_device_name"),
+    (18, "oem"),
     ])
 
 libxl_smbios = Struct("smbios", [
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index ba219024b6..e344d4fda3 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1864,6 +1864,9 @@ void parse_config_data(const char *config_source,
         switch (xlu_cfg_get_list(config, "smbios", &smbios, &num_smbios, 0))
         {
         case 0: /* Success */
+        {
+            unsigned int num_oem = 1;
+
             b_info->u.hvm.num_smbios = num_smbios;
             b_info->u.hvm.smbios = xcalloc(num_smbios, sizeof(libxl_smbios));
             for (i = 0; i < num_smbios; i++) {
@@ -1903,12 +1906,22 @@ void parse_config_data(const char *config_source,
                     exit(EXIT_FAILURE);
                 }
 
+                if (type == LIBXL_SMBIOS_TYPE_OEM) {
+                    if (num_oem > 99) {
+                        fprintf(stderr,
+                                "xl: smbios limited to 99 oem strings\n");
+                        exit(EXIT_FAILURE);
+                    }
+                    num_oem++;
+                }
+
                 b_info->u.hvm.smbios[i].key = type;
                 b_info->u.hvm.smbios[i].value = xstrdup(value);
 
                 free(option);
             }
             break;
+        }
         case ESRCH: /* Option not present */
             break;
         default:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 16 20:11:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Mar 2023 20:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510821.789234 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctx3-0007l1-NL; Thu, 16 Mar 2023 20:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510821.789234; Thu, 16 Mar 2023 20: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 1pctx3-0007kt-Kj; Thu, 16 Mar 2023 20:11:53 +0000
Received: by outflank-mailman (input) for mailman id 510821;
 Thu, 16 Mar 2023 20: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 1pctx3-0007ke-0m
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20: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 1pctx2-0001DE-Vo
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctx2-0007YY-Uc
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20: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=KjCAkAD2RINrTMAIiJrE+tHSrGWXwUlEFuYArftg0Io=; b=qNPB/n/GkdrbK9mHzLiWWT3Ojg
	p+tbsjxAtYzGVy7PfFrfF+lh3Jnne2Nhwu2w1Vp0PPszx85vlVLOuoBEPkpMHI3dGJPKZC5Z7KhfM
	Xq0N5Bc4rcRN4BtUwpL2+DSWIHDV6AxdYLOt/EwNKIzymhO7sB3suwnZ48Me6W1q6MhY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Fix libxl__device_pci_reset error messages
Message-Id: <E1pctx2-0007YY-Uc@xenbits.xenproject.org>
Date: Thu, 16 Mar 2023 20:11:52 +0000

commit fc750656aa78595a6a3693b41cd27e6cf07aba31
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Mon Mar 13 15:57:55 2023 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 15 18:41:46 2023 +0000

    libxl: Fix libxl__device_pci_reset error messages
    
    Don't use the LOG*D macros.  They expect a domid, but "domain" here is
    the PCI domain.  Hence it is inappropriate for this use.
    
    Make the write error messages uniform with LOGE.  errno has the
    interesting information while rc is just -1.  Drop printing rc and use
    LOGE to print errno as text.
    
    The interesting part of a failed write to do_flr is that PCI BDF, so
    print that.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_pci.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index f4c4f17545..27d9dbff25 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -1554,27 +1554,27 @@ static int libxl__device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned
         char *buf = GCSPRINTF(PCI_BDF, domain, bus, dev, func);
         rc = write(fd, buf, strlen(buf));
         if (rc < 0)
-            LOGD(ERROR, domain, "write to %s returned %d", reset, rc);
+            LOGE(ERROR, "write '%s' to %s failed", buf, reset);
         close(fd);
         return rc < 0 ? rc : 0;
     }
     if (errno != ENOENT)
-        LOGED(ERROR, domain, "Failed to access pciback path %s", reset);
+        LOGE(ERROR, "Failed to access pciback path %s", reset);
     reset = GCSPRINTF("%s/"PCI_BDF"/reset", SYSFS_PCI_DEV, domain, bus, dev, func);
     fd = open(reset, O_WRONLY);
     if (fd >= 0) {
         rc = write(fd, "1", 1);
         if (rc < 0)
-            LOGED(ERROR, domain, "write to %s returned %d", reset, rc);
+            LOGE(ERROR, "write to %s failed", reset);
         close(fd);
         return rc < 0 ? rc : 0;
     }
     if (errno == ENOENT) {
-        LOGD(ERROR, domain,
-             "The kernel doesn't support reset from sysfs for PCI device "PCI_BDF,
-             domain, bus, dev, func);
+        LOG(ERROR,
+            "The kernel doesn't support reset from sysfs for PCI device "PCI_BDF,
+            domain, bus, dev, func);
     } else {
-        LOGED(ERROR, domain, "Failed to access reset path %s", reset);
+        LOGE(ERROR, "Failed to access reset path %s", reset);
     }
     return -1;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 16 20:12:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Mar 2023 20:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510822.789238 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pctxD-0007oH-PQ; Thu, 16 Mar 2023 20:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510822.789238; Thu, 16 Mar 2023 20: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 1pctxD-0007o9-ME; Thu, 16 Mar 2023 20:12:03 +0000
Received: by outflank-mailman (input) for mailman id 510822;
 Thu, 16 Mar 2023 20: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 1pctxD-0007o1-4a
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20: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 1pctxD-0001DZ-3f
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pctxD-0007aw-2W
 for xen-changelog@lists.xenproject.org; Thu, 16 Mar 2023 20: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=vLi7/ENxM0N9dUYr3UF3+TZQ2xDrOn+MrOLlT5gjMRk=; b=6A/uMdqCBgdMFF3Mj+HdOt2xA3
	P6utHxoCR54PBQKheEhJ5QNwy8LjlmMZekfOi33cLP61WIHHslsCYMxncY0/3Ft7APERSZD3FPihT
	cZFtbW7FYzVLmhIaobaZ5mmiR1yyjf17p1qWU8R0O/Ab75nlz9f8d+CBvX1WUo5YfGzE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/grants: repurpose command line max options
Message-Id: <E1pctxD-0007aw-2W@xenbits.xenproject.org>
Date: Thu, 16 Mar 2023 20:12:03 +0000

commit b2ea81d2b935474cf27a76b4aa143ae897e82457
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 14 15:45:53 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 15 18:41:46 2023 +0000

    xen/grants: repurpose command line max options
    
    Slightly change the meaning of the command line
    gnttab_max_{maptrack_,}frames: do not use them as upper bounds for the
    passed values at domain creation, instead just use them as defaults
    in the absence of any provided value.
    
    It's not very useful for the options to be used both as defaults and
    as capping values for domain creation inputs.  The defaults passed on
    the command line are used by dom0 which has a very different grant
    requirements than a regular domU.  dom0 usually needs a bigger
    maptrack array, while domU usually require a bigger number of grant
    frames.
    
    The relaxation in the logic for the maximum size of the grant and
    maptrack table sizes doesn't change the fact that domain creation
    hypercall can cause resource exhausting, so disaggregated setups
    should take it into account.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc | 16 +++++++++-------
 xen/common/grant_table.c          |  9 +++------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index f68deaa6a9..e0b89b7d33 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1232,11 +1232,11 @@ The usage of gnttab v2 is not security supported on ARM platforms.
 
 > Can be modified at runtime
 
-Specify the maximum number of frames which any domain may use as part
-of its grant table. This value is an upper boundary of the per-domain
-value settable via Xen tools.
+Specify the default upper bound on the number of frames which any domain may
+use as part of its grant table unless a different value is specified at domain
+creation.
 
-Dom0 is using this value for sizing its grant table.
+Note this value is the effective upper bound for dom0.
 
 ### gnttab_max_maptrack_frames
 > `= <integer>`
@@ -1245,9 +1245,11 @@ Dom0 is using this value for sizing its grant table.
 
 > Can be modified at runtime
 
-Specify the maximum number of frames to use as part of a domains
-maptrack array. This value is an upper boundary of the per-domain
-value settable via Xen tools.
+Specify the default upper bound on the number of frames which any domain may
+use as part of its maptrack array unless a different value is specified at
+domain creation.
+
+Note this value is the effective upper bound for dom0.
 
 ### global-pages
     = <boolean>
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index b896f9af0e..d87e58a53d 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1956,18 +1956,15 @@ int grant_table_init(struct domain *d, int max_grant_frames,
         return -EINVAL;
     }
 
-    /* Default to maximum value if no value was specified */
+    /* Apply defaults if no value was specified */
     if ( max_grant_frames < 0 )
         max_grant_frames = opt_max_grant_frames;
     if ( max_maptrack_frames < 0 )
         max_maptrack_frames = opt_max_maptrack_frames;
 
-    if ( max_grant_frames < INITIAL_NR_GRANT_FRAMES ||
-         max_grant_frames > opt_max_grant_frames ||
-         max_maptrack_frames > opt_max_maptrack_frames )
+    if ( max_grant_frames < INITIAL_NR_GRANT_FRAMES )
     {
-        dprintk(XENLOG_INFO, "Bad grant table sizes: grant %u, maptrack %u\n",
-                max_grant_frames, max_maptrack_frames);
+        dprintk(XENLOG_INFO, "Bad grant table size: %u frames\n", max_grant_frames);
         return -EINVAL;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 17 11:11:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Mar 2023 11:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510998.789656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zD-0006kB-At; Fri, 17 Mar 2023 11:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510998.789656; Fri, 17 Mar 2023 11:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zD-0006k3-89; Fri, 17 Mar 2023 11:11:03 +0000
Received: by outflank-mailman (input) for mailman id 510998;
 Fri, 17 Mar 2023 11: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 1pd7zB-0006jx-V3
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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 1pd7zB-0005uO-Qx
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pd7zB-0006SD-Pn
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FhKpxNIwE0jWt0xWaCtxOM2evRHE7DAjNNKTuQH2IlM=; b=6oks2Kw5QSJn7xuVFVGHXTTjML
	99LFORsd5JKg0mV1hxt3lCICHwqx55d11dIiLeLwZVdqS9koVzlE+1tDxKUNbd3hv+obxzdrjB3E0
	ZRbRnxGrXq6INsjzThQWYPeyJdz93vEb/PAC67FhMH0DbIhz4EcGfm49duRFrAYqo4Vw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] console: use more appropriate domain RCU-locking function
Message-Id: <E1pd7zB-0006SD-Pn@xenbits.xenproject.org>
Date: Fri, 17 Mar 2023 11:11:01 +0000

commit bdb7a95e6506776aee749d1414c0dd687c01aa10
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 16 13:21:50 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 16 13:21:50 2023 +0100

    console: use more appropriate domain RCU-locking function
    
    While both 19afff14b4cb ("xen: support console_switching between Dom0
    and DomUs on ARM") and 1ee1e4b0d1ff ("xen/arm: Allow vpl011 to be used
    by DomU") were part of the same series (iirc), the latter correctly used
    rcu_lock_domain_by_id() in console_input_domain(), whereas the former
    for some reason used rcu_lock_domain_by_any_id() instead, despite that
    code only kind of open-coding console_input_domain(). There's no point
    here to deal with DOMID_SELF, which is the sole difference between the
    two functions.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/char/console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index e8468c121a..51e5408f21 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -525,7 +525,7 @@ static void __serial_rx(char c, struct cpu_user_regs *regs)
 #ifdef CONFIG_SBSA_VUART_CONSOLE
     default:
     {
-        struct domain *d = rcu_lock_domain_by_any_id(console_rx - 1);
+        struct domain *d = rcu_lock_domain_by_id(console_rx - 1);
 
         /*
          * If we have a properly initialized vpl011 console for the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 17 11:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Mar 2023 11:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.510999.789659 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zN-0006mR-CT; Fri, 17 Mar 2023 11:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 510999.789659; Fri, 17 Mar 2023 11:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zN-0006mJ-9g; Fri, 17 Mar 2023 11:11:13 +0000
Received: by outflank-mailman (input) for mailman id 510999;
 Fri, 17 Mar 2023 11: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 1pd7zL-0006ls-VM
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11: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 1pd7zL-0005uV-UR
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pd7zL-0006Sg-TS
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bDvuj3K7wt2/Zw7yqLct2irdJZ5xGQ72d9Q5jJgzM+4=; b=ov4C9w1cceVIiT2HUE/F8ZLSnX
	HLmQr8d1SbP5RJgkiv98iW+pbUeVHPcx5bVU0wwNwU0b0JEBk20HF4J8Cxrl6Yb0uNLPi+DUOahMi
	/ZxZyphHOiastQNZlSQjfdaX57K/yPgBr9z2ByfNPjfPib31ThQmZvHbbAO5FqAdSf9k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: don't include processor.h from system.h
Message-Id: <E1pd7zL-0006Sg-TS@xenbits.xenproject.org>
Date: Fri, 17 Mar 2023 11:11:11 +0000

commit 5d8f05e10646aeef1c4a49610c0c44a7cdaf62a3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 16 13:23:14 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 16 13:23:14 2023 +0100

    x86: don't include processor.h from system.h
    
    processor.h in particular pulls in xen/smp.h, which is overly heavy for
    a supposedly pretty fundamental header like system.h. To keep things
    building, move the declarations of struct cpuinfo_x86 and boot_cpu_data
    to asm/cpufeature.h (which arguably also is where they belong). In the
    course of the move switch away from using fixed-width types and convert
    plain "int" to "unsigned int" for the two x86_cache_* fields.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/cpufeature.h | 24 ++++++++++++++++++++++++
 xen/arch/x86/include/asm/processor.h  | 28 ----------------------------
 xen/arch/x86/include/asm/system.h     |  3 ++-
 3 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index 0a301013c3..3cacc237ee 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -19,6 +19,30 @@
 #ifndef __ASSEMBLY__
 #include <xen/bitops.h>
 
+struct cpuinfo_x86 {
+    unsigned char x86;                 /* CPU family */
+    unsigned char x86_vendor;          /* CPU vendor */
+    unsigned char x86_model;
+    unsigned char x86_mask;
+    int cpuid_level;                   /* Maximum supported CPUID level, -1=no CPUID */
+    unsigned int extended_cpuid_level; /* Maximum supported CPUID extended level */
+    unsigned int x86_capability[NCAPINTS];
+    char x86_vendor_id[16];
+    char x86_model_id[64];
+    unsigned int x86_cache_size;       /* in KB - valid only when supported */
+    unsigned int x86_cache_alignment;  /* In bytes */
+    unsigned int x86_max_cores;        /* cpuid returned max cores value */
+    unsigned int booted_cores;         /* number of cores as seen by OS */
+    unsigned int x86_num_siblings;     /* cpuid logical cpus per chip value */
+    unsigned int apicid;
+    unsigned int phys_proc_id;         /* package ID of each logical CPU */
+    unsigned int cpu_core_id;          /* core ID of each logical CPU */
+    unsigned int compute_unit_id;      /* AMD compute unit ID of each logical CPU */
+    unsigned short x86_clflush_size;
+} __cacheline_aligned;
+
+extern struct cpuinfo_x86 boot_cpu_data;
+
 #define cpu_has(c, bit)		test_bit(bit, (c)->x86_capability)
 #define boot_cpu_has(bit)	test_bit(bit, boot_cpu_data.x86_capability)
 
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 8a73d3d8b1..677d49ebed 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -118,34 +118,6 @@ struct x86_cpu_id {
     const void *driver_data;
 };
 
-struct cpuinfo_x86 {
-    uint8_t x86;            /* CPU family */
-    uint8_t x86_vendor;     /* CPU vendor */
-    uint8_t x86_model;
-    uint8_t x86_mask;
-    int  cpuid_level;    /* Maximum supported CPUID level, -1=no CPUID */
-    uint32_t extended_cpuid_level; /* Maximum supported CPUID extended level */
-    unsigned int x86_capability[NCAPINTS];
-    char x86_vendor_id[16];
-    char x86_model_id[64];
-    int  x86_cache_size; /* in KB - valid for CPUS which support this call  */
-    int  x86_cache_alignment;    /* In bytes */
-    uint32_t x86_max_cores;   /* cpuid returned max cores value */
-    uint32_t booted_cores;    /* number of cores as seen by OS */
-    uint32_t x86_num_siblings; /* cpuid logical cpus per chip value */
-    uint32_t apicid;
-    uint32_t phys_proc_id;    /* package ID of each logical CPU */
-    uint32_t cpu_core_id;     /* core ID of each logical CPU */
-    uint32_t compute_unit_id; /* AMD compute unit ID of each logical CPU */
-    unsigned short x86_clflush_size;
-} __cacheline_aligned;
-
-/*
- * capabilities of CPUs
- */
-
-extern struct cpuinfo_x86 boot_cpu_data;
-
 extern struct cpuinfo_x86 cpu_data[];
 #define current_cpu_data cpu_data[smp_processor_id()]
 
diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h
index 65e63de69a..6e40a03cb3 100644
--- a/xen/arch/x86/include/asm/system.h
+++ b/xen/arch/x86/include/asm/system.h
@@ -3,7 +3,8 @@
 
 #include <xen/lib.h>
 #include <xen/bitops.h>
-#include <asm/processor.h>
+#include <asm/cpufeature.h>
+#include <asm/x86-defns.h>
 
 static inline void wbinvd(void)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 17 11:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Mar 2023 11:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511002.789668 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zX-0006sp-NA; Fri, 17 Mar 2023 11:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511002.789668; Fri, 17 Mar 2023 11:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zX-0006sC-JA; Fri, 17 Mar 2023 11:11:23 +0000
Received: by outflank-mailman (input) for mailman id 511002;
 Fri, 17 Mar 2023 11: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 1pd7zW-0006pS-2y
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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 1pd7zW-0005uo-24
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pd7zW-0006TR-0r
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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=QaNp/EXagYglNqWyNpzmdjVWtVcS4X+ultoE+386KIQ=; b=AvD5dfSvr5kGLgVTHatV++zpYR
	qleI5oVNExmDINTOKPHIhLjQbs8LNrG7+hjrsF63iiEa6geyOqzv+jMDoJDQbCHPSYIHfSDQ9nXK2
	Y4UlfXpCTQ3kvc2HSxJVAiOjrL2pVFnsawl7sg7KnVJkjWD92l7uTaqRB67NcykqRrTY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/paging: fold most HAP and shadow final teardown
Message-Id: <E1pd7zW-0006TR-0r@xenbits.xenproject.org>
Date: Fri, 17 Mar 2023 11:11:22 +0000

commit 462de8ad4507c12d246e0949ba39d0756331ad82
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 16 14:42:04 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 16 14:42:04 2023 +0100

    x86/paging: fold most HAP and shadow final teardown
    
    HAP does a few things beyond what's common, which are left there at
    least for now. Common operations, however, are moved to
    paging_final_teardown(), allowing shadow_final_teardown() to go away.
    
    While moving (and hence generalizing) the respective SHADOW_PRINTK()
    drop the logging of total_pages from the 2nd instance - the value is
    necessarily zero after {hap,shadow}_set_allocation() - and shorten the
    messages, in part accounting for PAGING_PRINTK() logging __func__
    already.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/shadow.h |  3 ---
 xen/arch/x86/mm/hap/hap.c         | 16 ++--------------
 xen/arch/x86/mm/paging.c          | 39 +++++++++++++++++++++++++++++++++++++--
 xen/arch/x86/mm/shadow/common.c   | 31 +------------------------------
 4 files changed, 40 insertions(+), 49 deletions(-)

diff --git a/xen/arch/x86/include/asm/shadow.h b/xen/arch/x86/include/asm/shadow.h
index 1365fe4805..73122f0312 100644
--- a/xen/arch/x86/include/asm/shadow.h
+++ b/xen/arch/x86/include/asm/shadow.h
@@ -78,9 +78,6 @@ int shadow_domctl(struct domain *d,
 void shadow_vcpu_teardown(struct vcpu *v);
 void shadow_teardown(struct domain *d, bool *preempted);
 
-/* Call once all of the references to the domain have gone away */
-void shadow_final_teardown(struct domain *d);
-
 void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all);
 
 /* Adjust shadows ready for a guest page to change its type. */
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 84cb358df1..010163d051 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -268,8 +268,8 @@ static void hap_free(struct domain *d, mfn_t mfn)
 
     /*
      * For dying domains, actually free the memory here. This way less work is
-     * left to hap_final_teardown(), which cannot easily have preemption checks
-     * added.
+     * left to paging_final_teardown(), which cannot easily have preemption
+     * checks added.
      */
     if ( unlikely(d->is_dying) )
     {
@@ -552,18 +552,6 @@ void hap_final_teardown(struct domain *d)
     for (i = 0; i < MAX_NESTEDP2M; i++) {
         p2m_teardown(d->arch.nested_p2m[i], true, NULL);
     }
-
-    if ( d->arch.paging.total_pages != 0 )
-        hap_teardown(d, NULL);
-
-    p2m_teardown(p2m_get_hostp2m(d), true, NULL);
-    /* Free any memory that the p2m teardown released */
-    paging_lock(d);
-    hap_set_allocation(d, 0, NULL);
-    ASSERT(d->arch.paging.p2m_pages == 0);
-    ASSERT(d->arch.paging.free_pages == 0);
-    ASSERT(d->arch.paging.total_pages == 0);
-    paging_unlock(d);
 }
 
 void hap_vcpu_teardown(struct vcpu *v)
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 2991585117..4e4de80f55 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -841,10 +841,45 @@ int paging_teardown(struct domain *d)
 /* Call once all of the references to the domain have gone away */
 void paging_final_teardown(struct domain *d)
 {
-    if ( hap_enabled(d) )
+    bool hap = hap_enabled(d);
+
+    PAGING_PRINTK("%pd start: total = %u, free = %u, p2m = %u\n",
+                  d, d->arch.paging.total_pages,
+                  d->arch.paging.free_pages, d->arch.paging.p2m_pages);
+
+    if ( hap )
         hap_final_teardown(d);
+
+    /*
+     * Remove remaining paging memory.  This can be nonzero on certain error
+     * paths.
+     */
+    if ( d->arch.paging.total_pages )
+    {
+        if ( hap )
+            hap_teardown(d, NULL);
+        else
+            shadow_teardown(d, NULL);
+    }
+
+    /* It is now safe to pull down the p2m map. */
+    p2m_teardown(p2m_get_hostp2m(d), true, NULL);
+
+    /* Free any paging memory that the p2m teardown released. */
+    paging_lock(d);
+
+    if ( hap )
+        hap_set_allocation(d, 0, NULL);
     else
-        shadow_final_teardown(d);
+        shadow_set_allocation(d, 0, NULL);
+
+    PAGING_PRINTK("%pd done: free = %u, p2m = %u\n",
+                  d, d->arch.paging.free_pages, d->arch.paging.p2m_pages);
+    ASSERT(!d->arch.paging.p2m_pages);
+    ASSERT(!d->arch.paging.free_pages);
+    ASSERT(!d->arch.paging.total_pages);
+
+    paging_unlock(d);
 
     p2m_final_teardown(d);
 }
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 7c829c1a1d..0a4a6e9c39 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1231,7 +1231,7 @@ void shadow_free(struct domain *d, mfn_t smfn)
 
         /*
          * For dying domains, actually free the memory here. This way less
-         * work is left to shadow_final_teardown(), which cannot easily have
+         * work is left to paging_final_teardown(), which cannot easily have
          * preemption checks added.
          */
         if ( unlikely(dying) )
@@ -2896,35 +2896,6 @@ out:
     }
 }
 
-void shadow_final_teardown(struct domain *d)
-/* Called by arch_domain_destroy(), when it's safe to pull down the p2m map. */
-{
-    SHADOW_PRINTK("dom %u final teardown starts."
-                   "  Shadow pages total = %u, free = %u, p2m=%u\n",
-                   d->domain_id, d->arch.paging.total_pages,
-                   d->arch.paging.free_pages, d->arch.paging.p2m_pages);
-
-    /* Double-check that the domain didn't have any shadow memory.
-     * It is possible for a domain that never got domain_kill()ed
-     * to get here with its shadow allocation intact. */
-    if ( d->arch.paging.total_pages != 0 )
-        shadow_teardown(d, NULL);
-
-    /* It is now safe to pull down the p2m map. */
-    p2m_teardown(p2m_get_hostp2m(d), true, NULL);
-    /* Free any shadow memory that the p2m teardown released */
-    paging_lock(d);
-    shadow_set_allocation(d, 0, NULL);
-    SHADOW_PRINTK("dom %u final teardown done."
-                   "  Shadow pages total = %u, free = %u, p2m=%u\n",
-                   d->domain_id, d->arch.paging.total_pages,
-                   d->arch.paging.free_pages, d->arch.paging.p2m_pages);
-    ASSERT(d->arch.paging.p2m_pages == 0);
-    ASSERT(d->arch.paging.free_pages == 0);
-    ASSERT(d->arch.paging.total_pages == 0);
-    paging_unlock(d);
-}
-
 static int shadow_one_bit_enable(struct domain *d, u32 mode)
 /* Turn on a single shadow mode feature */
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 17 11:11:32 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Mar 2023 11:11:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511005.789679 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zg-0007B5-Ub; Fri, 17 Mar 2023 11:11:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511005.789679; Fri, 17 Mar 2023 11:11:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zg-0007Aw-RO; Fri, 17 Mar 2023 11:11:32 +0000
Received: by outflank-mailman (input) for mailman id 511005;
 Fri, 17 Mar 2023 11: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 1pd7zg-0007AR-6a
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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 1pd7zg-0005vG-5f
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pd7zg-0006UG-4V
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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=rwwzYl950k+L3VQmXpks3fCZ7XS1+hCW++oPP25O0sg=; b=0d3/cn4kcAQxhiLA+j8aonEs8g
	TETyWQbX6A9d3UWxFKn0EsdZl4NwXcCZHIjwHBJKY5zYkRdBn+nfbDpwBmC4YxPiy+UU2lsR5dYWr
	0DOoCiXNEB8+aKvJ9ZnKPc63YD3bOYWdJBgWZxr6cydKrUPxqJ2aBL7js1hiVbs2Id2w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/paging: drop set-allocation from final-teardown
Message-Id: <E1pd7zg-0006UG-4V@xenbits.xenproject.org>
Date: Fri, 17 Mar 2023 11:11:32 +0000

commit 6b41622ae03015d275de2b73a4177c6d5570004a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 16 14:43:31 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 16 14:43:31 2023 +0100

    x86/paging: drop set-allocation from final-teardown
    
    The fixes for XSA-410 have arranged for P2M pages being freed by P2M
    code to be properly freed directly, rather than being put back on the
    paging pool list. Therefore whatever p2m_teardown() may return will no
    longer need taking care of here. Drop the code, leaving the assertions
    in place and adding "total" back to the PAGING_PRINTK() message.
    
    With merely the (optional) log message and the assertions left, there's
    really no point anymore to hold the paging lock there, so drop that too.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/paging.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 4e4de80f55..616010e6b8 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -865,22 +865,13 @@ void paging_final_teardown(struct domain *d)
     /* It is now safe to pull down the p2m map. */
     p2m_teardown(p2m_get_hostp2m(d), true, NULL);
 
-    /* Free any paging memory that the p2m teardown released. */
-    paging_lock(d);
-
-    if ( hap )
-        hap_set_allocation(d, 0, NULL);
-    else
-        shadow_set_allocation(d, 0, NULL);
-
-    PAGING_PRINTK("%pd done: free = %u, p2m = %u\n",
-                  d, d->arch.paging.free_pages, d->arch.paging.p2m_pages);
+    PAGING_PRINTK("%pd done: total = %u, free = %u, p2m = %u\n",
+                  d, d->arch.paging.total_pages,
+                  d->arch.paging.free_pages, d->arch.paging.p2m_pages);
     ASSERT(!d->arch.paging.p2m_pages);
     ASSERT(!d->arch.paging.free_pages);
     ASSERT(!d->arch.paging.total_pages);
 
-    paging_unlock(d);
-
     p2m_final_teardown(d);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 17 11:11:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Mar 2023 11:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511006.789684 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd7zs-0007It-0g; Fri, 17 Mar 2023 11:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511006.789684; Fri, 17 Mar 2023 11: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 1pd7zr-0007Ie-Su; Fri, 17 Mar 2023 11:11:43 +0000
Received: by outflank-mailman (input) for mailman id 511006;
 Fri, 17 Mar 2023 11: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 1pd7zq-0007IB-Au
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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 1pd7zq-0005vN-9w
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pd7zq-0006Up-8d
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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=q1/oNJZW+fkWN6RVZ6tfbBDaNphIYrL6JAns5EWRL2E=; b=FA9bd3rJG8fy7MO4fZ7H/d67Cu
	BzLqjWJgDbNMcezQfOwe8DrIs9KXfvvHJMpa0ytv3A7qLPBcfgH6LSBErEujEXBdwI1w9isO0VAxz
	GgfDN0KDtOUXLEuWJE1aXVlamoO6yP5A/kjO1mC2CiK01Dw3Hj7fjp0KhVyDADmEcMYc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/paging: move update_paging_modes() hook
Message-Id: <E1pd7zq-0006Up-8d@xenbits.xenproject.org>
Date: Fri, 17 Mar 2023 11:11:42 +0000

commit d0816a9085b5d3e5b3a06222e6ede8dfa3c58eec
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 16 14:46:31 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 16 14:46:31 2023 +0100

    x86/paging: move update_paging_modes() hook
    
    The hook isn't mode dependent, hence it's misplaced in struct
    paging_mode. (Or alternatively I see no reason why the alloc_page() and
    free_page() hooks don't also live there.) Move it to struct
    paging_domain.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/domain.h |  2 ++
 xen/arch/x86/include/asm/paging.h |  3 +--
 xen/arch/x86/mm/hap/hap.c         |  9 +++++----
 xen/arch/x86/mm/shadow/common.c   | 11 ++++++++++-
 xen/arch/x86/mm/shadow/multi.c    |  1 -
 xen/arch/x86/mm/shadow/none.c     | 15 +++++++++------
 xen/arch/x86/mm/shadow/private.h  |  5 -----
 7 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index b5354c3677..ff9cdb56e8 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -235,6 +235,8 @@ struct paging_domain {
      * (used by p2m and log-dirty code for their tries) */
     struct page_info * (*alloc_page)(struct domain *d);
     void (*free_page)(struct domain *d, struct page_info *pg);
+
+    void (*update_paging_modes)(struct vcpu *v);
 };
 
 struct paging_vcpu {
diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index 8c0b0ef29a..e5e469c304 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -139,7 +139,6 @@ struct paging_mode {
 #endif
     void          (*update_cr3            )(struct vcpu *v, int do_locking,
                                             bool noflush);
-    void          (*update_paging_modes   )(struct vcpu *v);
     bool          (*flush_tlb             )(const unsigned long *vcpu_bitmap);
 
     unsigned int guest_levels;
@@ -315,7 +314,7 @@ static inline void paging_update_cr3(struct vcpu *v, bool noflush)
  * has changed, and when bringing up a VCPU for the first time. */
 static inline void paging_update_paging_modes(struct vcpu *v)
 {
-    paging_get_hostmode(v)->update_paging_modes(v);
+    v->domain->arch.paging.update_paging_modes(v);
 }
 
 #ifdef CONFIG_PV
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 010163d051..5b200e1e72 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -443,6 +443,9 @@ static void hap_destroy_monitor_table(struct vcpu* v, mfn_t mmfn)
 /************************************************/
 /*          HAP DOMAIN LEVEL FUNCTIONS          */
 /************************************************/
+
+static void cf_check hap_update_paging_modes(struct vcpu *v);
+
 void hap_domain_init(struct domain *d)
 {
     static const struct log_dirty_ops hap_ops = {
@@ -453,6 +456,8 @@ void hap_domain_init(struct domain *d)
 
     /* Use HAP logdirty mechanism. */
     paging_log_dirty_init(d, &hap_ops);
+
+    d->arch.paging.update_paging_modes = hap_update_paging_modes;
 }
 
 /* return 0 for success, -errno for failure */
@@ -842,7 +847,6 @@ static const struct paging_mode hap_paging_real_mode = {
     .gva_to_gfn             = hap_gva_to_gfn_real_mode,
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_real_mode,
     .update_cr3             = hap_update_cr3,
-    .update_paging_modes    = hap_update_paging_modes,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 1
 };
@@ -853,7 +857,6 @@ static const struct paging_mode hap_paging_protected_mode = {
     .gva_to_gfn             = hap_gva_to_gfn_2_levels,
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_2_levels,
     .update_cr3             = hap_update_cr3,
-    .update_paging_modes    = hap_update_paging_modes,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 2
 };
@@ -864,7 +867,6 @@ static const struct paging_mode hap_paging_pae_mode = {
     .gva_to_gfn             = hap_gva_to_gfn_3_levels,
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_3_levels,
     .update_cr3             = hap_update_cr3,
-    .update_paging_modes    = hap_update_paging_modes,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 3
 };
@@ -875,7 +877,6 @@ static const struct paging_mode hap_paging_long_mode = {
     .gva_to_gfn             = hap_gva_to_gfn_4_levels,
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_4_levels,
     .update_cr3             = hap_update_cr3,
-    .update_paging_modes    = hap_update_paging_modes,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 4
 };
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 0a4a6e9c39..9a00321457 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -83,6 +83,8 @@ static int cf_check sh_enable_log_dirty(struct domain *, bool log_global);
 static int cf_check sh_disable_log_dirty(struct domain *);
 static void cf_check sh_clean_dirty_bitmap(struct domain *);
 
+static void cf_check shadow_update_paging_modes(struct vcpu *);
+
 /* Set up the shadow-specific parts of a domain struct at start of day.
  * Called for every domain from arch_domain_create() */
 int shadow_domain_init(struct domain *d)
@@ -98,6 +100,8 @@ int shadow_domain_init(struct domain *d)
     /* Use shadow pagetables for log-dirty support */
     paging_log_dirty_init(d, &sh_ops);
 
+    d->arch.paging.update_paging_modes = shadow_update_paging_modes;
+
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
     d->arch.paging.shadow.oos_active = 0;
 #endif
@@ -2514,7 +2518,12 @@ static void sh_update_paging_modes(struct vcpu *v)
     v->arch.paging.mode->update_cr3(v, 0, false);
 }
 
-void cf_check shadow_update_paging_modes(struct vcpu *v)
+/*
+ * Update all the things that are derived from the guest's CR0/CR3/CR4.
+ * Called to initialize paging structures if the paging mode has changed,
+ * and when bringing up a VCPU for the first time.
+ */
+static void cf_check shadow_update_paging_modes(struct vcpu *v)
 {
     paging_lock(v->domain);
     sh_update_paging_modes(v);
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index f02f100f24..bacfa27e23 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4167,7 +4167,6 @@ const struct paging_mode sh_paging_mode = {
     .gva_to_gfn                    = sh_gva_to_gfn,
 #endif
     .update_cr3                    = sh_update_cr3,
-    .update_paging_modes           = shadow_update_paging_modes,
     .flush_tlb                     = shadow_flush_tlb,
     .guest_levels                  = GUEST_PAGING_LEVELS,
 #ifdef CONFIG_PV
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index eaaa874b11..f28fb76a9b 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -18,8 +18,14 @@ static void cf_check _clean_dirty_bitmap(struct domain *d)
     ASSERT(is_pv_domain(d));
 }
 
+static void cf_check _update_paging_modes(struct vcpu *v)
+{
+    ASSERT_UNREACHABLE();
+}
+
 int shadow_domain_init(struct domain *d)
 {
+    /* For HVM set up pointers for safety, then fail. */
     static const struct log_dirty_ops sh_none_ops = {
         .enable  = _enable_log_dirty,
         .disable = _disable_log_dirty,
@@ -27,6 +33,9 @@ int shadow_domain_init(struct domain *d)
     };
 
     paging_log_dirty_init(d, &sh_none_ops);
+
+    d->arch.paging.update_paging_modes = _update_paging_modes;
+
     return is_hvm_domain(d) ? -EOPNOTSUPP : 0;
 }
 
@@ -57,11 +66,6 @@ static void cf_check _update_cr3(struct vcpu *v, int do_locking, bool noflush)
     ASSERT_UNREACHABLE();
 }
 
-static void cf_check _update_paging_modes(struct vcpu *v)
-{
-    ASSERT_UNREACHABLE();
-}
-
 static const struct paging_mode sh_paging_none = {
     .page_fault                    = _page_fault,
     .invlpg                        = _invlpg,
@@ -69,7 +73,6 @@ static const struct paging_mode sh_paging_none = {
     .gva_to_gfn                    = _gva_to_gfn,
 #endif
     .update_cr3                    = _update_cr3,
-    .update_paging_modes           = _update_paging_modes,
 };
 
 void shadow_vcpu_init(struct vcpu *v)
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 8cd2d60d13..296a2f6113 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -434,11 +434,6 @@ void cf_check sh_write_guest_entry(
 intpte_t cf_check sh_cmpxchg_guest_entry(
     struct vcpu *v, intpte_t *p, intpte_t old, intpte_t new, mfn_t gmfn);
 
-/* Update all the things that are derived from the guest's CR0/CR3/CR4.
- * Called to initialize paging structures if the paging mode
- * has changed, and when bringing up a VCPU for the first time. */
-void cf_check shadow_update_paging_modes(struct vcpu *v);
-
 /* Unhook the non-Xen mappings in this top-level shadow mfn.
  * With user_only == 1, unhooks only the user-mode mappings. */
 void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 17 11:11:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Mar 2023 11:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511009.789689 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd802-0007R3-2D; Fri, 17 Mar 2023 11:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511009.789689; Fri, 17 Mar 2023 11: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 1pd801-0007Qv-VW; Fri, 17 Mar 2023 11:11:53 +0000
Received: by outflank-mailman (input) for mailman id 511009;
 Fri, 17 Mar 2023 11: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 1pd800-0007PH-Es
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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 1pd800-0005va-Dt
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pd800-0006VP-Cx
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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=sfR/9iWju/+WAYsg4E5LahdSUANs/sUFIPjF3d1rSRQ=; b=c0UdPUqs3RnwB0dAqnWKvt9mde
	+F6WqryLqfG0YVM8Tw8S4XtQwwWSHwxk7u9hTYEmGPPoV7uH0u7QGXTcaOMZdItf71CRgz190DrPt
	TnJewb881qzigTX0DSxYxtg7RNqrttT3wG5i5Fjxia6RJigiqe0IuuIIeKUtl9OEdQEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/paging: move and conditionalize flush_tlb() hook
Message-Id: <E1pd800-0006VP-Cx@xenbits.xenproject.org>
Date: Fri, 17 Mar 2023 11:11:52 +0000

commit 0e1d55d970a7b2def24c75616e5873ea45e708d4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 16 14:48:23 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 16 14:48:23 2023 +0100

    x86/paging: move and conditionalize flush_tlb() hook
    
    The hook isn't mode dependent, hence it's misplaced in struct
    paging_mode. (Or alternatively I see no reason why the alloc_page() and
    free_page() hooks don't also live there.) Move it to struct
    paging_domain.
    
    The hook also is used for HVM guests only, so make respective pieces
    conditional upon CONFIG_HVM.
    
    While there also add __must_check to the hook declaration, as it's
    imperative that callers deal with getting back "false".
    
    While moving the shadow implementation, introduce a "curr" local
    variable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/domain.h |  5 ++++
 xen/arch/x86/include/asm/paging.h | 13 ++++-----
 xen/arch/x86/mm/hap/hap.c         |  6 ++--
 xen/arch/x86/mm/shadow/common.c   | 61 +--------------------------------------
 xen/arch/x86/mm/shadow/hvm.c      | 60 ++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/multi.c    |  1 -
 6 files changed, 74 insertions(+), 72 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index ff9cdb56e8..7bc126587d 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -237,6 +237,11 @@ struct paging_domain {
     void (*free_page)(struct domain *d, struct page_info *pg);
 
     void (*update_paging_modes)(struct vcpu *v);
+
+#ifdef CONFIG_HVM
+    /* Flush selected vCPUs TLBs.  NULL for all. */
+    bool __must_check (*flush_tlb)(const unsigned long *vcpu_bitmap);
+#endif
 };
 
 struct paging_vcpu {
diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index e5e469c304..f75e1b771a 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -139,7 +139,6 @@ struct paging_mode {
 #endif
     void          (*update_cr3            )(struct vcpu *v, int do_locking,
                                             bool noflush);
-    bool          (*flush_tlb             )(const unsigned long *vcpu_bitmap);
 
     unsigned int guest_levels;
 
@@ -299,6 +298,12 @@ static inline unsigned long paging_ga_to_gfn_cr3(struct vcpu *v,
         page_order);
 }
 
+/* Flush selected vCPUs TLBs.  NULL for all. */
+static inline bool paging_flush_tlb(const unsigned long *vcpu_bitmap)
+{
+    return current->domain->arch.paging.flush_tlb(vcpu_bitmap);
+}
+
 #endif /* CONFIG_HVM */
 
 /* Update all the things that are derived from the guest's CR3.
@@ -407,12 +412,6 @@ static always_inline unsigned int paging_max_paddr_bits(const struct domain *d)
     return bits;
 }
 
-/* Flush selected vCPUs TLBs.  NULL for all. */
-static inline bool paging_flush_tlb(const unsigned long *vcpu_bitmap)
-{
-    return paging_get_hostmode(current)->flush_tlb(vcpu_bitmap);
-}
-
 #endif /* XEN_PAGING_H */
 
 /*
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 5b200e1e72..16e9c3325f 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -445,6 +445,7 @@ static void hap_destroy_monitor_table(struct vcpu* v, mfn_t mmfn)
 /************************************************/
 
 static void cf_check hap_update_paging_modes(struct vcpu *v);
+static bool cf_check flush_tlb(const unsigned long *vcpu_bitmap);
 
 void hap_domain_init(struct domain *d)
 {
@@ -458,6 +459,7 @@ void hap_domain_init(struct domain *d)
     paging_log_dirty_init(d, &hap_ops);
 
     d->arch.paging.update_paging_modes = hap_update_paging_modes;
+    d->arch.paging.flush_tlb           = flush_tlb;
 }
 
 /* return 0 for success, -errno for failure */
@@ -847,7 +849,6 @@ static const struct paging_mode hap_paging_real_mode = {
     .gva_to_gfn             = hap_gva_to_gfn_real_mode,
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_real_mode,
     .update_cr3             = hap_update_cr3,
-    .flush_tlb              = flush_tlb,
     .guest_levels           = 1
 };
 
@@ -857,7 +858,6 @@ static const struct paging_mode hap_paging_protected_mode = {
     .gva_to_gfn             = hap_gva_to_gfn_2_levels,
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_2_levels,
     .update_cr3             = hap_update_cr3,
-    .flush_tlb              = flush_tlb,
     .guest_levels           = 2
 };
 
@@ -867,7 +867,6 @@ static const struct paging_mode hap_paging_pae_mode = {
     .gva_to_gfn             = hap_gva_to_gfn_3_levels,
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_3_levels,
     .update_cr3             = hap_update_cr3,
-    .flush_tlb              = flush_tlb,
     .guest_levels           = 3
 };
 
@@ -877,7 +876,6 @@ static const struct paging_mode hap_paging_long_mode = {
     .gva_to_gfn             = hap_gva_to_gfn_4_levels,
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_4_levels,
     .update_cr3             = hap_update_cr3,
-    .flush_tlb              = flush_tlb,
     .guest_levels           = 4
 };
 
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 9a00321457..a9260f5711 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -106,6 +106,7 @@ int shadow_domain_init(struct domain *d)
     d->arch.paging.shadow.oos_active = 0;
 #endif
 #ifdef CONFIG_HVM
+    d->arch.paging.flush_tlb = shadow_flush_tlb;
     d->arch.paging.shadow.pagetable_dying_op = 0;
 #endif
 
@@ -3090,66 +3091,6 @@ static void cf_check sh_clean_dirty_bitmap(struct domain *d)
     paging_unlock(d);
 }
 
-
-static bool flush_vcpu(const struct vcpu *v, const unsigned long *vcpu_bitmap)
-{
-    return !vcpu_bitmap || test_bit(v->vcpu_id, vcpu_bitmap);
-}
-
-/* Flush TLB of selected vCPUs.  NULL for all. */
-bool cf_check shadow_flush_tlb(const unsigned long *vcpu_bitmap)
-{
-    static DEFINE_PER_CPU(cpumask_t, flush_cpumask);
-    cpumask_t *mask = &this_cpu(flush_cpumask);
-    struct domain *d = current->domain;
-    struct vcpu *v;
-
-    /* Avoid deadlock if more than one vcpu tries this at the same time. */
-    if ( !spin_trylock(&d->hypercall_deadlock_mutex) )
-        return false;
-
-    /* Pause all other vcpus. */
-    for_each_vcpu ( d, v )
-        if ( v != current && flush_vcpu(v, vcpu_bitmap) )
-            vcpu_pause_nosync(v);
-
-    /* Now that all VCPUs are signalled to deschedule, we wait... */
-    for_each_vcpu ( d, v )
-        if ( v != current && flush_vcpu(v, vcpu_bitmap) )
-            while ( !vcpu_runnable(v) && v->is_running )
-                cpu_relax();
-
-    /* All other vcpus are paused, safe to unlock now. */
-    spin_unlock(&d->hypercall_deadlock_mutex);
-
-    cpumask_clear(mask);
-
-    /* Flush paging-mode soft state (e.g., va->gfn cache; PAE PDPE cache). */
-    for_each_vcpu ( d, v )
-    {
-        unsigned int cpu;
-
-        if ( !flush_vcpu(v, vcpu_bitmap) )
-            continue;
-
-        paging_update_cr3(v, false);
-
-        cpu = read_atomic(&v->dirty_cpu);
-        if ( is_vcpu_dirty_cpu(cpu) )
-            __cpumask_set_cpu(cpu, mask);
-    }
-
-    /* Flush TLBs on all CPUs with dirty vcpu state. */
-    guest_flush_tlb_mask(d, mask);
-
-    /* Done. */
-    for_each_vcpu ( d, v )
-        if ( v != current && flush_vcpu(v, vcpu_bitmap) )
-            vcpu_unpause(v);
-
-    return true;
-}
-
 /**************************************************************************/
 /* Shadow-control XEN_DOMCTL dispatcher */
 
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 88c3c16322..e2ee1c7705 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -688,6 +688,66 @@ static void sh_emulate_unmap_dest(struct vcpu *v, void *addr,
     atomic_inc(&v->domain->arch.paging.shadow.gtable_dirty_version);
 }
 
+static bool flush_vcpu(const struct vcpu *v, const unsigned long *vcpu_bitmap)
+{
+    return !vcpu_bitmap || test_bit(v->vcpu_id, vcpu_bitmap);
+}
+
+/* Flush TLB of selected vCPUs.  NULL for all. */
+bool cf_check shadow_flush_tlb(const unsigned long *vcpu_bitmap)
+{
+    static DEFINE_PER_CPU(cpumask_t, flush_cpumask);
+    cpumask_t *mask = &this_cpu(flush_cpumask);
+    const struct vcpu *curr = current;
+    struct domain *d = curr->domain;
+    struct vcpu *v;
+
+    /* Avoid deadlock if more than one vcpu tries this at the same time. */
+    if ( !spin_trylock(&d->hypercall_deadlock_mutex) )
+        return false;
+
+    /* Pause all other vcpus. */
+    for_each_vcpu ( d, v )
+        if ( v != curr && flush_vcpu(v, vcpu_bitmap) )
+            vcpu_pause_nosync(v);
+
+    /* Now that all VCPUs are signalled to deschedule, we wait... */
+    for_each_vcpu ( d, v )
+        if ( v != curr && flush_vcpu(v, vcpu_bitmap) )
+            while ( !vcpu_runnable(v) && v->is_running )
+                cpu_relax();
+
+    /* All other vcpus are paused, safe to unlock now. */
+    spin_unlock(&d->hypercall_deadlock_mutex);
+
+    cpumask_clear(mask);
+
+    /* Flush paging-mode soft state (e.g., va->gfn cache; PAE PDPE cache). */
+    for_each_vcpu ( d, v )
+    {
+        unsigned int cpu;
+
+        if ( !flush_vcpu(v, vcpu_bitmap) )
+            continue;
+
+        paging_update_cr3(v, false);
+
+        cpu = read_atomic(&v->dirty_cpu);
+        if ( is_vcpu_dirty_cpu(cpu) )
+            __cpumask_set_cpu(cpu, mask);
+    }
+
+    /* Flush TLBs on all CPUs with dirty vcpu state. */
+    guest_flush_tlb_mask(d, mask);
+
+    /* Done. */
+    for_each_vcpu ( d, v )
+        if ( v != curr && flush_vcpu(v, vcpu_bitmap) )
+            vcpu_unpause(v);
+
+    return true;
+}
+
 mfn_t sh_make_monitor_table(const struct vcpu *v, unsigned int shadow_levels)
 {
     struct domain *d = v->domain;
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index bacfa27e23..415e18a8df 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4167,7 +4167,6 @@ const struct paging_mode sh_paging_mode = {
     .gva_to_gfn                    = sh_gva_to_gfn,
 #endif
     .update_cr3                    = sh_update_cr3,
-    .flush_tlb                     = shadow_flush_tlb,
     .guest_levels                  = GUEST_PAGING_LEVELS,
 #ifdef CONFIG_PV
     .shadow.write_guest_entry      = sh_write_guest_entry,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 17 11:12:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Mar 2023 11:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511010.789693 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd80C-0007Ux-3y; Fri, 17 Mar 2023 11:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511010.789693; Fri, 17 Mar 2023 11: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 1pd80C-0007Up-0z; Fri, 17 Mar 2023 11:12:04 +0000
Received: by outflank-mailman (input) for mailman id 511010;
 Fri, 17 Mar 2023 11: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 1pd80A-0007Ub-Ib
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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 1pd80A-0005vu-Hd
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pd80A-0006Xp-GT
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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=zlJGvSbTHMcQj/OwIYYjCigKN29737y498ejzXPXDEk=; b=otwUPgEhAZajCh0kRiIUj0YKXL
	s2zzyv0UTBMR7k61Ltmr11293fpu7wYQ7Q5yS2ERSJ9AYRfq4BMA8kCvzTQffhQXdQAuwC5hqBh3B
	z0J0ZiIgh4cBUWGGzsnC9Wcs7anSUZkR2gQkN74nW8m22ywQZIUAiYC+UnqlzK+hy5tk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: drop zero initialization from shadow_domain_init()
Message-Id: <E1pd80A-0006Xp-GT@xenbits.xenproject.org>
Date: Fri, 17 Mar 2023 11:12:02 +0000

commit 4e4a3eeaa8a32b7ed5333894a1bc73f97fedc5d4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 16 14:49:20 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 16 14:49:20 2023 +0100

    x86/shadow: drop zero initialization from shadow_domain_init()
    
    There's no need for this as struct domain starts out zero-filled.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index a9260f5711..7ad0e538b3 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -102,12 +102,8 @@ int shadow_domain_init(struct domain *d)
 
     d->arch.paging.update_paging_modes = shadow_update_paging_modes;
 
-#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
-    d->arch.paging.shadow.oos_active = 0;
-#endif
 #ifdef CONFIG_HVM
     d->arch.paging.flush_tlb = shadow_flush_tlb;
-    d->arch.paging.shadow.pagetable_dying_op = 0;
 #endif
 
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 17 11:12:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Mar 2023 11:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511011.789696 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pd80M-0007bt-6l; Fri, 17 Mar 2023 11:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511011.789696; Fri, 17 Mar 2023 11: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 1pd80M-0007bl-47; Fri, 17 Mar 2023 11:12:14 +0000
Received: by outflank-mailman (input) for mailman id 511011;
 Fri, 17 Mar 2023 11: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 1pd80K-0007bN-Lw
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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 1pd80K-0005w4-Kw
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pd80K-0006YM-K4
 for xen-changelog@lists.xenproject.org; Fri, 17 Mar 2023 11: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=VTqFJxgtLRwt0CC5Eivbzaypzzz9k8TwkDDcY/dkWEc=; b=pcPR6fjJHAuEwjiLaNvKnWGL2u
	qV8n97UPLewwv1NA7VzXpG3N2qT2GMAfSXmJx1w8DYvR6FVTDU7xsViQtRdOZ2jnJxwmzE4CQWxbE
	G3TmAzv0eOAvJzx3nM0AOtv3F4g9n8jfcmb7YMnRIopName2qO9VRC0uwmOVkMDsmY1U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: mention xl/libxl SMBIOS support
Message-Id: <E1pd80K-0006YM-K4@xenbits.xenproject.org>
Date: Fri, 17 Mar 2023 11:12:12 +0000

commit 36e49fc8cbad21a4308b4701caaa685ef04e120b
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu Mar 16 14:50:08 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 16 14:50:08 2023 +0100

    CHANGELOG: mention xl/libxl SMBIOS support
    
    Add an entry for the new xl/libxl SMBIOS support.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Henry Wang <Henry.Wang@arm.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b116163b62..c978cfd9b6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
      livelocks, instead of crashing the entire server.
    - Bus-lock detection, used by Xen to mitigate (by rate-limiting) the system
      wide impact of a guest misusing atomic instructions.
+ - xl/libxl can customize SMBIOS strings for HVM guests.
 
 ## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.17.0) - 2022-12-12
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:33:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511495.790538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeAh-00037A-DD; Sat, 18 Mar 2023 21:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511495.790538; Sat, 18 Mar 2023 21: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 1pdeAh-000372-A7; Sat, 18 Mar 2023 21:33:03 +0000
Received: by outflank-mailman (input) for mailman id 511495;
 Sat, 18 Mar 2023 21: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 1pdeAf-00036u-KV
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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 1pdeAf-00057L-JI
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeAf-0002xb-Hm
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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=E0ygsLwuZfQmYCGJsn3n6cV/9gzKNM3atbldo7y9wkY=; b=0+DJqtAKllBnmroolxoSRWRVo3
	GJb4d0of4dPcMTc4fhYpMievaeK69wpohz9hYTxiLm4VZGFSOgswANQ3jZwUXpobo++RCs6eYiYDK
	vOITBRVTfxH4W7dn8+cVUjudTrJS2cgs3CQsj5xGDRldevi2Se+CIv0kqW8hSIdKSaig=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: Provide EXITINFO decodes for IO intercetps
Message-Id: <E1pdeAf-0002xb-Hm@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:33:01 +0000

commit df9369154aa010b2322e3f3e0727a242784cfd4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 15 19:52:25 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    x86/svm: Provide EXITINFO decodes for IO intercetps
    
    This removes raw number manipulation, and makes the logic easier to follow.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/svm.c              | 11 +++++------
 xen/arch/x86/include/asm/hvm/svm/vmcb.h | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index a43bcf2e92..bfe03316de 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2939,13 +2939,12 @@ void svm_vmexit_handler(void)
         break;
 
     case VMEXIT_IOIO:
-        if ( (vmcb->exitinfo1 & (1u<<2)) == 0 )
+        if ( !vmcb->ei.io.str )
         {
-            uint16_t port = (vmcb->exitinfo1 >> 16) & 0xFFFF;
-            int bytes = ((vmcb->exitinfo1 >> 4) & 0x07);
-            int dir = (vmcb->exitinfo1 & 1) ? IOREQ_READ : IOREQ_WRITE;
-            if ( handle_pio(port, bytes, dir) )
-                __update_guest_eip(regs, vmcb->exitinfo2 - vmcb->rip);
+            if ( handle_pio(vmcb->ei.io.port,
+                            vmcb->ei.io.bytes,
+                            vmcb->ei.io.in ? IOREQ_READ : IOREQ_WRITE) )
+                __update_guest_eip(regs, vmcb->ei.io.nrip - vmcb->rip);
         }
         else if ( !hvm_emulate_one_insn(x86_insn_is_portio, "port I/O") )
             hvm_inject_hw_exception(TRAP_gp_fault, 0);
diff --git a/xen/arch/x86/include/asm/hvm/svm/vmcb.h b/xen/arch/x86/include/asm/hvm/svm/vmcb.h
index e87728fa81..b809e85507 100644
--- a/xen/arch/x86/include/asm/hvm/svm/vmcb.h
+++ b/xen/arch/x86/include/asm/hvm/svm/vmcb.h
@@ -436,6 +436,20 @@ struct vmcb_struct {
             uint64_t exitinfo2; /* offset 0x80 */
         };
         union {
+            struct {
+                bool     in:1;
+                bool     :1;
+                bool     str:1;
+                bool     rep:1;
+                uint16_t bytes:3;
+                uint16_t /* asz */:3;
+                uint16_t seg:3;
+                uint16_t :3;
+                uint16_t port;
+                uint32_t :32;
+
+                uint64_t nrip;
+            } io;
             struct {
                 uint16_t sel;
                 uint64_t :48;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:33:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511496.790542 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeAr-00038o-Eb; Sat, 18 Mar 2023 21:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511496.790542; Sat, 18 Mar 2023 21: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 1pdeAr-00038g-Bq; Sat, 18 Mar 2023 21:33:13 +0000
Received: by outflank-mailman (input) for mailman id 511496;
 Sat, 18 Mar 2023 21: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 1pdeAp-00038V-OY
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeAp-00057j-NW
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeAp-0002yN-Ls
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FJ9cseAq/2+iCH9IR0cey2wl6AOLkXTT6orzo4Ti+EE=; b=gx/Ao8dLRotHtm4GSed4FZ9/kA
	3unRi84r6S3u9Oy9YdJzC32zHvQEAwBwjRRfrVJSP91YEMMcuuXuaszCedyS3OQSBbsPdBy2GIKnp
	N99tSpwOFgflQ4IfPDoPHfY1/7sQDGXxbO0Sd8lbc55UYnatk1exjeWFAXKskIMM1d2g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/python: Drop pylintrc
Message-Id: <E1pdeAp-0002yN-Ls@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:33:11 +0000

commit 397f9e57aacc9a51c6d4a4303f35dd75357d065d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 14 13:18:41 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    tools/python: Drop pylintrc
    
    This was added in 2004 in c/s b7d4a69f0ccb5 and has never been referenced
    since.  Given the the commit message of simply "Added .", it was quite
    possibly a mistake in the first place.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/python/pylintrc | 307 --------------------------------------------------
 1 file changed, 307 deletions(-)

diff --git a/tools/python/pylintrc b/tools/python/pylintrc
deleted file mode 100644
index efc4b0b3b2..0000000000
--- a/tools/python/pylintrc
+++ /dev/null
@@ -1,307 +0,0 @@
-# lint Python modules using external checkers.                            
-#                                                                                
-#     This is the main checker controling the other ones and the reports         
-#     generation. It is itself both a raw checker and an astng checker in order  
-#     to:                                                                        
-#     * handle message activation / deactivation at the module level             
-#     * handle some basic but necessary stats'data (number of classes, methods...)
-#                                                                                 
-# This checker also defines the following reports:                                    
-#   * R0001: Total errors / warnings                                              
-#   * R0002: % errors / warnings by module                                        
-#   * R0003: Messages                                                             
-#   * R0004: Global evaluation                                                    
-# 
-[MASTER]
-# Add <file or directory> to the black list. It should be a base name, not a
-# path. You may set this option multiple times.
-ignore=CVS
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# Set the cache size for astng objects.
-cache-size=500
-
-
-
-[REPORTS]
-# Tells wether to display a full report or only the messages
-reports=yes
-
-# Use HTML as output format instead of text
-html=no
-
-# Use a parseable text output format, so your favorite text editor will be able
-# to jump to the line corresponding to a message.
-parseable=no
-
-# Colorizes text output using ansi escape codes
-color=no
-
-# Put messages in a separate file for each module / package specified on the
-# command line instead of printing them on stdout. Reports (if any) will be
-# written in a file name "pylint_global.[txt|html]".
-files-output=no
-
-# Python expression which should return a note less than 10 (10 is the highest
-# note).You have access to the variables errors warning, statement which
-# respectivly contain the number of errors / warnings messages and the total
-# number of statements analyzed. This is used by the global evaluation report
-# (R0004).
-evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
-
-# Add a comment according to your evaluation note. This is used by the global
-# evaluation report (R0004).
-comment=no
-
-# Include message's id in output
-include-ids=yes
-
-
-
-# checks for                                                              
-#     * unused variables / imports                                               
-#     * undefined variables                                                      
-#     * redefinition of variable from builtins or from an outer scope            
-#     * use of variable before assigment                                         
-#     
-[VARIABLES]
-# Enable / disable this checker
-enable-variables=yes
-
-# Tells wether we should check for unused import in __init__ files.
-init-import=no
-
-# List of variable names used for dummy variables (i.e. not used).
-dummy-variables=_,_1,_2,_3,_4,_5,dummy
-
-
-
-# checks for :                                                            
-#     * doc strings                                                              
-#     * modules / classes / functions / methods / arguments / variables name     
-#     * number of arguments, local variables, branchs, returns and statements in
-# functions, methods                                                       
-#     * required module attributes                                             
-#     * dangerous default values as arguments                                    
-#     * redefinition of function / method / class                                
-#     * uses of the global statement                                             
-#                                                                                 
-# This checker also defines the following reports:                                    
-#   * R0101: Statistics by type                                                   
-# 
-[BASIC]
-# Enable / disable this checker
-enable-basic=yes
-
-# Required attributes for module, separated by a comma
-required-attributes=
-
-# Regular expression which should only match functions or classes name which do
-# not require a docstring
-no-docstring-rgx=.*
-
-# Minimal length for module / class / function / method / argument / variable
-# names
-min-name-length=1
-
-# Regular expression which should only match correct module names
-module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-
-# Regular expression which should only match correct class names
-class-rgx=[A-Z_][a-zA-Z0-9]+$
-
-# Regular expression which should only match correct function names
-function-rgx=[a-z_][A-Za-z0-9_]*$
-
-# Regular expression which should only match correct method names
-method-rgx=[a-z_][A-Za-z0-9_]*$
-
-# Regular expression which should only match correct argument names
-argument-rgx=[a-z_][A-Za-z0-9_]*$
-
-# Regular expression which should only match correct variable names
-variable-rgx=[a-z_][A-Za-z0-9_]*$
-
-# Good variable names which should always be accepted, separated by a comma
-good-names=i,j,k,ex,Run,_
-
-# Bad variable names which should always be refused, separated by a comma
-bad-names=foo,bar,baz,toto,tutu,tata
-
-# List of builtins function names that should not be used, separated by a comma
-bad-functions=apply,input
-
-
-
-# checks for sign of poor/misdesign:                                      
-#     * number of methods, attributes, local variables...                        
-#     * size, complexity of functions, methods                                   
-#     
-[DESIGN]
-# Enable / disable this checker
-enable-design=yes
-
-# Maximum number of arguments for function / method
-max-args=15
-
-# Maximum number of locals for function / method body
-max-locals=15
-
-# Maximum number of return / yield for function / method body
-max-returns=6
-
-# Maximum number of branch for function / method body
-max-branchs=12
-
-# Maximum number of statements in function / method body
-max-statements=50
-
-# Maximum number of parents for a class (see R0901).
-max-parents=7
-
-# Maximum number of attributes for a class (see R0902).
-max-attributes=7
-
-# Minimum number of public methods for a class (see R0903).
-min-public-methods=2
-
-# Maximum number of public methods for a class (see R0904).
-max-public-methods=20
-
-
-
-# checks for :                                                            
-#     * methods without self as first argument                                   
-#     * overriden methods signature                                              
-#     * access only to existant members via self                                 
-#     * attributes not defined in the __init__ method                            
-#     * supported interfaces implementation                                      
-#     * unreachable code                                                         
-#     
-[CLASSES]
-# Enable / disable this checker
-enable-classes=yes
-
-# List of interface methods to ignore, separated by a comma. This is used for
-# instance to not check methods defines in Zope's Interface base class.
-ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
-
-# Tells wether missing members accessed in mixin class should be ignored. A
-# mixin class is detected if its name ends with "mixin" (case insensitive).
-ignore-mixin-members=yes
-
-
-
-# checks for                                                              
-#     * external modules dependencies                                            
-#     * relative / wildcard imports                                                         
-#     * cyclic imports                                                           
-#     * uses of deprecated modules
-#                                                                                 
-# This checker also defines the following reports:                                    
-#   * R0401: External dependencies                                                
-#   * R0402: Modules dependencies graph                                           
-# 
-[IMPORTS]
-# Enable / disable this checker
-enable-imports=no
-
-# Deprecated modules which should not be used, separated by a comma
-deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
-
-# Create a graph of every (i.e. internal and external) dependencies in the given
-# file (report R0402 must not be disabled)
-import-graph=
-
-# Create a graph of external dependencies in the given file (report R0402 must
-# not be disabled)
-ext-import-graph=
-
-# Create a graph of internal dependencies in the given file (report R0402 must
-# not be disabled)
-int-import-graph=
-
-
-
-# checks for                                                              
-#     * excepts without exception filter                                         
-#     * string exceptions                                                        
-#     
-[EXCEPTIONS]
-# Enable / disable this checker
-enable-exceptions=yes
-
-
-
-# checks for :                                                            
-#     * unauthorized constructions                                               
-#     * strict indentation                                                       
-#     * line length                                                              
-#     * use of <> instead of !=
-#     
-[FORMAT]
-# Enable / disable this checker
-enable-format=no
-
-# Maximum number of characters on a single line.
-max-line-length=80
-
-# Maximum number of lines in a module
-max-module-lines=1000
-
-# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab).
-indent-string='    '
-
-
-
-# does not check anything but gives some raw metrics :                    
-#     * total number of lines                                                    
-#     * total number of code lines                                               
-#     * total number of docstring lines                                          
-#     * total number of comments lines                                           
-#     * total number of empty lines                                              
-#                                                                                 
-# This checker also defines the following reports:                                    
-#   * R0701: Raw metrics                                                          
-# 
-[METRICS]
-# Enable / disable this checker
-enable-metrics=yes
-
-
-
-# checks for:                                                             
-#     * warning notes in the code like FIXME, XXX                                
-#     * PEP 263: source code with non ascii character but no encoding declaration
-#     
-[MISCELLANEOUS]
-# Enable / disable this checker
-enable-miscellaneous=yes
-
-# List of note tags to take in consideration, separated by a comma. Default to
-# FIXME, XXX, TODO
-notes=FIXME,XXX,TODO
-
-
-
-# checks for similarities and duplicated code. This computation may be
-#     memory / CPU intensive, so you should disable it if you experiments some
-#     problems.
-#                                                                                 
-# This checker also defines the following reports:                                    
-#   * R0801: Duplication                                                          
-# 
-[SIMILARITIES]
-# Enable / disable this checker
-enable-similarities=yes
-
-# Minimum lines number of a similarity.
-min-similarity-lines=4
-
-# Ignore comments when computing similarities.
-ignore-comments=yes
-
-
-
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:33:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511497.790545 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeB1-0003BR-GP; Sat, 18 Mar 2023 21:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511497.790545; Sat, 18 Mar 2023 21: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 1pdeB1-0003BJ-DP; Sat, 18 Mar 2023 21:33:23 +0000
Received: by outflank-mailman (input) for mailman id 511497;
 Sat, 18 Mar 2023 21: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 1pdeAz-0003B4-SM
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33: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 1pdeAz-00057t-RK
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeAz-0002z0-QB
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0kE0C/IEkD4eZ5vnYPUgUtS7RmpZUDdu5f14FKvJteE=; b=6yOr0XhUW3ywmHZOW+nvx63iQo
	/EmqBEdJdePDWzIdY888EddqU6OxeD6gnsebK1W4FG8+AtwMlunhojpPWrSQ3bxOoJcz11eDfOQhv
	WBKC4HP50VDwwRhP/Lcwv3VLvZXLY4LWaxSsV21tnpBYCRP8yrdCH+AidvXEu9ZPCbfI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/misc: Drop xencons
Message-Id: <E1pdeAz-0002z0-QB@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:33:21 +0000

commit 5d22d69b30c48c8f4df9279dac56a4b5310b648c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 14 13:31:32 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    tools/misc: Drop xencons
    
    This script is not python3 compatible, but has its shebang altered to say
    python3 by INSTALL_PYTHON_PROG.
    
    The most recent reference I can find to this script (which isn't incidental
    adjustments in the makefile) is from the Xen book, fileish 561e30b80402 which
    says
    
      %% <snip>  Alternatively, if the
      %% Xen machine is connected to a serial-port server then we supply a
      %% dumb TCP terminal client, {\tt xencons}.
    
    So this a not-invented-here version of telnet.  Delete it.
    
    Resolves: xen-project/xen#159
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/misc/Makefile |  2 --
 tools/misc/xencons  | 92 -----------------------------------------------------
 2 files changed, 94 deletions(-)

diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 1c6e1d6a04..233a7948c0 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -12,7 +12,6 @@ CFLAGS += $(CFLAGS_libxenstore)
 # Everything to be installed in regular bin/
 INSTALL_BIN-$(CONFIG_X86)      += xen-cpuid
 INSTALL_BIN-$(CONFIG_X86)      += xen-detect
-INSTALL_BIN                    += xencons
 INSTALL_BIN                    += xencov_split
 INSTALL_BIN += $(INSTALL_BIN-y)
 
@@ -44,7 +43,6 @@ INSTALL_PRIVBIN                += xenpvnetboot
 TARGETS_ALL := $(INSTALL_BIN) $(INSTALL_SBIN) $(INSTALL_PRIVBIN)
 
 # Everything which only needs copying to install
-TARGETS_COPY += xencons
 TARGETS_COPY += xencov_split
 TARGETS_COPY += xenpvnetboot
 
diff --git a/tools/misc/xencons b/tools/misc/xencons
deleted file mode 100755
index 8bd3178eab..0000000000
--- a/tools/misc/xencons
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-
-##############################################
-# Console client for Xen guest OSes
-# Copyright (c) 2004, K A Fraser
-##############################################
-
-import errno, os, signal, socket, struct, sys
-
-from termios import *
-# Indexes into termios.tcgetattr() list.
-IFLAG  = 0
-OFLAG  = 1
-CFLAG  = 2
-LFLAG  = 3
-ISPEED = 4
-OSPEED = 5
-CC     = 6
-
-def __child_death(signum, frame):
-    global stop
-    stop = True
-
-def __recv_from_sock(sock):
-    global stop
-    stop = False
-    while not stop:
-        try:
-            data = sock.recv(1024)
-        except socket.error, error:
-            if error[0] != errno.EINTR:
-                raise
-        else:
-            try:
-                os.write(1, data)
-            except os.error, error:
-                if error[0] != errno.EINTR:
-                    raise
-    os.wait()
-
-def __send_to_sock(sock):
-    while 1:
-        try:
-            data = os.read(0,1024)
-        except os.error, error:
-            if error[0] != errno.EINTR:
-                raise
-        else:
-            if ord(data[0]) == ord(']')-64:
-                break
-            try:
-                sock.send(data)
-            except socket.error, error:
-                if error[0] == errno.EPIPE:
-                    sys.exit(0)
-                if error[0] != errno.EINTR:
-                    raise
-    sys.exit(0)
-
-def connect(host,port):
-    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
-    sock.connect((host,port))
-
-    oattrs = tcgetattr(0)
-    nattrs = tcgetattr(0)
-    nattrs[IFLAG] = nattrs[IFLAG] & ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
-    nattrs[OFLAG] = nattrs[OFLAG] & ~(OPOST)
-    nattrs[CFLAG] = nattrs[CFLAG] & ~(CSIZE | PARENB)
-    nattrs[CFLAG] = nattrs[CFLAG] | CS8
-    nattrs[LFLAG] = nattrs[LFLAG] & ~(ECHO | ICANON | IEXTEN | ISIG)
-    nattrs[CC][VMIN] = 1
-    nattrs[CC][VTIME] = 0
-
-    if os.fork():
-        signal.signal(signal.SIGCHLD, __child_death)
-        print "************ REMOTE CONSOLE: CTRL-] TO QUIT ********"
-        tcsetattr(0, TCSAFLUSH, nattrs)
-        try:
-            __recv_from_sock(sock)
-        finally:
-            tcsetattr(0, TCSAFLUSH, oattrs)
-            print
-            print "************ REMOTE CONSOLE EXITED *****************"
-    else:
-        signal.signal(signal.SIGPIPE, signal.SIG_IGN)
-        __send_to_sock(sock)
-
-if __name__ == '__main__':
-    if len(sys.argv) != 3:
-        print sys.argv[0] + " <host> <port>"
-        sys.exit(1)
-    connect(str(sys.argv[1]),int(sys.argv[2]))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:33:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511498.790550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeBB-0003EP-J9; Sat, 18 Mar 2023 21:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511498.790550; Sat, 18 Mar 2023 21: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 1pdeBB-0003EH-Ff; Sat, 18 Mar 2023 21:33:33 +0000
Received: by outflank-mailman (input) for mailman id 511498;
 Sat, 18 Mar 2023 21: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 1pdeBA-0003E7-0I
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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 1pdeB9-000581-VQ
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeB9-0002zW-UP
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7vz5M6vACvZLyKzqPt8+afNfiltJjMZiXrTNc2UVl8Y=; b=NSaxf5Ddb+yHgUNR0xcOHMsubW
	g882AJbNRiLLs7FDdeb4VVliujJPYDuBvv8ZthTNUzceeiXs89TQHxbmeaSBE312LoWLXwzbqmJ1U
	ZQ3qveAjm1SJnI/i9Zm+aHhgAOezgpyXW8OBcdC9+5hRnUqycBhlnkQVxPmo3aGRrfls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Delete trailing whitespace in python scripts
Message-Id: <E1pdeB9-0002zW-UP@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:33:31 +0000

commit 1b000684206317f328a9f767dfbaf7c4d0cc7e80
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 14 13:17:19 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    tools: Delete trailing whitespace in python scripts
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/misc/xencov_split            |   1 -
 tools/pygrub/src/ExtLinuxConf.py   |   2 +-
 tools/pygrub/src/GrubConf.py       |  30 +++---
 tools/pygrub/src/fsimage/fsimage.c |   8 +-
 tools/pygrub/src/pygrub            |  44 ++++----
 tools/python/xen/lowlevel/xc/xc.c  | 200 ++++++++++++++++++-------------------
 tools/python/xen/lowlevel/xs/xs.c  |   4 +-
 tools/xenmon/xenmon.py             |  44 ++++----
 8 files changed, 166 insertions(+), 167 deletions(-)

diff --git a/tools/misc/xencov_split b/tools/misc/xencov_split
index 5771f6cfc2..e4f68ebb6e 100755
--- a/tools/misc/xencov_split
+++ b/tools/misc/xencov_split
@@ -94,4 +94,3 @@ if __name__ == "__main__":
         sys.exit(1)
     except KeyboardInterrupt:
         sys.exit(1)
-
diff --git a/tools/pygrub/src/ExtLinuxConf.py b/tools/pygrub/src/ExtLinuxConf.py
index 9fd635b9cf..4e990a9304 100644
--- a/tools/pygrub/src/ExtLinuxConf.py
+++ b/tools/pygrub/src/ExtLinuxConf.py
@@ -207,7 +207,7 @@ class ExtLinuxConfigFile(object):
                  "f1": None,
                  "f2": None,
                  }
-        
+
 if __name__ == "__main__":
     if len(sys.argv) < 2:
         raise RuntimeError("Need a configuration file to read")
diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
index 73f1bbed2f..580c9628ca 100644
--- a/tools/pygrub/src/GrubConf.py
+++ b/tools/pygrub/src/GrubConf.py
@@ -95,7 +95,7 @@ class _GrubImage(object):
         self.title = title.strip()
 
     def __repr__(self):
-        return ("title: %s\n" 
+        return ("title: %s\n"
                 "  root: %s\n"
                 "  kernel: %s\n"
                 "  args: %s\n"
@@ -140,7 +140,7 @@ class _GrubImage(object):
 class GrubImage(_GrubImage):
     def __init__(self, title, lines):
         _GrubImage.__init__(self, title, lines)
-    
+
     def set_from_line(self, line, replace = None):
         (com, arg) = grub_exact_split(line, 2)
 
@@ -265,7 +265,7 @@ class _GrubConfigFile(object):
 class GrubConfigFile(_GrubConfigFile):
     def __init__(self, fn = None):
         _GrubConfigFile.__init__(self,fn)
-        
+
     def new_image(self, title, lines):
         return GrubImage(title, lines)
 
@@ -297,7 +297,7 @@ class GrubConfigFile(_GrubConfigFile):
                 img = []
                 title = l[6:]
                 continue
-                
+
             if img is not None:
                 img.append(l)
                 continue
@@ -310,7 +310,7 @@ class GrubConfigFile(_GrubConfigFile):
                     logging.info("Ignored directive %s" %(com,))
             else:
                 logging.warning("Unknown directive %s" %(com,))
-                
+
         if img:
             self.add_image(GrubImage(title, img))
 
@@ -322,7 +322,7 @@ def grub2_handle_set(arg):
     com="set:" + com
     m = re.match("([\"\'])(.*)\\1", arg)
     if m is not None:
-        arg=m.group(2) 
+        arg=m.group(2)
     return (com,arg)
 
 class Grub2Image(_GrubImage):
@@ -334,7 +334,7 @@ class Grub2Image(_GrubImage):
 
         if com == "set":
             (com,arg) = grub2_handle_set(arg)
-            
+
         if com in self.commands:
             if self.commands[com] is not None:
                 setattr(self, self.commands[com], arg.strip())
@@ -351,7 +351,7 @@ class Grub2Image(_GrubImage):
         else:
             self.lines.pop(replace)
             self.lines.insert(replace, line)
-                
+
     commands = {'set:root': 'root',
                 'linux': 'kernel',
                 'linux16': 'kernel',
@@ -360,14 +360,14 @@ class Grub2Image(_GrubImage):
                 'echo': None,
                 'insmod': None,
                 'search': None}
-    
+
 class Grub2ConfigFile(_GrubConfigFile):
     def __init__(self, fn = None):
         _GrubConfigFile.__init__(self, fn)
-       
+
     def new_image(self, title, lines):
         return Grub2Image(title, lines)
- 
+
     def parse(self, buf = None):
         if buf is None:
             if self.filename is None:
@@ -431,10 +431,10 @@ class Grub2ConfigFile(_GrubConfigFile):
                 continue
 
             (com, arg) = grub_exact_split(l, 2)
-        
+
             if com == "set":
                 (com,arg) = grub2_handle_set(arg)
-                
+
             if com in self.commands:
                 if self.commands[com] is not None:
                     arg_strip = arg.strip()
@@ -448,7 +448,7 @@ class Grub2ConfigFile(_GrubConfigFile):
                 pass
             else:
                 logging.warning("Unknown directive %s" %(com,))
-            
+
         if img is not None:
             raise RuntimeError("syntax error: end of file with open menuentry(%d %s)" % (len(img),img))
 
@@ -466,7 +466,7 @@ class Grub2ConfigFile(_GrubConfigFile):
                 'if': None,
                 'fi': None,
                 }
-        
+
 if __name__ == "__main__":
     if len(sys.argv) < 3:
         raise RuntimeError('Need a grub version ("grub" or "grub2") and a grub.conf or grub.cfg to read')
diff --git a/tools/pygrub/src/fsimage/fsimage.c b/tools/pygrub/src/fsimage/fsimage.c
index 2ebbbe35df..fdcfa1a3c0 100644
--- a/tools/pygrub/src/fsimage/fsimage.c
+++ b/tools/pygrub/src/fsimage/fsimage.c
@@ -31,7 +31,7 @@ typedef struct fsimage_fs {
 	fsi_t *fs;
 } fsimage_fs_t;
 
-typedef struct fsimage_file { 
+typedef struct fsimage_file {
 	PyObject_HEAD
 	fsimage_fs_t *fs;
 	fsi_file_t *file;
@@ -47,7 +47,7 @@ fsimage_file_read(fsimage_file_t *file, PyObject *args, PyObject *kwargs)
 	ssize_t bytesread = 0;
 	PyObject * buffer;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iL", kwlist, 
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iL", kwlist,
 	    &size, &offset))
 		return (NULL);
 
@@ -62,7 +62,7 @@ fsimage_file_read(fsimage_file_t *file, PyObject *args, PyObject *kwargs)
 
 	if (buffer == NULL)
 		return (NULL);
- 
+
 	while (1) {
 		int err;
 		void *buf =
@@ -255,7 +255,7 @@ fsimage_open(PyObject *o, PyObject *args, PyObject *kwargs)
 	uint64_t offset = 0;
 	fsimage_fs_t *fs;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Ls", kwlist, 
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Ls", kwlist,
 	    &name, &offset, &options))
 		return (NULL);
 
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index ce7ab0eb8c..a759d90ade 100755
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -46,7 +46,7 @@ def enable_cursor(ison):
         val = 2
     else:
         val = 0
-        
+
     try:
         curses.curs_set(val)
     except _curses.error:
@@ -114,7 +114,7 @@ FDISK_PART_GPT=0xee
 def get_partition_offsets(file):
     image_type = identify_disk_image(file)
     if image_type == DISK_TYPE_RAW:
-        # No MBR: assume whole disk filesystem, which is like a 
+        # No MBR: assume whole disk filesystem, which is like a
         # single partition starting at 0
         return [0]
     elif image_type == DISK_TYPE_HYBRIDISO:
@@ -135,7 +135,7 @@ def get_partition_offsets(file):
         partbuf = buf[poff:poff+16]
         offset  = struct.unpack("<L", partbuf[8:12])[0] * SECTOR_SIZE
         type    = struct.unpack("<B", partbuf[4:5])[0]
-        
+
         # offset == 0 implies this partition is not enabled
         if offset == 0:
             continue
@@ -171,7 +171,7 @@ class GrubLineEditor(curses.textpad.Textbox):
         screen.noutrefresh()
         win = curses.newwin(1, 74, startx, starty + 2)
         curses.textpad.Textbox.__init__(self, win)
-        
+
         self.line = list(line)
         self.pos = len(line)
         self.cancelled = False
@@ -237,7 +237,7 @@ class GrubLineEditor(curses.textpad.Textbox):
         if self.cancelled:
             return None
         return string.join(self.line, "")
-        
+
 
 class Grub:
     ENTRY_WIN_LINES = 8
@@ -261,7 +261,7 @@ class Grub:
             self.entry_win = curses.newwin(Grub.ENTRY_WIN_LINES + 2, 74, 2, 1)
             self.text_win = curses.newwin(10, 70, 12, 5)
             curses.def_prog_mode()
-        
+
         curses.reset_prog_mode()
         self.screen.erase()
 
@@ -279,7 +279,7 @@ class Grub:
             self.start_image = self.selected_image
         if self.selected_image < self.start_image:
             self.start_image = self.selected_image
-        
+
         for y in range(self.start_image, len(self.cf.images)):
             i = self.cf.images[y]
             if y > self.start_image + maxy:
@@ -329,7 +329,7 @@ class Grub:
                 l = img.lines[idx].expandtabs().ljust(70)
                 if len(l) > 70:
                     l = l[:69] + ">"
-                    
+
                 self.entry_win.addstr(idp, 2, l)
                 if idx == curline:
                     self.entry_win.attroff(curses.A_REVERSE)
@@ -367,7 +367,7 @@ class Grub:
                 self.command_line_mode()
                 if self.isdone:
                     return
-                
+
             # bound at the top and bottom
             if curline < 0:
                 curline = 0
@@ -400,7 +400,7 @@ class Grub:
         lines = []
         while 1:
             t = GrubLineEditor(self.screen, y, 2)
-            enable_cursor(True)            
+            enable_cursor(True)
             ret = t.edit()
             if ret:
                 if ret in ("quit", "return"):
@@ -410,7 +410,7 @@ class Grub:
                     lines.append(ret)
                     continue
 
-                # if we got boot, then we want to boot the entered image 
+                # if we got boot, then we want to boot the entered image
                 img = self.cf.new_image("entered", lines)
                 self.cf.add_image(img)
                 self.selected_image = len(self.cf.images) - 1
@@ -423,7 +423,7 @@ class Grub:
     def read_config(self, fn, fs = None):
         """Read the given file to parse the config.  If fs = None, then
         we're being given a raw config file rather than a disk image."""
-        
+
         if not os.access(fn, os.R_OK):
             raise RuntimeError("Unable to access %s" %(fn,))
 
@@ -499,7 +499,7 @@ class Grub:
         while not self.isdone:
             self.run_main(timeout)
             timeout = -1
-            
+
         return self.selected_image
 
     def run_main(self, timeout = -1):
@@ -529,7 +529,7 @@ class Grub:
         self.start_image = 0
         while (timeout == -1 or mytime < int(timeout)):
             draw()
-            if timeout != -1 and mytime != -1: 
+            if timeout != -1 and mytime != -1:
                 self.screen.addstr(20, 5, "Will boot selected entry in %2d seconds"
                                    %(int(timeout) - mytime))
             else:
@@ -600,7 +600,7 @@ class Grub:
                 self.selected_image = 0
             elif self.selected_image >= len(self.cf.images):
                 self.selected_image = len(self.cf.images) - 1
-        
+
 def get_entry_idx(cf, entry):
     # first, see if the given entry is numeric
     try:
@@ -697,10 +697,10 @@ def sniff_solaris(fs, cfg):
     # Unpleasant. Typically we'll have 'root=foo -k' or 'root=foo /kernel -k',
     # and we need to maintain Xen properties (root= and ip=) and the kernel
     # before any user args.
-    
+
     xenargs = ""
     userargs = ""
-    
+
     if not cfg["args"]:
         cfg["args"] = cfg["kernel"]
     else:
@@ -712,7 +712,7 @@ def sniff_solaris(fs, cfg):
         cfg["args"] = xenargs + " " + cfg["kernel"] + " " + userargs
 
     return cfg
- 
+
 def sniff_netware(fs, cfg):
     if not fs.file_exists("/nwserver/xnloader.sys"):
         return cfg
@@ -729,7 +729,7 @@ def format_sxp(kernel, ramdisk, args):
     if args:
         s += "(args %s)" % repr(args)
     return s
-                
+
 def format_simple(kernel, ramdisk, args, sep):
     for check in (kernel, ramdisk, args):
         if check is not None and sep in check:
@@ -744,7 +744,7 @@ def format_simple(kernel, ramdisk, args, sep):
 
 if __name__ == "__main__":
     sel = None
-    
+
     def usage():
         print("Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],), file=sys.stderr)
 
@@ -783,7 +783,7 @@ if __name__ == "__main__":
         opts, args = getopt.gnu_getopt(sys.argv[1:], 'qilnh::',
                                    ["quiet", "interactive", "list-entries", "not-really", "help",
                                     "output=", "output-format=", "output-directory=", "offset=",
-                                    "entry=", "kernel=", 
+                                    "entry=", "kernel=",
                                     "ramdisk=", "args=", "isconfig", "debug"])
     except getopt.GetoptError:
         usage()
@@ -967,4 +967,4 @@ if __name__ == "__main__":
         os.write(fd, ostring)
     else:
         os.write(fd, ostring.encode())
-    
+
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index cfb2734a99..e3a0c13bac 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Xc.c
- * 
+ *
  * Copyright (c) 2003-2004, K A Fraser (University of Cambridge)
  */
 
@@ -108,7 +108,7 @@ static PyObject *pyxc_domain_dumpcore(XcObject *self, PyObject *args)
 
     if ( xc_domain_dumpcore(self->xc_handle, dom, corefile) != 0 )
         return pyxc_error_to_exception(self->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 }
@@ -143,7 +143,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
         return NULL;
     if ( pyhandle != NULL )
     {
-        if ( !PyList_Check(pyhandle) || 
+        if ( !PyList_Check(pyhandle) ||
              (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
             goto out_exception;
 
@@ -191,7 +191,7 @@ static PyObject *pyxc_domain_max_vcpus(XcObject *self, PyObject *args)
 
     if (xc_domain_max_vcpus(self->xc_handle, dom, max) != 0)
         return pyxc_error_to_exception(self->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 }
@@ -226,7 +226,7 @@ static PyObject *pyxc_domain_shutdown(XcObject *self, PyObject *args)
 
     if ( xc_domain_shutdown(self->xc_handle, dom, reason) != 0 )
         return pyxc_error_to_exception(self->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 }
@@ -258,7 +258,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
 
     static char *kwd_list[] = { "domid", "vcpu", "cpumap", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list, 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list,
                                       &dom, &vcpu, &cpulist) )
         return NULL;
 
@@ -272,7 +272,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
 
     if ( (cpulist != NULL) && PyList_Check(cpulist) )
     {
-        for ( i = 0; i < PyList_Size(cpulist); i++ ) 
+        for ( i = 0; i < PyList_Size(cpulist); i++ )
         {
             long cpu = PyLongOrInt_AsLong(PyList_GetItem(cpulist, i));
             if ( cpu < 0 || cpu >= nr_cpus )
@@ -285,7 +285,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
             cpumap[cpu / 8] |= 1 << (cpu % 8);
         }
     }
-  
+
     if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap,
                              NULL, XEN_VCPUAFFINITY_HARD) != 0 )
     {
@@ -293,7 +293,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
         return pyxc_error_to_exception(self->xc_handle);
     }
     Py_INCREF(zero);
-    free(cpumap); 
+    free(cpumap);
     return zero;
 }
 
@@ -307,7 +307,7 @@ static PyObject *pyxc_domain_sethandle(XcObject *self, PyObject *args)
     if (!PyArg_ParseTuple(args, "iO", &dom, &pyhandle))
         return NULL;
 
-    if ( !PyList_Check(pyhandle) || 
+    if ( !PyList_Check(pyhandle) ||
          (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
     {
         goto out_exception;
@@ -323,7 +323,7 @@ static PyObject *pyxc_domain_sethandle(XcObject *self, PyObject *args)
 
     if (xc_domain_sethandle(self->xc_handle, dom, handle) < 0)
         return pyxc_error_to_exception(self->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 
@@ -345,7 +345,7 @@ static PyObject *pyxc_domain_getinfo(XcObject *self,
     xc_dominfo_t *info;
 
     static char *kwd_list[] = { "first_dom", "max_doms", NULL };
-    
+
     if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
                                       &first_dom, &max_doms) )
         return NULL;
@@ -418,7 +418,7 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self,
     int nr_cpus;
 
     static char *kwd_list[] = { "domid", "vcpu", NULL };
-    
+
     if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
                                       &dom, &vcpu) )
         return NULL;
@@ -473,7 +473,7 @@ static PyObject *pyxc_hvm_param_get(XcObject *self,
     int param;
     uint64_t value;
 
-    static char *kwd_list[] = { "domid", "param", NULL }; 
+    static char *kwd_list[] = { "domid", "param", NULL };
     if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
                                       &dom, &param) )
         return NULL;
@@ -493,7 +493,7 @@ static PyObject *pyxc_hvm_param_set(XcObject *self,
     int param;
     uint64_t value;
 
-    static char *kwd_list[] = { "domid", "param", "value", NULL }; 
+    static char *kwd_list[] = { "domid", "param", "value", NULL };
     if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiL", kwd_list,
                                       &dom, &param, &value) )
         return NULL;
@@ -663,7 +663,7 @@ static PyObject *pyxc_get_device_group(XcObject *self,
 
     if ( rc < 0 )
     {
-        free(sdev_array); 
+        free(sdev_array);
         return pyxc_error_to_exception(self->xc_handle);
     }
 
@@ -786,7 +786,7 @@ static PyObject *pyxc_physdev_pci_access_modify(XcObject *self,
 
     static char *kwd_list[] = { "domid", "bus", "dev", "func", "enable", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list, 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
                                       &dom, &bus, &dev, &func, &enable) )
         return NULL;
 
@@ -901,7 +901,7 @@ static PyObject *pyxc_physinfo(XcObject *self)
                             "nr_nodes",         pinfo.nr_nodes,
                             "threads_per_core", pinfo.threads_per_core,
                             "cores_per_socket", pinfo.cores_per_socket,
-                            "nr_cpus",          pinfo.nr_cpus, 
+                            "nr_cpus",          pinfo.nr_cpus,
                             "total_memory",     pages_to_kib(pinfo.total_pages),
                             "free_memory",      pages_to_kib(pinfo.free_pages),
                             "scrub_memory",     pages_to_kib(pinfo.scrub_pages),
@@ -1191,13 +1191,13 @@ static PyObject *pyxc_shadow_control(PyObject *self,
 
     static char *kwd_list[] = { "dom", "op", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
                                       &dom, &op) )
         return NULL;
-    
+
     if ( xc_shadow_control(xc->xc_handle, dom, op, NULL, 0) < 0 )
         return pyxc_error_to_exception(xc->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 }
@@ -1214,26 +1214,26 @@ static PyObject *pyxc_shadow_mem_control(PyObject *self,
 
     static char *kwd_list[] = { "dom", "mb", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
                                       &dom, &mbarg) )
         return NULL;
-    
-    if ( mbarg < 0 ) 
+
+    if ( mbarg < 0 )
         op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION;
-    else 
+    else
     {
         mb = mbarg;
         op = XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION;
     }
     if ( xc_shadow_control(xc->xc_handle, dom, op, &mb, 0) < 0 )
         return pyxc_error_to_exception(xc->xc_handle);
-    
+
     mbarg = mb;
     return Py_BuildValue("i", mbarg);
 }
 
 static PyObject *pyxc_sched_id_get(XcObject *self) {
-    
+
     int sched_id;
     if (xc_sched_id(self->xc_handle, &sched_id) != 0)
         return PyErr_SetFromErrno(xc_error_obj);
@@ -1251,10 +1251,10 @@ static PyObject *pyxc_sched_credit_domain_set(XcObject *self,
     static char *kwd_list[] = { "domid", "weight", "cap", NULL };
     static char kwd_type[] = "I|HH";
     struct xen_domctl_sched_credit sdom;
-    
+
     weight = 0;
     cap = (uint16_t)~0U;
-    if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list, 
+    if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list,
                                      &domid, &weight, &cap) )
         return NULL;
 
@@ -1272,10 +1272,10 @@ static PyObject *pyxc_sched_credit_domain_get(XcObject *self, PyObject *args)
 {
     uint32_t domid;
     struct xen_domctl_sched_credit sdom;
-    
+
     if( !PyArg_ParseTuple(args, "I", &domid) )
         return NULL;
-    
+
     if ( xc_sched_credit_domain_get(self->xc_handle, domid, &sdom) != 0 )
         return pyxc_error_to_exception(self->xc_handle);
 
@@ -1336,7 +1336,7 @@ static PyObject *pyxc_domain_setmaxmem(XcObject *self, PyObject *args)
 
     if (xc_domain_setmaxmem(self->xc_handle, dom, maxmem_kb) != 0)
         return pyxc_error_to_exception(self->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 }
@@ -1349,12 +1349,12 @@ static PyObject *pyxc_domain_set_target_mem(XcObject *self, PyObject *args)
     if (!PyArg_ParseTuple(args, "ii", &dom, &mem_kb))
         return NULL;
 
-    mem_pages = mem_kb / 4; 
+    mem_pages = mem_kb / 4;
 
     if (xc_domain_set_pod_target(self->xc_handle, dom, mem_pages,
 				 NULL, NULL, NULL) != 0)
         return pyxc_error_to_exception(self->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 }
@@ -1369,7 +1369,7 @@ static PyObject *pyxc_domain_set_memmap_limit(XcObject *self, PyObject *args)
 
     if ( xc_domain_set_memmap_limit(self->xc_handle, dom, maplimit_kb) != 0 )
         return pyxc_error_to_exception(self->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 }
@@ -1383,7 +1383,7 @@ static PyObject *pyxc_domain_ioport_permission(XcObject *self,
 
     static char *kwd_list[] = { "domid", "first_port", "nr_ports", "allow_access", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list, 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list,
                                       &dom, &first_port, &nr_ports, &allow_access) )
         return NULL;
 
@@ -1406,7 +1406,7 @@ static PyObject *pyxc_domain_irq_permission(PyObject *self,
 
     static char *kwd_list[] = { "domid", "pirq", "allow_access", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list, 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
                                       &dom, &pirq, &allow_access) )
         return NULL;
 
@@ -1429,7 +1429,7 @@ static PyObject *pyxc_domain_iomem_permission(PyObject *self,
 
     static char *kwd_list[] = { "domid", "first_pfn", "nr_pfns", "allow_access", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illi", kwd_list, 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illi", kwd_list,
                                       &dom, &first_pfn, &nr_pfns, &allow_access) )
         return NULL;
 
@@ -1480,7 +1480,7 @@ static PyObject *pyxc_domain_send_trigger(XcObject *self,
 
     static char *kwd_list[] = { "domid", "trigger", "vcpu", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|i", kwd_list, 
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|i", kwd_list,
                                       &dom, &trigger, &vcpu) )
         return NULL;
 
@@ -1534,7 +1534,7 @@ static PyObject *pyxc_dom_set_memshr(XcObject *self, PyObject *args)
 
     if (xc_memshr_control(self->xc_handle, dom, enable) != 0)
         return pyxc_error_to_exception(self->xc_handle);
-    
+
     Py_INCREF(zero);
     return zero;
 }
@@ -1758,11 +1758,11 @@ static PyObject *pyflask_sid_to_context(PyObject *self, PyObject *args,
     if (!xc_handle) {
         return PyErr_SetFromErrno(xc_error_obj);
     }
-    
+
     ret = xc_flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
-    
+
     xc_interface_close(xc_handle);
-    
+
     if ( ret != 0 ) {
         errno = -ret;
         return PyErr_SetFromErrno(xc_error_obj);
@@ -1779,7 +1779,7 @@ static PyObject *pyflask_load(PyObject *self, PyObject *args, PyObject *kwds)
     int ret;
 
     static char *kwd_list[] = { "policy", NULL };
-  
+
     if( !PyArg_ParseTupleAndKeywords(args, kwds, "s#", kwd_list, &policy, &len) )
         return NULL;
 
@@ -1809,11 +1809,11 @@ static PyObject *pyflask_getenforce(PyObject *self)
     if (!xc_handle) {
         return PyErr_SetFromErrno(xc_error_obj);
     }
-    
+
     ret = xc_flask_getenforce(xc_handle);
-    
+
     xc_interface_close(xc_handle);
-    
+
     if ( ret < 0 ) {
         errno = -ret;
         return PyErr_SetFromErrno(xc_error_obj);
@@ -1839,11 +1839,11 @@ static PyObject *pyflask_setenforce(PyObject *self, PyObject *args,
     if (!xc_handle) {
         return PyErr_SetFromErrno(xc_error_obj);
     }
-    
+
     ret = xc_flask_setenforce(xc_handle, mode);
-    
+
     xc_interface_close(xc_handle);
-    
+
     if ( ret != 0 ) {
         errno = -ret;
         return PyErr_SetFromErrno(xc_error_obj);
@@ -1861,7 +1861,7 @@ static PyObject *pyflask_access(PyObject *self, PyObject *args,
     uint32_t req, allowed, decided, auditallow, auditdeny, seqno;
     int ret;
 
-    static char *kwd_list[] = { "src_context", "tar_context", 
+    static char *kwd_list[] = { "src_context", "tar_context",
                                 "tar_class", "req_permissions",
                                 "decided", "auditallow","auditdeny",
                                 "seqno", NULL };
@@ -1875,10 +1875,10 @@ static PyObject *pyflask_access(PyObject *self, PyObject *args,
     if (!xc_handle) {
         return PyErr_SetFromErrno(xc_error_obj);
     }
-    
+
     ret = xc_flask_access(xc_handle, scon, tcon, tclass, req, &allowed, &decided,
                         &auditallow, &auditdeny, &seqno);
-        
+
     xc_interface_close(xc_handle);
 
     if ( ret != 0 ) {
@@ -1890,14 +1890,14 @@ static PyObject *pyflask_access(PyObject *self, PyObject *args,
 }
 
 static PyMethodDef pyxc_methods[] = {
-    { "domain_create", 
-      (PyCFunction)pyxc_domain_create, 
+    { "domain_create",
+      (PyCFunction)pyxc_domain_create,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Create a new domain.\n"
       " dom    [int, 0]:        Domain identifier to use (allocated if zero).\n"
       "Returns: [int] new domain identifier; -1 on error.\n" },
 
-    { "domain_max_vcpus", 
+    { "domain_max_vcpus",
       (PyCFunction)pyxc_domain_max_vcpus,
       METH_VARARGS, "\n"
       "Set the maximum number of VCPUs a domain may create.\n"
@@ -1905,43 +1905,43 @@ static PyMethodDef pyxc_methods[] = {
       " max     [int, 0]:      New maximum number of VCPUs in domain.\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_dumpcore", 
-      (PyCFunction)pyxc_domain_dumpcore, 
+    { "domain_dumpcore",
+      (PyCFunction)pyxc_domain_dumpcore,
       METH_VARARGS, "\n"
       "Dump core of a domain.\n"
       " dom [int]: Identifier of domain to dump core of.\n"
       " corefile [string]: Name of corefile to be created.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_pause", 
-      (PyCFunction)pyxc_domain_pause, 
+    { "domain_pause",
+      (PyCFunction)pyxc_domain_pause,
       METH_VARARGS, "\n"
       "Temporarily pause execution of a domain.\n"
       " dom [int]: Identifier of domain to be paused.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_unpause", 
-      (PyCFunction)pyxc_domain_unpause, 
+    { "domain_unpause",
+      (PyCFunction)pyxc_domain_unpause,
       METH_VARARGS, "\n"
       "(Re)start execution of a domain.\n"
       " dom [int]: Identifier of domain to be unpaused.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_destroy", 
-      (PyCFunction)pyxc_domain_destroy, 
+    { "domain_destroy",
+      (PyCFunction)pyxc_domain_destroy,
       METH_VARARGS, "\n"
       "Destroy a domain.\n"
       " dom [int]:    Identifier of domain to be destroyed.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_destroy_hook", 
-      (PyCFunction)pyxc_domain_destroy_hook, 
+    { "domain_destroy_hook",
+      (PyCFunction)pyxc_domain_destroy_hook,
       METH_VARARGS, "\n"
       "Add a hook for arch stuff before destroy a domain.\n"
       " dom [int]:    Identifier of domain to be destroyed.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_resume", 
+    { "domain_resume",
       (PyCFunction)pyxc_domain_resume,
       METH_VARARGS, "\n"
       "Resume execution of a suspended domain.\n"
@@ -1949,7 +1949,7 @@ static PyMethodDef pyxc_methods[] = {
       " fast [int]: Use cooperative resume.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_shutdown", 
+    { "domain_shutdown",
       (PyCFunction)pyxc_domain_shutdown,
       METH_VARARGS, "\n"
       "Shutdown a domain.\n"
@@ -1957,8 +1957,8 @@ static PyMethodDef pyxc_methods[] = {
       " reason     [int, 0]:      Reason for shutdown.\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "vcpu_setaffinity", 
-      (PyCFunction)pyxc_vcpu_setaffinity, 
+    { "vcpu_setaffinity",
+      (PyCFunction)pyxc_vcpu_setaffinity,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Pin a VCPU to a specified set CPUs.\n"
       " dom [int]:     Identifier of domain to which VCPU belongs.\n"
@@ -1966,7 +1966,7 @@ static PyMethodDef pyxc_methods[] = {
       " cpumap [list, []]: list of usable CPUs.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_sethandle", 
+    { "domain_sethandle",
       (PyCFunction)pyxc_domain_sethandle,
       METH_VARARGS, "\n"
       "Set domain's opaque handle.\n"
@@ -1974,8 +1974,8 @@ static PyMethodDef pyxc_methods[] = {
       " handle [list of 16 ints]: New opaque handle.\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_getinfo", 
-      (PyCFunction)pyxc_domain_getinfo, 
+    { "domain_getinfo",
+      (PyCFunction)pyxc_domain_getinfo,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Get information regarding a set of domains, in increasing id order.\n"
       " first_dom [int, 0]:    First domain to retrieve info about.\n"
@@ -2000,8 +2000,8 @@ static PyMethodDef pyxc_methods[] = {
       "reason why it shut itself down.\n"
       " cpupool  [int]   Id of cpupool domain is bound to.\n" },
 
-    { "vcpu_getinfo", 
-      (PyCFunction)pyxc_vcpu_getinfo, 
+    { "vcpu_getinfo",
+      (PyCFunction)pyxc_vcpu_getinfo,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Get information regarding a VCPU.\n"
       " dom  [int]:    Domain to retrieve info about.\n"
@@ -2025,7 +2025,7 @@ static PyMethodDef pyxc_methods[] = {
       " xenstore_domid [int]: \n"
       "Returns: None on success. Raises exception on error.\n" },
 
-    { "hvm_get_param", 
+    { "hvm_get_param",
       (PyCFunction)pyxc_hvm_param_get,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "get a parameter of HVM guest OS.\n"
@@ -2033,7 +2033,7 @@ static PyMethodDef pyxc_methods[] = {
       " param   [int]:      No. of HVM param.\n"
       "Returns: [long] value of the param.\n" },
 
-    { "hvm_set_param", 
+    { "hvm_set_param",
       (PyCFunction)pyxc_hvm_param_set,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "set a parameter of HVM guest OS.\n"
@@ -2076,12 +2076,12 @@ static PyMethodDef pyxc_methods[] = {
        " dom     [int]:      Domain to deassign device from.\n"
        " pci_str [str]:      PCI devices.\n"
        "Returns: [int] 0 on success, or device bdf that can't be deassigned.\n" },
-  
+
     { "sched_id_get",
       (PyCFunction)pyxc_sched_id_get,
       METH_NOARGS, "\n"
       "Get the current scheduler type in use.\n"
-      "Returns: [int] sched_id.\n" },    
+      "Returns: [int] sched_id.\n" },
 
     { "sched_credit_domain_set",
       (PyCFunction)pyxc_sched_credit_domain_set,
@@ -2119,7 +2119,7 @@ static PyMethodDef pyxc_methods[] = {
       "Returns:   [dict]\n"
       " weight    [short]: domain's scheduling weight\n"},
 
-    { "evtchn_alloc_unbound", 
+    { "evtchn_alloc_unbound",
       (PyCFunction)pyxc_evtchn_alloc_unbound,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Allocate an unbound port that will await a remote connection.\n"
@@ -2127,7 +2127,7 @@ static PyMethodDef pyxc_methods[] = {
       " remote_dom [int]: Remote domain to accept connections from.\n\n"
       "Returns: [int] Unbound event-channel port.\n" },
 
-    { "evtchn_reset", 
+    { "evtchn_reset",
       (PyCFunction)pyxc_evtchn_reset,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Reset all connections.\n"
@@ -2152,9 +2152,9 @@ static PyMethodDef pyxc_methods[] = {
       " func   [int]: PCI function\n"
       " enable [int]: Non-zero means enable access; else disable access\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
- 
-    { "readconsolering", 
-      (PyCFunction)pyxc_readconsolering, 
+
+    { "readconsolering",
+      (PyCFunction)pyxc_readconsolering,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Read Xen's console ring.\n"
       " clear [int, 0]: Bool - clear the ring after reading from it?\n\n"
@@ -2202,40 +2202,40 @@ static PyMethodDef pyxc_methods[] = {
       "Returns [str]: Xen buildid"
       "        [None]: on failure.\n" },
 
-    { "shadow_control", 
-      (PyCFunction)pyxc_shadow_control, 
+    { "shadow_control",
+      (PyCFunction)pyxc_shadow_control,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Set parameter for shadow pagetable interface\n"
       " dom [int]:   Identifier of domain.\n"
       " op [int, 0]: operation\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "shadow_mem_control", 
-      (PyCFunction)pyxc_shadow_mem_control, 
+    { "shadow_mem_control",
+      (PyCFunction)pyxc_shadow_mem_control,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Set or read shadow pagetable memory use\n"
       " dom [int]:   Identifier of domain.\n"
       " mb [int, -1]: MB of shadow memory this domain should have.\n\n"
       "Returns: [int] MB of shadow memory in use by this domain.\n" },
 
-    { "domain_setmaxmem", 
-      (PyCFunction)pyxc_domain_setmaxmem, 
+    { "domain_setmaxmem",
+      (PyCFunction)pyxc_domain_setmaxmem,
       METH_VARARGS, "\n"
       "Set a domain's memory limit\n"
       " dom [int]: Identifier of domain.\n"
       " maxmem_kb [int]: .\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_set_target_mem", 
-      (PyCFunction)pyxc_domain_set_target_mem, 
+    { "domain_set_target_mem",
+      (PyCFunction)pyxc_domain_set_target_mem,
       METH_VARARGS, "\n"
       "Set a domain's memory target\n"
       " dom [int]: Identifier of domain.\n"
       " mem_kb [int]: .\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
-    { "domain_set_memmap_limit", 
-      (PyCFunction)pyxc_domain_set_memmap_limit, 
+    { "domain_set_memmap_limit",
+      (PyCFunction)pyxc_domain_set_memmap_limit,
       METH_VARARGS, "\n"
       "Set a domain's physical memory mapping limit\n"
       " dom [int]: Identifier of domain.\n"
@@ -2309,7 +2309,7 @@ static PyMethodDef pyxc_methods[] = {
       "Inject debug keys into Xen.\n"
       " keys    [str]: String of keys to inject.\n" },
 
-    { "dom_set_memshr", 
+    { "dom_set_memshr",
       (PyCFunction)pyxc_dom_set_memshr,
       METH_VARARGS, "\n"
       "Enable/disable memory sharing for the domain.\n"
@@ -2391,20 +2391,20 @@ static PyMethodDef pyxc_methods[] = {
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Loads a policy into the hypervisor.\n"
       " policy [str]: policy to be load\n"
-      "Returns: [int]: 0 on success; -1 on failure.\n" }, 
-      
+      "Returns: [int]: 0 on success; -1 on failure.\n" },
+
     { "flask_getenforce",
       (PyCFunction)pyflask_getenforce,
       METH_NOARGS, "\n"
       "Returns the current mode of the Flask XSM module.\n"
-      "Returns: [int]: 0 for permissive; 1 for enforcing; -1 on failure.\n" }, 
+      "Returns: [int]: 0 for permissive; 1 for enforcing; -1 on failure.\n" },
 
     { "flask_setenforce",
       (PyCFunction)pyflask_setenforce,
       METH_VARARGS | METH_KEYWORDS, "\n"
       "Modifies the current mode for the Flask XSM module.\n"
       " mode [int]: mode to change to\n"
-      "Returns: [int]: 0 on success; -1 on failure.\n" }, 
+      "Returns: [int]: 0 on success; -1 on failure.\n" },
 
     { "flask_access",
       (PyCFunction)pyflask_access,
@@ -2423,7 +2423,7 @@ static PyMethodDef pyxc_methods[] = {
       " auditdeny [int] permissions set to audit on deny\n"
       " seqno [int] not used\n"
       "Returns: [int]: 0 on all permission granted; -1 if any permissions are \
-       denied\n" }, 
+       denied\n" },
 
     { NULL, NULL, 0, NULL }
 };
diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
index 3ba5a8b893..87f1187bb1 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * Python interface to the Xen Store Daemon.
  *
  * This library is free software; you can redistribute it and/or
@@ -859,7 +859,7 @@ static void remove_watch(XsHandle *self, PyObject *token)
  * Parse transaction and path arguments from the given args and kwds,
  * convert the given self value to an xs_handle, and return all three by
  * reference.
- * 
+ *
  * @return 1 on success, in which case *xh, *th, and *path are valid, or 0 on
  * failure.
  */
diff --git a/tools/xenmon/xenmon.py b/tools/xenmon/xenmon.py
index 977ada6887..1b357aed51 100644
--- a/tools/xenmon/xenmon.py
+++ b/tools/xenmon/xenmon.py
@@ -13,12 +13,12 @@
 #   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; under version 2 of the License.
-# 
+#
 #   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/>.
 #####################################################################
@@ -79,7 +79,7 @@ def setup_cmdline_parser():
     parser.add_option("-p", "--prefix", dest="prefix",
                       default = "log", help="prefix to use for output files")
     parser.add_option("-t", "--time", dest="duration",
-            action="store", type="int", default=10, 
+            action="store", type="int", default=10,
             help="stop logging to file after this much time has elapsed (in seconds). set to 0 to keep logging indefinitely")
     parser.add_option("-i", "--interval", dest="interval",
             action="store", type="int", default=1000,
@@ -179,7 +179,7 @@ class DomainInfo(object):
         return [total/(float(passed)/10**9), avg]
 
     def stats(self, passed):
-        return [self.gotten_stats(passed), self.allocated_stats(passed), self.blocked_stats(passed), 
+        return [self.gotten_stats(passed), self.allocated_stats(passed), self.blocked_stats(passed),
                 self.waited_stats(passed), self.ec_stats(passed), self.io_stats(passed)]
 
 # report values over desired interval
@@ -187,13 +187,13 @@ def summarize(startat, endat, duration, samples):
     dominfos = {}
     for i in range(0, NDOMAINS):
         dominfos[i] = DomainInfo()
-        
+
     passed = 1              # to prevent zero division
     curid = startat
     numbuckets = 0
     lost_samples = []
     ffp_samples = []
-    
+
     while passed < duration:
         for i in range(0, NDOMAINS):
             if dom_in_use[i]:
@@ -203,7 +203,7 @@ def summarize(startat, endat, duration, samples):
                 dominfos[i].blocked_sum += samples[curid][3*NDOMAINS + i]
                 dominfos[i].exec_count += samples[curid][4*NDOMAINS + i]
                 dominfos[i].iocount_sum += samples[curid][5*NDOMAINS + i]
-    
+
         passed += samples[curid][6*NDOMAINS]
         lost_samples.append(samples[curid][6*NDOMAINS + 2])
         ffp_samples.append(samples[curid][6*NDOMAINS + 3])
@@ -271,7 +271,7 @@ def show_livestats(cpu):
     cpu_10sec_usage = 0.0
     heartbeat = 1
     global dom_in_use, options
-    
+
     # mmap the (the first chunk of the) file
     shmf = open(SHM_FILE, "r+")
     shm = mmap.mmap(shmf.fileno(), QOS_DATA_SIZE)
@@ -284,7 +284,7 @@ def show_livestats(cpu):
     stdscr.keypad(1)
     stdscr.timeout(1000)
     [maxy, maxx] = stdscr.getmaxyx()
-    
+
     # display in a loop
     while True:
 
@@ -342,7 +342,7 @@ def show_livestats(cpu):
             cpuidx = cpuidx + 1
 
         # calculate starting and ending datapoints; never look at "next" since
-        # it represents live data that may be in transition. 
+        # it represents live data that may be in transition.
         startat = next - 1
         if next + 10 < NSAMPLES:
             endat = next + 10
@@ -374,7 +374,7 @@ def show_livestats(cpu):
 
             if h1[dom][0][1] > 0 or domain_id[dom] == IDLE_DOMAIN:
                 # display gotten
-                row += 1 
+                row += 1
                 col = 2
                 display_domain_id(stdscr, row, col, domain_id[dom])
                 col += 4
@@ -396,7 +396,7 @@ def show_livestats(cpu):
 
                 if dom != IDLE_DOMAIN:
                     cpu_1sec_usage = cpu_1sec_usage + h1[dom][0][1]
-    
+
                 # display allocated
                 if options.allocated:
                     row += 1
@@ -454,7 +454,7 @@ def show_livestats(cpu):
                     row += 1
                     col = 2
                     display_domain_id(stdscr, row, col, domain_id[dom])
-                    
+
                     col += 28
                     display(stdscr, row, col, "%d/s" % h2[dom][4])
                     col += 42
@@ -490,14 +490,14 @@ def show_livestats(cpu):
         display(stdscr, row, 1, star)
         display(stdscr, row, 2, TOTALS % (total_h2_cpu, total_h1_cpu))
         row += 1
-#        display(stdscr, row, 2, 
-#                "\tFFP: %d (Min: %d, Max: %d)\t\t\tFFP: %d (Min: %d, Max %d)" % 
+#        display(stdscr, row, 2,
+#                "\tFFP: %d (Min: %d, Max: %d)\t\t\tFFP: %d (Min: %d, Max %d)" %
 #                (math.ceil(f2[1]), f2[0], f2[2], math.ceil(f1[1]), f1[0], f1[2]), _c.A_BOLD)
 
         if l1[1] > 1 :
             row += 1
-            display(stdscr, row, 2, 
-                    "\tRecords lost: %d (Min: %d, Max: %d)\t\t\tRecords lost: %d (Min: %d, Max %d)" % 
+            display(stdscr, row, 2,
+                    "\tRecords lost: %d (Min: %d, Max: %d)\t\t\tRecords lost: %d (Min: %d, Max %d)" %
                     (math.ceil(l2[1]), l2[0], l2[2], math.ceil(l1[1]), l1[0], l1[2]), _c.A_BOLD)
 
         # grab a char from tty input; exit if interrupt hit
@@ -505,11 +505,11 @@ def show_livestats(cpu):
             c = stdscr.getch()
         except:
             break
-        
+
         # q = quit
         if c == ord('q'):
             break
-    
+
         # c = cycle to a new cpu of interest
         if c == ord('c'):
             cpu = (cpu + 1) % ncpu
@@ -560,7 +560,7 @@ class Delayed(object):
     def close(self):
         if  self.opened:
             self.file.close()
-            
+
 
 def writelog():
     global options
@@ -639,7 +639,7 @@ def writelog():
                                      h1[dom][1],
                                      h1[dom][2][0], h1[dom][2][1], h1[dom][2][2],
                                      h1[dom][3][0], h1[dom][3][1], h1[dom][3][2],
-                                     h1[dom][4], 
+                                     h1[dom][4],
                                      h1[dom][5][0], h1[dom][5][1]))
                     outfiles[dom].flush()
             curr = time.time()
@@ -698,7 +698,7 @@ def main():
        options.mspersample > options.duration * 1000:
         parser.error("option --ms_per_sample: too large (> %d ms)" %
                      (options.duration * 1000))
-    
+
     start_xenbaked()
     if options.live:
         show_livestats(options.cpu)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:33:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511499.790554 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeBK-0003HM-MM; Sat, 18 Mar 2023 21:33:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511499.790554; Sat, 18 Mar 2023 21:33: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 1pdeBK-0003HE-JM; Sat, 18 Mar 2023 21:33:42 +0000
Received: by outflank-mailman (input) for mailman id 511499;
 Sat, 18 Mar 2023 21: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 1pdeBK-0003H6-3s
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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 1pdeBK-000588-2x
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeBK-0002zv-1i
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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=+rbp4+WeSlB/216LzwmlIgAP6vPdvF0t9ANOJqPAQ/o=; b=oeAiR8XimUe1dm3OZNQ9qoGvSK
	WNU9nnccQsyYUsJPpN8AJADLfs3GMIqmgO2RVRWhAk+EQZFr5ugbG2Jd+am8E1/rS7RlwBajOeegk
	MmnTNTQtqwwYuSMRSIA11ouwYwleI4J5HWtL3Bh2VaJZxRnE6mjUvWdZg6T7/6C3aPbo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/pygrub: Factor out common setup.py parts
Message-Id: <E1pdeBK-0002zv-1i@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:33:42 +0000

commit 8d14976d3722381cb0947829f90932fd284c9f45
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 14 11:24:22 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    tools/pygrub: Factor out common setup.py parts
    
    ... to mirror the tools/python side in c/s 2b8314a3c354.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/pygrub/Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
index 37b2146214..29ad051321 100644
--- a/tools/pygrub/Makefile
+++ b/tools/pygrub/Makefile
@@ -6,19 +6,20 @@ PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
 PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS)
 INSTALL_LOG = build/installed_files.txt
 
+setup.py = CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" \
+           $(PYTHON) setup.py
+
 .PHONY: all
 all: build
 .PHONY: build
 build:
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
+	$(setup.py) build
 
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)/$(bindir)
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \
-		LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \
-		--record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
-		 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
+	$(setup.py) install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
+		--root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
 	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
 	             "`readlink -f $(DESTDIR)/$(bindir)`" != \
 	             "`readlink -f $(LIBEXEC_BIN)`" ]; then \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:33:52 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:33:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511500.790558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeBU-0003Jh-Ni; Sat, 18 Mar 2023 21:33:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511500.790558; Sat, 18 Mar 2023 21:33: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 1pdeBU-0003Ja-Kz; Sat, 18 Mar 2023 21:33:52 +0000
Received: by outflank-mailman (input) for mailman id 511500;
 Sat, 18 Mar 2023 21: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 1pdeBU-0003JQ-7c
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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 1pdeBU-00058G-6e
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeBU-00030Q-5Z
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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=u/bdNNlMeBLjNjHeu3u1sw05sMQfxBPf1wdGXzjMBqA=; b=yXoiZHQGH31dVDRhXqA+CRlVUb
	LSB3mWVqLDAJ1v0Jra+GWbha1naFirejDOwMjG6UbeuCqjxzVvaDKsh0mrxvn70dkgRCN4hSDMPV+
	f2ZBKx5f3/ufIAoySrZojzS9z5Cbd6xFMcM1tsosAGtVvSJBlSzk3+l69yoMUoOKYRHY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/python: Improve unit test handling
Message-Id: <E1pdeBU-00030Q-5Z@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:33:52 +0000

commit fd8fecb97ba98cd7d819d6963d7562fe14436a6b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 14 10:59:25 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    tools/python: Improve unit test handling
    
     * Add X86_{CPUID,MSR}_POLICY_FORMAT checks which were missed previously.
     * Drop test_suite().  It hasn't been necessary since the Py2.3 era.
     * Drop the __main__ logic.  This can't be used without manually adjusting the
       include path, and `make test` knows how to do the right thing.
     * For `make test`, use `-v` to see which tests have been discovered and run.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/python/Makefile               |  2 +-
 tools/python/xen/migration/tests.py | 14 ++------------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/tools/python/Makefile b/tools/python/Makefile
index cc76423647..437431c48e 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -36,7 +36,7 @@ uninstall:
 
 .PHONY: test
 test:
-	LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover
+	LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover -v
 
 .PHONY: clean
 clean:
diff --git a/tools/python/xen/migration/tests.py b/tools/python/xen/migration/tests.py
index ff2768946b..f22e2c2b7c 100644
--- a/tools/python/xen/migration/tests.py
+++ b/tools/python/xen/migration/tests.py
@@ -26,6 +26,8 @@ class TestLibxc(unittest.TestCase):
                          (libxc.X86_TSC_INFO_FORMAT, 24),
                          (libxc.HVM_PARAMS_ENTRY_FORMAT, 16),
                          (libxc.HVM_PARAMS_FORMAT, 8),
+                         (libxc.X86_CPUID_POLICY_FORMAT, 24),
+                         (libxc.X86_MSR_POLICY_FORMAT, 16),
                          ):
             self.assertEqual(calcsize(fmt), sz)
 
@@ -40,15 +42,3 @@ class TestLibxl(unittest.TestCase):
                          (libxl.EMULATOR_HEADER_FORMAT, 8),
                          ):
             self.assertEqual(calcsize(fmt), sz)
-
-
-def test_suite():
-    suite = unittest.TestSuite()
-
-    suite.addTest(unittest.makeSuite(TestLibxc))
-    suite.addTest(unittest.makeSuite(TestLibxl))
-
-    return suite
-
-if __name__ == "__main__":
-    unittest.main()
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:34:02 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:34:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511501.790562 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeBe-0003M7-QA; Sat, 18 Mar 2023 21:34:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511501.790562; Sat, 18 Mar 2023 21:34: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 1pdeBe-0003Lz-Mj; Sat, 18 Mar 2023 21:34:02 +0000
Received: by outflank-mailman (input) for mailman id 511501;
 Sat, 18 Mar 2023 21: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 1pdeBe-0003Lt-B6
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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 1pdeBe-00058b-A7
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeBe-000313-9E
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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=hzzSfSts8JTZRsRQqSdSpI3XMsS/HkoMNG53Y7eNltY=; b=csU82zpQ7b2Dymhfwp9eKpwwFC
	dlicqZY8Xox6+BxdOPvqD26w1ZzMbdJxxLmBF+3ZwizBCg1uprvoLaXZP42XSAm2yo6W42Q7kXDuv
	WNultswMdPMi94I5N4nLWSlIIbybJoX+wfJ6kOJEnN1jBI0A3ZEhZeCg+BWnJOkUsetw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/python: Drop shebangs from library files
Message-Id: <E1pdeBe-000313-9E@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:34:02 +0000

commit c82aff87f118ee98b2fc0d5198ecd27ef657a32a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 14 11:32:11 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    tools/python: Drop shebangs from library files
    
    These aren't runable scripts, so shouldn't have shebangs.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/python/xen/migration/legacy.py | 1 -
 tools/python/xen/migration/libxc.py  | 1 -
 tools/python/xen/migration/libxl.py  | 1 -
 tools/python/xen/migration/public.py | 1 -
 tools/python/xen/migration/tests.py  | 1 -
 tools/python/xen/migration/verify.py | 1 -
 tools/python/xen/migration/xl.py     | 1 -
 tools/python/xen/util.py             | 1 -
 8 files changed, 8 deletions(-)

diff --git a/tools/python/xen/migration/legacy.py b/tools/python/xen/migration/legacy.py
index 6456d6157c..e196ca8760 100644
--- a/tools/python/xen/migration/legacy.py
+++ b/tools/python/xen/migration/legacy.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 """
diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py
index 9881f5ced4..e52e632cb1 100644
--- a/tools/python/xen/migration/libxc.py
+++ b/tools/python/xen/migration/libxc.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 """
diff --git a/tools/python/xen/migration/libxl.py b/tools/python/xen/migration/libxl.py
index 5c4d4fe063..5dcb50fe02 100644
--- a/tools/python/xen/migration/libxl.py
+++ b/tools/python/xen/migration/libxl.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 """
diff --git a/tools/python/xen/migration/public.py b/tools/python/xen/migration/public.py
index fab2f84587..23183ef67d 100644
--- a/tools/python/xen/migration/public.py
+++ b/tools/python/xen/migration/public.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 """
diff --git a/tools/python/xen/migration/tests.py b/tools/python/xen/migration/tests.py
index f22e2c2b7c..fcf94b0bb2 100644
--- a/tools/python/xen/migration/tests.py
+++ b/tools/python/xen/migration/tests.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 """
diff --git a/tools/python/xen/migration/verify.py b/tools/python/xen/migration/verify.py
index 1e38f4a3c0..b847c4bd22 100644
--- a/tools/python/xen/migration/verify.py
+++ b/tools/python/xen/migration/verify.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 """
diff --git a/tools/python/xen/migration/xl.py b/tools/python/xen/migration/xl.py
index 978e744dfd..139d496654 100644
--- a/tools/python/xen/migration/xl.py
+++ b/tools/python/xen/migration/xl.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 """
diff --git a/tools/python/xen/util.py b/tools/python/xen/util.py
index a11358eefa..47ceb5bd21 100644
--- a/tools/python/xen/util.py
+++ b/tools/python/xen/util.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 import os
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:34:12 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:34:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511502.790565 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeBo-0003OZ-R0; Sat, 18 Mar 2023 21:34:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511502.790565; Sat, 18 Mar 2023 21:34: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 1pdeBo-0003OR-OQ; Sat, 18 Mar 2023 21:34:12 +0000
Received: by outflank-mailman (input) for mailman id 511502;
 Sat, 18 Mar 2023 21:34:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeBo-0003OJ-ER
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:34:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeBo-00058y-Da
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeBo-000329-Ce
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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=HumAnHUA92aavTFCkAkw13ZVCzNXOWQmNO/lk50seQA=; b=P9b271LSQC4hAB24Q3hCDst0BQ
	es0yc1kH/afIDIMvnmWfmGH+U/zLhh+EDSP6di/XKCLULlQegGnIFvlvH0AOgJ3/OBROEs2TzgX3A
	qPBAquwkBWEfE2v5xvR2HUmTApY3vnop02wf4PjjzTTiUcb9l8Nilr0Gqq7oCbffQAbs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Use -s for python shebangs
Message-Id: <E1pdeBo-000329-Ce@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:34:12 +0000

commit 9c0061825143716c61622966e76983886ef59361
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 14 10:53:51 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 10:44:16 2023 +0000

    tools: Use -s for python shebangs
    
    This is mandated by the Fedora packaging guidelines because it is a security
    vulnerability otherwise in suid scripts.  While Xen doesn't have suid scripts,
    it's a very good idea generally because it prevents the users local python
    environment interfering from system packaged scripts.
    
    pygrub is the odd-script-out, being installed by distutils rather than
    manually with INSTALL_PYTHON_PROG.  distutils has no nice way of editing the
    shebang, so arrange to use INSTALL_PYTHON_PROG for pygrub too.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/Rules.mk        | 2 +-
 tools/pygrub/Makefile | 4 +++-
 tools/pygrub/setup.py | 1 -
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 6e135387bd..18cf83f5be 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -179,7 +179,7 @@ CFLAGS += $(CFLAGS-y)
 CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
 
 INSTALL_PYTHON_PROG = \
-	$(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
+	$(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH) -s" $(INSTALL_PROG)
 
 %.opic: %.c
 	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
index 29ad051321..4963bc89c6 100644
--- a/tools/pygrub/Makefile
+++ b/tools/pygrub/Makefile
@@ -18,8 +18,10 @@ build:
 .PHONY: install
 install: all
 	$(INSTALL_DIR) $(DESTDIR)/$(bindir)
+	$(INSTALL_DIR) $(DESTDIR)/$(LIBEXEC_BIN)
 	$(setup.py) install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
-		--root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
+		--root="$(DESTDIR)" --force
+	$(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
 	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
 	             "`readlink -f $(DESTDIR)/$(bindir)`" != \
 	             "`readlink -f $(LIBEXEC_BIN)`" ]; then \
diff --git a/tools/pygrub/setup.py b/tools/pygrub/setup.py
index 0e4e3d02d3..502aa4df2d 100644
--- a/tools/pygrub/setup.py
+++ b/tools/pygrub/setup.py
@@ -23,7 +23,6 @@ setup(name='pygrub',
       author_email='katzj@redhat.com',
       license='GPL',
       package_dir={'grub': 'src', 'fsimage': 'src'},
-      scripts = ["src/pygrub"],
       packages=pkgs,
       ext_modules = [ xenfsimage ]
       )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 18 21:34:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Mar 2023 21:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.511503.790570 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pdeBz-0003Re-Sj; Sat, 18 Mar 2023 21:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 511503.790570; Sat, 18 Mar 2023 21: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 1pdeBz-0003RW-Ps; Sat, 18 Mar 2023 21:34:23 +0000
Received: by outflank-mailman (input) for mailman id 511503;
 Sat, 18 Mar 2023 21: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 1pdeBy-0003RI-I4
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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 1pdeBy-000595-HG
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pdeBy-00032w-GH
 for xen-changelog@lists.xenproject.org; Sat, 18 Mar 2023 21: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=+6oso/sskvuRSxMNpUvWuSpg4h52/6ntFGFMkdseFgw=; b=BUt8INEXkUgpCxDujitOaB+pF/
	BgTNuoEPy+ZNmh7Mr+zvlv3t4QCMWEZT9gQ2ErBujSj/VXKuDE7ngKcFeP8uyUn0xNyICRGN8qs9x
	ZorYr7ETNyWp5ltOu7m6QBKsY7PoHvgoQTKTa33XB2p+zR3cly0g6Fgh6t1omw0x6HVg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Drop sles11sp4 dockerfile
Message-Id: <E1pdeBy-00032w-GH@xenbits.xenproject.org>
Date: Sat, 18 Mar 2023 21:34:22 +0000

commit 9bf21fcaef07f68ab52d0382ff554616a1cf66d8
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Mar 3 13:53:46 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 17 11:18:50 2023 +0000

    automation: Drop sles11sp4 dockerfile
    
    It has reached EOL and there are no jobs using it on any branch.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/suse/sles11sp4.dockerfile | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/automation/build/suse/sles11sp4.dockerfile b/automation/build/suse/sles11sp4.dockerfile
deleted file mode 100644
index ff69a99afc..0000000000
--- a/automation/build/suse/sles11sp4.dockerfile
+++ /dev/null
@@ -1,20 +0,0 @@
-FROM registry.gitlab.com/xen-project/xen/suse:sles11sp4-base
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# Nothing else is needed -- base image already contain everything.
-
-# Note:
-#
-# SLES11 SP4 runs pre-2.13 glibc, which requires vsyscall support.  Most
-# distros nowadays disable vsyscall. To run this container, the host needs to
-# have vsyscall=emulate in its kernel command line.
-#
-# Due to various issues in SLES11 SP4, you might want to disable building
-# certain components. Known *not bulding* components include OVMF, SEABIOS
-# and upstream QEMU.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 21 07:44:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Mar 2023 07:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.512233.792068 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peWf5-0002UD-HF; Tue, 21 Mar 2023 07:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 512233.792068; Tue, 21 Mar 2023 07: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 1peWf5-0002U2-EL; Tue, 21 Mar 2023 07:44:03 +0000
Received: by outflank-mailman (input) for mailman id 512233;
 Tue, 21 Mar 2023 07: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 1peWf4-0002Tw-En
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peWf4-0004nW-Dk
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peWf4-0005Er-Cf
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ePhCiImlu5h0TvdyI/CBoUzHhgJ5s+vY+bIcn35eEeg=; b=nzTJT6WXIPsOXK+FjPWNmOSjBv
	yz90y51cs/WOoMq8VxaEzvJtw+HioZlFl9MPtIeveZ5jpbF5x27oBrQQe4go/9ZPTPIi00Edx/ALS
	oYrh+O2DC2e7zL6ogxbykzubPJXZNv0es361jdJeCksKyfzX6ER86jJyEaaiDmsrcKJY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: disable fpu
Message-Id: <E1peWf4-0005Er-Cf@xenbits.xenproject.org>
Date: Tue, 21 Mar 2023 07:44:02 +0000

commit d1e67674591c262e7cedfcd42547a3f64caec251
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Mar 20 17:10:34 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 20 17:10:34 2023 +0100

    xen/riscv: disable fpu
    
    Disable FPU to detect illegal usage of floating point in kernel
    space.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bobby Eshleman <bobbyeshleman@gmail.com>
---
 xen/arch/riscv/riscv64/head.S | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index ffd95f9f89..52fa41c778 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -6,6 +6,13 @@ ENTRY(start)
         /* Mask all interrupts */
         csrw    CSR_SIE, zero
 
+        /*
+         * Disable FPU to detect illegal usage of
+         * floating point in kernel space
+         */
+        li      t0, SSTATUS_FS
+        csrc    CSR_SSTATUS, t0
+
         la      sp, cpu0_boot_stack
         li      t0, STACK_SIZE
         add     sp, sp, t0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 21 07:44:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Mar 2023 07:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.512234.792071 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peWfF-0002Wd-IS; Tue, 21 Mar 2023 07:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 512234.792071; Tue, 21 Mar 2023 07: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 1peWfF-0002WW-Ft; Tue, 21 Mar 2023 07:44:13 +0000
Received: by outflank-mailman (input) for mailman id 512234;
 Tue, 21 Mar 2023 07: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 1peWfE-0002WH-IC
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07: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 1peWfE-0004nk-HG
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peWfE-0005MZ-GM
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07: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=HMrjsriOuoY3mPIxciqASLZ3T12UBQ3QUWA6k9u5l6g=; b=lxqVcHurAL/ULZ/ZqQq4djNerP
	H41lE6RAc43ciZYsKQFkNYhkgxltcONTLGEQIoUbA5XRgHKOCstK2ngtOEzaSxExCejWxw217Dl2T
	jcbPBzFFCvsRN6uw7tncuxxG5rBdJgDPXRfRcnpKUJ4v/3RtTCFJgVf5ugn7P4ubGIn0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: read/save hart_id and dtb_base passed by bootloader
Message-Id: <E1peWfE-0005MZ-GM@xenbits.xenproject.org>
Date: Tue, 21 Mar 2023 07:44:12 +0000

commit 537ed7a41b83290fe5afecc389d03ff4e8573324
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Mar 20 17:11:13 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 20 17:11:13 2023 +0100

    xen/riscv: read/save hart_id and dtb_base passed by bootloader
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bobby Eshleman <bobbyeshleman@gmail.com>
---
 xen/arch/riscv/riscv64/head.S | 5 +++++
 xen/arch/riscv/setup.c        | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index 52fa41c778..adf5d6c74a 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -2,6 +2,11 @@
 
         .section .text.header, "ax", %progbits
 
+        /*
+         * OpenSBI pass to start():
+         *   a0 -> hart_id ( bootcpu_id )
+         *   a1 -> dtb_base 
+         */
 ENTRY(start)
         /* Mask all interrupts */
         csrw    CSR_SIE, zero
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 1c87899e8e..22ef2817ff 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -7,7 +7,8 @@
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
 
-void __init noreturn start_xen(void)
+void __init noreturn start_xen(unsigned long bootcpu_id,
+                               paddr_t dtb_addr)
 {
     early_printk("Hello from C env\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 21 07:44:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Mar 2023 07:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.512236.792076 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peWfP-0002Z9-K2; Tue, 21 Mar 2023 07:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 512236.792076; Tue, 21 Mar 2023 07: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 1peWfP-0002Z1-HN; Tue, 21 Mar 2023 07:44:23 +0000
Received: by outflank-mailman (input) for mailman id 512236;
 Tue, 21 Mar 2023 07: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 1peWfO-0002Yt-LT
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07: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 1peWfO-0004nr-Ka
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peWfO-0005ND-Jh
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07: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=rz0938+LytMOnOxCfQ8B8pxobPu+KH/KkTEldvMKrGk=; b=4izLw2s0mB8SmRekUGpCENtjqV
	loMGeyFO65WCxNpTE5z4Tyaj9hX2FEDabzNazFhzMANVHj6v//pJ1cQfIDdhGQ0n406rzQUHcZt+l
	1haqZ6CvP20z2nk3MUq+n4E45paWh+EKMQIOedGuVxcncM6RZYI62IF235A85/0fnUsQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: initialize .bss section
Message-Id: <E1peWfO-0005ND-Jh@xenbits.xenproject.org>
Date: Tue, 21 Mar 2023 07:44:22 +0000

commit cfa0409f7cbb674c160b92335e9345e7e051dc1e
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Mar 20 17:12:04 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 20 17:12:04 2023 +0100

    xen/riscv: initialize .bss section
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bobby Eshleman <bobbyeshleman@gmail.com>
---
 xen/arch/riscv/riscv64/head.S | 9 +++++++++
 xen/arch/riscv/setup.c        | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index adf5d6c74a..8887f0cbd4 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -1,3 +1,4 @@
+#include <asm/asm.h>
 #include <asm/riscv_encoding.h>
 
         .section .text.header, "ax", %progbits
@@ -18,6 +19,14 @@ ENTRY(start)
         li      t0, SSTATUS_FS
         csrc    CSR_SSTATUS, t0
 
+        /* Clear the BSS */
+        la      t3, __bss_start
+        la      t4, __bss_end
+.L_clear_bss:
+        REG_S   zero, (t3)
+        add     t3, t3, __SIZEOF_POINTER__
+        bltu    t3, t4, .L_clear_bss
+
         la      sp, cpu0_boot_stack
         li      t0, STACK_SIZE
         add     sp, sp, t0
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 22ef2817ff..3786f337e0 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -7,6 +7,14 @@
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
 
+/*  
+ * To be sure that .bss isn't zero. It will simplify code of
+ * .bss initialization.
+ * TODO:
+ *   To be deleted when the first real .bss user appears
+ */
+int dummy_bss __attribute__((unused));
+
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 21 07:44:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Mar 2023 07:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.512237.792080 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peWfZ-0002bt-Lj; Tue, 21 Mar 2023 07:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 512237.792080; Tue, 21 Mar 2023 07: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 1peWfZ-0002bl-In; Tue, 21 Mar 2023 07:44:33 +0000
Received: by outflank-mailman (input) for mailman id 512237;
 Tue, 21 Mar 2023 07: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 1peWfY-0002bd-P7
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07: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 1peWfY-0004o4-O3
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peWfY-0005Nm-N2
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07: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=sZ0pr3gNw1i6U5ePCjKz7OefhwK905VQuxwE1B1PRyU=; b=ZU3T7oRTcTHCEKDYgBuGS4ZcOJ
	4sXv9dgXi0rvcA4+fce8UbRvzeG6MHb56AgbAYQZYxj5YXzV2hwxAuqfFJqKIcU0XISmu5KfwGb5H
	oSZKSW0nS3hc9jyyRmRLPXc4VF1GfFX890mYSVxIR6wyr/1sZWW6DvvTtmMJvOta31Rs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libacpi: fix PCI hotplug AML
Message-Id: <E1peWfY-0005Nm-N2@xenbits.xenproject.org>
Date: Tue, 21 Mar 2023 07:44:32 +0000

commit b190af7d3e90f58da5f58044b8dea7261b8b483d
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Mon Mar 20 17:12:34 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 20 17:12:34 2023 +0100

    libacpi: fix PCI hotplug AML
    
    The emulated PIIX3 uses a nybble for the status of each PCI function,
    so the status for e.g. slot 0 functions 0 and 1 respectively can be
    read as (\_GPE.PH00 & 0x0F), and (\_GPE.PH00 >> 0x04).
    
    The AML that Xen gives to a guest gets the operand order for the odd-
    numbered functions the wrong way round, returning (0x04 >> \_GPE.PH00)
    instead.
    
    As far as I can tell, this was the wrong way round in Xen from the
    moment that PCI hotplug was first introduced in commit 83d82e6f35a8:
    
    +                    ShiftRight (0x4, \_GPE.PH00, Local1)
    +                    Return (Local1) /* IN status as the _STA */
    
    Or maybe there's bizarre AML operand ordering going on there, like
    Intel's wrong-way-round assembler, and it only broke later when it was
    changed to being generated?
    
    Either way, it's definitely wrong now, and instrumenting a Linux guest
    shows that it correctly sees _STA being 0x00 in function 0 of an empty
    slot, but then the loop in acpiphp_glue.c::get_slot_status() goes on to
    look at function 1 and sees that _STA evaluates to 0x04. Thus reporting
    an adapter is present in every slot in /sys/bus/pci/slots/*
    
    Quite why Linux wants to look for function 1 being physically present
    when function 0 isn't... I don't want to think about right now.
    
    Fixes: 83d82e6f35a8 ("hvmloader: pass-through: multi-function PCI hot-plug")
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libacpi/mk_dsdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 1176da80ef..1d27809116 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -431,7 +431,7 @@ int main(int argc, char **argv)
                 stmt("Store", "0x89, \\_GPE.DPT2");
             }
             if ( slot & 1 )
-                stmt("ShiftRight", "0x4, \\_GPE.PH%02X, Local1", slot & ~1);
+                stmt("ShiftRight", "\\_GPE.PH%02X, 0x04, Local1", slot & ~1);
             else
                 stmt("And", "\\_GPE.PH%02X, 0x0f, Local1", slot & ~1);
             stmt("Return", "Local1"); /* IN status as the _STA */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 21 07:44:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Mar 2023 07:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.512238.792084 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peWfj-0002ee-NR; Tue, 21 Mar 2023 07:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 512238.792084; Tue, 21 Mar 2023 07: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 1peWfj-0002eW-KO; Tue, 21 Mar 2023 07:44:43 +0000
Received: by outflank-mailman (input) for mailman id 512238;
 Tue, 21 Mar 2023 07: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 1peWfi-0002eO-Sk
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07: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 1peWfi-0004oB-Rt
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peWfi-0005P1-Qo
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 07: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=lezsmNlSr5eibR6LNe/eW/v7PA3xxXCZh0mDDJAYsDU=; b=EFVsF22bYY5jtUDAV73QC/oHqV
	g+6MH7Gn1d7z2ZX4BX5HxtocF8eYDXsMSnMaRG0nAtAMrmMO9EwUbh86wZeZ/AZA8OEprxfZVEtR8
	QWh2htOmfqW0f6EV5XPam+nLy2j8JubkmyH4puUwsKwTDrtlOAPT241JyGWGvFPFxET8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/console: skip switching serial input to non existing domains
Message-Id: <E1peWfi-0005P1-Qo@xenbits.xenproject.org>
Date: Tue, 21 Mar 2023 07:44:42 +0000

commit c2581c58bec96afa450ebaca3fa2a33bcb0a9974
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 20 17:12:51 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 20 17:12:51 2023 +0100

    xen/console: skip switching serial input to non existing domains
    
    At the moment, we direct serial input to hardware domain by default.
    This does not make any sense when running in true dom0less mode, since
    such domain does not exist. As a result, users wishing to write to
    an emulated UART of a domU are always forced to execute CTRL-AAA first.
    The same issue is when rotating among serial inputs, where we always
    have to go through hardware domain case. This problem can be elaborated
    further to all the domains that no longer exist.
    
    Modify switch_serial_input() so that we skip switching serial input to
    non existing domains. Take the opportunity to define and make use of
    macro max_console_rx to make it clear what 'max_init_domid + 1' means
    in the console code context. Also, modify call to printk() to use correct
    format specifier for unsigned int.
    
    For now, to minimize the required changes and to match the current
    behavior with hwdom, the default input goes to the first real domain.
    The choice is more or less arbitrary since dom0less domUs are supposedly
    equal. This will be handled in the future by adding support in boot time
    configuration for marking a specific domain preferred in terms of
    directing serial input to.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/console.c | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 51e5408f21..0e410fa086 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -473,6 +473,8 @@ static void cf_check dump_console_ring_key(unsigned char key)
  */
 static unsigned int __read_mostly console_rx = 0;
 
+#define max_console_rx (max_init_domid + 1)
+
 /* Make sure to rcu_unlock_domain after use */
 struct domain *console_input_domain(void)
 {
@@ -483,15 +485,31 @@ struct domain *console_input_domain(void)
 
 static void switch_serial_input(void)
 {
-    if ( console_rx == max_init_domid + 1 )
-    {
-        console_rx = 0;
-        printk("*** Serial input to Xen");
-    }
-    else
+    unsigned int next_rx = console_rx;
+
+    /*
+     * Rotate among Xen, dom0 and boot-time created domUs while skipping
+     * switching serial input to non existing domains.
+     */
+    for ( ; ; )
     {
-        console_rx++;
-        printk("*** Serial input to DOM%d", console_rx - 1);
+        struct domain *d;
+
+        if ( next_rx++ >= max_console_rx )
+        {
+            console_rx = 0;
+            printk("*** Serial input to Xen");
+            break;
+        }
+
+        d = rcu_lock_domain_by_id(next_rx - 1);
+        if ( d )
+        {
+            rcu_unlock_domain(d);
+            console_rx = next_rx;
+            printk("*** Serial input to DOM%u", next_rx - 1);
+            break;
+        }
     }
 
     if ( switch_code )
@@ -1089,7 +1107,7 @@ void __init console_endboot(void)
      * a useful 'how to switch' message.
      */
     if ( opt_conswitch[1] == 'x' )
-        console_rx = max_init_domid + 1;
+        console_rx = max_console_rx;
 
     register_keyhandler('w', dump_console_ring_key,
                         "synchronously dump console ring buffer (dmesg)", 0);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 21 21:44:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Mar 2023 21:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513042.793466 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pejm0-0005ms-7H; Tue, 21 Mar 2023 21:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513042.793466; Tue, 21 Mar 2023 21: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 1pejm0-0005mk-4B; Tue, 21 Mar 2023 21:44:04 +0000
Received: by outflank-mailman (input) for mailman id 513042;
 Tue, 21 Mar 2023 21: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 1pejly-0005me-4r
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 21:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pejly-0000iX-1s
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 21:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pejly-0000Yz-0Z
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 21:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UYkzmHwiPbRrgkqOGhdDVwpTKr2tsuSl6CNsNT5eb/8=; b=WASeEFIg+fuzssKOigmWskzb+E
	f9HXCZBe1Kla8S0w1CT/DYpDndKLuDJZUA9bgACxTb85el2qDla2qtt38zIvVntYwaigPVbO92cUg
	aaCOAS1LBBcYuGgaqEsIm6chIM3g79DyES/bU4pUX7+52OIpzX+fOA9XBhS14wkYsQIo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: arm64: Create test jobs for testing static heap on qemu
Message-Id: <E1pejly-0000Yz-0Z@xenbits.xenproject.org>
Date: Tue, 21 Mar 2023 21:44:02 +0000

commit 0511403a0d44937441245825d80380a83a091722
Author:     Jiamei Xie <jiamei.xie@arm.com>
AuthorDate: Thu Mar 16 09:12:23 2023 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 20 15:57:19 2023 -0700

    automation: arm64: Create test jobs for testing static heap on qemu
    
    Create 2 new test jobs, called qemu-smoke-dom0less-arm64-gcc-staticheap
    and qemu-smoke-dom0less-arm64-gcc-debug-staticheap.
    
    Add property "xen,static-heap" under /chosen node to enable static-heap.
    If the domU can start successfully with static-heap enabled, then this
    test pass.
    
    ImageBuillder sets the kernel and ramdisk range based on the file size.
    It will use the memory range between 0x45600000 to 0x47AED1E8. It uses
    MEMORY_START and MEMORY_END from the cfg file as a range in which it can
    instruct u-boot where to place the images.
    
    Change MEMORY_END to 0x50000000 for all test cases.
    
    Signed-off-by: Jiamei Xie <jiamei.xie@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                  | 16 ++++++++++++++++
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 21 ++++++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 2e1a6886df..37465305ff 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -158,6 +158,22 @@ qemu-smoke-dom0less-arm64-gcc-debug-staticmem:
     - *arm64-test-needs
     - alpine-3.12-gcc-debug-arm64-staticmem
 
+qemu-smoke-dom0less-arm64-gcc-staticheap:
+ extends: .qemu-arm64
+ script:
+   - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-heap 2>&1 | tee ${LOGFILE}
+ needs:
+   - *arm64-test-needs
+   - alpine-3.12-gcc-arm64
+
+qemu-smoke-dom0less-arm64-gcc-debug-staticheap:
+ extends: .qemu-arm64
+ script:
+   - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-heap 2>&1 | tee ${LOGFILE}
+ needs:
+   - *arm64-test-needs
+   - alpine-3.12-gcc-debug-arm64
+
 qemu-smoke-dom0less-arm64-gcc-boot-cpupools:
   extends: .qemu-arm64
   script:
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 182a4b6c18..2d69d976ea 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -27,6 +27,11 @@ fi
 "
 fi
 
+if [[ "${test_variant}" == "static-heap" ]]; then
+    passed="${test_variant} test passed"
+    domU_check="echo \"${passed}\""
+fi
+
 if [[ "${test_variant}" == "boot-cpupools" ]]; then
     # Check if domU0 (id=1) is assigned to Pool-1 with null scheduler
     passed="${test_variant} test passed"
@@ -107,7 +112,7 @@ cd ..
 
 # ImageBuilder
 echo 'MEMORY_START="0x40000000"
-MEMORY_END="0xC0000000"
+MEMORY_END="0x50000000"
 
 DEVICE_TREE="virt-gicv2.dtb"
 XEN="xen"
@@ -128,6 +133,20 @@ if [[ "${test_variant}" == "static-mem" ]]; then
     echo -e "\nDOMU_STATIC_MEM[0]=\"${domu_base} ${domu_size}\"" >> binaries/config
 fi
 
+if [[ "${test_variant}" == "static-heap" ]]; then
+    # ImageBuilder uses the config file to create the uboot script. Devicetree
+    # will be set via the generated uboot script.
+    # The valid memory range is 0x40000000 to 0x80000000 as defined before.
+    # ImageBuillder sets the kernel and ramdisk range based on the file size.
+    # It will use the memory range between 0x45600000 to 0x47AED1E8, and
+    # MEMORY_END has been set to 0x50000000 above, so set memory range between
+    # 0x50000000 and 0x80000000 as static heap.
+    echo  '
+XEN_STATIC_HEAP="0x50000000 0x30000000"
+# The size of static heap should be greater than the guest memory
+DOMU_MEM[0]="128"' >> binaries/config
+fi
+
 if [[ "${test_variant}" == "boot-cpupools" ]]; then
     echo '
 CPUPOOL[0]="cpu@1 null"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 21 21:44:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Mar 2023 21:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513043.793471 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pejmA-0005op-9H; Tue, 21 Mar 2023 21:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513043.793471; Tue, 21 Mar 2023 21: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 1pejmA-0005of-5w; Tue, 21 Mar 2023 21:44:14 +0000
Received: by outflank-mailman (input) for mailman id 513043;
 Tue, 21 Mar 2023 21: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 1pejm8-0005oP-6S
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 21: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 1pejm8-0000ix-5T
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 21:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pejm8-0000Zv-4O
 for xen-changelog@lists.xenproject.org; Tue, 21 Mar 2023 21: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=YaOyDor89Obd5L2sAlEVHXHnAdW/cbMKpOYdjDeDcX0=; b=2Kx54/fHhjki7MnIwFeM3gJyJT
	uq8HWh20D8z/YGFCXJCPVNNJsdQcac2QTUwatG18ffRWdjhC/rVBlL7OH/mUjrOEXS1XccmOSZ/Sb
	ASJ+j+cRoHhs9S35fo6vgg4gGhpLzq3jMg7mfny+HHsUliGprZm7TefMwkcJA+WgN3TQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: arm64: Create test jobs for testing static shared memory on qemu
Message-Id: <E1pejm8-0000Zv-4O@xenbits.xenproject.org>
Date: Tue, 21 Mar 2023 21:44:12 +0000

commit 0bbf102d8794fb961cb103ada00999768547916e
Author:     Jiamei Xie <jiamei.xie@arm.com>
AuthorDate: Thu Mar 16 09:12:24 2023 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 20 17:48:05 2023 -0700

    automation: arm64: Create test jobs for testing static shared memory on qemu
    
    Create 2 new test jobs, called qemu-smoke-dom0less-arm64-gcc-static-shared-mem
    and qemu-smoke-dom0less-arm64-gcc-debug-static-shared-mem.
    
    Adjust qemu-smoke-dom0less-arm64.sh script to accomodate the static
    shared memory test as a new test variant. The test variant is determined
    based on the first argument passed to the script. For testing static
    shared memory, the argument is 'static-shared-mem'.
    
    The test configures two dom0less DOMUs with a static shared memory
    region and adds a check in the init script.
    
    The check consists in comparing the contents of the /proc/device-tree/reserved-memory
    xen-shmem entry with the static shared memory range and id with which
    DOMUs were configured. If the memory layout is correct, a message gets
    printed by DOMU.
    
    At the end of the qemu run, the script searches for the specific message
    in the logs and fails if not found.
    
    Signed-off-by: Jiamei Xie <jiamei.xie@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml                 | 18 +++++++++++++++
 automation/gitlab-ci/test.yaml                  | 16 ++++++++++++++
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 29 +++++++++++++++++++++++++
 3 files changed, 63 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 38bb22d860..820cc0af83 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -623,6 +623,24 @@ alpine-3.12-gcc-debug-arm64-staticmem:
       CONFIG_UNSUPPORTED=y
       CONFIG_STATIC_MEMORY=y
 
+alpine-3.12-gcc-arm64-static-shared-mem:
+  extends: .gcc-arm64-build
+  variables:
+    CONTAINER: alpine:3.12-arm64v8
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UNSUPPORTED=y
+      CONFIG_STATIC_MEMORY=y
+      CONFIG_STATIC_SHM=y
+
+alpine-3.12-gcc-debug-arm64-static-shared-mem:
+  extends: .gcc-arm64-build-debug
+  variables:
+    CONTAINER: alpine:3.12-arm64v8
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UNSUPPORTED=y
+      CONFIG_STATIC_MEMORY=y
+      CONFIG_STATIC_SHM=y
+
 alpine-3.12-gcc-arm64-boot-cpupools:
   extends: .gcc-arm64-build
   variables:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 37465305ff..d75662358f 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -174,6 +174,22 @@ qemu-smoke-dom0less-arm64-gcc-debug-staticheap:
    - *arm64-test-needs
    - alpine-3.12-gcc-debug-arm64
 
+qemu-smoke-dom0less-arm64-gcc-static-shared-mem:
+  extends: .qemu-arm64
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-shared-mem 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - alpine-3.12-gcc-arm64-static-shared-mem
+
+qemu-smoke-dom0less-arm64-gcc-debug-static-shared-mem:
+  extends: .qemu-arm64
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-shared-mem 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - alpine-3.12-gcc-debug-arm64-static-shared-mem
+
 qemu-smoke-dom0less-arm64-gcc-boot-cpupools:
   extends: .qemu-arm64
   script:
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 2d69d976ea..75f575424a 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -32,6 +32,25 @@ if [[ "${test_variant}" == "static-heap" ]]; then
     domU_check="echo \"${passed}\""
 fi
 
+
+if [[ "${test_variant}" == "static-shared-mem" ]]; then
+    passed="${test_variant} test passed"
+    SHARED_MEM_HOST="50000000"
+    SHARED_MEM_GUEST="4000000"
+    SHARED_MEM_SIZE="10000000"
+    SHARED_MEM_ID="my-shared-mem-0"
+
+    domU_check="
+current_id=\$(cat /proc/device-tree/reserved-memory/xen-shmem@4000000/xen,id 2>/dev/null)
+expected_id=\"\$(echo ${SHARED_MEM_ID})\"
+current_reg=\$(hexdump -e '16/1 \"%02x\"' /proc/device-tree/reserved-memory/xen-shmem@4000000/reg 2>/dev/null)
+expected_reg=$(printf \"%016x%016x\" 0x${SHARED_MEM_GUEST} 0x${SHARED_MEM_SIZE})
+if [[ \"\${expected_reg}\" == \"\${current_reg}\" && \"\${current_id}\" == \"\${expected_id}\" ]]; then
+    echo \"${passed}\"
+fi
+    "
+fi
+
 if [[ "${test_variant}" == "boot-cpupools" ]]; then
     # Check if domU0 (id=1) is assigned to Pool-1 with null scheduler
     passed="${test_variant} test passed"
@@ -124,6 +143,9 @@ NUM_DOMUS=1
 DOMU_KERNEL[0]="Image"
 DOMU_RAMDISK[0]="initrd"
 DOMU_MEM[0]="256"
+DOMU_KERNEL[1]="Image"
+DOMU_RAMDISK[1]="initrd"
+DOMU_MEM[1]="256"
 
 LOAD_CMD="tftpb"
 UBOOT_SOURCE="boot.source"
@@ -133,6 +155,13 @@ if [[ "${test_variant}" == "static-mem" ]]; then
     echo -e "\nDOMU_STATIC_MEM[0]=\"${domu_base} ${domu_size}\"" >> binaries/config
 fi
 
+if [[ "${test_variant}" == "static-shared-mem" ]]; then
+echo "
+NUM_DOMUS=2
+DOMU_SHARED_MEM[0]=\"${SHARED_MEM_ID} 0x${SHARED_MEM_HOST} 0x${SHARED_MEM_GUEST} 0x${SHARED_MEM_SIZE}\"
+DOMU_SHARED_MEM[1]=\"${SHARED_MEM_ID} 0x${SHARED_MEM_HOST} 0x${SHARED_MEM_GUEST} 0x${SHARED_MEM_SIZE}\"" >> binaries/config
+fi
+
 if [[ "${test_variant}" == "static-heap" ]]; then
     # ImageBuilder uses the config file to create the uboot script. Devicetree
     # will be set via the generated uboot script.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 04:44:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 04:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513092.793575 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peqKR-0006jl-35; Wed, 22 Mar 2023 04:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513092.793575; Wed, 22 Mar 2023 04: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 1peqKR-0006jd-09; Wed, 22 Mar 2023 04:44:03 +0000
Received: by outflank-mailman (input) for mailman id 513092;
 Wed, 22 Mar 2023 04: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 1peqKQ-0006jX-AD
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peqKQ-000135-9G
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peqKQ-0001I0-7S
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2o3M2J5s7N+W05YXA2VKtByQbetgr4609kt8fj6RQvk=; b=MhtdPgsN1a2b9330TqR0eY3TZc
	Biv40G5xpE+u2KHFIFes5srhDvtB8pvuCr99Lgx91NH8/noqOJ9gj4EkDpa5H2LYcIjkTzUmFjDbO
	jmCvWbdsQb7meJSRCcjamPBOzoLzw5TD6rfdKGyeloYLGKJAn3cobQ2mecvQCSIif4nw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/shadow: account for log-dirty mode when pre-allocating
Message-Id: <E1peqKQ-0001I0-7S@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 04:44:02 +0000

commit 254663bec2bcae8b0a658f3db7a4dfb5ab6a0c83
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:00:14 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:44 2023 +0000

    x86/shadow: account for log-dirty mode when pre-allocating
    
    Pre-allocation is intended to ensure that in the course of constructing
    or updating shadows there won't be any risk of just made shadows or
    shadows being acted upon can disappear under our feet. The amount of
    pages pre-allocated then, however, needs to account for all possible
    subsequent allocations. While the use in sh_page_fault() accounts for
    all shadows which may need making, so far it didn't account for
    allocations coming from log-dirty tracking (which piggybacks onto the
    P2M allocation functions).
    
    Since shadow_prealloc() takes a count of shadows (or other data
    structures) rather than a count of pages, putting the adjustment at the
    call site of this function won't work very well: We simply can't express
    the correct count that way in all cases. Instead take care of this in
    the function itself, by "snooping" for L1 type requests. (While not
    applicable right now, future new request sites of L1 tables would then
    also be covered right away.)
    
    It is relevant to note here that pre-allocations like the one done from
    shadow_alloc_p2m_page() are benign when they fall in the "scope" of an
    earlier pre-alloc which already included that count: The inner call will
    simply find enough pages available then; it'll bail right away.
    
    This is CVE-2022-42332 / XSA-427.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
    (cherry picked from commit 91767a71061035ae42be93de495cd976f863a41a)
---
 xen/arch/x86/mm/paging.c         |  1 +
 xen/arch/x86/mm/shadow/common.c  | 12 +++++++++++-
 xen/arch/x86/mm/shadow/private.h |  1 +
 xen/include/asm-x86/paging.h     |  4 ++++
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 7662db1ad4..75573df9ab 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -278,6 +278,7 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn)
     if ( unlikely(!VALID_M2P(pfn_x(pfn))) )
         return;
 
+    BUILD_BUG_ON(paging_logdirty_levels() != 4);
     i1 = L1_LOGDIRTY_IDX(pfn);
     i2 = L2_LOGDIRTY_IDX(pfn);
     i3 = L3_LOGDIRTY_IDX(pfn);
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index e803ac7866..96d77fec87 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1012,7 +1012,17 @@ bool shadow_prealloc(struct domain *d, unsigned int type, unsigned int count)
     if ( unlikely(d->is_dying) )
        return false;
 
-    ret = _shadow_prealloc(d, shadow_size(type) * count);
+    count *= shadow_size(type);
+    /*
+     * Log-dirty handling may result in allocations when populating its
+     * tracking structures.  Tie this to the caller requesting space for L1
+     * shadows.
+     */
+    if ( paging_mode_log_dirty(d) &&
+         ((SHF_L1_ANY | SHF_FL1_ANY) & (1u << type)) )
+        count += paging_logdirty_levels();
+
+    ret = _shadow_prealloc(d, count);
     if ( !ret && (!d->is_shutting_down || d->shutdown_code != SHUTDOWN_crash) )
         /*
          * Failing to allocate memory required for shadow usage can only result in
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index e2100f0f34..25803b7e07 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -269,6 +269,7 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_64  (SHF_L1_64|SHF_FL1_64|SHF_L2_64|SHF_L2H_64|SHF_L3_64|SHF_L4_64)
 
 #define SHF_L1_ANY  (SHF_L1_32|SHF_L1_PAE|SHF_L1_64)
+#define SHF_FL1_ANY (SHF_FL1_32|SHF_FL1_PAE|SHF_FL1_64)
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
 /* Marks a guest L1 page table which is shadowed but not write-protected.
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 2ca6325c5f..2c2709b9d3 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -190,6 +190,10 @@ int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
+#define paging_logdirty_levels() \
+    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
+                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
+
 /* VRAM dirty tracking support */
 struct sh_dirty_vram {
     unsigned long begin_pfn;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 04:44:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 04:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513093.793578 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peqKb-0006lp-4L; Wed, 22 Mar 2023 04:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513093.793578; Wed, 22 Mar 2023 04: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 1peqKb-0006lh-1l; Wed, 22 Mar 2023 04:44:13 +0000
Received: by outflank-mailman (input) for mailman id 513093;
 Wed, 22 Mar 2023 04: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 1peqKa-0006lZ-Dv
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04: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 1peqKa-00013D-Cu
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peqKa-0001IT-Bo
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04: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=yjM485+WwY54/o33YbLJidbIjvvvnfDPeKAn+JLZgf8=; b=oLD9kGeLQSnv6/VTG0zqeF2pld
	JUW6mNiYw/P1UsllP/ANHJIfaKDDOjjip8Frzp0Cx3Mvi4JR9UiSWp5O8K4j9lNjxM5Cb8lu5IwUo
	upsJqVjouSsfGoCKyOdqdw8Dduzsk+FEukN8GAjDZPWhW+URWedqkI67UMgKhfroZnjY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/HVM: bound number of pinned cache attribute regions
Message-Id: <E1peqKa-0001IT-Bo@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 04:44:12 +0000

commit 71b344955525caa6f7586b5c9ff2d2b69a64e210
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:44 2023 +0000

    x86/HVM: bound number of pinned cache attribute regions
    
    This is exposed via DMOP, i.e. to potentially not fully privileged
    device models. With that we may not permit registration of an (almost)
    unbounded amount of such regions.
    
    This is CVE-2022-42333 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit a5e768640f786b681063f4e08af45d0c4e91debf)
---
 xen/arch/x86/hvm/mtrr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 2bd64e8025..752524684e 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -596,6 +596,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
     struct hvm_mem_pinned_cacheattr_range *range;
+    unsigned int nr = 0;
     int rc = 1;
 
     if ( !is_hvm_domain(d) )
@@ -667,11 +668,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
             rc = -EBUSY;
             break;
         }
+        ++nr;
     }
     rcu_read_unlock(&pinned_cacheattr_rcu_lock);
     if ( rc <= 0 )
         return rc;
 
+    if ( nr >= 64 /* The limit is arbitrary. */ )
+        return -ENOSPC;
+
     range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
     if ( range == NULL )
         return -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 04:44:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 04:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513094.793582 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peqKm-0006oO-5k; Wed, 22 Mar 2023 04:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513094.793582; Wed, 22 Mar 2023 04: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 1peqKm-0006oH-3G; Wed, 22 Mar 2023 04:44:24 +0000
Received: by outflank-mailman (input) for mailman id 513094;
 Wed, 22 Mar 2023 04: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 1peqKk-0006o9-HI
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04: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 1peqKk-00013e-GM
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peqKk-0001Iw-FR
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04: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=PFlZaWRi65/QmiK+bqsJhdj/at+irN1Uk/V16bywQ78=; b=gRvitZTb1VBJNAw5vmiAQdeIxv
	74KKNLSwWgXRx+Qbf6CySoIJCmjCWyejrimUCSB92TqrfdxDlGaNFM1AJ6RW1/GhiSFG8oUfLkjjH
	JL3LDcB/B7HpOhjWFarb1zBdJF8AxvUnwXkcWCk11MYndZ7s751BCjnT70wluL9NzSAk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/HVM: serialize pinned cache attribute list manipulation
Message-Id: <E1peqKk-0001Iw-FR@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 04:44:22 +0000

commit 99e9afaeb00b5a00d6fc3e2d2e593f9ed35695d5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:44 2023 +0000

    x86/HVM: serialize pinned cache attribute list manipulation
    
    While the RCU variants of list insertion and removal allow lockless list
    traversal (with RCU just read-locked), insertions and removals still
    need serializing amongst themselves. To keep things simple, use the
    domain lock for this purpose.
    
    This is CVE-2022-42334 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 829ec245cf66560e3b50d140ccb3168e7fb7c945)
---
 xen/arch/x86/hvm/mtrr.c | 51 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 752524684e..97ddc2075e 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -595,7 +595,7 @@ static void free_pinned_cacheattr_entry(struct rcu_head *rcu)
 int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
-    struct hvm_mem_pinned_cacheattr_range *range;
+    struct hvm_mem_pinned_cacheattr_range *range, *newr;
     unsigned int nr = 0;
     int rc = 1;
 
@@ -609,14 +609,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
     {
     case XEN_DOMCTL_DELETE_MEM_CACHEATTR:
         /* Remove the requested range. */
-        rcu_read_lock(&pinned_cacheattr_rcu_lock);
-        list_for_each_entry_rcu ( range,
-                                  &d->arch.hvm.pinned_cacheattr_ranges,
-                                  list )
+        domain_lock(d);
+        list_for_each_entry ( range,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
+                              list )
             if ( range->start == gfn_start && range->end == gfn_end )
             {
-                rcu_read_unlock(&pinned_cacheattr_rcu_lock);
                 list_del_rcu(&range->list);
+                domain_unlock(d);
+
                 type = range->type;
                 call_rcu(&range->rcu, free_pinned_cacheattr_entry);
                 p2m_memory_type_changed(d);
@@ -637,7 +638,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                 }
                 return 0;
             }
-        rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+        domain_unlock(d);
         return -ENOENT;
 
     case PAT_TYPE_UC_MINUS:
@@ -652,7 +653,10 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         return -EINVAL;
     }
 
-    rcu_read_lock(&pinned_cacheattr_rcu_lock);
+    newr = xzalloc(struct hvm_mem_pinned_cacheattr_range);
+
+    domain_lock(d);
+
     list_for_each_entry_rcu ( range,
                               &d->arch.hvm.pinned_cacheattr_ranges,
                               list )
@@ -670,27 +674,34 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         }
         ++nr;
     }
-    rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+
     if ( rc <= 0 )
-        return rc;
+        /* nothing */;
+    else if ( nr >= 64 /* The limit is arbitrary. */ )
+        rc = -ENOSPC;
+    else if ( !newr )
+        rc = -ENOMEM;
+    else
+    {
+        newr->start = gfn_start;
+        newr->end = gfn_end;
+        newr->type = type;
 
-    if ( nr >= 64 /* The limit is arbitrary. */ )
-        return -ENOSPC;
+        list_add_rcu(&newr->list, &d->arch.hvm.pinned_cacheattr_ranges);
 
-    range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
-    if ( range == NULL )
-        return -ENOMEM;
+        newr = NULL;
+        rc = 0;
+    }
+
+    domain_unlock(d);
 
-    range->start = gfn_start;
-    range->end = gfn_end;
-    range->type = type;
+    xfree(newr);
 
-    list_add_rcu(&range->list, &d->arch.hvm.pinned_cacheattr_ranges);
     p2m_memory_type_changed(d);
     if ( type != PAT_TYPE_WRBACK )
         flush_all(FLUSH_CACHE);
 
-    return 0;
+    return rc;
 }
 
 static int hvm_save_mtrr_msr(struct vcpu *v, hvm_domain_context_t *h)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 04:44:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 04:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513096.793587 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1peqKw-0006ry-AG; Wed, 22 Mar 2023 04:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513096.793587; Wed, 22 Mar 2023 04: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 1peqKw-0006rr-7H; Wed, 22 Mar 2023 04:44:34 +0000
Received: by outflank-mailman (input) for mailman id 513096;
 Wed, 22 Mar 2023 04: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 1peqKu-0006rg-LT
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04: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 1peqKu-00013q-K8
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1peqKu-0001JW-Iz
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 04: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=2hxfV5CcFCj0dCB31RPos49Gr45UBoCTxSQ/fRY6fBM=; b=h1h4HV0ijVSOuD+XLBZdZBVo2s
	SMV/0EwRidm+EjuOYU3vrRKpj7HOZ6w5/iCLq+lW4c7jPh8F3K2swdl6gSFS2DDJnAp/o8iLWVN5B
	imb9INNi41RiHSqnJKOFI+GQfeNz9QmSpxJ54mvKabwBSr6nsPgPD7smPKZBjZaVIxnQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
Message-Id: <E1peqKu-0001JW-Iz@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 04:44:32 +0000

commit e49571868d67944b9f4a546ade130e0b6e506b65
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 10 21:11:14 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:44 2023 +0000

    x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
    
    As stated (correctly) by the comment next to SPEC_CTRL_ENTRY_FROM_PV, between
    the two hunks visible in the patch, RET's are not safe prior to this point.
    
    CR4_PV32_RESTORE hides a CALL/RET pair in certain configurations (PV32
    compiled in, SMEP or SMAP active), and the RET can be attacked with one of
    several known speculative issues.
    
    Furthermore, CR4_PV32_RESTORE also hides a reference to the cr4_pv32_mask
    global variable, which is not safe when XPTI is active before restoring Xen's
    full pagetables.
    
    This crash has gone unnoticed because it is only AMD CPUs which permit the
    SYSCALL instruction in compatibility mode, and these are not vulnerable to
    Meltdown so don't activate XPTI by default.
    
    This is XSA-429 / CVE-2022-42331
    
    Fixes: 5e7962901131 ("x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point")
    Fixes: 5784de3e2067 ("x86: Meltdown band-aid against malicious 64-bit PV guests")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit df5b055b12116d9e63ced59ae5389e69a2a3de48)
---
 xen/arch/x86/x86_64/compat/entry.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index 302530e65e..84a8c97b77 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -202,7 +202,6 @@ ENTRY(cstar_enter)
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
 #endif
         push  %rax          /* Guest %rsp */
-        CR4_PV32_RESTORE
         movq  8(%rsp), %rax /* Restore guest %rax. */
         movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
@@ -226,6 +225,8 @@ ENTRY(cstar_enter)
 .Lcstar_cr3_okay:
         sti
 
+        CR4_PV32_RESTORE
+
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 08:11:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 08:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513155.793743 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1petYm-0005iF-0c; Wed, 22 Mar 2023 08:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513155.793743; Wed, 22 Mar 2023 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 1petYl-0005i8-Tu; Wed, 22 Mar 2023 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 513155;
 Wed, 22 Mar 2023 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 1petYj-0005i2-TG
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 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 1petYj-0006se-QX
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 08:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1petYj-0002l2-PL
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 08:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0Di23i0UXV/ruek6+lpwfnttDwNrUhfJ9gCUqWjdDiw=; b=RTTm8w2Ve+CEVdiecLMDYkDS3b
	JFy1vkPmdABlUCBXWEBwPS+croTy27SpWr2UIAXPDd6NM20Mt4awIxawyeIUjUXOYzr9ITF6U5Q2R
	ZYbgfTa8ZhdfNIECDVx+dw8tCuNcPPBvjdO/bPhWkasMhIwewZRH15kb5u9GxKm2NVIw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/shadow: account for log-dirty mode when pre-allocating
Message-Id: <E1petYj-0002l2-PL@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 08:11:01 +0000

commit 3a0b7fb38a3e40fcf82c10980775f0fecab667b5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:00:02 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:43 2023 +0000

    x86/shadow: account for log-dirty mode when pre-allocating
    
    Pre-allocation is intended to ensure that in the course of constructing
    or updating shadows there won't be any risk of just made shadows or
    shadows being acted upon can disappear under our feet. The amount of
    pages pre-allocated then, however, needs to account for all possible
    subsequent allocations. While the use in sh_page_fault() accounts for
    all shadows which may need making, so far it didn't account for
    allocations coming from log-dirty tracking (which piggybacks onto the
    P2M allocation functions).
    
    Since shadow_prealloc() takes a count of shadows (or other data
    structures) rather than a count of pages, putting the adjustment at the
    call site of this function won't work very well: We simply can't express
    the correct count that way in all cases. Instead take care of this in
    the function itself, by "snooping" for L1 type requests. (While not
    applicable right now, future new request sites of L1 tables would then
    also be covered right away.)
    
    It is relevant to note here that pre-allocations like the one done from
    shadow_alloc_p2m_page() are benign when they fall in the "scope" of an
    earlier pre-alloc which already included that count: The inner call will
    simply find enough pages available then; it'll bail right away.
    
    This is CVE-2022-42332 / XSA-427.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
    (cherry picked from commit 91767a71061035ae42be93de495cd976f863a41a)
---
 xen/arch/x86/mm/paging.c         |  1 +
 xen/arch/x86/mm/shadow/common.c  | 12 +++++++++++-
 xen/arch/x86/mm/shadow/private.h |  1 +
 xen/include/asm-x86/paging.h     |  4 ++++
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 579d01c161..ab1cdf1e72 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -280,6 +280,7 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn)
     if ( unlikely(!VALID_M2P(pfn_x(pfn))) )
         return;
 
+    BUILD_BUG_ON(paging_logdirty_levels() != 4);
     i1 = L1_LOGDIRTY_IDX(pfn);
     i2 = L2_LOGDIRTY_IDX(pfn);
     i3 = L3_LOGDIRTY_IDX(pfn);
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index e36d49d1fc..e73931573b 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1014,7 +1014,17 @@ bool shadow_prealloc(struct domain *d, unsigned int type, unsigned int count)
     if ( unlikely(d->is_dying) )
        return false;
 
-    ret = _shadow_prealloc(d, shadow_size(type) * count);
+    count *= shadow_size(type);
+    /*
+     * Log-dirty handling may result in allocations when populating its
+     * tracking structures.  Tie this to the caller requesting space for L1
+     * shadows.
+     */
+    if ( paging_mode_log_dirty(d) &&
+         ((SHF_L1_ANY | SHF_FL1_ANY) & (1u << type)) )
+        count += paging_logdirty_levels();
+
+    ret = _shadow_prealloc(d, count);
     if ( !ret && (!d->is_shutting_down || d->shutdown_code != SHUTDOWN_crash) )
         /*
          * Failing to allocate memory required for shadow usage can only result in
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 3fe0388e7c..1be84fc951 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -269,6 +269,7 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_64  (SHF_L1_64|SHF_FL1_64|SHF_L2_64|SHF_L2H_64|SHF_L3_64|SHF_L4_64)
 
 #define SHF_L1_ANY  (SHF_L1_32|SHF_L1_PAE|SHF_L1_64)
+#define SHF_FL1_ANY (SHF_FL1_32|SHF_FL1_PAE|SHF_FL1_64)
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
 /* Marks a guest L1 page table which is shadowed but not write-protected.
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index eb23652978..5ec508a351 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -190,6 +190,10 @@ int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
+#define paging_logdirty_levels() \
+    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
+                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
+
 #ifdef CONFIG_HVM
 /* VRAM dirty tracking support */
 struct sh_dirty_vram {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 08:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513156.793748 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1petYv-0005ju-2F; Wed, 22 Mar 2023 08:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513156.793748; Wed, 22 Mar 2023 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 1petYu-0005jm-Va; Wed, 22 Mar 2023 08:11:12 +0000
Received: by outflank-mailman (input) for mailman id 513156;
 Wed, 22 Mar 2023 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 1petYt-0005jg-VJ
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 08:11: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 1petYt-0006sn-UR
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 08:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1petYt-0002lV-TB
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 08:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4FUqQcD7zriDlWzGpqDyvgOqjw2wDAYJFP1K7n7bxyw=; b=uYanp0FCeBBddFag10QclTOki/
	rzJczB0jYhTWpuc/vt2Hq+TnUz57UueUN0txya5q/r8HAqOmar2aUttUlpjxKlQ8C17c0fPUfQtV7
	2WL/RyiegekkAekWujvKuaAyyN1pd/v8xCaVHKXeYFRZ3N6HegD5pp9IzENrA3j4tZug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/HVM: bound number of pinned cache attribute regions
Message-Id: <E1petYt-0002lV-TB@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 08:11:11 +0000

commit 887ba097cfcd4454d4707e1bee6504322335ea79
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:43 2023 +0000

    x86/HVM: bound number of pinned cache attribute regions
    
    This is exposed via DMOP, i.e. to potentially not fully privileged
    device models. With that we may not permit registration of an (almost)
    unbounded amount of such regions.
    
    This is CVE-2022-42333 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit a5e768640f786b681063f4e08af45d0c4e91debf)
---
 xen/arch/x86/hvm/mtrr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index fb051d59c3..09a51f415d 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -596,6 +596,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
     struct hvm_mem_pinned_cacheattr_range *range;
+    unsigned int nr = 0;
     int rc = 1;
 
     if ( !is_hvm_domain(d) )
@@ -667,11 +668,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
             rc = -EBUSY;
             break;
         }
+        ++nr;
     }
     rcu_read_unlock(&pinned_cacheattr_rcu_lock);
     if ( rc <= 0 )
         return rc;
 
+    if ( nr >= 64 /* The limit is arbitrary. */ )
+        return -ENOSPC;
+
     range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
     if ( range == NULL )
         return -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 08:11:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 08:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513157.793751 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1petZ6-0005mK-3J; Wed, 22 Mar 2023 08:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513157.793751; Wed, 22 Mar 2023 08: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 1petZ6-0005mD-0r; Wed, 22 Mar 2023 08:11:24 +0000
Received: by outflank-mailman (input) for mailman id 513157;
 Wed, 22 Mar 2023 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 1petZ4-0005m0-3R
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 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 1petZ4-0006tF-1i
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 08:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1petZ4-0002lu-0i
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 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=Ej+Sa7cZxT35VtYN+fDFc6Bn+9U/UjezXCRQdTyK+sc=; b=c3xye5N3vzFPprA/6qDv503iPG
	uSI9IZeZN/oXn3dEkTykGxEyuopYRhrNJO+mZvkM1b3Q8wHsuNT4/bxVZdfyyj98sCRxfIWm4ivZl
	1cWcpzqZI9fFkslfPyNmtgq+4ocdt0HQKC0ORURL2vhGLP9eU2AVE9W376e9jJ853xh8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/HVM: serialize pinned cache attribute list manipulation
Message-Id: <E1petZ4-0002lu-0i@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 08:11:22 +0000

commit fc7dfd94432f4c55a97e86ff63387bfac5da58e3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:43 2023 +0000

    x86/HVM: serialize pinned cache attribute list manipulation
    
    While the RCU variants of list insertion and removal allow lockless list
    traversal (with RCU just read-locked), insertions and removals still
    need serializing amongst themselves. To keep things simple, use the
    domain lock for this purpose.
    
    This is CVE-2022-42334 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 829ec245cf66560e3b50d140ccb3168e7fb7c945)
---
 xen/arch/x86/hvm/mtrr.c | 51 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 09a51f415d..1d31def3c3 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -595,7 +595,7 @@ static void free_pinned_cacheattr_entry(struct rcu_head *rcu)
 int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
-    struct hvm_mem_pinned_cacheattr_range *range;
+    struct hvm_mem_pinned_cacheattr_range *range, *newr;
     unsigned int nr = 0;
     int rc = 1;
 
@@ -609,14 +609,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
     {
     case XEN_DOMCTL_DELETE_MEM_CACHEATTR:
         /* Remove the requested range. */
-        rcu_read_lock(&pinned_cacheattr_rcu_lock);
-        list_for_each_entry_rcu ( range,
-                                  &d->arch.hvm.pinned_cacheattr_ranges,
-                                  list )
+        domain_lock(d);
+        list_for_each_entry ( range,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
+                              list )
             if ( range->start == gfn_start && range->end == gfn_end )
             {
-                rcu_read_unlock(&pinned_cacheattr_rcu_lock);
                 list_del_rcu(&range->list);
+                domain_unlock(d);
+
                 type = range->type;
                 call_rcu(&range->rcu, free_pinned_cacheattr_entry);
                 p2m_memory_type_changed(d);
@@ -637,7 +638,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                 }
                 return 0;
             }
-        rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+        domain_unlock(d);
         return -ENOENT;
 
     case PAT_TYPE_UC_MINUS:
@@ -652,7 +653,10 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         return -EINVAL;
     }
 
-    rcu_read_lock(&pinned_cacheattr_rcu_lock);
+    newr = xzalloc(struct hvm_mem_pinned_cacheattr_range);
+
+    domain_lock(d);
+
     list_for_each_entry_rcu ( range,
                               &d->arch.hvm.pinned_cacheattr_ranges,
                               list )
@@ -670,27 +674,34 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         }
         ++nr;
     }
-    rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+
     if ( rc <= 0 )
-        return rc;
+        /* nothing */;
+    else if ( nr >= 64 /* The limit is arbitrary. */ )
+        rc = -ENOSPC;
+    else if ( !newr )
+        rc = -ENOMEM;
+    else
+    {
+        newr->start = gfn_start;
+        newr->end = gfn_end;
+        newr->type = type;
 
-    if ( nr >= 64 /* The limit is arbitrary. */ )
-        return -ENOSPC;
+        list_add_rcu(&newr->list, &d->arch.hvm.pinned_cacheattr_ranges);
 
-    range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
-    if ( range == NULL )
-        return -ENOMEM;
+        newr = NULL;
+        rc = 0;
+    }
+
+    domain_unlock(d);
 
-    range->start = gfn_start;
-    range->end = gfn_end;
-    range->type = type;
+    xfree(newr);
 
-    list_add_rcu(&range->list, &d->arch.hvm.pinned_cacheattr_ranges);
     p2m_memory_type_changed(d);
     if ( type != PAT_TYPE_WRBACK )
         flush_all(FLUSH_CACHE);
 
-    return 0;
+    return rc;
 }
 
 static int hvm_save_mtrr_msr(struct vcpu *v, hvm_domain_context_t *h)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 08:11:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 08:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513158.793754 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1petZG-0005pk-4m; Wed, 22 Mar 2023 08:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513158.793754; Wed, 22 Mar 2023 08: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 1petZG-0005pe-2I; Wed, 22 Mar 2023 08:11:34 +0000
Received: by outflank-mailman (input) for mailman id 513158;
 Wed, 22 Mar 2023 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 1petZE-0005pN-67
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 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 1petZE-0006tM-5E
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 08:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1petZE-0002mL-47
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 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=pHidR9KjFCEuynK0AillRiU1eqspKNOCwdphhb16V5s=; b=a1TfS2/3Hptaz21J2MxnpuYsys
	IdObl0mylDvYDBnDEZRkB5X/o6JxA7pWYw1i/j1R+Bh7LEWy+yTMfrBOL6vKaFxWNGfpjcwzolSLZ
	N4FCgo+RhG0/U+wF+j1/+DGMdc4aN4BhPeFLK/1U+ubEvTVS5SQfyclmka+IbamtvZPU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
Message-Id: <E1petZE-0002mL-47@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 08:11:32 +0000

commit 11193e13e5359ba1896be46be3e9b468154c1295
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 10 21:11:14 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:43 2023 +0000

    x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
    
    As stated (correctly) by the comment next to SPEC_CTRL_ENTRY_FROM_PV, between
    the two hunks visible in the patch, RET's are not safe prior to this point.
    
    CR4_PV32_RESTORE hides a CALL/RET pair in certain configurations (PV32
    compiled in, SMEP or SMAP active), and the RET can be attacked with one of
    several known speculative issues.
    
    Furthermore, CR4_PV32_RESTORE also hides a reference to the cr4_pv32_mask
    global variable, which is not safe when XPTI is active before restoring Xen's
    full pagetables.
    
    This crash has gone unnoticed because it is only AMD CPUs which permit the
    SYSCALL instruction in compatibility mode, and these are not vulnerable to
    Meltdown so don't activate XPTI by default.
    
    This is XSA-429 / CVE-2022-42331
    
    Fixes: 5e7962901131 ("x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point")
    Fixes: 5784de3e2067 ("x86: Meltdown band-aid against malicious 64-bit PV guests")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit df5b055b12116d9e63ced59ae5389e69a2a3de48)
---
 xen/arch/x86/x86_64/compat/entry.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index 5c999271e6..09a86768ac 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -206,7 +206,6 @@ ENTRY(cstar_enter)
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
 #endif
         push  %rax          /* Guest %rsp */
-        CR4_PV32_RESTORE
         movq  8(%rsp), %rax /* Restore guest %rax. */
         movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
@@ -230,6 +229,8 @@ ENTRY(cstar_enter)
 .Lcstar_cr3_okay:
         sti
 
+        CR4_PV32_RESTORE
+
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
         movq  VCPU_domain(%rbx),%rcx
         cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 11:11:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 11:11:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513341.794182 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pewMx-0000EI-ME; Wed, 22 Mar 2023 11:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513341.794182; Wed, 22 Mar 2023 11:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pewMx-0000EA-JF; Wed, 22 Mar 2023 11:11:03 +0000
Received: by outflank-mailman (input) for mailman id 513341;
 Wed, 22 Mar 2023 11:11: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 1pewMv-0000E4-Ll
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pewMv-0002qM-J8
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pewMv-0002Qn-Hr
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vmNkDW5jWZmsMFbvWGqhXvhoiWTcDswODuszleIWrBs=; b=AMSoaaDm3JiRduw5itAPo+Oqyu
	G/l0uLvZy5rhJ9Y9yec9PwPWspc/dw75khqPJUqBi7mawHFJkdR9f3vCB54PkDMhHq4xeMkKwdQiS
	ICrIrQbQapis8jb5zvKZCZVqknPMToCmbPlVCAbTA1qUZIlE0XRoBMKNHYxD5r63eY8c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/shadow: account for log-dirty mode when pre-allocating
Message-Id: <E1pewMv-0002Qn-Hr@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 11:11:01 +0000

commit f8f8f07880d3817fc7b0472420eca9fecaa55358
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 11:58:50 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:42 2023 +0000

    x86/shadow: account for log-dirty mode when pre-allocating
    
    Pre-allocation is intended to ensure that in the course of constructing
    or updating shadows there won't be any risk of just made shadows or
    shadows being acted upon can disappear under our feet. The amount of
    pages pre-allocated then, however, needs to account for all possible
    subsequent allocations. While the use in sh_page_fault() accounts for
    all shadows which may need making, so far it didn't account for
    allocations coming from log-dirty tracking (which piggybacks onto the
    P2M allocation functions).
    
    Since shadow_prealloc() takes a count of shadows (or other data
    structures) rather than a count of pages, putting the adjustment at the
    call site of this function won't work very well: We simply can't express
    the correct count that way in all cases. Instead take care of this in
    the function itself, by "snooping" for L1 type requests. (While not
    applicable right now, future new request sites of L1 tables would then
    also be covered right away.)
    
    It is relevant to note here that pre-allocations like the one done from
    shadow_alloc_p2m_page() are benign when they fall in the "scope" of an
    earlier pre-alloc which already included that count: The inner call will
    simply find enough pages available then; it'll bail right away.
    
    This is CVE-2022-42332 / XSA-427.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
    (cherry picked from commit 91767a71061035ae42be93de495cd976f863a41a)
---
 xen/arch/x86/include/asm/paging.h |  4 ++++
 xen/arch/x86/mm/paging.c          |  1 +
 xen/arch/x86/mm/shadow/common.c   | 12 +++++++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index b2b243a4ff..635ccc83b1 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -190,6 +190,10 @@ bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
+#define paging_logdirty_levels() \
+    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
+                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
+
 #ifdef CONFIG_HVM
 /* VRAM dirty tracking support */
 struct sh_dirty_vram {
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 8d579fa9a3..308d44bce7 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -282,6 +282,7 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn)
     if ( unlikely(!VALID_M2P(pfn_x(pfn))) )
         return;
 
+    BUILD_BUG_ON(paging_logdirty_levels() != 4);
     i1 = L1_LOGDIRTY_IDX(pfn);
     i2 = L2_LOGDIRTY_IDX(pfn);
     i3 = L3_LOGDIRTY_IDX(pfn);
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index a8404f97f6..cf5e181f74 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1015,7 +1015,17 @@ bool shadow_prealloc(struct domain *d, unsigned int type, unsigned int count)
     if ( unlikely(d->is_dying) )
        return false;
 
-    ret = _shadow_prealloc(d, shadow_size(type) * count);
+    count *= shadow_size(type);
+    /*
+     * Log-dirty handling may result in allocations when populating its
+     * tracking structures.  Tie this to the caller requesting space for L1
+     * shadows.
+     */
+    if ( paging_mode_log_dirty(d) &&
+         ((SHF_L1_ANY | SHF_FL1_ANY) & (1u << type)) )
+        count += paging_logdirty_levels();
+
+    ret = _shadow_prealloc(d, count);
     if ( !ret && (!d->is_shutting_down || d->shutdown_code != SHUTDOWN_crash) )
         /*
          * Failing to allocate memory required for shadow usage can only result in
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 11:11:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 11:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513342.794186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pewN7-0000Gi-PR; Wed, 22 Mar 2023 11:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513342.794186; Wed, 22 Mar 2023 11:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pewN7-0000Ga-MY; Wed, 22 Mar 2023 11:11:13 +0000
Received: by outflank-mailman (input) for mailman id 513342;
 Wed, 22 Mar 2023 11:11: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 1pewN5-0000GL-Nv
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11: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 1pewN5-0002qj-Ma
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pewN5-0002RG-LS
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ED89k/HDAx5RhsPYlZ9T1R3AFAEKwKu/SIEt9tbOaho=; b=GVNLyP5bEbg1grWI8kNx3Mkf8n
	WFMFmKqmBJG+tPzcPs0d37HpCicwA1RtGcHIQql418L1h1YmpjgbBIQ4/j+i0kXDHdx2Qyzhp/mG+
	GFNKbBWLJdTnYGXSI/5+YGy27qX1f7Hyti9ff5ST6SZCPqjHKW7McMKixLhk17QmANKY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/HVM: bound number of pinned cache attribute regions
Message-Id: <E1pewN5-0002RG-LS@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 11:11:11 +0000

commit d0cb66d59a956ccba3dbe794f4ec01e4a4269ee9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:42 2023 +0000

    x86/HVM: bound number of pinned cache attribute regions
    
    This is exposed via DMOP, i.e. to potentially not fully privileged
    device models. With that we may not permit registration of an (almost)
    unbounded amount of such regions.
    
    This is CVE-2022-42333 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit a5e768640f786b681063f4e08af45d0c4e91debf)
---
 xen/arch/x86/hvm/mtrr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 4d2aa6def8..714911dd7f 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -595,6 +595,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
     struct hvm_mem_pinned_cacheattr_range *range;
+    unsigned int nr = 0;
     int rc = 1;
 
     if ( !is_hvm_domain(d) )
@@ -666,11 +667,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
             rc = -EBUSY;
             break;
         }
+        ++nr;
     }
     rcu_read_unlock(&pinned_cacheattr_rcu_lock);
     if ( rc <= 0 )
         return rc;
 
+    if ( nr >= 64 /* The limit is arbitrary. */ )
+        return -ENOSPC;
+
     range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
     if ( range == NULL )
         return -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 11:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 11:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513343.794190 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pewNH-0000JY-Qu; Wed, 22 Mar 2023 11:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513343.794190; Wed, 22 Mar 2023 11:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pewNH-0000JQ-O6; Wed, 22 Mar 2023 11:11:23 +0000
Received: by outflank-mailman (input) for mailman id 513343;
 Wed, 22 Mar 2023 11:11: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 1pewNF-0000Is-Rp
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11: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 1pewNF-0002qu-Qb
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pewNF-0002S0-PC
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iYtkXFjbTgMaxP52N3PLNvQWN7fUIBqvUY2I3YDZae0=; b=iyf8HvsCA+FPxdLLknirlceTLi
	6YoGXsosORqPm1RHkG0YoxUCC9V3xVf5ajO/aAYeEHrHj4JoPY6AzVDZjxsQtiPi44AzORcUZURWx
	AAi8l57GqBRVWhj0RTRV8ORsG1YzXindpUb5s16nFU7aIF0VWtkS/vuR1dWb4/nx8KGc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/HVM: serialize pinned cache attribute list manipulation
Message-Id: <E1pewNF-0002S0-PC@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 11:11:21 +0000

commit a2a915b3960e6ab060d8be2c36e6e697700ea87c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:42 2023 +0000

    x86/HVM: serialize pinned cache attribute list manipulation
    
    While the RCU variants of list insertion and removal allow lockless list
    traversal (with RCU just read-locked), insertions and removals still
    need serializing amongst themselves. To keep things simple, use the
    domain lock for this purpose.
    
    This is CVE-2022-42334 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 829ec245cf66560e3b50d140ccb3168e7fb7c945)
---
 xen/arch/x86/hvm/mtrr.c | 51 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 714911dd7f..bd5cc42ef4 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -594,7 +594,7 @@ static void cf_check free_pinned_cacheattr_entry(struct rcu_head *rcu)
 int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
-    struct hvm_mem_pinned_cacheattr_range *range;
+    struct hvm_mem_pinned_cacheattr_range *range, *newr;
     unsigned int nr = 0;
     int rc = 1;
 
@@ -608,14 +608,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
     {
     case XEN_DOMCTL_DELETE_MEM_CACHEATTR:
         /* Remove the requested range. */
-        rcu_read_lock(&pinned_cacheattr_rcu_lock);
-        list_for_each_entry_rcu ( range,
-                                  &d->arch.hvm.pinned_cacheattr_ranges,
-                                  list )
+        domain_lock(d);
+        list_for_each_entry ( range,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
+                              list )
             if ( range->start == gfn_start && range->end == gfn_end )
             {
-                rcu_read_unlock(&pinned_cacheattr_rcu_lock);
                 list_del_rcu(&range->list);
+                domain_unlock(d);
+
                 type = range->type;
                 call_rcu(&range->rcu, free_pinned_cacheattr_entry);
                 p2m_memory_type_changed(d);
@@ -636,7 +637,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                 }
                 return 0;
             }
-        rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+        domain_unlock(d);
         return -ENOENT;
 
     case PAT_TYPE_UC_MINUS:
@@ -651,7 +652,10 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         return -EINVAL;
     }
 
-    rcu_read_lock(&pinned_cacheattr_rcu_lock);
+    newr = xzalloc(struct hvm_mem_pinned_cacheattr_range);
+
+    domain_lock(d);
+
     list_for_each_entry_rcu ( range,
                               &d->arch.hvm.pinned_cacheattr_ranges,
                               list )
@@ -669,27 +673,34 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         }
         ++nr;
     }
-    rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+
     if ( rc <= 0 )
-        return rc;
+        /* nothing */;
+    else if ( nr >= 64 /* The limit is arbitrary. */ )
+        rc = -ENOSPC;
+    else if ( !newr )
+        rc = -ENOMEM;
+    else
+    {
+        newr->start = gfn_start;
+        newr->end = gfn_end;
+        newr->type = type;
 
-    if ( nr >= 64 /* The limit is arbitrary. */ )
-        return -ENOSPC;
+        list_add_rcu(&newr->list, &d->arch.hvm.pinned_cacheattr_ranges);
 
-    range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
-    if ( range == NULL )
-        return -ENOMEM;
+        newr = NULL;
+        rc = 0;
+    }
+
+    domain_unlock(d);
 
-    range->start = gfn_start;
-    range->end = gfn_end;
-    range->type = type;
+    xfree(newr);
 
-    list_add_rcu(&range->list, &d->arch.hvm.pinned_cacheattr_ranges);
     p2m_memory_type_changed(d);
     if ( type != PAT_TYPE_WRBACK )
         flush_all(FLUSH_CACHE);
 
-    return 0;
+    return rc;
 }
 
 static int cf_check hvm_save_mtrr_msr(struct vcpu *v, hvm_domain_context_t *h)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Mar 22 11:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Mar 2023 11:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513344.794196 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pewNR-0000MV-Tj; Wed, 22 Mar 2023 11:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513344.794196; Wed, 22 Mar 2023 11:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pewNR-0000MN-Pb; Wed, 22 Mar 2023 11:11:33 +0000
Received: by outflank-mailman (input) for mailman id 513344;
 Wed, 22 Mar 2023 11: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 1pewNP-0000MA-VQ
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11: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 1pewNP-0002rH-UT
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pewNP-0002ST-TK
 for xen-changelog@lists.xenproject.org; Wed, 22 Mar 2023 11:11:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9glJBsMD+hpNURZeHgoQZxSDN7iIr/zIrz5DCTtlAck=; b=abq1YnhkZJg2QLnHUGI5+DKBmQ
	RZVQ96PAw9n5QSFY/sshpxkU641IB2ypLo+EK8bIRVzNRnpcLnaHUPKeErH8qEvlCQPqxJWObj5OD
	SCxWkN4y7kv4CXrPDmZVOxmSp0W/36xB+btEO67DeM6DTQcEPUDSoqGFx096RDitXl4o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
Message-Id: <E1pewNP-0002ST-TK@xenbits.xenproject.org>
Date: Wed, 22 Mar 2023 11:11:31 +0000

commit a730e4d1190594102784222f76a984d10bbc88a9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 10 21:11:14 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:42 2023 +0000

    x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
    
    As stated (correctly) by the comment next to SPEC_CTRL_ENTRY_FROM_PV, between
    the two hunks visible in the patch, RET's are not safe prior to this point.
    
    CR4_PV32_RESTORE hides a CALL/RET pair in certain configurations (PV32
    compiled in, SMEP or SMAP active), and the RET can be attacked with one of
    several known speculative issues.
    
    Furthermore, CR4_PV32_RESTORE also hides a reference to the cr4_pv32_mask
    global variable, which is not safe when XPTI is active before restoring Xen's
    full pagetables.
    
    This crash has gone unnoticed because it is only AMD CPUs which permit the
    SYSCALL instruction in compatibility mode, and these are not vulnerable to
    Meltdown so don't activate XPTI by default.
    
    This is XSA-429 / CVE-2022-42331
    
    Fixes: 5e7962901131 ("x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point")
    Fixes: 5784de3e2067 ("x86: Meltdown band-aid against malicious 64-bit PV guests")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit df5b055b12116d9e63ced59ae5389e69a2a3de48)
---
 xen/arch/x86/x86_64/entry.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index ae01285181..7675a59ff0 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -288,7 +288,6 @@ ENTRY(cstar_enter)
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
 #endif
         push  %rax          /* Guest %rsp */
-        CR4_PV32_RESTORE
         movq  8(%rsp), %rax /* Restore guest %rax. */
         movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
@@ -312,6 +311,8 @@ ENTRY(cstar_enter)
 .Lcstar_cr3_okay:
         sti
 
+        CR4_PV32_RESTORE
+
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
 
 #ifdef CONFIG_PV32
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 03:11:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 03:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513625.794878 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfBLz-0008FJ-0q; Thu, 23 Mar 2023 03:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513625.794878; Thu, 23 Mar 2023 03:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfBLy-0008FA-Tz; Thu, 23 Mar 2023 03:11:02 +0000
Received: by outflank-mailman (input) for mailman id 513625;
 Thu, 23 Mar 2023 03:11: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 1pfBLx-0008F4-QB
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfBLx-0001Ed-PE
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfBLx-0006zt-O6
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 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=91Ke7A07ODNpoJjF0ek/v/ZGOSXsK/yy/Ytef+Yi7ZM=; b=GbZsqau0SY+sEtHdNlsy9wrF+6
	ICAAuHhCiJj7aQDWRExUeQxJALYpkbGY1c6HRyLijW4ZToXMSe1cOfWqLaYiMHzilx79g5D7hfB1b
	uzB1LKYikvhb4KpJ/qCeP3U7nbhswCdO2ci2252J6nveAPW5mVzYOYH9j98Mi8dDaQ7Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] AMD/IOMMU: without XT, x2APIC needs to be forced into physical mode
Message-Id: <E1pfBLx-0006zt-O6@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 03:11:01 +0000

commit 0d2686f6b66b4b1b3c72c3525083b0ce02830054
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 09:23:25 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 09:23:25 2023 +0100

    AMD/IOMMU: without XT, x2APIC needs to be forced into physical mode
    
    An earlier change with the same title (commit 1ba66a870eba) altered only
    the path where x2apic_phys was already set to false (perhaps from the
    command line). The same of course needs applying when the variable
    wasn't modified yet from its initial value.
    
    Reported-by: Elliott Mitchell <ehem+xen@m5p.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/genapic/x2apic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index f73390cdb0..0a7ee820f5 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -236,11 +236,11 @@ const struct genapic *__init apic_x2apic_probe(void)
     if ( x2apic_phys < 0 )
     {
         /*
-         * Force physical mode if there's no interrupt remapping support: The
-         * ID in clustered mode requires a 32 bit destination field due to
+         * Force physical mode if there's no (full) interrupt remapping support:
+         * The ID in clustered mode requires a 32 bit destination field due to
          * the usage of the high 16 bits to hold the cluster ID.
          */
-        x2apic_phys = !iommu_intremap ||
+        x2apic_phys = iommu_intremap != iommu_intremap_full ||
                       (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL) ||
                       (IS_ENABLED(CONFIG_X2APIC_PHYSICAL) &&
                        !(acpi_gbl_FADT.flags & ACPI_FADT_APIC_CLUSTER));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 03:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 03:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513626.794882 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfBM9-0008H5-1s; Thu, 23 Mar 2023 03:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513626.794882; Thu, 23 Mar 2023 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 1pfBM8-0008Gy-Vg; Thu, 23 Mar 2023 03:11:12 +0000
Received: by outflank-mailman (input) for mailman id 513626;
 Thu, 23 Mar 2023 03:11: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 1pfBM7-0008Gn-UC
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11: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 1pfBM7-0001El-TC
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfBM7-00070i-S7
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lXAxGDORTA9UdEj2c8U5Fe+FcIcVmlkYQiaCRYJOuVk=; b=i9daKWLA6R3YjrMCcpbcU9+BKm
	euZtB7l7OZ6v0IzmtwbDrIMt5JVRV0NmKUYX854Ujmpt8iikfhAkObCQU7u0Zw/7Rq70OBF1ecZOW
	2c3IF7bs9R9hYL0WvVB1dKzdW7zR3CwkBVMduSjm0Ef/ajDWQggzjsJIbcestaPrF0gw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: Provide named fields for IO exit qualification
Message-Id: <E1pfBM7-00070i-S7@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 03:11:11 +0000

commit f71f8e95c34fedb0d9ae21a100bfa9f012543abf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 16 17:53:56 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 10:41:16 2023 +0000

    x86/vmx: Provide named fields for IO exit qualification
    
    This removes most of the opencoded bit logic on the exit qualification.
    Unfortunately, size is 1-based not 0-based, so need adjusting in a separate
    variable.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/vmx.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 00b531f76c..78ac9ece6f 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4560,23 +4560,37 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         break;
 
     case EXIT_REASON_IO_INSTRUCTION:
-        __vmread(EXIT_QUALIFICATION, &exit_qualification);
-        if ( exit_qualification & 0x10 )
+    {
+        union {
+            unsigned long raw;
+            struct {
+                uint16_t size:3;
+                bool     in:1;
+                bool     str:1;
+                bool     rep:1;
+                bool     imm:1;
+                uint16_t :9;
+                uint16_t port;
+            };
+        } io_qual;
+        unsigned int bytes;
+
+        __vmread(EXIT_QUALIFICATION, &io_qual.raw);
+        bytes = io_qual.size + 1;
+
+        if ( io_qual.str )
         {
-            /* INS, OUTS */
             if ( !hvm_emulate_one_insn(x86_insn_is_portio, "port I/O") )
                 hvm_inject_hw_exception(TRAP_gp_fault, 0);
         }
         else
         {
-            /* IN, OUT */
-            uint16_t port = (exit_qualification >> 16) & 0xFFFF;
-            int bytes = (exit_qualification & 0x07) + 1;
-            int dir = (exit_qualification & 0x08) ? IOREQ_READ : IOREQ_WRITE;
-            if ( handle_pio(port, bytes, dir) )
+            if ( handle_pio(io_qual.port, bytes,
+                            io_qual.in ? IOREQ_READ : IOREQ_WRITE) )
                 update_guest_eip(); /* Safe: IN, OUT */
         }
         break;
+    }
 
     case EXIT_REASON_INVD:
     case EXIT_REASON_WBINVD:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 03:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 03:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513627.794887 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfBMJ-0008Jj-3c; Thu, 23 Mar 2023 03:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513627.794887; Thu, 23 Mar 2023 03: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 1pfBMJ-0008Jb-0y; Thu, 23 Mar 2023 03:11:23 +0000
Received: by outflank-mailman (input) for mailman id 513627;
 Thu, 23 Mar 2023 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 1pfBMI-0008JU-1s
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 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 1pfBMI-0001F9-0u
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfBMH-00071F-W6
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m9wm3aH1D5jHkMsDwevgfNihlDja1lgCig2GKn9rOGk=; b=naLqNZxbvS3sBtZtu5zfxaCsbz
	tD+s7sywQHzIfsvEFkb3SWP7Nm6Cmzq9nkgAczj51GmZX0TZCHCa5/3JNFacrpt0H5KHt9MK3+Luk
	pCyTqPoHbr4Klj3zj94bwmlOR034nKGNMUb+FiBAKFHfa+q+GHhaH1wv0ic9BCI9HNsg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: account for log-dirty mode when pre-allocating
Message-Id: <E1pfBMH-00071F-W6@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 03:11:21 +0000

commit 33fb3a6612235a23b30df556bf92b52a3450c340
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 11:58:50 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:41 2023 +0000

    x86/shadow: account for log-dirty mode when pre-allocating
    
    Pre-allocation is intended to ensure that in the course of constructing
    or updating shadows there won't be any risk of just made shadows or
    shadows being acted upon can disappear under our feet. The amount of
    pages pre-allocated then, however, needs to account for all possible
    subsequent allocations. While the use in sh_page_fault() accounts for
    all shadows which may need making, so far it didn't account for
    allocations coming from log-dirty tracking (which piggybacks onto the
    P2M allocation functions).
    
    Since shadow_prealloc() takes a count of shadows (or other data
    structures) rather than a count of pages, putting the adjustment at the
    call site of this function won't work very well: We simply can't express
    the correct count that way in all cases. Instead take care of this in
    the function itself, by "snooping" for L1 type requests. (While not
    applicable right now, future new request sites of L1 tables would then
    also be covered right away.)
    
    It is relevant to note here that pre-allocations like the one done from
    shadow_alloc_p2m_page() are benign when they fall in the "scope" of an
    earlier pre-alloc which already included that count: The inner call will
    simply find enough pages available then; it'll bail right away.
    
    This is CVE-2022-42332 / XSA-427.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/include/asm/paging.h |  4 ++++
 xen/arch/x86/mm/paging.c          |  1 +
 xen/arch/x86/mm/shadow/common.c   | 12 +++++++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index f75e1b771a..38bec8af2e 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -187,6 +187,10 @@ bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
+#define paging_logdirty_levels() \
+    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
+                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
+
 #ifdef CONFIG_HVM
 /* VRAM dirty tracking support */
 struct sh_dirty_vram {
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 616010e6b8..ff5b480677 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -282,6 +282,7 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn)
     if ( unlikely(!VALID_M2P(pfn_x(pfn))) )
         return;
 
+    BUILD_BUG_ON(paging_logdirty_levels() != 4);
     i1 = L1_LOGDIRTY_IDX(pfn);
     i2 = L2_LOGDIRTY_IDX(pfn);
     i3 = L3_LOGDIRTY_IDX(pfn);
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 7ad0e538b3..7ced6aec0a 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1012,7 +1012,17 @@ bool shadow_prealloc(struct domain *d, unsigned int type, unsigned int count)
     if ( unlikely(d->is_dying) )
        return false;
 
-    ret = _shadow_prealloc(d, shadow_size(type) * count);
+    count *= shadow_size(type);
+    /*
+     * Log-dirty handling may result in allocations when populating its
+     * tracking structures.  Tie this to the caller requesting space for L1
+     * shadows.
+     */
+    if ( paging_mode_log_dirty(d) &&
+         ((SHF_L1_ANY | SHF_FL1_ANY) & (1u << type)) )
+        count += paging_logdirty_levels();
+
+    ret = _shadow_prealloc(d, count);
     if ( !ret && (!d->is_shutting_down || d->shutdown_code != SHUTDOWN_crash) )
         /*
          * Failing to allocate memory required for shadow usage can only result in
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 03:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 03:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513628.794891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfBMT-0008ME-5D; Thu, 23 Mar 2023 03:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513628.794891; Thu, 23 Mar 2023 03: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 1pfBMT-0008M6-2P; Thu, 23 Mar 2023 03:11:33 +0000
Received: by outflank-mailman (input) for mailman id 513628;
 Thu, 23 Mar 2023 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 1pfBMS-0008Ly-5g
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 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 1pfBMS-0001FG-4f
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfBMS-00071g-3X
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 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=bNvCHE1MWie49E4Ek4DtWfKA8DJQiNx2/e0hllIiYQk=; b=PAVIuImxX+G/U62kmAYJPecYR2
	W8l7v6sh68/CeYp9YRcHT8kIBsHPAgmhNoVRQko2q1VapNnOtKS+mqatC3HxVUeTi6akPfqWa/9uG
	5dZp7tcDoTyJNsWMukw4/yszlNjcJj3dfe2yjs7DOLVcV5ROZYZ1Bn0zm0QgfFSpbE8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: bound number of pinned cache attribute regions
Message-Id: <E1pfBMS-00071g-3X@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 03:11:32 +0000

commit d484dcca7972794ad70cefd3af73fe0328d610f1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:41 2023 +0000

    x86/HVM: bound number of pinned cache attribute regions
    
    This is exposed via DMOP, i.e. to potentially not fully privileged
    device models. With that we may not permit registration of an (almost)
    unbounded amount of such regions.
    
    This is CVE-2022-42333 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/mtrr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 344edc2d6a..58f755128c 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -588,6 +588,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
     struct hvm_mem_pinned_cacheattr_range *range;
+    unsigned int nr = 0;
     int rc = 1;
 
     if ( !is_hvm_domain(d) )
@@ -659,11 +660,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
             rc = -EBUSY;
             break;
         }
+        ++nr;
     }
     rcu_read_unlock(&pinned_cacheattr_rcu_lock);
     if ( rc <= 0 )
         return rc;
 
+    if ( nr >= 64 /* The limit is arbitrary. */ )
+        return -ENOSPC;
+
     range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
     if ( range == NULL )
         return -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 03:11:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 03:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513629.794895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfBMd-0008PH-6S; Thu, 23 Mar 2023 03:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513629.794895; Thu, 23 Mar 2023 03: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 1pfBMd-0008P9-3p; Thu, 23 Mar 2023 03:11:43 +0000
Received: by outflank-mailman (input) for mailman id 513629;
 Thu, 23 Mar 2023 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 1pfBMc-0008Oz-Bi
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 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 1pfBMc-0001Ff-AT
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfBMc-000725-7E
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 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=1eh4ffJQ61ntJBbwnr1ULKwn08C6BlbqcM3H0x/dEcM=; b=Ek7bD0hnHA3eED6DxuUIOS2LST
	lU/ZR7okhwzpmUYk+JNF+K1SOWPOggerRywIlHwgw9OhTym0Luqg1J3e0HrtB+Tu4AUsy7EOAS+X/
	ggPD5ntGOcTxx7CeSFZbIvOirrZGlPOnVj8mIIrBP+IDoCEaiFd2M+FQtsXwrfjduZaY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: serialize pinned cache attribute list manipulation
Message-Id: <E1pfBMc-000725-7E@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 03:11:42 +0000

commit ab2d47eb135380105b32a2a419f1e19445e19fc1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:42 2023 +0000

    x86/HVM: serialize pinned cache attribute list manipulation
    
    While the RCU variants of list insertion and removal allow lockless list
    traversal (with RCU just read-locked), insertions and removals still
    need serializing amongst themselves. To keep things simple, use the
    domain lock for this purpose.
    
    This is CVE-2022-42334 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/x86/hvm/mtrr.c | 51 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 58f755128c..f1a88d7616 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -587,7 +587,7 @@ static void cf_check free_pinned_cacheattr_entry(struct rcu_head *rcu)
 int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
-    struct hvm_mem_pinned_cacheattr_range *range;
+    struct hvm_mem_pinned_cacheattr_range *range, *newr;
     unsigned int nr = 0;
     int rc = 1;
 
@@ -601,14 +601,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
     {
     case XEN_DOMCTL_DELETE_MEM_CACHEATTR:
         /* Remove the requested range. */
-        rcu_read_lock(&pinned_cacheattr_rcu_lock);
-        list_for_each_entry_rcu ( range,
-                                  &d->arch.hvm.pinned_cacheattr_ranges,
-                                  list )
+        domain_lock(d);
+        list_for_each_entry ( range,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
+                              list )
             if ( range->start == gfn_start && range->end == gfn_end )
             {
-                rcu_read_unlock(&pinned_cacheattr_rcu_lock);
                 list_del_rcu(&range->list);
+                domain_unlock(d);
+
                 type = range->type;
                 call_rcu(&range->rcu, free_pinned_cacheattr_entry);
                 p2m_memory_type_changed(d);
@@ -629,7 +630,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                 }
                 return 0;
             }
-        rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+        domain_unlock(d);
         return -ENOENT;
 
     case X86_MT_UCM:
@@ -644,7 +645,10 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         return -EINVAL;
     }
 
-    rcu_read_lock(&pinned_cacheattr_rcu_lock);
+    newr = xzalloc(struct hvm_mem_pinned_cacheattr_range);
+
+    domain_lock(d);
+
     list_for_each_entry_rcu ( range,
                               &d->arch.hvm.pinned_cacheattr_ranges,
                               list )
@@ -662,27 +666,34 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         }
         ++nr;
     }
-    rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+
     if ( rc <= 0 )
-        return rc;
+        /* nothing */;
+    else if ( nr >= 64 /* The limit is arbitrary. */ )
+        rc = -ENOSPC;
+    else if ( !newr )
+        rc = -ENOMEM;
+    else
+    {
+        newr->start = gfn_start;
+        newr->end = gfn_end;
+        newr->type = type;
 
-    if ( nr >= 64 /* The limit is arbitrary. */ )
-        return -ENOSPC;
+        list_add_rcu(&newr->list, &d->arch.hvm.pinned_cacheattr_ranges);
 
-    range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
-    if ( range == NULL )
-        return -ENOMEM;
+        newr = NULL;
+        rc = 0;
+    }
+
+    domain_unlock(d);
 
-    range->start = gfn_start;
-    range->end = gfn_end;
-    range->type = type;
+    xfree(newr);
 
-    list_add_rcu(&range->list, &d->arch.hvm.pinned_cacheattr_ranges);
     p2m_memory_type_changed(d);
     if ( type != X86_MT_WB )
         flush_all(FLUSH_CACHE);
 
-    return 0;
+    return rc;
 }
 
 static int cf_check hvm_save_mtrr_msr(struct vcpu *v, hvm_domain_context_t *h)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 03:11:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 03:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513630.794898 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfBMn-0008RV-7p; Thu, 23 Mar 2023 03:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513630.794898; Thu, 23 Mar 2023 03: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 1pfBMn-0008RN-5E; Thu, 23 Mar 2023 03:11:53 +0000
Received: by outflank-mailman (input) for mailman id 513630;
 Thu, 23 Mar 2023 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 1pfBMm-0008RD-Fm
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 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 1pfBMm-0001Fm-EL
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 03:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfBMm-00072c-D9
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 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=a6SzxChpiKcK9GkHaEFQI75AsXUsqk9Ltg+xdFruI1k=; b=BF45nIuMZJO1/jFMTRzNpzsWMv
	eBkmFqwC4NG8T9Q35Dyubmb/v8Rm1f+KzlK2ebdAkSMexar6yB3zQ7khowl+D/pxOrcQFtLLJK5+v
	wf6ZOxlv9D6p5+WxaAj0Mxn/6BnBZFUww9iYw5RFSK2BX0CGxBODxCgjek+0bKndN7bU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
Message-Id: <E1pfBMm-00072c-D9@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 03:11:52 +0000

commit 245d030f4aa79f766e575684127f86748c63bb32
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 10 21:11:14 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:42 2023 +0000

    x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
    
    As stated (correctly) by the comment next to SPEC_CTRL_ENTRY_FROM_PV, between
    the two hunks visible in the patch, RET's are not safe prior to this point.
    
    CR4_PV32_RESTORE hides a CALL/RET pair in certain configurations (PV32
    compiled in, SMEP or SMAP active), and the RET can be attacked with one of
    several known speculative issues.
    
    Furthermore, CR4_PV32_RESTORE also hides a reference to the cr4_pv32_mask
    global variable, which is not safe when XPTI is active before restoring Xen's
    full pagetables.
    
    This crash has gone unnoticed because it is only AMD CPUs which permit the
    SYSCALL instruction in compatibility mode, and these are not vulnerable to
    Meltdown so don't activate XPTI by default.
    
    This is XSA-429 / CVE-2022-42331
    
    Fixes: 5e7962901131 ("x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point")
    Fixes: 5784de3e2067 ("x86: Meltdown band-aid against malicious 64-bit PV guests")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/entry.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index ae01285181..7675a59ff0 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -288,7 +288,6 @@ ENTRY(cstar_enter)
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
 #endif
         push  %rax          /* Guest %rsp */
-        CR4_PV32_RESTORE
         movq  8(%rsp), %rax /* Restore guest %rax. */
         movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
@@ -312,6 +311,8 @@ ENTRY(cstar_enter)
 .Lcstar_cr3_okay:
         sti
 
+        CR4_PV32_RESTORE
+
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
 
 #ifdef CONFIG_PV32
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:11:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513633.794909 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCI3-0007KM-Gz; Thu, 23 Mar 2023 04:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513633.794909; Thu, 23 Mar 2023 04: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 1pfCI3-0007KE-Df; Thu, 23 Mar 2023 04:11:03 +0000
Received: by outflank-mailman (input) for mailman id 513633;
 Thu, 23 Mar 2023 04: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 1pfCI2-0007K6-Fk
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCI2-0002ss-92
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCI2-00016h-7g
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=th73MPq6DIJpJUrp1TsOuabnBhJPnsY1lXM3EQsJzsI=; b=W3s59FA378OqC60rsUQKWkk6VD
	4Fs7TFwvJdfQ9TNQoD9hx40a9Ctjd8dV6ugK48LP55bdK+MHCXsZm6KhpGmZD2EJK3G8AZigDm8Aa
	B85xcpnEeZAp0sjDY6DUOb071HMbr+I1gTxoGX5CJsnArvHJn0PnVJFc0hE6cDBnQUB0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/vmx: implement VMExit based guest Bus Lock detection
Message-Id: <E1pfCI2-00016h-7g@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:11:02 +0000

commit 83f12e4eafdc4b034501adf4847a09a1293fdf8b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Mar 21 13:40:41 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:40:41 2023 +0100

    x86/vmx: implement VMExit based guest Bus Lock detection
    
    Add support for enabling guest Bus Lock Detection on Intel systems.
    Such detection works by triggering a vmexit, which ought to be enough
    of a pause to prevent a guest from abusing of the Bus Lock.
    
    Add an extra Xen perf counter to track the number of Bus Locks detected.
    This is done because Bus Locks can also be reported by setting the bit
    26 in the exit reason field, so also account for those.
    
    Note EXIT_REASON_BUS_LOCK VMExits will always have bit 26 set in
    exit_reason, and hence the performance counter doesn't need to be
    increased for EXIT_REASON_BUS_LOCK handling.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: f7d07619d2ae0382e2922e287fbfbb27722f3f0b
    master date: 2022-12-19 11:22:43 +0100
---
 xen/arch/x86/hvm/vmx/vmcs.c             |  4 +++-
 xen/arch/x86/hvm/vmx/vmx.c              | 15 +++++++++++++++
 xen/arch/x86/hvm/vmx/vvmx.c             |  3 ++-
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  3 +++
 xen/arch/x86/include/asm/hvm/vmx/vmx.h  |  2 ++
 xen/arch/x86/include/asm/perfc_defn.h   |  4 +++-
 6 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 84dbb88d33..a0d5e8d6ab 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -209,6 +209,7 @@ static void __init vmx_display_features(void)
     P(cpu_has_vmx_virt_exceptions, "Virtualisation Exceptions");
     P(cpu_has_vmx_pml, "Page Modification Logging");
     P(cpu_has_vmx_tsc_scaling, "TSC Scaling");
+    P(cpu_has_vmx_bus_lock_detection, "Bus Lock Detection");
 #undef P
 
     if ( !printed )
@@ -318,7 +319,8 @@ static int vmx_init_vmcs_config(bool bsp)
                SECONDARY_EXEC_ENABLE_VM_FUNCTIONS |
                SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS |
                SECONDARY_EXEC_XSAVES |
-               SECONDARY_EXEC_TSC_SCALING);
+               SECONDARY_EXEC_TSC_SCALING |
+               SECONDARY_EXEC_BUS_LOCK_DETECTION);
         if ( _vmx_misc_cap & VMX_MISC_VMWRITE_ALL )
             opt |= SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
         if ( opt_vpid_enabled )
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 861f91f2af..d0f0f2e429 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4084,6 +4084,12 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
             return;
     }
 
+    if ( unlikely(exit_reason & VMX_EXIT_REASONS_BUS_LOCK) )
+    {
+        perfc_incr(buslock);
+        exit_reason &= ~VMX_EXIT_REASONS_BUS_LOCK;
+    }
+
     /* XXX: This looks ugly, but we need a mechanism to ensure
      * any pending vmresume has really happened
      */
@@ -4593,6 +4599,15 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         vmx_handle_descriptor_access(exit_reason);
         break;
 
+    case EXIT_REASON_BUS_LOCK:
+        /*
+         * Nothing to do: just taking a vmexit should be enough of a pause to
+         * prevent a VM from crippling the host with bus locks.  Note
+         * EXIT_REASON_BUS_LOCK will always have bit 26 set in exit_reason, and
+         * hence the perf counter is already increased.
+         */
+        break;
+
     case EXIT_REASON_VMX_PREEMPTION_TIMER_EXPIRED:
     case EXIT_REASON_INVPCID:
     /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 5f54451475..2095c1e612 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2405,7 +2405,7 @@ void nvmx_idtv_handling(void)
      * be reinjected, otherwise, pass to L1.
      */
     __vmread(VM_EXIT_REASON, &reason);
-    if ( reason != EXIT_REASON_EPT_VIOLATION ?
+    if ( (uint16_t)reason != EXIT_REASON_EPT_VIOLATION ?
          !(nvmx->intr.intr_info & INTR_INFO_VALID_MASK) :
          !nvcpu->nv_vmexit_pending )
     {
@@ -2486,6 +2486,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
     case EXIT_REASON_EPT_VIOLATION:
     case EXIT_REASON_EPT_MISCONFIG:
     case EXIT_REASON_EXTERNAL_INTERRUPT:
+    case EXIT_REASON_BUS_LOCK:
         /* pass to L0 handler */
         break;
     case VMX_EXIT_REASONS_FAILED_VMENTRY:
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 75f9928abf..f3df5113d4 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -267,6 +267,7 @@ extern u32 vmx_vmentry_control;
 #define SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS   0x00040000
 #define SECONDARY_EXEC_XSAVES                   0x00100000
 #define SECONDARY_EXEC_TSC_SCALING              0x02000000
+#define SECONDARY_EXEC_BUS_LOCK_DETECTION       0x40000000
 extern u32 vmx_secondary_exec_control;
 
 #define VMX_EPT_EXEC_ONLY_SUPPORTED                         0x00000001
@@ -346,6 +347,8 @@ extern u64 vmx_ept_vpid_cap;
     (vmx_secondary_exec_control & SECONDARY_EXEC_XSAVES)
 #define cpu_has_vmx_tsc_scaling \
     (vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
+#define cpu_has_vmx_bus_lock_detection \
+    (vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
 
 #define VMCS_RID_TYPE_MASK              0x80000000
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 8eedf59155..03995701a1 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -159,6 +159,7 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
  * Exit Reasons
  */
 #define VMX_EXIT_REASONS_FAILED_VMENTRY 0x80000000
+#define VMX_EXIT_REASONS_BUS_LOCK       (1u << 26)
 
 #define EXIT_REASON_EXCEPTION_NMI       0
 #define EXIT_REASON_EXTERNAL_INTERRUPT  1
@@ -219,6 +220,7 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
 #define EXIT_REASON_PML_FULL            62
 #define EXIT_REASON_XSAVES              63
 #define EXIT_REASON_XRSTORS             64
+#define EXIT_REASON_BUS_LOCK            74
 /* Remember to also update VMX_PERF_EXIT_REASON_SIZE! */
 
 /*
diff --git a/xen/arch/x86/include/asm/perfc_defn.h b/xen/arch/x86/include/asm/perfc_defn.h
index 509afc516b..6fce21e85a 100644
--- a/xen/arch/x86/include/asm/perfc_defn.h
+++ b/xen/arch/x86/include/asm/perfc_defn.h
@@ -6,7 +6,7 @@ PERFCOUNTER_ARRAY(exceptions,           "exceptions", 32)
 
 #ifdef CONFIG_HVM
 
-#define VMX_PERF_EXIT_REASON_SIZE 65
+#define VMX_PERF_EXIT_REASON_SIZE 75
 #define VMEXIT_NPF_PERFC 143
 #define SVM_PERF_EXIT_REASON_SIZE (VMEXIT_NPF_PERFC + 1)
 PERFCOUNTER_ARRAY(vmexits,              "vmexits",
@@ -128,4 +128,6 @@ PERFCOUNTER(pauseloop_exits, "vmexits from Pause-Loop Detection")
 PERFCOUNTER(iommu_pt_shatters,    "IOMMU page table shatters")
 PERFCOUNTER(iommu_pt_coalesces,   "IOMMU page table coalesces")
 
+PERFCOUNTER(buslock, "Bus Locks Detected")
+
 /*#endif*/ /* __XEN_PERFC_DEFN_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:11:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513634.794913 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCID-0007Me-Jn; Thu, 23 Mar 2023 04:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513634.794913; Thu, 23 Mar 2023 04: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 1pfCID-0007MW-H8; Thu, 23 Mar 2023 04:11:13 +0000
Received: by outflank-mailman (input) for mailman id 513634;
 Thu, 23 Mar 2023 04: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 1pfCIC-0007MM-Du
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCIC-0002sx-Cv
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCIC-00017J-Bt
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=t2P8d5009oRZlfTdLxZtZfzNiMM2cI/fEbISgZmBOVw=; b=4BMsBe+wxtziKns1X8FQDmR9ad
	PlEbk6RhMWT3gwqm1NCfqwQfZDArFUwOlF2yP26M08nrL2TfqvIaiAzmugICG5Fg3XeGV9cjymOJw
	yhQ7Z+mH8GgCm9Trog1UZ740gGXlKIQHJFMISj/UzYLjU8oyUAE+n1TOrgxadASPGAvM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/vmx: introduce helper to set VMX_INTR_SHADOW_NMI
Message-Id: <E1pfCIC-00017J-Bt@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:11:12 +0000

commit 27abea1ba6fa68f81b98de31cf9b9ebb594ff238
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Mar 21 13:41:49 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:41:49 2023 +0100

    x86/vmx: introduce helper to set VMX_INTR_SHADOW_NMI
    
    Introduce a small helper to OR VMX_INTR_SHADOW_NMI in
    GUEST_INTERRUPTIBILITY_INFO in order to help dealing with the NMI
    unblocked by IRET case.  Replace the existing usage in handling
    EXIT_REASON_EXCEPTION_NMI and also add such handling to EPT violations
    and page-modification log-full events.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: d329b37d12132164c3894d0b6284be72576ef950
    master date: 2022-12-19 11:23:34 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c             | 28 +++++++++++++++++++++-------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h |  3 +++
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d0f0f2e429..456726e897 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3967,6 +3967,15 @@ static int vmx_handle_apic_write(void)
     return vlapic_apicv_write(current, exit_qualification & 0xfff);
 }
 
+static void undo_nmis_unblocked_by_iret(void)
+{
+    unsigned long guest_info;
+
+    __vmread(GUEST_INTERRUPTIBILITY_INFO, &guest_info);
+    __vmwrite(GUEST_INTERRUPTIBILITY_INFO,
+              guest_info | VMX_INTR_SHADOW_NMI);
+}
+
 void vmx_vmexit_handler(struct cpu_user_regs *regs)
 {
     unsigned long exit_qualification, exit_reason, idtv_info, intr_info = 0;
@@ -4167,13 +4176,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         if ( unlikely(intr_info & INTR_INFO_NMI_UNBLOCKED_BY_IRET) &&
              !(idtv_info & INTR_INFO_VALID_MASK) &&
              (vector != TRAP_double_fault) )
-        {
-            unsigned long guest_info;
-
-            __vmread(GUEST_INTERRUPTIBILITY_INFO, &guest_info);
-            __vmwrite(GUEST_INTERRUPTIBILITY_INFO,
-                      guest_info | VMX_INTR_SHADOW_NMI);
-        }
+            undo_nmis_unblocked_by_iret();
 
         perfc_incra(cause_vector, vector);
 
@@ -4539,6 +4542,11 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
 
         __vmread(GUEST_PHYSICAL_ADDRESS, &gpa);
         __vmread(EXIT_QUALIFICATION, &exit_qualification);
+
+        if ( unlikely(exit_qualification & INTR_INFO_NMI_UNBLOCKED_BY_IRET) &&
+             !(idtv_info & INTR_INFO_VALID_MASK) )
+            undo_nmis_unblocked_by_iret();
+
         ept_handle_violation(exit_qualification, gpa);
         break;
     }
@@ -4583,6 +4591,12 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         break;
 
     case EXIT_REASON_PML_FULL:
+        __vmread(EXIT_QUALIFICATION, &exit_qualification);
+
+        if ( unlikely(exit_qualification & INTR_INFO_NMI_UNBLOCKED_BY_IRET) &&
+             !(idtv_info & INTR_INFO_VALID_MASK) )
+            undo_nmis_unblocked_by_iret();
+
         vmx_vcpu_flush_pml_buffer(v);
         break;
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 03995701a1..eae39365aa 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -225,6 +225,9 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
 
 /*
  * Interruption-information format
+ *
+ * Note INTR_INFO_NMI_UNBLOCKED_BY_IRET is also used with Exit Qualification
+ * field for EPT violations, PML full and SPP-related event vmexits.
  */
 #define INTR_INFO_VECTOR_MASK           0xff            /* 7:0 */
 #define INTR_INFO_INTR_TYPE_MASK        0x700           /* 10:8 */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513635.794917 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCIN-0007Ox-Lf; Thu, 23 Mar 2023 04:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513635.794917; Thu, 23 Mar 2023 04: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 1pfCIN-0007Op-Ie; Thu, 23 Mar 2023 04:11:23 +0000
Received: by outflank-mailman (input) for mailman id 513635;
 Thu, 23 Mar 2023 04: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 1pfCIM-0007Og-IW
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCIM-0002tI-HD
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCIM-00017j-G8
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=W2I42iqIjg65ibGX5MeRBfBwUL0aVXdtpou0TK+o+WM=; b=YjmyxRBqOT0hSe9roUXUseHW4r
	5pwckrECYB5BYHmpHWpxzp2kQT9hHGHQDDJci99E8YzFyL+8RJqx58v/W6pjiVExHAulsW1ZrDXrA
	SnkyiYEUBac6P5rsOhnDFoElJ5+w4NwUEu60mMVgw9i7ORnoCWwdDf6ux4pNgHNCWB3s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/vmx: implement Notify VM Exit
Message-Id: <E1pfCIM-00017j-G8@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:11:22 +0000

commit b745ff30113d2bd91e2d34cf56437b2fe2e2ea35
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Mar 21 13:42:43 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:42:43 2023 +0100

    x86/vmx: implement Notify VM Exit
    
    Under certain conditions guests can get the CPU stuck in an unbounded
    loop without the possibility of an interrupt window to occur on
    instruction boundary.  This was the case with the scenarios described
    in XSA-156.
    
    Make use of the Notify VM Exit mechanism, that will trigger a VM Exit
    if no interrupt window occurs for a specified amount of time.  Note
    that using the Notify VM Exit avoids having to trap #AC and #DB
    exceptions, as Xen is guaranteed to get a VM Exit even if the guest
    puts the CPU in a loop without an interrupt window, as such disable
    the intercepts if the feature is available and enabled.
    
    Setting the notify VM exit window to 0 is safe because there's a
    threshold added by the hardware in order to have a sane window value.
    
    Note the handling of EXIT_REASON_NOTIFY in the nested virtualization
    case is passed to L0, and hence a nested guest being able to trigger a
    notify VM exit with an invalid context would be able to crash the L1
    hypervisor (by L0 destroying the domain).  Since we don't expose VM
    Notify support to L1 it should already enable the required
    protections in order to prevent VM Notify from triggering in the first
    place.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    
    x86/vmx: Partially revert "x86/vmx: implement Notify VM Exit"
    
    The original patch tried to do two things - implement VMNotify, and
    re-optimise VT-x to not intercept #DB/#AC by default.
    
    The second part is buggy in multiple ways.  Both GDBSX and Introspection need
    to conditionally intercept #DB, which was not accounted for.  Also, #DB
    interception has nothing at all to do with cpu_has_monitor_trap_flag.
    
    Revert the second half, leaving #DB/#AC intercepted unilaterally, but with
    VMNotify active by default when available.
    
    Fixes: 573279cde1c4 ("x86/vmx: implement Notify VM Exit")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 573279cde1c4e752d4df34bc65ffafa17573148e
    master date: 2022-12-19 11:24:14 +0100
    master commit: 5f08bc9404c7cfa8131e262c7dbcb4d96c752686
    master date: 2023-01-20 19:39:32 +0000
---
 docs/misc/xen-command-line.pandoc       | 11 +++++++++++
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 ++++++++++
 xen/arch/x86/hvm/vmx/vmx.c              | 16 ++++++++++++++++
 xen/arch/x86/hvm/vmx/vvmx.c             |  1 +
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  4 ++++
 xen/arch/x86/include/asm/hvm/vmx/vmx.h  |  6 ++++++
 xen/arch/x86/include/asm/perfc_defn.h   |  3 ++-
 7 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 5be5ce10c6..d601120faa 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2634,6 +2634,17 @@ guest will notify Xen that it has failed to acquire a spinlock.
 <major>, <minor> and <build> must be integers. The values will be
 encoded in guest CPUID 0x40000002 if viridian enlightenments are enabled.
 
+### vm-notify-window (Intel)
+> `= <integer>`
+
+> Default: `0`
+
+Specify the value of the VM Notify window used to detect locked VMs. Set to -1
+to disable the feature.  Value is in units of crystal clock cycles.
+
+Note the hardware might add a threshold to the provided value in order to make
+it safe, and hence using 0 is fine.
+
 ### vpid (Intel)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index a0d5e8d6ab..7912053bda 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -67,6 +67,9 @@ integer_param("ple_gap", ple_gap);
 static unsigned int __read_mostly ple_window = 4096;
 integer_param("ple_window", ple_window);
 
+static unsigned int __ro_after_init vm_notify_window;
+integer_param("vm-notify-window", vm_notify_window);
+
 static bool __read_mostly opt_ept_pml = true;
 static s8 __read_mostly opt_ept_ad = -1;
 int8_t __read_mostly opt_ept_exec_sp = -1;
@@ -210,6 +213,7 @@ static void __init vmx_display_features(void)
     P(cpu_has_vmx_pml, "Page Modification Logging");
     P(cpu_has_vmx_tsc_scaling, "TSC Scaling");
     P(cpu_has_vmx_bus_lock_detection, "Bus Lock Detection");
+    P(cpu_has_vmx_notify_vm_exiting, "Notify VM Exit");
 #undef P
 
     if ( !printed )
@@ -329,6 +333,8 @@ static int vmx_init_vmcs_config(bool bsp)
             opt |= SECONDARY_EXEC_UNRESTRICTED_GUEST;
         if ( opt_ept_pml )
             opt |= SECONDARY_EXEC_ENABLE_PML;
+        if ( vm_notify_window != ~0u )
+            opt |= SECONDARY_EXEC_NOTIFY_VM_EXITING;
 
         /*
          * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
@@ -1290,6 +1296,10 @@ static int construct_vmcs(struct vcpu *v)
     v->arch.hvm.vmx.exception_bitmap = HVM_TRAP_MASK
               | (paging_mode_hap(d) ? 0 : (1U << TRAP_page_fault))
               | (v->arch.fully_eager_fpu ? 0 : (1U << TRAP_no_device));
+
+    if ( cpu_has_vmx_notify_vm_exiting )
+        __vmwrite(NOTIFY_WINDOW, vm_notify_window);
+
     vmx_update_exception_bitmap(v);
 
     v->arch.hvm.guest_cr[0] = X86_CR0_PE | X86_CR0_ET;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 456726e897..f0e759eeaf 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4622,6 +4622,22 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
          */
         break;
 
+    case EXIT_REASON_NOTIFY:
+        __vmread(EXIT_QUALIFICATION, &exit_qualification);
+
+        if ( unlikely(exit_qualification & NOTIFY_VM_CONTEXT_INVALID) )
+        {
+            perfc_incr(vmnotify_crash);
+            gprintk(XENLOG_ERR, "invalid VM context after notify vmexit\n");
+            domain_crash(v->domain);
+            break;
+        }
+
+        if ( unlikely(exit_qualification & INTR_INFO_NMI_UNBLOCKED_BY_IRET) )
+            undo_nmis_unblocked_by_iret();
+
+        break;
+
     case EXIT_REASON_VMX_PREEMPTION_TIMER_EXPIRED:
     case EXIT_REASON_INVPCID:
     /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 2095c1e612..f8fe8d0c14 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2487,6 +2487,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
     case EXIT_REASON_EPT_MISCONFIG:
     case EXIT_REASON_EXTERNAL_INTERRUPT:
     case EXIT_REASON_BUS_LOCK:
+    case EXIT_REASON_NOTIFY:
         /* pass to L0 handler */
         break;
     case VMX_EXIT_REASONS_FAILED_VMENTRY:
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index f3df5113d4..78404e42b3 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -268,6 +268,7 @@ extern u32 vmx_vmentry_control;
 #define SECONDARY_EXEC_XSAVES                   0x00100000
 #define SECONDARY_EXEC_TSC_SCALING              0x02000000
 #define SECONDARY_EXEC_BUS_LOCK_DETECTION       0x40000000
+#define SECONDARY_EXEC_NOTIFY_VM_EXITING        0x80000000
 extern u32 vmx_secondary_exec_control;
 
 #define VMX_EPT_EXEC_ONLY_SUPPORTED                         0x00000001
@@ -349,6 +350,8 @@ extern u64 vmx_ept_vpid_cap;
     (vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
 #define cpu_has_vmx_bus_lock_detection \
     (vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
+#define cpu_has_vmx_notify_vm_exiting \
+    (vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING)
 
 #define VMCS_RID_TYPE_MASK              0x80000000
 
@@ -456,6 +459,7 @@ enum vmcs_field {
     SECONDARY_VM_EXEC_CONTROL       = 0x0000401e,
     PLE_GAP                         = 0x00004020,
     PLE_WINDOW                      = 0x00004022,
+    NOTIFY_WINDOW                   = 0x00004024,
     VM_INSTRUCTION_ERROR            = 0x00004400,
     VM_EXIT_REASON                  = 0x00004402,
     VM_EXIT_INTR_INFO               = 0x00004404,
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index eae39365aa..8e1e42ac47 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -221,6 +221,7 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
 #define EXIT_REASON_XSAVES              63
 #define EXIT_REASON_XRSTORS             64
 #define EXIT_REASON_BUS_LOCK            74
+#define EXIT_REASON_NOTIFY              75
 /* Remember to also update VMX_PERF_EXIT_REASON_SIZE! */
 
 /*
@@ -236,6 +237,11 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
 #define INTR_INFO_VALID_MASK            0x80000000      /* 31 */
 #define INTR_INFO_RESVD_BITS_MASK       0x7ffff000
 
+/*
+ * Exit Qualifications for NOTIFY VM EXIT
+ */
+#define NOTIFY_VM_CONTEXT_INVALID       1u
+
 /*
  * Exit Qualifications for MOV for Control Register Access
  */
diff --git a/xen/arch/x86/include/asm/perfc_defn.h b/xen/arch/x86/include/asm/perfc_defn.h
index 6fce21e85a..487e20dc97 100644
--- a/xen/arch/x86/include/asm/perfc_defn.h
+++ b/xen/arch/x86/include/asm/perfc_defn.h
@@ -6,7 +6,7 @@ PERFCOUNTER_ARRAY(exceptions,           "exceptions", 32)
 
 #ifdef CONFIG_HVM
 
-#define VMX_PERF_EXIT_REASON_SIZE 75
+#define VMX_PERF_EXIT_REASON_SIZE 76
 #define VMEXIT_NPF_PERFC 143
 #define SVM_PERF_EXIT_REASON_SIZE (VMEXIT_NPF_PERFC + 1)
 PERFCOUNTER_ARRAY(vmexits,              "vmexits",
@@ -129,5 +129,6 @@ PERFCOUNTER(iommu_pt_shatters,    "IOMMU page table shatters")
 PERFCOUNTER(iommu_pt_coalesces,   "IOMMU page table coalesces")
 
 PERFCOUNTER(buslock, "Bus Locks Detected")
+PERFCOUNTER(vmnotify_crash, "domain crashes by Notify VM Exit")
 
 /*#endif*/ /* __XEN_PERFC_DEFN_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513636.794921 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCIX-0007Rs-My; Thu, 23 Mar 2023 04:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513636.794921; Thu, 23 Mar 2023 04: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 1pfCIX-0007Rl-KJ; Thu, 23 Mar 2023 04:11:33 +0000
Received: by outflank-mailman (input) for mailman id 513636;
 Thu, 23 Mar 2023 04: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 1pfCIW-0007RW-Lu
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCIW-0002tX-Ky
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCIW-000188-Js
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=HrKwogIM9wPNMA3BHaCXsHr4FdorT5Afq3Sp+cle7VM=; b=OIlCjiNySTOHI6CUeCQ1zixYk3
	tiuyDDZsyGP7deyJjFMX1Zh3/0Ka3eP1UaEyOJqWMzaH/kv+pFVPvm/vMlC/1ddX8JJKNp8UYxzzS
	FDXTrp58Hzt5ldBHE5Qow1IwAA35D+u4kFvQB5GwrKNPYMXhRk9OHX8nZwCNPsWwtRi4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/python: change 's#' size type for Python >= 3.10
Message-Id: <E1pfCIW-000188-Js@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:11:32 +0000

commit 651ffe2c7847cb9922d22980984a3bea6f47bea7
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Mar 21 13:43:44 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:43:44 2023 +0100

    tools/python: change 's#' size type for Python >= 3.10
    
    Python < 3.10 by default uses 'int' type for data+size string types
    (s#), unless PY_SSIZE_T_CLEAN is defined - in which case it uses
    Py_ssize_t. The former behavior was removed in Python 3.10 and now it's
    required to define PY_SSIZE_T_CLEAN before including Python.h, and using
    Py_ssize_t for the length argument. The PY_SSIZE_T_CLEAN behavior is
    supported since Python 2.5.
    
    Adjust bindings accordingly.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 897257ba49d0a6ddcf084960fd792ccce9c40f94
    master date: 2023-02-06 08:50:13 +0100
---
 tools/python/xen/lowlevel/xc/xc.c | 3 ++-
 tools/python/xen/lowlevel/xs/xs.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index fd00861032..cfb2734a99 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -4,6 +4,7 @@
  * Copyright (c) 2003-2004, K A Fraser (University of Cambridge)
  */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #define XC_WANT_COMPAT_MAP_FOREIGN_API
 #include <xenctrl.h>
@@ -1774,7 +1775,7 @@ static PyObject *pyflask_load(PyObject *self, PyObject *args, PyObject *kwds)
 {
     xc_interface *xc_handle;
     char *policy;
-    uint32_t len;
+    Py_ssize_t len;
     int ret;
 
     static char *kwd_list[] = { "policy", NULL };
diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
index 0dad7fa5f2..3ba5a8b893 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -18,6 +18,7 @@
  * Copyright (C) 2005 XenSource Ltd.
  */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <stdbool.h>
@@ -141,7 +142,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
     char *thstr;
     char *path;
     char *data;
-    int data_n;
+    Py_ssize_t data_n;
     bool result;
 
     if (!xh)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:11:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513637.794925 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCIh-0007Uh-OW; Thu, 23 Mar 2023 04:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513637.794925; Thu, 23 Mar 2023 04: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 1pfCIh-0007UZ-Lk; Thu, 23 Mar 2023 04:11:43 +0000
Received: by outflank-mailman (input) for mailman id 513637;
 Thu, 23 Mar 2023 04: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 1pfCIg-0007UO-PJ
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCIg-0002tw-OO
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCIg-00018X-NX
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=AR6AO8oNUNyvCv0Sp0IFs3f3U0h6qjDe/hauY49emnc=; b=JXCp1Pn+H0efZA5PP0/ZzRwUSA
	TlOFK1uPoIV7olLdao7NksTVFv82V811ErZmDX7/kRjqM//2S9EkjQCaNGoTuJPrxaOtmnQGsWncS
	hWS5b5EoHMX+ZtLvxl7GuZlmC9AeC5+RNy+EsgdSg3/oAQdvqpnAbkO0Cp7lyaK9HhqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/xenmon: Fix xenmon.py for with python3.x
Message-Id: <E1pfCIg-00018X-NX@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:11:42 +0000

commit 244d39fb13abae6c2da341b76363f169d8bbc93b
Author:     Bernhard Kaindl <bernhard.kaindl@citrix.com>
AuthorDate: Tue Mar 21 13:44:04 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:44:04 2023 +0100

    tools/xenmon: Fix xenmon.py for with python3.x
    
    Fixes for Py3:
    * class Delayed(): file not defined; also an error for pylint -E.  Inherit
      object instead for Py2 compatibility.  Fix DomainInfo() too.
    * Inconsistent use of tabs and spaces for indentation (in one block)
    
    Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3a59443c1d5ae0677a792c660ccd3796ce036732
    master date: 2023-02-06 10:22:12 +0000
---
 tools/xenmon/xenmon.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/xenmon/xenmon.py b/tools/xenmon/xenmon.py
index 175eacd2cb..977ada6887 100644
--- a/tools/xenmon/xenmon.py
+++ b/tools/xenmon/xenmon.py
@@ -117,7 +117,7 @@ def setup_cmdline_parser():
     return parser
 
 # encapsulate information about a domain
-class DomainInfo:
+class DomainInfo(object):
     def __init__(self):
         self.allocated_sum = 0
         self.gotten_sum = 0
@@ -533,7 +533,7 @@ def show_livestats(cpu):
 # simple functions to allow initialization of log files without actually
 # physically creating files that are never used; only on the first real
 # write does the file get created
-class Delayed(file):
+class Delayed(object):
     def __init__(self, filename, mode):
         self.filename = filename
         self.saved_mode = mode
@@ -677,8 +677,8 @@ def main():
 
     if os.uname()[0] == "SunOS":
         xenbaked_cmd = "/usr/lib/xenbaked"
-	stop_cmd = "/usr/bin/pkill -INT -z global xenbaked"
-	kill_cmd = "/usr/bin/pkill -KILL -z global xenbaked"
+        stop_cmd = "/usr/bin/pkill -INT -z global xenbaked"
+        kill_cmd = "/usr/bin/pkill -KILL -z global xenbaked"
     else:
         # assumes that xenbaked is in your path
         xenbaked_cmd = "xenbaked"
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:11:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513638.794928 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCIs-0007Wr-QJ; Thu, 23 Mar 2023 04:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513638.794928; Thu, 23 Mar 2023 04: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 1pfCIs-0007Wj-NF; Thu, 23 Mar 2023 04:11:54 +0000
Received: by outflank-mailman (input) for mailman id 513638;
 Thu, 23 Mar 2023 04: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 1pfCIq-0007WZ-Sq
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCIq-0002u9-Rz
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCIq-00018z-Qv
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=9gbbItl9mrnIrd/qk1mxUPaTqTPC5u04xfKnqsceN+g=; b=OVcf8e5AWS2M9mkzEYqpTeCGcm
	29p5RQnVkLcGczCfG7ruFN0t8+o4pf/kqyytU3TMZuoFY5YE7QWIpTRpdxPu4EQzxuT3CqadlPR7Y
	bZKBlAO3opRukoYy1oTbhpXfbRC8ocUwA0QnGjZTtBaqWqVJR/2QZp0yjoxlkvpbSu5Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/spec-ctrl: Add BHI controls to userspace components
Message-Id: <E1pfCIq-00018z-Qv@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:11:52 +0000

commit b4dad09bb23c439f2e67ed2eb6d7bdd640b8bbae
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 21 13:44:27 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:44:27 2023 +0100

    x86/spec-ctrl: Add BHI controls to userspace components
    
    This was an oversight when adding the Xen parts.
    
    Fixes: cea9ae062295 ("x86/spec-ctrl: Enumeration for new Intel BHI controls")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 9276e832aef60437da13d91e66fc259fd94d6f91
    master date: 2023-03-13 11:26:26 +0000
---
 tools/libs/light/libxl_cpuid.c | 3 +++
 tools/misc/xen-cpuid.c         | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index d97a2f3338..55cfbc8f23 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -238,6 +238,9 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"cet-sss",      0x00000007,  1, CPUID_REG_EDX, 18,  1},
 
         {"intel-psfd",   0x00000007,  2, CPUID_REG_EDX,  0,  1},
+        {"ipred-ctrl",   0x00000007,  2, CPUID_REG_EDX,  1,  1},
+        {"rrsba-ctrl",   0x00000007,  2, CPUID_REG_EDX,  2,  1},
+        {"bhi-ctrl",     0x00000007,  2, CPUID_REG_EDX,  4,  1},
         {"mcdt-no",      0x00000007,  2, CPUID_REG_EDX,  5,  1},
 
         {"lahfsahf",     0x80000001, NA, CPUID_REG_ECX,  0,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 0248eaef44..45e443f5d9 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -213,9 +213,9 @@ static const char *const str_7d1[32] =
 
 static const char *const str_7d2[32] =
 {
-    [ 0] = "intel-psfd",
-
-    /* 4 */                 [ 5] = "mcdt-no",
+    [ 0] = "intel-psfd",    [ 1] = "ipred-ctrl",
+    [ 2] = "rrsba-ctrl",
+    [ 4] = "bhi-ctrl",      [ 5] = "mcdt-no",
 };
 
 static const struct {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:12:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513639.794933 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCJ2-0007aA-UR; Thu, 23 Mar 2023 04:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513639.794933; Thu, 23 Mar 2023 04: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 1pfCJ2-0007a2-RN; Thu, 23 Mar 2023 04:12:04 +0000
Received: by outflank-mailman (input) for mailman id 513639;
 Thu, 23 Mar 2023 04: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 1pfCJ1-0007Zs-0Z
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCJ0-0002uY-Vp
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCJ0-0001B8-UY
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=Aa28EcRXyLPMSnlZBjLJj5tk7ZqpW48zHQj+MfdTZvU=; b=c0xz9x5u0UskMKMA6RqwgiBzBs
	mBPmlVIB0FsGeruING7CjXmPg6XoldUqiand3FJQ1E4CbySQt1o+yZCH+K+xBo7NXuN3tvm30UpWL
	rvzFF7T5zINBF15YuTjaRLZcVoLYOskVnV1iR4m1OkTWnNIECJF5JdISUiAk008RHarA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] core-parking: fix build with gcc12 and NR_CPUS=1
Message-Id: <E1pfCJ0-0001B8-UY@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:12:02 +0000

commit b5409f4e4d0722e8669123d59f15f784903d153f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 13:44:53 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:44:53 2023 +0100

    core-parking: fix build with gcc12 and NR_CPUS=1
    
    Gcc12 takes issue with core_parking_remove()'s
    
        for ( ; i < cur_idle_nums; ++i )
            core_parking_cpunum[i] = core_parking_cpunum[i + 1];
    
    complaining that the right hand side array access is past the bounds of
    1. Clearly the compiler can't know that cur_idle_nums can only ever be
    zero in this case (as the sole CPU cannot be parked).
    
    Arrange for core_parking.c's contents to not be needed altogether, and
    then disable its building when NR_CPUS == 1.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 4b0422f70feb4b1cd04598ffde805fc224f3812e
    master date: 2023-03-13 15:15:42 +0100
---
 xen/arch/x86/Kconfig              |  2 +-
 xen/arch/x86/platform_hypercall.c | 11 ++++++++---
 xen/arch/x86/sysctl.c             |  3 +++
 xen/common/Kconfig                |  1 +
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 6a7825f4ba..2a5c3304e2 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -10,7 +10,7 @@ config X86
 	select ALTERNATIVE_CALL
 	select ARCH_MAP_DOMAIN_PAGE
 	select ARCH_SUPPORTS_INT128
-	select CORE_PARKING
+	imply CORE_PARKING
 	select HAS_ALTERNATIVE
 	select HAS_COMPAT
 	select HAS_CPUFREQ
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index a7341dc3d7..e7deee2268 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -727,12 +727,17 @@ ret_t do_platform_op(
         case XEN_CORE_PARKING_SET:
             idle_nums = min_t(uint32_t,
                     op->u.core_parking.idle_nums, num_present_cpus() - 1);
-            ret = continue_hypercall_on_cpu(
-                    0, core_parking_helper, (void *)(unsigned long)idle_nums);
+            if ( CONFIG_NR_CPUS > 1 )
+                ret = continue_hypercall_on_cpu(
+                        0, core_parking_helper,
+                        (void *)(unsigned long)idle_nums);
+            else if ( idle_nums )
+                ret = -EINVAL;
             break;
 
         case XEN_CORE_PARKING_GET:
-            op->u.core_parking.idle_nums = get_cur_idle_nums();
+            op->u.core_parking.idle_nums = CONFIG_NR_CPUS > 1
+                                           ? get_cur_idle_nums() : 0;
             ret = __copy_field_to_guest(u_xenpf_op, op, u.core_parking) ?
                   -EFAULT : 0;
             break;
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index f82abc2488..f8f8d79755 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -179,6 +179,9 @@ long arch_do_sysctl(
                 ret = -EBUSY;
                 break;
             }
+            if ( CONFIG_NR_CPUS <= 1 )
+                /* Mimic behavior of smt_up_down_helper(). */
+                return 0;
             plug = op == XEN_SYSCTL_CPU_HOTPLUG_SMT_ENABLE;
             fn = smt_up_down_helper;
             hcpu = _p(plug);
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index f1ea3199c8..855c843113 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -10,6 +10,7 @@ config COMPAT
 
 config CORE_PARKING
 	bool
+	depends on NR_CPUS > 1
 
 config GRANT_TABLE
 	bool "Grant table support" if EXPERT
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:12:15 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:12:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513640.794936 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCJC-0007cZ-Vc; Thu, 23 Mar 2023 04:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513640.794936; Thu, 23 Mar 2023 04: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 1pfCJC-0007cR-T5; Thu, 23 Mar 2023 04:12:14 +0000
Received: by outflank-mailman (input) for mailman id 513640;
 Thu, 23 Mar 2023 04: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 1pfCJB-0007cG-54
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCJB-0002uf-44
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCJB-0001Bn-2L
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=a76LtkYucXX7QLwJrRL8FxIezbuVVKRNzQt08p5hmOM=; b=7F7mCqw0hYomdDZK1Y7A8ZCbA2
	oBKt4BUCnZgQwK/MEZHpab1LuHex3plBHB6MAXmuXjaoDoUQHh3d/+oDJCL/dPFyyPvO8uS2t1MIf
	atYzLneev1m+PxxQ4H+tnUjJY4g5KLqWKm+sVVo3gEj2N69HSNGK8TK5XHVtfGDu6+YM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/altp2m: help gcc13 to avoid it emitting a warning
Message-Id: <E1pfCJB-0001Bn-2L@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:12:13 +0000

commit d84612ecab00ab31c09a7c5a5892906edbacaf5b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 13:45:47 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:45:47 2023 +0100

    x86/altp2m: help gcc13 to avoid it emitting a warning
    
    Switches of altp2m-s always expect a valid altp2m to be in place (and
    indeed altp2m_vcpu_initialise() sets the active one to be at index 0).
    The compiler, however, cannot know that, and hence it cannot eliminate
    p2m_get_altp2m()'s case of returnin (literal) NULL. If then the compiler
    decides to special case that code path in the caller, the dereference in
    instances of
    
        atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
    
    can, to the code generator, appear to be NULL dereferences, leading to
    
    In function 'atomic_dec',
        inlined from '...' at ...:
    ./arch/x86/include/asm/atomic.h:182:5: error: array subscript 0 is outside array bounds of 'int[0]' [-Werror=array-bounds=]
    
    Aid the compiler by adding a BUG_ON() checking the return value of the
    problematic p2m_get_altp2m(). Since with the use of the local variable
    the 2nd p2m_get_altp2m() each will look questionable at the first glance
    (Why is the local variable not used here?), open-code the only relevant
    piece of p2m_get_altp2m() there.
    
    To avoid repeatedly doing these transformations, and also to limit how
    "bad" the open-coding really is, convert the entire operation to an
    inline helper, used by all three instances (and accepting the redundant
    BUG_ON(idx >= MAX_ALTP2M) in two of the three cases).
    
    Reported-by: Charles Arnold <carnold@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: be62b1fc2aa7375d553603fca07299da765a89fe
    master date: 2023-03-13 15:16:21 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c     |  8 +-------
 xen/arch/x86/include/asm/p2m.h | 20 ++++++++++++++++++++
 xen/arch/x86/mm/p2m.c          | 14 ++------------
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index f0e759eeaf..a8fb4365ad 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4072,13 +4072,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
             }
         }
 
-        if ( idx != vcpu_altp2m(v).p2midx )
-        {
-            BUG_ON(idx >= MAX_ALTP2M);
-            atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-            vcpu_altp2m(v).p2midx = idx;
-            atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
-        }
+        p2m_set_altp2m(v, idx);
     }
 
     if ( unlikely(currd->arch.monitor.vmexit_enabled) )
diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index bd684d02f3..cd43d8621a 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -879,6 +879,26 @@ static inline struct p2m_domain *p2m_get_altp2m(struct vcpu *v)
     return v->domain->arch.altp2m_p2m[index];
 }
 
+/* set current alternate p2m table */
+static inline bool p2m_set_altp2m(struct vcpu *v, unsigned int idx)
+{
+    struct p2m_domain *orig;
+
+    BUG_ON(idx >= MAX_ALTP2M);
+
+    if ( idx == vcpu_altp2m(v).p2midx )
+        return false;
+
+    orig = p2m_get_altp2m(v);
+    BUG_ON(!orig);
+    atomic_dec(&orig->active_vcpus);
+
+    vcpu_altp2m(v).p2midx = idx;
+    atomic_inc(&v->domain->arch.altp2m_p2m[idx]->active_vcpus);
+
+    return true;
+}
+
 /* Switch alternate p2m for a single vcpu */
 bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx);
 
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index a405ee5fde..b28c899b5e 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1787,13 +1787,8 @@ bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx)
 
     if ( d->arch.altp2m_eptp[idx] != mfn_x(INVALID_MFN) )
     {
-        if ( idx != vcpu_altp2m(v).p2midx )
-        {
-            atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-            vcpu_altp2m(v).p2midx = idx;
-            atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
+        if ( p2m_set_altp2m(v, idx) )
             altp2m_vcpu_update_p2m(v);
-        }
         rc = 1;
     }
 
@@ -2070,13 +2065,8 @@ int p2m_switch_domain_altp2m_by_id(struct domain *d, unsigned int idx)
     if ( d->arch.altp2m_visible_eptp[idx] != mfn_x(INVALID_MFN) )
     {
         for_each_vcpu( d, v )
-            if ( idx != vcpu_altp2m(v).p2midx )
-            {
-                atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-                vcpu_altp2m(v).p2midx = idx;
-                atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
+            if ( p2m_set_altp2m(v, idx) )
                 altp2m_vcpu_update_p2m(v);
-            }
 
         rc = 0;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:12:25 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:12:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513641.794940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCJN-0007fA-0z; Thu, 23 Mar 2023 04:12:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513641.794940; Thu, 23 Mar 2023 04: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 1pfCJM-0007f2-Ua; Thu, 23 Mar 2023 04:12:24 +0000
Received: by outflank-mailman (input) for mailman id 513641;
 Thu, 23 Mar 2023 04: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 1pfCJL-0007en-8T
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCJL-0002um-7Y
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCJL-0001CQ-6b
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=Vm/IS5BPaZrawZKCDbYi8vidke/pUJRM4sTnTnrspjU=; b=S/tUwOqHTjX78TEaa5i7C8BcFp
	jycefkyDNLsssHHCLuD7oLttyZwPG1whYdWejvmkaAqLAWIYtkxN8/pqt+yPIdlH73u69L2AgI+L4
	0RtIrOrdHQp+F0Jqo5N/h0zAaaQvqQIKjNY3ztknTNNUc3AyopFi23WXkA7dt0oqDu7I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] VT-d: constrain IGD check
Message-Id: <E1pfCJL-0001CQ-6b@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:12:23 +0000

commit f971f5c531ce6a5fd6c1ff1f525f2c6837eeb78d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 13:46:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:46:39 2023 +0100

    VT-d: constrain IGD check
    
    Marking a DRHD as controlling an IGD isn't very sensible without
    checking that at the very least it's a graphics device that lives at
    0000:00:02.0. Re-use the reading of the class-code to control both the
    clearing of "gfx_only" and the setting of "igd_drhd_address".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: f8c4317295fa1cde1a81779b7e362651c084efb8
    master date: 2023-03-14 10:44:08 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 78c8bad151..78d4526446 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -391,15 +391,12 @@ static int __init acpi_parse_dev_scope(
 
             if ( drhd )
             {
-                if ( (seg == 0) && (bus == 0) && (path->dev == 2) &&
-                     (path->fn == 0) )
-                    igd_drhd_address = drhd->address;
-
-                if ( gfx_only &&
-                     pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
+                if ( pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
                                     PCI_CLASS_DEVICE + 1) != 0x03
                                     /* PCI_BASE_CLASS_DISPLAY */ )
                     gfx_only = false;
+                else if ( !seg && !bus && path->dev == 2 && !path->fn )
+                    igd_drhd_address = drhd->address;
             }
 
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:12:35 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:12:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513642.794945 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCJX-0007iZ-2W; Thu, 23 Mar 2023 04:12:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513642.794945; Thu, 23 Mar 2023 04: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 1pfCJW-0007iR-W5; Thu, 23 Mar 2023 04:12:34 +0000
Received: by outflank-mailman (input) for mailman id 513642;
 Thu, 23 Mar 2023 04: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 1pfCJV-0007i7-C7
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCJV-0002uz-BC
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCJV-0001Cv-A7
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=Euw3jHoDyrISYHVc9e6cbtwAxPc96xdrp6HWbg4hV24=; b=u276hHyJ+sKMB7OxJa5lXi5TPN
	+ujtyFQwkWC3vb2hfkZeDGreOtlQL9w/qbBgjsoIBwsiH5VmNqot2eW8uoS0y9ZeGswgv9RoGDCzr
	r10GhRSbfpvS5hyywC6hBcGP+ZhUPCA7VJQ1W2tOjqmbfnrzp5gh4/2vdNfpqBVIQw5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] bunzip: work around gcc13 warning
Message-Id: <E1pfCJV-0001Cv-A7@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:12:33 +0000

commit 7082d656ae9bcd26392caf72e50e0f7a61c8f285
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 13:47:11 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:47:11 2023 +0100

    bunzip: work around gcc13 warning
    
    While provable that length[0] is always initialized (because symCount
    cannot be zero), upcoming gcc13 fails to recognize this and warns about
    the unconditional use of the value immediately following the loop.
    
    See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106511.
    
    Reported-by: Martin Liška <martin.liska@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 402195e56de0aacf97e05c80ed367d464ca6938b
    master date: 2023-03-14 10:45:28 +0100
---
 xen/common/bunzip2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 61b80aff1b..4466426941 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -233,6 +233,11 @@ static int __init get_next_block(struct bunzip_data *bd)
 		   becomes negative, so an unsigned inequality catches
 		   it.) */
 		t = get_bits(bd, 5)-1;
+		/* GCC 13 has apparently improved use-before-set detection, but
+		   it can't figure out that length[0] is always intialized by
+		   virtue of symCount always being positive when making it here.
+		   See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106511. */
+		length[0] = 0;
 		for (i = 0; i < symCount; i++) {
 			for (;;) {
 				if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 04:12:45 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 04:12:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513644.794949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfCJh-0007lV-3x; Thu, 23 Mar 2023 04:12:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513644.794949; Thu, 23 Mar 2023 04: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 1pfCJh-0007lN-1K; Thu, 23 Mar 2023 04:12:45 +0000
Received: by outflank-mailman (input) for mailman id 513644;
 Thu, 23 Mar 2023 04: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 1pfCJf-0007lG-FM
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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 1pfCJf-0002vS-EQ
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfCJf-0001DM-Df
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 04: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=+I6g2nLyxdqFJogxXnX/bu0anIiNsiWDblTvt6jTFAo=; b=M3oVx+Qh74l0rurFQMILFQPsQ6
	34dAZIE8G3o/AVSnSZF6Vj6hxLxDpGXgA0wQ9/gKOCsn4V8os93zFDktwm8a6ckOH3kBwscuTZsv2
	cVf4w1vPJhoiA3rdrBfdTAe2ZxgZTlOl9WOm6VcIhNIfqmc8I27IpEMe29q90sNKTk/Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] libacpi: fix PCI hotplug AML
Message-Id: <E1pfCJf-0001DM-Df@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 04:12:43 +0000

commit 3eac216e6e60860bbc030602c401d3ef8efce8d9
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Tue Mar 21 13:47:52 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:47:52 2023 +0100

    libacpi: fix PCI hotplug AML
    
    The emulated PIIX3 uses a nybble for the status of each PCI function,
    so the status for e.g. slot 0 functions 0 and 1 respectively can be
    read as (\_GPE.PH00 & 0x0F), and (\_GPE.PH00 >> 0x04).
    
    The AML that Xen gives to a guest gets the operand order for the odd-
    numbered functions the wrong way round, returning (0x04 >> \_GPE.PH00)
    instead.
    
    As far as I can tell, this was the wrong way round in Xen from the
    moment that PCI hotplug was first introduced in commit 83d82e6f35a8:
    
    +                    ShiftRight (0x4, \_GPE.PH00, Local1)
    +                    Return (Local1) /* IN status as the _STA */
    
    Or maybe there's bizarre AML operand ordering going on there, like
    Intel's wrong-way-round assembler, and it only broke later when it was
    changed to being generated?
    
    Either way, it's definitely wrong now, and instrumenting a Linux guest
    shows that it correctly sees _STA being 0x00 in function 0 of an empty
    slot, but then the loop in acpiphp_glue.c::get_slot_status() goes on to
    look at function 1 and sees that _STA evaluates to 0x04. Thus reporting
    an adapter is present in every slot in /sys/bus/pci/slots/*
    
    Quite why Linux wants to look for function 1 being physically present
    when function 0 isn't... I don't want to think about right now.
    
    Fixes: 83d82e6f35a8 ("hvmloader: pass-through: multi-function PCI hot-plug")
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b190af7d3e90f58da5f58044b8dea7261b8b483d
    master date: 2023-03-20 17:12:34 +0100
---
 tools/libacpi/mk_dsdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 1176da80ef..1d27809116 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -431,7 +431,7 @@ int main(int argc, char **argv)
                 stmt("Store", "0x89, \\_GPE.DPT2");
             }
             if ( slot & 1 )
-                stmt("ShiftRight", "0x4, \\_GPE.PH%02X, Local1", slot & ~1);
+                stmt("ShiftRight", "\\_GPE.PH%02X, 0x04, Local1", slot & ~1);
             else
                 stmt("And", "\\_GPE.PH%02X, 0x0f, Local1", slot & ~1);
             stmt("Return", "Local1"); /* IN status as the _STA */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:44:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513663.794991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFcB-00011P-CA; Thu, 23 Mar 2023 07:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513663.794991; Thu, 23 Mar 2023 07: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 1pfFcB-00011H-9J; Thu, 23 Mar 2023 07:44:03 +0000
Received: by outflank-mailman (input) for mailman id 513663;
 Thu, 23 Mar 2023 07: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 1pfFc9-00011B-VQ
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFc9-00086D-UM
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFc9-0003lR-TO
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=nk9nfRr8K8HqLJI+8gRqVrsG5HSmjIXKmBbAHARudnw=; b=qeceb0vw29KgOhDBLlHjxlzImo
	hM3A6ocY498K/DpUbCFW/3lj+Zz7kEqEmbUYzNaC2YEM+cijFJkIBBhV5vODjGeE9QpOhulxOjXd2
	znq37P4d+Ugxx3IO+yVdHyAoLXCa0w8HloWskmPq8v4hT0Uh53SAwAIyEEN+L5O3MXsI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/shadow: account for log-dirty mode when pre-allocating
Message-Id: <E1pfFc9-0003lR-TO@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:44:01 +0000

commit b0d6684ee58f7252940f5a62e4b85bdc56307eef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 11:59:44 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:43 2023 +0000

    x86/shadow: account for log-dirty mode when pre-allocating
    
    Pre-allocation is intended to ensure that in the course of constructing
    or updating shadows there won't be any risk of just made shadows or
    shadows being acted upon can disappear under our feet. The amount of
    pages pre-allocated then, however, needs to account for all possible
    subsequent allocations. While the use in sh_page_fault() accounts for
    all shadows which may need making, so far it didn't account for
    allocations coming from log-dirty tracking (which piggybacks onto the
    P2M allocation functions).
    
    Since shadow_prealloc() takes a count of shadows (or other data
    structures) rather than a count of pages, putting the adjustment at the
    call site of this function won't work very well: We simply can't express
    the correct count that way in all cases. Instead take care of this in
    the function itself, by "snooping" for L1 type requests. (While not
    applicable right now, future new request sites of L1 tables would then
    also be covered right away.)
    
    It is relevant to note here that pre-allocations like the one done from
    shadow_alloc_p2m_page() are benign when they fall in the "scope" of an
    earlier pre-alloc which already included that count: The inner call will
    simply find enough pages available then; it'll bail right away.
    
    This is CVE-2022-42332 / XSA-427.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
    (cherry picked from commit 91767a71061035ae42be93de495cd976f863a41a)
---
 xen/arch/x86/mm/paging.c        |  1 +
 xen/arch/x86/mm/shadow/common.c | 12 +++++++++++-
 xen/include/asm-x86/paging.h    |  4 ++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 97ac9ccf59..9fb66e65cd 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -280,6 +280,7 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn)
     if ( unlikely(!VALID_M2P(pfn_x(pfn))) )
         return;
 
+    BUILD_BUG_ON(paging_logdirty_levels() != 4);
     i1 = L1_LOGDIRTY_IDX(pfn);
     i2 = L2_LOGDIRTY_IDX(pfn);
     i3 = L3_LOGDIRTY_IDX(pfn);
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 1de0139742..c14a269935 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1015,7 +1015,17 @@ bool shadow_prealloc(struct domain *d, unsigned int type, unsigned int count)
     if ( unlikely(d->is_dying) )
        return false;
 
-    ret = _shadow_prealloc(d, shadow_size(type) * count);
+    count *= shadow_size(type);
+    /*
+     * Log-dirty handling may result in allocations when populating its
+     * tracking structures.  Tie this to the caller requesting space for L1
+     * shadows.
+     */
+    if ( paging_mode_log_dirty(d) &&
+         ((SHF_L1_ANY | SHF_FL1_ANY) & (1u << type)) )
+        count += paging_logdirty_levels();
+
+    ret = _shadow_prealloc(d, count);
     if ( !ret && (!d->is_shutting_down || d->shutdown_code != SHUTDOWN_crash) )
         /*
          * Failing to allocate memory required for shadow usage can only result in
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 27890791d8..c6b429c691 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -192,6 +192,10 @@ int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
+#define paging_logdirty_levels() \
+    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
+                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
+
 #ifdef CONFIG_HVM
 /* VRAM dirty tracking support */
 struct sh_dirty_vram {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:44:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513664.794995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFcL-00013k-Fh; Thu, 23 Mar 2023 07:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513664.794995; Thu, 23 Mar 2023 07: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 1pfFcL-00013c-D2; Thu, 23 Mar 2023 07:44:13 +0000
Received: by outflank-mailman (input) for mailman id 513664;
 Thu, 23 Mar 2023 07: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 1pfFcK-00013O-2Z
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFcK-00086R-1a
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFcK-0003mB-0V
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=qN6g0pHmERfiwlp7isfkXlS/24Eq1CA6Z/j4T24WWGs=; b=Ir5eUbbZahgVp6azAseWrVHdFO
	EcXPhMOmK+MkoTKUjg8mRhnkDv2H+4klI8gcjh9j8OkPUWNyaAxIBNX7X3Fwdini6xCggmqeFyBQm
	7sDWx0W1CQnTU/bTqV+vH88wMOqj3IyLzUFeC4gTlnHrZC8arX95cD6Qcayjn1ilrMOU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/HVM: bound number of pinned cache attribute regions
Message-Id: <E1pfFcK-0003mB-0V@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:44:12 +0000

commit 2fe1517a00e088f6b1f1aff7d4ea1b477b288987
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:43 2023 +0000

    x86/HVM: bound number of pinned cache attribute regions
    
    This is exposed via DMOP, i.e. to potentially not fully privileged
    device models. With that we may not permit registration of an (almost)
    unbounded amount of such regions.
    
    This is CVE-2022-42333 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit a5e768640f786b681063f4e08af45d0c4e91debf)
---
 xen/arch/x86/hvm/mtrr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 4a9f3177ed..98e55bbdbd 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -595,6 +595,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
     struct hvm_mem_pinned_cacheattr_range *range;
+    unsigned int nr = 0;
     int rc = 1;
 
     if ( !is_hvm_domain(d) )
@@ -666,11 +667,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
             rc = -EBUSY;
             break;
         }
+        ++nr;
     }
     rcu_read_unlock(&pinned_cacheattr_rcu_lock);
     if ( rc <= 0 )
         return rc;
 
+    if ( nr >= 64 /* The limit is arbitrary. */ )
+        return -ENOSPC;
+
     range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
     if ( range == NULL )
         return -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:44:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513665.794998 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFcV-000165-HB; Thu, 23 Mar 2023 07:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513665.794998; Thu, 23 Mar 2023 07: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 1pfFcV-00015x-EX; Thu, 23 Mar 2023 07:44:23 +0000
Received: by outflank-mailman (input) for mailman id 513665;
 Thu, 23 Mar 2023 07: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 1pfFcU-00015r-6A
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFcU-00086Z-58
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFcU-0003mi-47
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=Dz4RTqsry43t+u669hfKrDuFUl56n4HIUVBwTGnlJps=; b=j78C8+DvGS83L8PUjEOkdABNxs
	by+ceOJbyNGGZ8MyddV0wADtgAZdfIUyFaMnhMtfqU9BN9FtjyEyUUzWHLaaZ6I2ZTqIXCogium57
	jZjPewJaPS7LUlfc+wwhq49JbmGQW063eshMQqpSN1zzJQnXQJffDFmEd0fB0zoofLiE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/HVM: serialize pinned cache attribute list manipulation
Message-Id: <E1pfFcU-0003mi-47@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:44:22 +0000

commit 564de020d29fbc4efd20ef8052051e86b2465a1a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 12:01:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:43 2023 +0000

    x86/HVM: serialize pinned cache attribute list manipulation
    
    While the RCU variants of list insertion and removal allow lockless list
    traversal (with RCU just read-locked), insertions and removals still
    need serializing amongst themselves. To keep things simple, use the
    domain lock for this purpose.
    
    This is CVE-2022-42334 / part of XSA-428.
    
    Fixes: 642123c5123f ("x86/hvm: provide XEN_DMOP_pin_memory_cacheattr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 829ec245cf66560e3b50d140ccb3168e7fb7c945)
---
 xen/arch/x86/hvm/mtrr.c | 51 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 98e55bbdbd..9b3b33012b 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -594,7 +594,7 @@ static void free_pinned_cacheattr_entry(struct rcu_head *rcu)
 int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                                  uint64_t gfn_end, uint32_t type)
 {
-    struct hvm_mem_pinned_cacheattr_range *range;
+    struct hvm_mem_pinned_cacheattr_range *range, *newr;
     unsigned int nr = 0;
     int rc = 1;
 
@@ -608,14 +608,15 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
     {
     case XEN_DOMCTL_DELETE_MEM_CACHEATTR:
         /* Remove the requested range. */
-        rcu_read_lock(&pinned_cacheattr_rcu_lock);
-        list_for_each_entry_rcu ( range,
-                                  &d->arch.hvm.pinned_cacheattr_ranges,
-                                  list )
+        domain_lock(d);
+        list_for_each_entry ( range,
+                              &d->arch.hvm.pinned_cacheattr_ranges,
+                              list )
             if ( range->start == gfn_start && range->end == gfn_end )
             {
-                rcu_read_unlock(&pinned_cacheattr_rcu_lock);
                 list_del_rcu(&range->list);
+                domain_unlock(d);
+
                 type = range->type;
                 call_rcu(&range->rcu, free_pinned_cacheattr_entry);
                 p2m_memory_type_changed(d);
@@ -636,7 +637,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                 }
                 return 0;
             }
-        rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+        domain_unlock(d);
         return -ENOENT;
 
     case PAT_TYPE_UC_MINUS:
@@ -651,7 +652,10 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         return -EINVAL;
     }
 
-    rcu_read_lock(&pinned_cacheattr_rcu_lock);
+    newr = xzalloc(struct hvm_mem_pinned_cacheattr_range);
+
+    domain_lock(d);
+
     list_for_each_entry_rcu ( range,
                               &d->arch.hvm.pinned_cacheattr_ranges,
                               list )
@@ -669,27 +673,34 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         }
         ++nr;
     }
-    rcu_read_unlock(&pinned_cacheattr_rcu_lock);
+
     if ( rc <= 0 )
-        return rc;
+        /* nothing */;
+    else if ( nr >= 64 /* The limit is arbitrary. */ )
+        rc = -ENOSPC;
+    else if ( !newr )
+        rc = -ENOMEM;
+    else
+    {
+        newr->start = gfn_start;
+        newr->end = gfn_end;
+        newr->type = type;
 
-    if ( nr >= 64 /* The limit is arbitrary. */ )
-        return -ENOSPC;
+        list_add_rcu(&newr->list, &d->arch.hvm.pinned_cacheattr_ranges);
 
-    range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
-    if ( range == NULL )
-        return -ENOMEM;
+        newr = NULL;
+        rc = 0;
+    }
+
+    domain_unlock(d);
 
-    range->start = gfn_start;
-    range->end = gfn_end;
-    range->type = type;
+    xfree(newr);
 
-    list_add_rcu(&range->list, &d->arch.hvm.pinned_cacheattr_ranges);
     p2m_memory_type_changed(d);
     if ( type != PAT_TYPE_WRBACK )
         flush_all(FLUSH_CACHE);
 
-    return 0;
+    return rc;
 }
 
 static int hvm_save_mtrr_msr(struct vcpu *v, hvm_domain_context_t *h)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:44:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513666.795003 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFcf-000194-Ik; Thu, 23 Mar 2023 07:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513666.795003; Thu, 23 Mar 2023 07: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 1pfFcf-00018w-G1; Thu, 23 Mar 2023 07:44:33 +0000
Received: by outflank-mailman (input) for mailman id 513666;
 Thu, 23 Mar 2023 07: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 1pfFce-00018i-9p
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFce-00086l-8o
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFce-0003nF-7f
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=hhR0/4qCzUKvwEOZTto+ATCuw/JyEveAK8VXEbS0PFo=; b=FbkA9OtwFDaM2+Sb1jF71WTWeZ
	IcX1Kv+Z6O7peGCHJ+r5/SOy7k4mmLsE+btFJHDtfJM+e9fYGmhSH+0Jm/8hU16MHuW2JIK1Ns9gF
	BQTE0ctMa1JbcYx4NzS9923rGJIhAjwQWIWfXAg3/Pa1peVi1//M4Y13TuMrvtFYTdyY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
Message-Id: <E1pfFce-0003nF-7f@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:44:32 +0000

commit 3c924fe46b455834b5c04268db6b528b549668d1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 10 21:11:14 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 21 12:07:43 2023 +0000

    x86/spec-ctrl: Defer CR4_PV32_RESTORE on the cstar_enter path
    
    As stated (correctly) by the comment next to SPEC_CTRL_ENTRY_FROM_PV, between
    the two hunks visible in the patch, RET's are not safe prior to this point.
    
    CR4_PV32_RESTORE hides a CALL/RET pair in certain configurations (PV32
    compiled in, SMEP or SMAP active), and the RET can be attacked with one of
    several known speculative issues.
    
    Furthermore, CR4_PV32_RESTORE also hides a reference to the cr4_pv32_mask
    global variable, which is not safe when XPTI is active before restoring Xen's
    full pagetables.
    
    This crash has gone unnoticed because it is only AMD CPUs which permit the
    SYSCALL instruction in compatibility mode, and these are not vulnerable to
    Meltdown so don't activate XPTI by default.
    
    This is XSA-429 / CVE-2022-42331
    
    Fixes: 5e7962901131 ("x86/entry: Organise the use of MSR_SPEC_CTRL at each entry/exit point")
    Fixes: 5784de3e2067 ("x86: Meltdown band-aid against malicious 64-bit PV guests")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit df5b055b12116d9e63ced59ae5389e69a2a3de48)
---
 xen/arch/x86/x86_64/entry.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index fba8ae498f..db2ea7871e 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -288,7 +288,6 @@ ENTRY(cstar_enter)
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
 #endif
         push  %rax          /* Guest %rsp */
-        CR4_PV32_RESTORE
         movq  8(%rsp), %rax /* Restore guest %rax. */
         movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
         pushq %r11
@@ -312,6 +311,8 @@ ENTRY(cstar_enter)
 .Lcstar_cr3_okay:
         sti
 
+        CR4_PV32_RESTORE
+
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
 
 #ifdef CONFIG_PV32
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:44:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513667.795007 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFcp-0001CM-K8; Thu, 23 Mar 2023 07:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513667.795007; Thu, 23 Mar 2023 07: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 1pfFcp-0001CF-HZ; Thu, 23 Mar 2023 07:44:43 +0000
Received: by outflank-mailman (input) for mailman id 513667;
 Thu, 23 Mar 2023 07: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 1pfFco-0001BK-DV
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFco-00087B-CZ
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFco-0003np-Bb
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=gqvchoSm/QkcOEUWrDn/CDaxcNwUhLe58up47MvVOVM=; b=MAlz3TgTNyeEv9tUwr9xbg9xJM
	5fVUY6moq2DQS63eN3wR8iGsiVGcPlIGf3CqD1X73541hamncF0umZ23YqF9ypvc2GzghISkM7JCp
	K7XQcMhTclIPEEYHE1ctjnK7YEBb/FJUx9TjW8ImUYKkwWZVxxlxbJqbAUo+kKLVVl7Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/python: change 's#' size type for Python >= 3.10
Message-Id: <E1pfFco-0003np-Bb@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:44:42 +0000

commit 0cbffc6099db7fd01041910a98b99ccad50af11b
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Mar 21 13:49:28 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:49:28 2023 +0100

    tools/python: change 's#' size type for Python >= 3.10
    
    Python < 3.10 by default uses 'int' type for data+size string types
    (s#), unless PY_SSIZE_T_CLEAN is defined - in which case it uses
    Py_ssize_t. The former behavior was removed in Python 3.10 and now it's
    required to define PY_SSIZE_T_CLEAN before including Python.h, and using
    Py_ssize_t for the length argument. The PY_SSIZE_T_CLEAN behavior is
    supported since Python 2.5.
    
    Adjust bindings accordingly.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 897257ba49d0a6ddcf084960fd792ccce9c40f94
    master date: 2023-02-06 08:50:13 +0100
---
 tools/python/xen/lowlevel/xc/xc.c | 3 ++-
 tools/python/xen/lowlevel/xs/xs.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index fd00861032..cfb2734a99 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -4,6 +4,7 @@
  * Copyright (c) 2003-2004, K A Fraser (University of Cambridge)
  */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #define XC_WANT_COMPAT_MAP_FOREIGN_API
 #include <xenctrl.h>
@@ -1774,7 +1775,7 @@ static PyObject *pyflask_load(PyObject *self, PyObject *args, PyObject *kwds)
 {
     xc_interface *xc_handle;
     char *policy;
-    uint32_t len;
+    Py_ssize_t len;
     int ret;
 
     static char *kwd_list[] = { "policy", NULL };
diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
index 0dad7fa5f2..3ba5a8b893 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -18,6 +18,7 @@
  * Copyright (C) 2005 XenSource Ltd.
  */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <stdbool.h>
@@ -141,7 +142,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
     char *thstr;
     char *path;
     char *data;
-    int data_n;
+    Py_ssize_t data_n;
     bool result;
 
     if (!xh)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:44:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513668.795010 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFcz-0001Eb-Lo; Thu, 23 Mar 2023 07:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513668.795010; Thu, 23 Mar 2023 07: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 1pfFcz-0001ES-JB; Thu, 23 Mar 2023 07:44:53 +0000
Received: by outflank-mailman (input) for mailman id 513668;
 Thu, 23 Mar 2023 07: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 1pfFcy-0001EF-Gx
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFcy-00088c-Fx
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFcy-0003oI-F4
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=G0AWjL0lX9fAav92cBC9URExjGeLMGMd8OjAqoYPP7k=; b=3ImIoZN0OTqVh9joYCJKYNuwUC
	6hKjq/8A2fhlun4M6NYXXKvZs69NA3GuRLJBUurGmC2XYq+LNUttGDDnVz6YvSM8Rssk0r4jUR06W
	vxm73zBK7kT0FQVqeskYWhnBysBsEX5Uq7tpgQlxSaKNs56ExwfBaDO2zlzUWc9GH224=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/xenmon: Fix xenmon.py for with python3.x
Message-Id: <E1pfFcy-0003oI-F4@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:44:52 +0000

commit 5ce8d2aef85f590e4fb42d18784512203069d0c0
Author:     Bernhard Kaindl <bernhard.kaindl@citrix.com>
AuthorDate: Tue Mar 21 13:49:47 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:49:47 2023 +0100

    tools/xenmon: Fix xenmon.py for with python3.x
    
    Fixes for Py3:
    * class Delayed(): file not defined; also an error for pylint -E.  Inherit
      object instead for Py2 compatibility.  Fix DomainInfo() too.
    * Inconsistent use of tabs and spaces for indentation (in one block)
    
    Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3a59443c1d5ae0677a792c660ccd3796ce036732
    master date: 2023-02-06 10:22:12 +0000
---
 tools/xenmon/xenmon.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/xenmon/xenmon.py b/tools/xenmon/xenmon.py
index 175eacd2cb..977ada6887 100644
--- a/tools/xenmon/xenmon.py
+++ b/tools/xenmon/xenmon.py
@@ -117,7 +117,7 @@ def setup_cmdline_parser():
     return parser
 
 # encapsulate information about a domain
-class DomainInfo:
+class DomainInfo(object):
     def __init__(self):
         self.allocated_sum = 0
         self.gotten_sum = 0
@@ -533,7 +533,7 @@ def show_livestats(cpu):
 # simple functions to allow initialization of log files without actually
 # physically creating files that are never used; only on the first real
 # write does the file get created
-class Delayed(file):
+class Delayed(object):
     def __init__(self, filename, mode):
         self.filename = filename
         self.saved_mode = mode
@@ -677,8 +677,8 @@ def main():
 
     if os.uname()[0] == "SunOS":
         xenbaked_cmd = "/usr/lib/xenbaked"
-	stop_cmd = "/usr/bin/pkill -INT -z global xenbaked"
-	kill_cmd = "/usr/bin/pkill -KILL -z global xenbaked"
+        stop_cmd = "/usr/bin/pkill -INT -z global xenbaked"
+        kill_cmd = "/usr/bin/pkill -KILL -z global xenbaked"
     else:
         # assumes that xenbaked is in your path
         xenbaked_cmd = "xenbaked"
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:45:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513669.795015 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFd9-0001HP-Ni; Thu, 23 Mar 2023 07:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513669.795015; Thu, 23 Mar 2023 07: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 1pfFd9-0001HH-Kq; Thu, 23 Mar 2023 07:45:03 +0000
Received: by outflank-mailman (input) for mailman id 513669;
 Thu, 23 Mar 2023 07: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 1pfFd8-0001H4-KQ
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFd8-00089R-JU
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFd8-0003p8-IU
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=3ICkM43d57NY8iBTU+2Sp/jIRFpg0DPEB4cu4SqMK1s=; b=PRpTsyyQ9eIIxbqnD8iXI0oPMZ
	tVXFcKmcWGivjwQ8zvxxqf3/fK0E/ByRgiNeZqSS6VVr3D9PxmFYFZqrYKL8PsnzC+Ts4+uxy4K6h
	VOl/wnZdHbzMJnQ0cRtSahFmFD86j5kLcDH30v8ZF5ovAtHSor6M8TQIEwwOcFoP0ZxA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] core-parking: fix build with gcc12 and NR_CPUS=1
Message-Id: <E1pfFd8-0003p8-IU@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:45:02 +0000

commit 4a6bedefe589dab12182d6b974de8ea3b2fcc681
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 13:50:18 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:50:18 2023 +0100

    core-parking: fix build with gcc12 and NR_CPUS=1
    
    Gcc12 takes issue with core_parking_remove()'s
    
        for ( ; i < cur_idle_nums; ++i )
            core_parking_cpunum[i] = core_parking_cpunum[i + 1];
    
    complaining that the right hand side array access is past the bounds of
    1. Clearly the compiler can't know that cur_idle_nums can only ever be
    zero in this case (as the sole CPU cannot be parked).
    
    Arrange for core_parking.c's contents to not be needed altogether, and
    then disable its building when NR_CPUS == 1.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 4b0422f70feb4b1cd04598ffde805fc224f3812e
    master date: 2023-03-13 15:15:42 +0100
---
 xen/arch/x86/Kconfig              |  2 +-
 xen/arch/x86/platform_hypercall.c | 11 ++++++++---
 xen/arch/x86/sysctl.c             |  3 +++
 xen/common/Kconfig                |  1 +
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 3c14096c80..8e2b504923 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -8,7 +8,7 @@ config X86
 	select ACPI_LEGACY_TABLES_LOOKUP
 	select ALTERNATIVE_CALL
 	select ARCH_SUPPORTS_INT128
-	select CORE_PARKING
+	imply CORE_PARKING
 	select HAS_ALTERNATIVE
 	select HAS_COMPAT
 	select HAS_CPUFREQ
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index bf4090c942..c35e5669a4 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -725,12 +725,17 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
         case XEN_CORE_PARKING_SET:
             idle_nums = min_t(uint32_t,
                     op->u.core_parking.idle_nums, num_present_cpus() - 1);
-            ret = continue_hypercall_on_cpu(
-                    0, core_parking_helper, (void *)(unsigned long)idle_nums);
+            if ( CONFIG_NR_CPUS > 1 )
+                ret = continue_hypercall_on_cpu(
+                        0, core_parking_helper,
+                        (void *)(unsigned long)idle_nums);
+            else if ( idle_nums )
+                ret = -EINVAL;
             break;
 
         case XEN_CORE_PARKING_GET:
-            op->u.core_parking.idle_nums = get_cur_idle_nums();
+            op->u.core_parking.idle_nums = CONFIG_NR_CPUS > 1
+                                           ? get_cur_idle_nums() : 0;
             ret = __copy_field_to_guest(u_xenpf_op, op, u.core_parking) ?
                   -EFAULT : 0;
             break;
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index aff52a13f3..ff843eaee2 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -179,6 +179,9 @@ long arch_do_sysctl(
                 ret = -EBUSY;
                 break;
             }
+            if ( CONFIG_NR_CPUS <= 1 )
+                /* Mimic behavior of smt_up_down_helper(). */
+                return 0;
             plug = op == XEN_SYSCTL_CPU_HOTPLUG_SMT_ENABLE;
             fn = smt_up_down_helper;
             hcpu = _p(plug);
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 6443943889..c9f4b7f492 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -10,6 +10,7 @@ config COMPAT
 
 config CORE_PARKING
 	bool
+	depends on NR_CPUS > 1
 
 config GRANT_TABLE
 	bool "Grant table support" if EXPERT
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:45:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513670.795019 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFdJ-0001Lj-QP; Thu, 23 Mar 2023 07:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513670.795019; Thu, 23 Mar 2023 07: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 1pfFdJ-0001La-MV; Thu, 23 Mar 2023 07:45:13 +0000
Received: by outflank-mailman (input) for mailman id 513670;
 Thu, 23 Mar 2023 07: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 1pfFdI-0001KA-Oa
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFdI-00089Y-Nb
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFdI-0003pm-MY
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=xrydEy9+e1tCr4v/iyCdZbMPQAUPxrSQUIDyt0OSnmw=; b=6CJdzlxtnIeGyASBSj5bvWrqiV
	X3BvAUueR2gAL4oQzFjTcG/5QSc6HZ0miuOusjgHE/M0PyIPgzhzZ7ivMU2Syby4TfIYVZWJ5i4jz
	vdyaJFeAiH3JjiIJKldWhZRsVQ3np4chfrbQ6UsuLqe0z4CqXfnfT8ArWfDnJZqRbogc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/altp2m: help gcc13 to avoid it emitting a warning
Message-Id: <E1pfFdI-0003pm-MY@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:45:12 +0000

commit cdde3171a2a932a6836b094c4387412e27414ec9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 13:51:42 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:51:42 2023 +0100

    x86/altp2m: help gcc13 to avoid it emitting a warning
    
    Switches of altp2m-s always expect a valid altp2m to be in place (and
    indeed altp2m_vcpu_initialise() sets the active one to be at index 0).
    The compiler, however, cannot know that, and hence it cannot eliminate
    p2m_get_altp2m()'s case of returnin (literal) NULL. If then the compiler
    decides to special case that code path in the caller, the dereference in
    instances of
    
        atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
    
    can, to the code generator, appear to be NULL dereferences, leading to
    
    In function 'atomic_dec',
        inlined from '...' at ...:
    ./arch/x86/include/asm/atomic.h:182:5: error: array subscript 0 is outside array bounds of 'int[0]' [-Werror=array-bounds=]
    
    Aid the compiler by adding a BUG_ON() checking the return value of the
    problematic p2m_get_altp2m(). Since with the use of the local variable
    the 2nd p2m_get_altp2m() each will look questionable at the first glance
    (Why is the local variable not used here?), open-code the only relevant
    piece of p2m_get_altp2m() there.
    
    To avoid repeatedly doing these transformations, and also to limit how
    "bad" the open-coding really is, convert the entire operation to an
    inline helper, used by all three instances (and accepting the redundant
    BUG_ON(idx >= MAX_ALTP2M) in two of the three cases).
    
    Reported-by: Charles Arnold <carnold@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: be62b1fc2aa7375d553603fca07299da765a89fe
    master date: 2023-03-13 15:16:21 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c |  8 +-------
 xen/arch/x86/mm/p2m.c      | 14 ++------------
 xen/include/asm-x86/p2m.h  | 20 ++++++++++++++++++++
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 094141be9a..c8a839cd5e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4036,13 +4036,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
             }
         }
 
-        if ( idx != vcpu_altp2m(v).p2midx )
-        {
-            BUG_ON(idx >= MAX_ALTP2M);
-            atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-            vcpu_altp2m(v).p2midx = idx;
-            atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
-        }
+        p2m_set_altp2m(v, idx);
     }
 
     /* XXX: This looks ugly, but we need a mechanism to ensure
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 8781df9dda..2d41446a69 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2194,13 +2194,8 @@ bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx)
 
     if ( d->arch.altp2m_eptp[idx] != mfn_x(INVALID_MFN) )
     {
-        if ( idx != vcpu_altp2m(v).p2midx )
-        {
-            atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-            vcpu_altp2m(v).p2midx = idx;
-            atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
+        if ( p2m_set_altp2m(v, idx) )
             altp2m_vcpu_update_p2m(v);
-        }
         rc = 1;
     }
 
@@ -2471,13 +2466,8 @@ int p2m_switch_domain_altp2m_by_id(struct domain *d, unsigned int idx)
     if ( d->arch.altp2m_visible_eptp[idx] != mfn_x(INVALID_MFN) )
     {
         for_each_vcpu( d, v )
-            if ( idx != vcpu_altp2m(v).p2midx )
-            {
-                atomic_dec(&p2m_get_altp2m(v)->active_vcpus);
-                vcpu_altp2m(v).p2midx = idx;
-                atomic_inc(&p2m_get_altp2m(v)->active_vcpus);
+            if ( p2m_set_altp2m(v, idx) )
                 altp2m_vcpu_update_p2m(v);
-            }
 
         rc = 0;
     }
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 2db9ab0122..f92bb97394 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -841,6 +841,26 @@ static inline struct p2m_domain *p2m_get_altp2m(struct vcpu *v)
     return v->domain->arch.altp2m_p2m[index];
 }
 
+/* set current alternate p2m table */
+static inline bool p2m_set_altp2m(struct vcpu *v, unsigned int idx)
+{
+    struct p2m_domain *orig;
+
+    BUG_ON(idx >= MAX_ALTP2M);
+
+    if ( idx == vcpu_altp2m(v).p2midx )
+        return false;
+
+    orig = p2m_get_altp2m(v);
+    BUG_ON(!orig);
+    atomic_dec(&orig->active_vcpus);
+
+    vcpu_altp2m(v).p2midx = idx;
+    atomic_inc(&v->domain->arch.altp2m_p2m[idx]->active_vcpus);
+
+    return true;
+}
+
 /* Switch alternate p2m for a single vcpu */
 bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:45:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513672.795024 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFdT-0001Pc-Tg; Thu, 23 Mar 2023 07:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513672.795024; Thu, 23 Mar 2023 07: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 1pfFdT-0001PU-QL; Thu, 23 Mar 2023 07:45:23 +0000
Received: by outflank-mailman (input) for mailman id 513672;
 Thu, 23 Mar 2023 07: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 1pfFdS-0001PC-S0
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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 1pfFdS-00089h-R5
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFdS-0003qF-QC
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07: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=mRnKIj8py24+xb0/2trHrLLriJBjvi4Wo9C/FdadXXI=; b=kYwlYjUmbG7hndR8eyUIxbiQZr
	YkFg7WYAyUPNO2BsKkFsCDxx+tmyauDUA/JvqVNp/ea9oRZ4jlsi9WZPkvEjst3JxporF7Ia3UuQa
	iTymKhkBBimaxQrumlW6UJEucvB6VtuqMUweeL2Z6c/9t3cXVdishGIPjq3wRpkVWelI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] VT-d: constrain IGD check
Message-Id: <E1pfFdS-0003qF-QC@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:45:22 +0000

commit 4d42cc4d25c35ca381370a1fa0b45350723d1308
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 13:52:20 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:52:20 2023 +0100

    VT-d: constrain IGD check
    
    Marking a DRHD as controlling an IGD isn't very sensible without
    checking that at the very least it's a graphics device that lives at
    0000:00:02.0. Re-use the reading of the class-code to control both the
    clearing of "gfx_only" and the setting of "igd_drhd_address".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: f8c4317295fa1cde1a81779b7e362651c084efb8
    master date: 2023-03-14 10:44:08 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 33a12b2ae9..9ec49936b8 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -391,15 +391,12 @@ static int __init acpi_parse_dev_scope(
 
             if ( drhd )
             {
-                if ( (seg == 0) && (bus == 0) && (path->dev == 2) &&
-                     (path->fn == 0) )
-                    igd_drhd_address = drhd->address;
-
-                if ( gfx_only &&
-                     pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
+                if ( pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
                                     PCI_CLASS_DEVICE + 1) != 0x03
                                     /* PCI_BASE_CLASS_DISPLAY */ )
                     gfx_only = false;
+                else if ( !seg && !bus && path->dev == 2 && !path->fn )
+                    igd_drhd_address = drhd->address;
             }
 
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:45:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513673.795026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFde-0001SN-UZ; Thu, 23 Mar 2023 07:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513673.795026; Thu, 23 Mar 2023 07:45:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFde-0001SF-Rq; Thu, 23 Mar 2023 07:45:34 +0000
Received: by outflank-mailman (input) for mailman id 513673;
 Thu, 23 Mar 2023 07:45: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 1pfFdc-0001S2-VP
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45: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 1pfFdc-00089t-UY
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFdc-0003r9-TY
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=njBj1men7aXUGa3WNvRzrtfY/s8zkW/0myt5nHtJ1s4=; b=mqFkzREsxYdaQsfnrfMjimEzcu
	lCghQAxB2nFWGj970OjEEJ+6b+1QmAG4mlY+t0g6AqMVbaWbLhmumz+ehEUs0Gc/UDohVwL8rGd2A
	B+WNNaT/GL1Eh/xMVDdebadeTzHCApcznUHCguUoo/d2VDi5QlVBfJaOXzxz96tgPXYw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] bunzip: work around gcc13 warning
Message-Id: <E1pfFdc-0003r9-TY@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:45:32 +0000

commit 49116b2101094c3d6658928f03db88d035ba97be
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 21 13:52:58 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:52:58 2023 +0100

    bunzip: work around gcc13 warning
    
    While provable that length[0] is always initialized (because symCount
    cannot be zero), upcoming gcc13 fails to recognize this and warns about
    the unconditional use of the value immediately following the loop.
    
    See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106511.
    
    Reported-by: Martin Liška <martin.liska@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 402195e56de0aacf97e05c80ed367d464ca6938b
    master date: 2023-03-14 10:45:28 +0100
---
 xen/common/bunzip2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 2087cfbbed..5108e570ed 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -233,6 +233,11 @@ static int __init get_next_block(struct bunzip_data *bd)
 		   becomes negative, so an unsigned inequality catches
 		   it.) */
 		t = get_bits(bd, 5)-1;
+		/* GCC 13 has apparently improved use-before-set detection, but
+		   it can't figure out that length[0] is always intialized by
+		   virtue of symCount always being positive when making it here.
+		   See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106511. */
+		length[0] = 0;
 		for (i = 0; i < symCount; i++) {
 			for (;;) {
 				if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Mar 23 07:45:45 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Mar 2023 07:45:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.513674.795030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFdo-0001VF-Vy; Thu, 23 Mar 2023 07:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 513674.795030; Thu, 23 Mar 2023 07:45:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pfFdo-0001V8-TQ; Thu, 23 Mar 2023 07:45:44 +0000
Received: by outflank-mailman (input) for mailman id 513674;
 Thu, 23 Mar 2023 07:45: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 1pfFdn-0001Uu-2x
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45: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 1pfFdn-0008AI-24
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pfFdn-0003ra-0w
 for xen-changelog@lists.xenproject.org; Thu, 23 Mar 2023 07:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5LZHM6B60VEItMHOqaYhUpxJet9ErL8YvYJ/eI6yruE=; b=xwbsKLiasAwGGX76e5bSrcccFt
	7f+clR9D2UANa24MUx9LOxnjMkRTeQR0NLaVkOSIHpYJrSoTttOJ8T5oJEPQ7lDF3aRThVCOjDtME
	omjzE8B+GQ5XyMfzNMvBW2xXxsZdceNnQP5CdITpiFFo5iyGIU+CTpKc11tOoZH/Udtg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] libacpi: fix PCI hotplug AML
Message-Id: <E1pfFdn-0003ra-0w@xenbits.xenproject.org>
Date: Thu, 23 Mar 2023 07:45:43 +0000

commit 54102e428ba3f677904278479f8110c8eef6fedc
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Tue Mar 21 13:53:25 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 21 13:53:25 2023 +0100

    libacpi: fix PCI hotplug AML
    
    The emulated PIIX3 uses a nybble for the status of each PCI function,
    so the status for e.g. slot 0 functions 0 and 1 respectively can be
    read as (\_GPE.PH00 & 0x0F), and (\_GPE.PH00 >> 0x04).
    
    The AML that Xen gives to a guest gets the operand order for the odd-
    numbered functions the wrong way round, returning (0x04 >> \_GPE.PH00)
    instead.
    
    As far as I can tell, this was the wrong way round in Xen from the
    moment that PCI hotplug was first introduced in commit 83d82e6f35a8:
    
    +                    ShiftRight (0x4, \_GPE.PH00, Local1)
    +                    Return (Local1) /* IN status as the _STA */
    
    Or maybe there's bizarre AML operand ordering going on there, like
    Intel's wrong-way-round assembler, and it only broke later when it was
    changed to being generated?
    
    Either way, it's definitely wrong now, and instrumenting a Linux guest
    shows that it correctly sees _STA being 0x00 in function 0 of an empty
    slot, but then the loop in acpiphp_glue.c::get_slot_status() goes on to
    look at function 1 and sees that _STA evaluates to 0x04. Thus reporting
    an adapter is present in every slot in /sys/bus/pci/slots/*
    
    Quite why Linux wants to look for function 1 being physically present
    when function 0 isn't... I don't want to think about right now.
    
    Fixes: 83d82e6f35a8 ("hvmloader: pass-through: multi-function PCI hot-plug")
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b190af7d3e90f58da5f58044b8dea7261b8b483d
    master date: 2023-03-20 17:12:34 +0100
---
 tools/libacpi/mk_dsdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index c5ba4c0b2f..250a50b7eb 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -431,7 +431,7 @@ int main(int argc, char **argv)
                 stmt("Store", "0x89, \\_GPE.DPT2");
             }
             if ( slot & 1 )
-                stmt("ShiftRight", "0x4, \\_GPE.PH%02X, Local1", slot & ~1);
+                stmt("ShiftRight", "\\_GPE.PH%02X, 0x04, Local1", slot & ~1);
             else
                 stmt("And", "\\_GPE.PH%02X, 0x0f, Local1", slot & ~1);
             stmt("Return", "Local1"); /* IN status as the _STA */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:33:11 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514654.796999 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4x5-00089z-Tb; Sat, 25 Mar 2023 14:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514654.796999; Sat, 25 Mar 2023 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 1pg4x5-00089r-Pr; Sat, 25 Mar 2023 14:33:03 +0000
Received: by outflank-mailman (input) for mailman id 514654;
 Sat, 25 Mar 2023 14: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 1pg4x4-00089l-S2
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4x4-0004bU-QH
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4x4-0003AW-PD
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 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=f0Aqydwi7LR0x4ljCLGyI4BuUCJRqWaegCk68Xg7Qis=; b=eMkL/8Klhb2U9l1SJl2zGP+Hml
	H8Od7JX3RzjSoQZBA/zDLvL2w9DG5WypuVWlNDTUHfeea84ZzRbSOPup3vH9HhSU0anak1QkMs3To
	rD9+G61VqtFeXsAZmfjV+ZA3TSMnH+pcnB0rMtXmUDDx6ZXfbS10lWjAh5dRuAdnhJbM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: rename xen-tools/libs.h file to common-macros.h
Message-Id: <E1pg4x4-0003AW-PD@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:33:02 +0000

commit 5b18843067278ba972a695ac7edca1dd21bcd01b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Mar 22 09:57:19 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 22 09:57:19 2023 +0100

    tools: rename xen-tools/libs.h file to common-macros.h
    
    In order to better reflect the contents of the header and to make it
    more appropriate to use it for different runtime environments like
    programs, libraries, and firmware, rename the libs.h include file to
    common-macros.h. Additionally add a comment pointing out the need to be
    self-contained.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> # tools/python/xen/lowlevel/xc/xc.c
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/console/daemon/io.c                        |  2 +-
 tools/fuzz/cpu-policy/afl-policy-fuzzer.c        |  2 +-
 tools/include/xen-tools/common-macros.h          | 79 ++++++++++++++++++++++++
 tools/include/xen-tools/libs.h                   | 70 ---------------------
 tools/libs/call/buffer.c                         |  2 +-
 tools/libs/ctrl/xc_pm.c                          |  2 +-
 tools/libs/ctrl/xc_private.h                     |  2 +-
 tools/libs/foreignmemory/linux.c                 |  2 +-
 tools/libs/gnttab/freebsd.c                      |  2 +-
 tools/libs/gnttab/linux.c                        |  2 +-
 tools/libs/guest/xg_core_arm.c                   |  2 +-
 tools/libs/guest/xg_cpuid_x86.c                  |  2 +-
 tools/libs/guest/xg_dom_arm.c                    |  2 +-
 tools/libs/guest/xg_dom_bzimageloader.c          |  2 +-
 tools/libs/guest/xg_dom_x86.c                    |  2 +-
 tools/libs/guest/xg_sr_common.c                  |  2 +-
 tools/libs/light/libxl_internal.h                |  2 +-
 tools/libs/light/libxl_psr.c                     |  2 +-
 tools/libs/stat/xenstat_linux.c                  |  2 +-
 tools/misc/xen-access.c                          |  2 +-
 tools/misc/xen-cpuid.c                           |  2 +-
 tools/misc/xen-diag.c                            |  2 +-
 tools/misc/xen-hptool.c                          |  2 +-
 tools/misc/xen-livepatch.c                       |  2 +-
 tools/misc/xen-mfndump.c                         |  2 +-
 tools/misc/xenpm.c                               |  2 +-
 tools/ocaml/libs/mmap/xenmmap_stubs.c            |  2 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c              |  2 +-
 tools/python/xen/lowlevel/xc/xc.c                |  2 +-
 tools/tests/cpu-policy/test-cpu-policy.c         |  2 +-
 tools/tests/paging-mempool/test-paging-mempool.c |  2 +-
 tools/tests/resource/test-resource.c             |  2 +-
 tools/tests/tsx/test-tsx.c                       |  2 +-
 tools/tests/x86_emulator/x86-emulate.h           |  2 +-
 tools/tests/xenstore/test-xenstore.c             |  2 +-
 tools/xenstore/utils.h                           |  2 +-
 tools/xentrace/analyze.h                         |  2 +-
 tools/xl/xl_cmdtable.c                           |  2 +-
 xen/lib/x86/private.h                            |  2 +-
 39 files changed, 116 insertions(+), 107 deletions(-)

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 682c1f4008..6bfe96715b 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -50,7 +50,7 @@
 #include <sys/ioctl.h>
 #include <libutil.h>
 #endif
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 /* Each 10 bits takes ~ 3 digits, plus one, plus one for nul terminator. */
 #define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
diff --git a/tools/fuzz/cpu-policy/afl-policy-fuzzer.c b/tools/fuzz/cpu-policy/afl-policy-fuzzer.c
index 79a849a044..7d0f274c6c 100644
--- a/tools/fuzz/cpu-policy/afl-policy-fuzzer.c
+++ b/tools/fuzz/cpu-policy/afl-policy-fuzzer.c
@@ -8,7 +8,7 @@
 
 #include <getopt.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 #include <xen/lib/x86/cpuid.h>
 #include <xen/lib/x86/msr.h>
 #include <xen/domctl.h>
diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-tools/common-macros.h
new file mode 100644
index 0000000000..a372b9ecf2
--- /dev/null
+++ b/tools/include/xen-tools/common-macros.h
@@ -0,0 +1,79 @@
+#ifndef __XEN_TOOLS_COMMON_MACROS__
+#define __XEN_TOOLS_COMMON_MACROS__
+
+/*
+ * Caution:
+ *
+ * This header must be completely self-contained. There are no external
+ * references to variables or functions allowed, as the file might be included
+ * for different runtime environments, such as firmware or target and build
+ * host programs.
+ */
+
+#ifndef BUILD_BUG_ON
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#define BUILD_BUG_ON(p) ({ _Static_assert(!(p), "!(" #p ")"); })
+#else
+#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
+#endif
+#endif
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
+#endif
+
+#ifndef MAX
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+#endif
+
+#ifndef MIN
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#endif
+
+#ifndef min
+#define min(x, y)                               \
+    ({                                          \
+        const typeof(x) _x = (x);               \
+        const typeof(y) _y = (y);               \
+        (void) (&_x == &_y);                    \
+        (_x < _y) ? _x : _y;                    \
+    })
+#endif
+
+#ifndef max
+#define max(x, y)                               \
+    ({                                          \
+        const typeof(x) _x = (x);               \
+        const typeof(y) _y = (y);               \
+        (void)(&_x == &_y);                     \
+        (_x > _y) ? _x : _y;                    \
+    })
+#endif
+
+#ifndef min_t
+#define min_t(type, x, y)                       \
+    ({                                          \
+        const type _x = (x);                    \
+        const type _y = (y);                    \
+        (_x < _y) ? _x: _y;                     \
+    })
+#endif
+
+#ifndef max_t
+#define max_t(type, x, y)                       \
+    ({                                          \
+        const type _x = (x);                    \
+        const type _y = (y);                    \
+        (_x > _y) ? _x: _y;                     \
+    })
+#endif
+
+#ifndef ROUNDUP
+#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
+#endif
+
+#ifndef __must_check
+#define __must_check __attribute__((__warn_unused_result__))
+#endif
+
+#endif	/* __XEN_TOOLS_COMMON_MACROS__ */
diff --git a/tools/include/xen-tools/libs.h b/tools/include/xen-tools/libs.h
deleted file mode 100644
index bafc90e2f6..0000000000
--- a/tools/include/xen-tools/libs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef __XEN_TOOLS_LIBS__
-#define __XEN_TOOLS_LIBS__
-
-#ifndef BUILD_BUG_ON
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#define BUILD_BUG_ON(p) ({ _Static_assert(!(p), "!(" #p ")"); })
-#else
-#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
-#endif
-#endif
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
-#endif
-
-#ifndef MAX
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-#endif
-
-#ifndef MIN
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#endif
-
-#ifndef min
-#define min(x, y)                               \
-    ({                                          \
-        const typeof(x) _x = (x);               \
-        const typeof(y) _y = (y);               \
-        (void) (&_x == &_y);                    \
-        (_x < _y) ? _x : _y;                    \
-    })
-#endif
-
-#ifndef max
-#define max(x, y)                               \
-    ({                                          \
-        const typeof(x) _x = (x);               \
-        const typeof(y) _y = (y);               \
-        (void)(&_x == &_y);                     \
-        (_x > _y) ? _x : _y;                    \
-    })
-#endif
-
-#ifndef min_t
-#define min_t(type, x, y)                       \
-    ({                                          \
-        const type _x = (x);                    \
-        const type _y = (y);                    \
-        (_x < _y) ? _x: _y;                     \
-    })
-#endif
-
-#ifndef max_t
-#define max_t(type, x, y)                       \
-    ({                                          \
-        const type _x = (x);                    \
-        const type _y = (y);                    \
-        (_x > _y) ? _x: _y;                     \
-    })
-#endif
-
-#ifndef ROUNDUP
-#define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1))
-#endif
-
-#ifndef __must_check
-#define __must_check __attribute__((__warn_unused_result__))
-#endif
-
-#endif	/* __XEN_TOOLS_LIBS__ */
diff --git a/tools/libs/call/buffer.c b/tools/libs/call/buffer.c
index 085674d882..2579b8c719 100644
--- a/tools/libs/call/buffer.c
+++ b/tools/libs/call/buffer.c
@@ -16,7 +16,7 @@
 #include <errno.h>
 #include <string.h>
 #include <pthread.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "private.h"
 
diff --git a/tools/libs/ctrl/xc_pm.c b/tools/libs/ctrl/xc_pm.c
index 76d7eb7f26..c3a9864bf7 100644
--- a/tools/libs/ctrl/xc_pm.c
+++ b/tools/libs/ctrl/xc_pm.c
@@ -21,7 +21,7 @@
 #include <stdbool.h>
 #include "xc_private.h"
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 /*
  * Get PM statistic info
diff --git a/tools/libs/ctrl/xc_private.h b/tools/libs/ctrl/xc_private.h
index ed960c6f30..80dc464c93 100644
--- a/tools/libs/ctrl/xc_private.h
+++ b/tools/libs/ctrl/xc_private.h
@@ -39,7 +39,7 @@
 
 #include <xen/sys/privcmd.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #if defined(HAVE_VALGRIND_MEMCHECK_H) && !defined(NDEBUG) && !defined(__MINIOS__)
 /* Compile in Valgrind client requests? */
diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index 9062117407..12f959765a 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -25,7 +25,7 @@
 
 #include <sys/mman.h>
 #include <sys/ioctl.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "private.h"
 
diff --git a/tools/libs/gnttab/freebsd.c b/tools/libs/gnttab/freebsd.c
index e42ac3fbf3..d69d928a16 100644
--- a/tools/libs/gnttab/freebsd.c
+++ b/tools/libs/gnttab/freebsd.c
@@ -31,7 +31,7 @@
 #include <xen/sys/gntdev.h>
 
 #include <xenctrl.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "private.h"
 
diff --git a/tools/libs/gnttab/linux.c b/tools/libs/gnttab/linux.c
index 5628fd5719..7286c1d4fe 100644
--- a/tools/libs/gnttab/linux.c
+++ b/tools/libs/gnttab/linux.c
@@ -33,7 +33,7 @@
 #include <xen/sys/gntalloc.h>
 
 #include <xenctrl.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "private.h"
 
diff --git a/tools/libs/guest/xg_core_arm.c b/tools/libs/guest/xg_core_arm.c
index aaabd07558..de30cf0c31 100644
--- a/tools/libs/guest/xg_core_arm.c
+++ b/tools/libs/guest/xg_core_arm.c
@@ -19,7 +19,7 @@
 #include "xc_private.h"
 #include "xg_core.h"
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 int
 xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 57f81eb0a0..4542878bbe 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -24,7 +24,7 @@
 #include <limits.h>
 #include "xg_private.h"
 #include <xen/hvm/params.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 enum {
 #define XEN_CPUFEATURE(name, value) X86_FEATURE_##name = value,
diff --git a/tools/libs/guest/xg_dom_arm.c b/tools/libs/guest/xg_dom_arm.c
index 5e3b76355e..d616dccbd6 100644
--- a/tools/libs/guest/xg_dom_arm.c
+++ b/tools/libs/guest/xg_dom_arm.c
@@ -21,7 +21,7 @@
 
 #include <xen/xen.h>
 #include <xen/io/protocols.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "xg_private.h"
 
diff --git a/tools/libs/guest/xg_dom_bzimageloader.c b/tools/libs/guest/xg_dom_bzimageloader.c
index 764ddbb43e..c6ee6d83e7 100644
--- a/tools/libs/guest/xg_dom_bzimageloader.c
+++ b/tools/libs/guest/xg_dom_bzimageloader.c
@@ -34,7 +34,7 @@
 #include "xg_private.h"
 #include "xg_dom_decompress.h"
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #ifndef __MINIOS__
 
diff --git a/tools/libs/guest/xg_dom_x86.c b/tools/libs/guest/xg_dom_x86.c
index 9328fbf804..811d176488 100644
--- a/tools/libs/guest/xg_dom_x86.c
+++ b/tools/libs/guest/xg_dom_x86.c
@@ -35,7 +35,7 @@
 #include <xen/arch-x86/hvm/start_info.h>
 #include <xen/io/protocols.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "xg_private.h"
 #include "xenctrl.h"
diff --git a/tools/libs/guest/xg_sr_common.c b/tools/libs/guest/xg_sr_common.c
index 17567ab133..7ccdc3b1f6 100644
--- a/tools/libs/guest/xg_sr_common.c
+++ b/tools/libs/guest/xg_sr_common.c
@@ -2,7 +2,7 @@
 
 #include "xg_sr_common.h"
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 static const char *const dhdr_types[] =
 {
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index ad982d691a..5244fde623 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -58,7 +58,7 @@
 #include <xenguest.h>
 #include <xenhypfs.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "xentoollog.h"
 
diff --git a/tools/libs/light/libxl_psr.c b/tools/libs/light/libxl_psr.c
index 9ced7d1715..712a55a73d 100644
--- a/tools/libs/light/libxl_psr.c
+++ b/tools/libs/light/libxl_psr.c
@@ -16,7 +16,7 @@
 #include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxl_internal.h"
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #define IA32_QM_CTR_ERROR_MASK         (0x3ul << 62)
 
diff --git a/tools/libs/stat/xenstat_linux.c b/tools/libs/stat/xenstat_linux.c
index ebcd65f24a..05d0b07553 100644
--- a/tools/libs/stat/xenstat_linux.c
+++ b/tools/libs/stat/xenstat_linux.c
@@ -30,7 +30,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <regex.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "xenstat_priv.h"
 
diff --git a/tools/misc/xen-access.c b/tools/misc/xen-access.c
index 0731c20b83..4097eebe6f 100644
--- a/tools/misc/xen-access.c
+++ b/tools/misc/xen-access.c
@@ -43,7 +43,7 @@
 #include <xenevtchn.h>
 #include <xen/vm_event.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #if defined(__arm__) || defined(__aarch64__)
 #include <xen/arch-arm.h>
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 37a7eaa8ed..5810b5bcca 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -10,7 +10,7 @@
 #include <xenctrl.h>
 #include <xenguest.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 static uint32_t nr_features;
 
diff --git a/tools/misc/xen-diag.c b/tools/misc/xen-diag.c
index 4778914820..cd0c2c1fc6 100644
--- a/tools/misc/xen-diag.c
+++ b/tools/misc/xen-diag.c
@@ -11,7 +11,7 @@
 #include <xenctrl.h>
 
 #include <xen/errno.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 static xc_interface *xch;
 
diff --git a/tools/misc/xen-hptool.c b/tools/misc/xen-hptool.c
index 7f17f24942..6d6aec8bad 100644
--- a/tools/misc/xen-hptool.c
+++ b/tools/misc/xen-hptool.c
@@ -5,7 +5,7 @@
 #include <xenctrl.h>
 #include <xenguest.h>
 #include <xenstore.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 static xc_interface *xch;
 
diff --git a/tools/misc/xen-livepatch.c b/tools/misc/xen-livepatch.c
index 16a4a47ab7..5bf9d9a32b 100644
--- a/tools/misc/xen-livepatch.c
+++ b/tools/misc/xen-livepatch.c
@@ -15,7 +15,7 @@
 #include <xenstore.h>
 
 #include <xen/errno.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 static xc_interface *xch;
 
diff --git a/tools/misc/xen-mfndump.c b/tools/misc/xen-mfndump.c
index 62121bd241..b32c95e262 100644
--- a/tools/misc/xen-mfndump.c
+++ b/tools/misc/xen-mfndump.c
@@ -8,7 +8,7 @@
 #include <xenctrl.h>
 #include <xenguest.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(xen_pfn_t)), 21)
 #define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 4f8cde690a..1bb6187e56 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -28,7 +28,7 @@
 #include <inttypes.h>
 #include <sys/time.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #define MAX_PKG_RESIDENCIES 12
 #define MAX_CORE_RESIDENCIES 8
diff --git a/tools/ocaml/libs/mmap/xenmmap_stubs.c b/tools/ocaml/libs/mmap/xenmmap_stubs.c
index d623ad390e..c85b1fcce7 100644
--- a/tools/ocaml/libs/mmap/xenmmap_stubs.c
+++ b/tools/ocaml/libs/mmap/xenmmap_stubs.c
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include "mmap_stubs.h"
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index ed1cbafdb4..6ec9ed6d1e 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -33,7 +33,7 @@
 #define XC_WANT_COMPAT_MAP_FOREIGN_API
 #include <xenctrl.h>
 #include <xenguest.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "mmap_stubs.h"
 
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index e3a0c13bac..35901c2d63 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -22,7 +22,7 @@
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/params.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 /* Needed for Python versions earlier than 2.3. */
 #ifndef PyMODINIT_FUNC
diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index ed450a0997..d3f24fd6d2 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -7,7 +7,7 @@
 #include <string.h>
 #include <err.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 #include <xen/asm/x86-vendors.h>
 #include <xen/lib/x86/cpu-policy.h>
 #include <xen/domctl.h>
diff --git a/tools/tests/paging-mempool/test-paging-mempool.c b/tools/tests/paging-mempool/test-paging-mempool.c
index b2dfe9b074..1ebc13455a 100644
--- a/tools/tests/paging-mempool/test-paging-mempool.c
+++ b/tools/tests/paging-mempool/test-paging-mempool.c
@@ -8,7 +8,7 @@
 #include <xenctrl.h>
 #include <xenforeignmemory.h>
 #include <xengnttab.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 static unsigned int nr_failures;
 #define fail(fmt, ...)                          \
diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 0a950072f9..7ae88ea348 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -7,7 +7,7 @@
 #include <xenctrl.h>
 #include <xenforeignmemory.h>
 #include <xengnttab.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 static unsigned int nr_failures;
 #define fail(fmt, ...)                          \
diff --git a/tools/tests/tsx/test-tsx.c b/tools/tests/tsx/test-tsx.c
index f11e8c54e0..d6d98c299b 100644
--- a/tools/tests/tsx/test-tsx.c
+++ b/tools/tests/tsx/test-tsx.c
@@ -28,7 +28,7 @@
 
 #include <xenctrl.h>
 #include <xenguest.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "xg_private.h"
 
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 18ae40d017..46d4e43cea 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -39,7 +39,7 @@
 #include <xen/asm/x86-defns.h>
 #include <xen/asm/x86-vendors.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #define BUG() abort()
 #define ASSERT assert
diff --git a/tools/tests/xenstore/test-xenstore.c b/tools/tests/xenstore/test-xenstore.c
index d3574b3fa2..d491dac53b 100644
--- a/tools/tests/xenstore/test-xenstore.c
+++ b/tools/tests/xenstore/test-xenstore.c
@@ -31,7 +31,7 @@
 #include <time.h>
 #include <xenstore.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #define TEST_PATH "xenstore-test"
 #define WRITE_BUFFERS_N    10
diff --git a/tools/xenstore/utils.h b/tools/xenstore/utils.h
index 9d012b97c1..028ecb9d7a 100644
--- a/tools/xenstore/utils.h
+++ b/tools/xenstore/utils.h
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "xenstore_lib.h"
 
diff --git a/tools/xentrace/analyze.h b/tools/xentrace/analyze.h
index f9d98d8da4..6fefa19639 100644
--- a/tools/xentrace/analyze.h
+++ b/tools/xentrace/analyze.h
@@ -3,7 +3,7 @@
 
 #include <stdint.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #define TRC_GEN_MAIN     0
 #define TRC_SCHED_MAIN   1
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 35182ca196..ccf4d83584 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -15,7 +15,7 @@
 #include <string.h>
 
 #include <libxl.h>
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 #include "xl.h"
 
diff --git a/xen/lib/x86/private.h b/xen/lib/x86/private.h
index 2d53bd3ced..60bb82a400 100644
--- a/xen/lib/x86/private.h
+++ b/xen/lib/x86/private.h
@@ -26,7 +26,7 @@
 #include <xen/asm/msr-index.h>
 #include <xen/asm/x86-vendors.h>
 
-#include <xen-tools/libs.h>
+#include <xen-tools/common-macros.h>
 
 static inline bool test_bit(unsigned int bit, const void *vaddr)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:33:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514655.797002 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4xF-0008BT-UU; Sat, 25 Mar 2023 14:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514655.797002; Sat, 25 Mar 2023 14:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4xF-0008BL-Rq; Sat, 25 Mar 2023 14:33:13 +0000
Received: by outflank-mailman (input) for mailman id 514655;
 Sat, 25 Mar 2023 14: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 1pg4xE-0008BF-VK
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4xE-0004bY-UG
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4xE-0003BG-TE
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=KXviJChPnRhrYuaqUWLmPVnyhJ+N9fAlzizLdkCFCKQ=; b=ZFsb7n+2TsKU38FvVnWgPMJheP
	5F5GZJCrlBZV+LHrJkQU8howdU4eKtiNiFnX0fLLzTUr+TUacBy9mh8xRgKm0mEgRkm8rNtmZa+Jg
	XzT3U/ajk5U4AUoyYvkTONGVV5ZW3bBv81wvEaSu2rWlfpZpscgydFN/2Y31LPwbbOgE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] move {,vcpu_}show_execution_state() declarations to common header
Message-Id: <E1pg4xE-0003BG-TE@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:33:12 +0000

commit 7fa8b6cda90c4cade2cfda098fd73e091ad776d3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 22 09:58:25 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 22 09:58:25 2023 +0100

    move {,vcpu_}show_execution_state() declarations to common header
    
    These are used from common code, so their signatures should be
    consistent across architectures. This is achieved / guaranteed easiest
    when their declarations are in a common header.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/domain.h    | 1 -
 xen/arch/arm/include/asm/processor.h | 1 -
 xen/arch/x86/include/asm/domain.h    | 1 -
 xen/arch/x86/include/asm/processor.h | 2 --
 xen/include/xen/kernel.h             | 7 +++++++
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index 0e310601e8..2a51f0ca68 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -232,7 +232,6 @@ struct arch_vcpu
 
 }  __cacheline_aligned;
 
-void vcpu_show_execution_state(struct vcpu *);
 void vcpu_show_registers(const struct vcpu *);
 void vcpu_switch_to_aarch64_mode(struct vcpu *);
 
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 1dd81d7d52..54f2530877 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -557,7 +557,6 @@ extern register_t __cpu_logical_map[];
 #ifndef __ASSEMBLY__
 void panic_PAR(uint64_t par);
 
-void show_execution_state(const struct cpu_user_regs *regs);
 /* Debugging functions are declared with external linkage to aid development. */
 void show_registers(const struct cpu_user_regs *regs);
 void show_stack(const struct cpu_user_regs *regs);
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 7bc126587d..0ccb58b72e 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -688,7 +688,6 @@ void domain_cpu_policy_changed(struct domain *d);
 bool update_secondary_system_time(struct vcpu *,
                                   struct vcpu_time_info *);
 
-void vcpu_show_execution_state(struct vcpu *);
 void vcpu_show_registers(const struct vcpu *);
 
 static inline struct vcpu_guest_context *alloc_vcpu_guest_context(void)
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 677d49ebed..678daeb484 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -436,8 +436,6 @@ static always_inline void rep_nop(void)
 void show_code(const struct cpu_user_regs *regs);
 void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs);
 void show_registers(const struct cpu_user_regs *regs);
-void show_execution_state(const struct cpu_user_regs *regs);
-void cf_check show_execution_state_nonconst(struct cpu_user_regs *regs);
 #define dump_execution_state() \
     run_in_exception_handler(show_execution_state_nonconst)
 void show_page_walk(unsigned long addr);
diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
index f1a7713784..9ac2694dc7 100644
--- a/xen/include/xen/kernel.h
+++ b/xen/include/xen/kernel.h
@@ -107,5 +107,12 @@ bool_t is_active_kernel_text(unsigned long addr);
 extern const char xen_config_data[];
 extern const unsigned int xen_config_data_size;
 
+struct cpu_user_regs;
+struct vcpu;
+
+void show_execution_state(const struct cpu_user_regs *regs);
+void cf_check show_execution_state_nonconst(struct cpu_user_regs *regs);
+void vcpu_show_execution_state(struct vcpu *);
+
 #endif /* _LINUX_KERNEL_H */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:33:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514656.797005 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4xP-0008E2-W0; Sat, 25 Mar 2023 14:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514656.797005; Sat, 25 Mar 2023 14:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4xP-0008Du-TO; Sat, 25 Mar 2023 14:33:23 +0000
Received: by outflank-mailman (input) for mailman id 514656;
 Sat, 25 Mar 2023 14: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 1pg4xP-0008Dk-2v
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4xP-0004bp-1u
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4xP-0003C5-0k
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=Zny27g69UCn1iy97OQefxNfWjjjuAyZek7gfbz2RJWw=; b=nVdiyTIKLp/Xn3/wB96ySp2Ov/
	Vph2iPs8fnYKGS2V63mMxy3eENsXhTDBj7yhdv0iOXuvpifyo8Vh1MYorBVn5lAv0e8skQwhWejXV
	uvc4trnOlmRazxzzt7iYxvi7iAElIilMLIHfEnQ/xrQY/dbPG3eRBPwuRJYOnw3WNYxE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: allow split_string_into_pair() to trim values
Message-Id: <E1pg4xP-0003C5-0k@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:33:23 +0000

commit eee0d79134cffe605e49d240c985bc571d4bacca
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Mar 22 10:00:09 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 22 10:00:09 2023 +0100

    tools/xl: allow split_string_into_pair() to trim values
    
    Most use cases of split_string_into_pair() are requiring the returned
    strings to be white space trimmed.
    
    In order to avoid the same code pattern multiple times, add a predicate
    parameter to split_string_into_pair() which can be specified to call
    trim() with that predicate for the string pair returned. Specifying
    NULL for the predicate will avoid the call of trim().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xl/xl_parse.c | 42 +++++++++++++++++++-----------------------
 tools/xl/xl_parse.h |  4 ++--
 2 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index e344d4fda3..0e1b6907fa 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -646,7 +646,7 @@ static void parse_vnuma_config(const XLU_Config *config,
              conf_count++) {
 
             if (xlu_cfg_value_type(conf_option) == XLU_STRING) {
-                char *buf, *option_untrimmed, *value_untrimmed;
+                char *buf;
                 char *option, *value;
                 unsigned long val;
 
@@ -654,15 +654,12 @@ static void parse_vnuma_config(const XLU_Config *config,
 
                 if (!buf) continue;
 
-                if (split_string_into_pair(buf, "=",
-                                           &option_untrimmed,
-                                           &value_untrimmed)) {
+                if (split_string_into_pair(buf, "=", &option, &value,
+                                           isspace)) {
                     fprintf(stderr, "xl: failed to split \"%s\" into pair\n",
                             buf);
                     exit(EXIT_FAILURE);
                 }
-                trim(isspace, option_untrimmed, &option);
-                trim(isspace, value_untrimmed, &value);
 
                 if (!strcmp("pnode", option)) {
                     val = parse_ulong(value);
@@ -715,8 +712,6 @@ static void parse_vnuma_config(const XLU_Config *config,
                 }
                 free(option);
                 free(value);
-                free(option_untrimmed);
-                free(value_untrimmed);
             }
         }
     }
@@ -838,7 +833,7 @@ int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token)
 
             rc = split_string_into_pair(connectors[i], ":",
                                         &vdispl->connectors[i].unique_id,
-                                        &resolution);
+                                        &resolution, NULL);
 
             rc= sscanf(resolution, "%ux%u", &vdispl->connectors[i].width,
                        &vdispl->connectors[i].height);
@@ -2361,18 +2356,15 @@ void parse_config_data(const char *config_source,
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
             for (i = 0; i < len; i++) {
-                char *key, *key_untrimmed, *value, *value_untrimmed;
+                char *key, *value;
                 int rc;
-                rc = split_string_into_pair(pairs[i], "=",
-                                            &key_untrimmed,
-                                            &value_untrimmed);
+                rc = split_string_into_pair(pairs[i], "=", &key, &value,
+                                            isspace);
                 if (rc != 0) {
                     fprintf(stderr, "failed to parse channel configuration: %s",
                             pairs[i]);
                     exit(1);
                 }
-                trim(isspace, key_untrimmed, &key);
-                trim(isspace, value_untrimmed, &value);
 
                 if (!strcmp(key, "backend")) {
                     replace_string(&chn->backend_domname, value);
@@ -2395,9 +2387,7 @@ void parse_config_data(const char *config_source,
                                   " ignoring\n", key);
                 }
                 free(key);
-                free(key_untrimmed);
                 free(value);
-                free(value_untrimmed);
             }
             switch (chn->connection) {
             case LIBXL_CHANNEL_CONNECTION_UNKNOWN:
@@ -3021,10 +3011,8 @@ void trim(char_predicate_t predicate, const char *input, char **output)
     *output = result;
 }
 
-int split_string_into_pair(const char *str,
-                           const char *delim,
-                           char **a,
-                           char **b)
+int split_string_into_pair(const char *str, const char *delim,
+                           char **a, char **b, char_predicate_t predicate)
 {
     char *s, *p, *saveptr, *aa = NULL, *bb = NULL;
     int rc = 0;
@@ -3036,13 +3024,21 @@ int split_string_into_pair(const char *str,
         rc = ERROR_INVAL;
         goto out;
     }
-    aa = xstrdup(p);
+    if (predicate) {
+        trim(predicate, p, &aa);
+    } else {
+        aa = xstrdup(p);
+    }
     p = strtok_r(NULL, delim, &saveptr);
     if (p == NULL) {
         rc = ERROR_INVAL;
         goto out;
     }
-    bb = xstrdup(p);
+    if (predicate) {
+        trim(predicate, p, &bb);
+    } else {
+        bb = xstrdup(p);
+    }
 
     *a = aa;
     aa = NULL;
diff --git a/tools/xl/xl_parse.h b/tools/xl/xl_parse.h
index bab2861f8c..ab35c68545 100644
--- a/tools/xl/xl_parse.h
+++ b/tools/xl/xl_parse.h
@@ -45,14 +45,14 @@ int match_option_size(const char *prefix, size_t len,
 
 void split_string_into_string_list(const char *str, const char *delim,
                                    libxl_string_list *psl);
-int split_string_into_pair(const char *str, const char *delim,
-                           char **a, char **b);
 void replace_string(char **str, const char *val);
 
 /* NB: this follows the interface used by <ctype.h>. See 'man 3 ctype'
    and look for CTYPE in libxl_internal.h */
 typedef int (*char_predicate_t)(const int c);
 void trim(char_predicate_t predicate, const char *input, char **output);
+int split_string_into_pair(const char *str, const char *delim,
+                           char **a, char **b, char_predicate_t predicate);
 
 const char *get_action_on_shutdown_name(libxl_action_on_shutdown a);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:33:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514657.797009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4xa-0008Hu-2x; Sat, 25 Mar 2023 14:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514657.797009; Sat, 25 Mar 2023 14: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 1pg4xa-0008Hn-0S; Sat, 25 Mar 2023 14:33:34 +0000
Received: by outflank-mailman (input) for mailman id 514657;
 Sat, 25 Mar 2023 14: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 1pg4xZ-0008Hd-6e
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4xZ-0004cF-5e
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4xZ-0003CZ-4a
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=mRv1h1EXZL2G8rJ/W5RV27elNluqkPZav50kIxlPEWo=; b=rYTUZ6aDuxOgtgpXEgnnkQUsFa
	nl3oj558TdNTVpettm6W+qK/5CENRzJWkQ+3Bpr02ZuR6hxTF15szlxcQ6Coq1Mow1/s3SJt2Z/6v
	mAKLTgq62jli1JT1Ze2Gc1/5DESeEbVxBylV8/BGnkcC6tIrnuvFWqQQ01ZEOwQ0T7qg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: fix iommu=no-igfx if the IOMMU scope contains fake device(s)
Message-Id: <E1pg4xZ-0003CZ-4a@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:33:33 +0000

commit 49de6749baa8d0addc3048defd4ef3e85cb135e9
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Mar 23 09:16:41 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 23 09:16:41 2023 +0100

    VT-d: fix iommu=no-igfx if the IOMMU scope contains fake device(s)
    
    If the scope for IGD's IOMMU contains additional device that doesn't
    actually exist, iommu=no-igfx would not disable that IOMMU. In this
    particular case (Thinkpad x230) it included 00:02.1, but there is no
    such device on this platform. Consider only existing devices for the
    "gfx only" check as well as the establishing of IGD DRHD address
    (underlying is_igd_drhd(), which is used to determine applicability of
    two workarounds).
    
    Fixes: 2d7f191b392e ("VT-d: generalize and correct "iommu=no-igfx" handling")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/dmar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 78d4526446..4936c20952 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -389,7 +389,7 @@ static int __init acpi_parse_dev_scope(
                 printk(VTDPREFIX " endpoint: %pp\n",
                        &PCI_SBDF(seg, bus, path->dev, path->fn));
 
-            if ( drhd )
+            if ( drhd && pci_device_detect(seg, bus, path->dev, path->fn) )
             {
                 if ( pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
                                     PCI_CLASS_DEVICE + 1) != 0x03
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:33:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514658.797013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4xk-0008KR-4k; Sat, 25 Mar 2023 14:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514658.797013; Sat, 25 Mar 2023 14: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 1pg4xk-0008KJ-1x; Sat, 25 Mar 2023 14:33:44 +0000
Received: by outflank-mailman (input) for mailman id 514658;
 Sat, 25 Mar 2023 14: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 1pg4xj-0008KB-Ak
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4xj-0004cQ-9X
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4xj-0003D2-8O
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=PQmPVVhMzikWIZghRRYcDpC/iVin7AcwOSfs07RNm4s=; b=LPoIJQ69UXIIMA912vikJ/ffm1
	naqHtqkCrYKisLyhblHugsjSDQiiJfIZPK3XScabGn+LHWvP3nXY+8a2x1knQzVmrOUSH8H65c8Cn
	98ie8ha9EIif5a/Lm3Mqa4LbtjdNjhNTDOj77+cwv08POki0+3BVFZNSpRTpTdMR5yz0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: use libxenlight for writing xenstore-stubdom console nodes
Message-Id: <E1pg4xj-0003D2-8O@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:33:43 +0000

commit 4fe3c78d8103eac0a8d9fa4c8176d012614652d0
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 23 09:17:57 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 23 09:17:57 2023 +0100

    tools: use libxenlight for writing xenstore-stubdom console nodes
    
    Instead of duplicating libxl__device_console_add() work in
    init-xenstore-domain.c, just use libxenlight.
    
    This requires to add a small wrapper function to libxenlight, as
    libxl__device_console_add() is an internal function.
    
    This at once removes a theoretical race between starting xenconsoled
    and xenstore-stubdom, as the old code wasn't using a single
    transaction for writing all the entries, leading to the possibility
    that xenconsoled would see only some of the entries being written.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/helpers/init-xenstore-domain.c | 42 +++++++++++-------------------------
 tools/include/libxl.h                | 14 ++++++++++++
 tools/libs/light/libxl_console.c     | 23 ++++++++++++++++++++
 3 files changed, 50 insertions(+), 29 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index 85cc9e8381..0950ba7dc5 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -11,6 +11,7 @@
 #include <xenguest.h>
 #include <xenstore.h>
 #include <xentoollog.h>
+#include <libxl.h>
 #include <xen/sys/xenbus_dev.h>
 #include <xen-xsm/flask/flask.h>
 #include <xen/io/xenbus.h>
@@ -403,15 +404,6 @@ static void do_xs_write(struct xs_handle *xsh, char *path, char *val)
         fprintf(stderr, "writing %s to xenstore failed.\n", path);
 }
 
-static void do_xs_write_dir_node(struct xs_handle *xsh, char *dir, char *node,
-                                 char *val)
-{
-    char full_path[100];
-
-    snprintf(full_path, 100, "%s/%s", dir, node);
-    do_xs_write(xsh, full_path, val);
-}
-
 static void do_xs_write_dom(struct xs_handle *xsh, char *path, char *val)
 {
     char full_path[64];
@@ -425,9 +417,10 @@ int main(int argc, char** argv)
     int opt;
     xc_interface *xch;
     struct xs_handle *xsh;
-    char buf[16], be_path[64], fe_path[64];
+    char buf[16];
     int rv, fd;
     char *maxmem_str = NULL;
+    libxl_ctx *ctx;
 
     while ( (opt = getopt_long(argc, argv, "v", options, NULL)) != -1 )
     {
@@ -528,27 +521,18 @@ int main(int argc, char** argv)
     if (maxmem)
         snprintf(buf, 16, "%d", maxmem * 1024);
     do_xs_write_dom(xsh, "memory/static-max", buf);
-    snprintf(be_path, 64, "/local/domain/0/backend/console/%d/0", domid);
-    snprintf(fe_path, 64, "/local/domain/%d/console", domid);
-    snprintf(buf, 16, "%d", domid);
-    do_xs_write_dir_node(xsh, be_path, "frontend-id", buf);
-    do_xs_write_dir_node(xsh, be_path, "frontend", fe_path);
-    do_xs_write_dir_node(xsh, be_path, "online", "1");
-    snprintf(buf, 16, "%d", XenbusStateInitialising);
-    do_xs_write_dir_node(xsh, be_path, "state", buf);
-    do_xs_write_dir_node(xsh, be_path, "protocol", "vt100");
-    do_xs_write_dir_node(xsh, fe_path, "backend", be_path);
-    do_xs_write_dir_node(xsh, fe_path, "backend-id", "0");
-    do_xs_write_dir_node(xsh, fe_path, "limit", "1048576");
-    do_xs_write_dir_node(xsh, fe_path, "type", "xenconsoled");
-    do_xs_write_dir_node(xsh, fe_path, "output", "pty");
-    do_xs_write_dir_node(xsh, fe_path, "tty", "");
-    snprintf(buf, 16, "%d", console_evtchn);
-    do_xs_write_dir_node(xsh, fe_path, "port", buf);
-    snprintf(buf, 16, "%ld", console_gfn);
-    do_xs_write_dir_node(xsh, fe_path, "ring-ref", buf);
     xs_close(xsh);
 
+    if ( libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, logger))
+    {
+        fprintf(stderr, "libxl_ctx_alloc() failed.\n");
+        rv = 3;
+        goto out;
+    }
+    libxl_console_add_xenstore(ctx, domid, 0, console_evtchn, console_gfn,
+                               NULL);
+    libxl_ctx_free(ctx);
+
     fd = creat(XEN_RUN_DIR "/xenstored.pid", 0666);
     if ( fd < 0 )
     {
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 5c65222f1e..cfa1a19131 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -547,6 +547,11 @@
  */
 #define LIBXL_HAVE_DEVICE_DISK_SPECIFICATION 1
 
+/*
+ * LIBXL_HAVE_CONSOLE_ADD_XENSTORE indicates presence of the function
+ * libxl_console_add_xenstore() in libxl.
+ */
+#define LIBXL_HAVE_CONSOLE_ADD_XENSTORE 1
 /*
  * libxl ABI compatibility
  *
@@ -1987,6 +1992,15 @@ int libxl_console_get_tty(libxl_ctx *ctx, uint32_t domid, int cons_num,
  */
 int libxl_primary_console_get_tty(libxl_ctx *ctx, uint32_t domid_vm, char **path);
 
+/* libxl_console_add_xenstore writes the Xenstore entries for a domain's
+ * primary console based on domid, event channel port and the guest frame
+ * number of the PV console's ring page.
+ */
+int libxl_console_add_xenstore(libxl_ctx *ctx, uint32_t domid, uint32_t backend,
+                               unsigned int evtch, unsigned long gfn,
+                               const libxl_asyncop_how *ao_how)
+                               LIBXL_EXTERNAL_CALLERS_ONLY;
+
 /* May be called with info_r == NULL to check for domain's existence.
  * Returns ERROR_DOMAIN_NOTFOUND if domain does not exist (used to return
  * ERROR_INVAL for this scenario). */
diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index d8b2bc5465..f497be141b 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -346,6 +346,29 @@ out:
     return rc;
 }
 
+int libxl_console_add_xenstore(libxl_ctx *ctx, uint32_t domid, uint32_t backend,
+                               unsigned int evtch, unsigned long gfn,
+                               const libxl_asyncop_how *ao_how)
+{
+    AO_CREATE(ctx, domid, ao_how);
+    int rc;
+    libxl__device_console console = { .backend_domid = backend,
+                                      .output = "pty",
+                                      .consback = LIBXL__CONSOLE_BACKEND_XENCONSOLED,
+                                    };
+    libxl__domain_build_state state = { .console_port = evtch,
+                                        .console_mfn = gfn,
+                                      };
+    libxl__device device = { };
+
+    rc = libxl__device_console_add(gc, domid, &console, &state, &device);
+    if (rc < 0)
+        LOGED(ERROR, domid, "Adding console Xenstore entries");
+
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
+}
+
 int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid,
                             libxl__device_console *console,
                             libxl__domain_build_state *state)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:33:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514659.797018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4xu-0008Me-6N; Sat, 25 Mar 2023 14:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514659.797018; Sat, 25 Mar 2023 14: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 1pg4xu-0008MU-3X; Sat, 25 Mar 2023 14:33:54 +0000
Received: by outflank-mailman (input) for mailman id 514659;
 Sat, 25 Mar 2023 14: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 1pg4xt-0008MI-EG
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4xt-0004d2-DH
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4xt-0003Db-CK
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=zuQvTshaVh2nLFJWjfD9wTzfvvuhdpII2f+mJ/0fZzU=; b=NcEEMXAKZUsxoMVAZc0CPqBIJ+
	BZ7Gt0iS7POqXzxfO/3hbvP7MmGTPLNnBm7oIOvS/YS1kbxEBxmEFKJRdCuz6oa4anoQF8J2UxeG0
	fybpMCKBVvaWeFCTU3Azrp+eTNl4o0BI3Zti7A/sKQnwQ6Vs9nXnEiH+UvNwczy00dhE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: make split_string_into_pair() more usable
Message-Id: <E1pg4xt-0003Db-CK@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:33:53 +0000

commit 4bad14a133aa0c817a90a13c4e86531a7290deea
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 23 09:18:12 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 23 09:18:12 2023 +0100

    tools/xl: make split_string_into_pair() more usable
    
    Today split_string_into_pair() will not really do what its name is
    suggesting: instead of splitting a string into a pair of strings using
    a delimiter, it will return the first two strings of the initial string
    by using the delimiter.
    
    This is never what the callers want, so modify split_string_into_pair()
    to split the string only at the first delimiter found, resulting in
    something like "x=a=b" to be split into "x" and "a=b" when being called
    with "=" as the delimiter. Today the returned strings would be "x" and
    "a".
    
    At the same time switch the delimiter from "const char *" (allowing
    multiple delimiter characters) to "char" (a single character only), as
    this makes the function more simple without breaking any use cases.
    
    Suggested-by: Anthony PERARD <anthony.perard@citrix.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xl/xl_parse.c | 23 ++++++++++++-----------
 tools/xl/xl_parse.h |  4 ++--
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 0e1b6907fa..09cabd2732 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -654,7 +654,7 @@ static void parse_vnuma_config(const XLU_Config *config,
 
                 if (!buf) continue;
 
-                if (split_string_into_pair(buf, "=", &option, &value,
+                if (split_string_into_pair(buf, '=', &option, &value,
                                            isspace)) {
                     fprintf(stderr, "xl: failed to split \"%s\" into pair\n",
                             buf);
@@ -831,7 +831,7 @@ int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token)
         {
             char *resolution;
 
-            rc = split_string_into_pair(connectors[i], ":",
+            rc = split_string_into_pair(connectors[i], ':',
                                         &vdispl->connectors[i].unique_id,
                                         &resolution, NULL);
 
@@ -2358,7 +2358,7 @@ void parse_config_data(const char *config_source,
             for (i = 0; i < len; i++) {
                 char *key, *value;
                 int rc;
-                rc = split_string_into_pair(pairs[i], "=", &key, &value,
+                rc = split_string_into_pair(pairs[i], '=', &key, &value,
                                             isspace);
                 if (rc != 0) {
                     fprintf(stderr, "failed to parse channel configuration: %s",
@@ -3011,26 +3011,27 @@ void trim(char_predicate_t predicate, const char *input, char **output)
     *output = result;
 }
 
-int split_string_into_pair(const char *str, const char *delim,
-                           char **a, char **b, char_predicate_t predicate)
+int split_string_into_pair(const char *str, char delim, char **a, char **b,
+                           char_predicate_t predicate)
 {
-    char *s, *p, *saveptr, *aa = NULL, *bb = NULL;
+    char *s, *p, *aa = NULL, *bb = NULL;
     int rc = 0;
 
     s = xstrdup(str);
 
-    p = strtok_r(s, delim, &saveptr);
+    p = strchr(s, delim);
     if (p == NULL) {
         rc = ERROR_INVAL;
         goto out;
     }
+    *p = 0;
     if (predicate) {
-        trim(predicate, p, &aa);
+        trim(predicate, s, &aa);
     } else {
-        aa = xstrdup(p);
+        aa = xstrdup(s);
     }
-    p = strtok_r(NULL, delim, &saveptr);
-    if (p == NULL) {
+    p++;
+    if (!*p) {
         rc = ERROR_INVAL;
         goto out;
     }
diff --git a/tools/xl/xl_parse.h b/tools/xl/xl_parse.h
index ab35c68545..fe0d586cdd 100644
--- a/tools/xl/xl_parse.h
+++ b/tools/xl/xl_parse.h
@@ -51,8 +51,8 @@ void replace_string(char **str, const char *val);
    and look for CTYPE in libxl_internal.h */
 typedef int (*char_predicate_t)(const int c);
 void trim(char_predicate_t predicate, const char *input, char **output);
-int split_string_into_pair(const char *str, const char *delim,
-                           char **a, char **b, char_predicate_t predicate);
+int split_string_into_pair(const char *str, char delim, char **a, char **b,
+                           char_predicate_t predicate);
 
 const char *get_action_on_shutdown_name(libxl_action_on_shutdown a);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:34:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:34:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514660.797024 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4y5-0008P1-8v; Sat, 25 Mar 2023 14:34:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514660.797024; Sat, 25 Mar 2023 14: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 1pg4y5-0008Ou-5B; Sat, 25 Mar 2023 14:34:05 +0000
Received: by outflank-mailman (input) for mailman id 514660;
 Sat, 25 Mar 2023 14: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 1pg4y3-0008Oh-IX
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4y3-0004dM-H7
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4y3-0003EB-Fz
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=uz/Qvjr0PCKSsLVLO7TNxPmVNQjI6NzN6scioBuBvjU=; b=A0Z3Ftaty0NOr49RFfYsWrwCWG
	YbFbBRgqZJ3+xsCfIcGK+dLbtJDfevtG/bWqgCKi3ATu0JAVRuVq2ODmHSV8kTJ/WuiKRZW+rzlWf
	tYGXM8H791lkEYjSZyw0IThUeJbbg9LowU5XYluesQSdOHJnjAcTfW0pZz6QVZiLFzms=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: rework p9 config parsing
Message-Id: <E1pg4y3-0003EB-Fz@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:34:03 +0000

commit 95b757598f699bcb37f7d1fa60faa0ccd0d55c77
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 23 09:18:26 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 23 09:18:26 2023 +0100

    tools/xl: rework p9 config parsing
    
    Rework the config parsing of a p9 device to use the
    split_string_into_pair() function instead of open coding it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xl/xl_parse.c | 74 ++++++++++++++++++++++++++---------------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 09cabd2732..1f6f47daf4 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2180,54 +2180,54 @@ void parse_config_data(const char *config_source,
 
     if (!xlu_cfg_get_list(config, "p9", &p9devs, 0, 0)) {
         libxl_device_p9 *p9;
-        char *security_model = NULL;
-        char *path = NULL;
-        char *tag = NULL;
-        char *backend = NULL;
-        char *p, *p2, *buf2;
 
         d_config->num_p9s = 0;
         d_config->p9s = NULL;
         while ((buf = xlu_cfg_get_listitem (p9devs, d_config->num_p9s)) != NULL) {
+            libxl_string_list pairs;
+            int len;
+
             p9 = ARRAY_EXTEND_INIT(d_config->p9s,
                                    d_config->num_p9s,
                                    libxl_device_p9_init);
             libxl_device_p9_init(p9);
 
-            buf2 = strdup(buf);
-            p = strtok(buf2, ",");
-            if(p) {
-               do {
-                  while(*p == ' ')
-                     ++p;
-                  if ((p2 = strchr(p, '=')) == NULL)
-                     break;
-                  *p2 = '\0';
-                  if (!strcmp(p, "security_model")) {
-                     security_model = strdup(p2 + 1);
-                  } else if(!strcmp(p, "path")) {
-                     path = strdup(p2 + 1);
-                  } else if(!strcmp(p, "tag")) {
-                     tag = strdup(p2 + 1);
-                  } else if(!strcmp(p, "backend")) {
-                     backend = strdup(p2 + 1);
-                  } else {
-                     fprintf(stderr, "Unknown string `%s' in 9pfs spec\n", p);
-                     exit(1);
-                  }
-               } while ((p = strtok(NULL, ",")) != NULL);
-            }
-            if (!path || !security_model || !tag) {
-               fprintf(stderr, "9pfs spec missing required field!\n");
-               exit(1);
+            split_string_into_string_list(buf, ",", &pairs);
+            len = libxl_string_list_length(&pairs);
+            for (i = 0; i < len; i++) {
+                char *key, *value;
+                int rc;
+
+                rc = split_string_into_pair(pairs[i], '=', &key, &value,
+                                            isspace);
+                if (rc != 0) {
+                    fprintf(stderr, "failed to parse 9pfs configuration: %s",
+                            pairs[i]);
+                    exit(1);
+                }
+
+                if (!strcmp(key, "security_model")) {
+                    replace_string(&p9->security_model, value);
+                } else if (!strcmp(key, "path")) {
+                    replace_string(&p9->path, value);
+                } else if (!strcmp(key, "tag")) {
+                    replace_string(&p9->tag, value);
+                } else if (!strcmp(key, "backend")) {
+                    replace_string(&p9->backend_domname, value);
+                } else {
+                    fprintf(stderr, "Unknown 9pfs parameter '%s'\n", key);
+                    exit(1);
+                }
+                free(key);
+                free(value);
             }
-            free(buf2);
 
-            replace_string(&p9->tag, tag);
-            replace_string(&p9->security_model, security_model);
-            replace_string(&p9->path, path);
-            if (backend)
-                    replace_string(&p9->backend_domname, backend);
+            libxl_string_list_dispose(&pairs);
+
+            if (!p9->path || !p9->security_model || !p9->tag) {
+                fprintf(stderr, "9pfs spec missing required field!\n");
+                exit(1);
+            }
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:34:15 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:34:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514661.797027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4yF-0008RY-Aj; Sat, 25 Mar 2023 14:34:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514661.797027; Sat, 25 Mar 2023 14: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 1pg4yF-0008RQ-6p; Sat, 25 Mar 2023 14:34:15 +0000
Received: by outflank-mailman (input) for mailman id 514661;
 Sat, 25 Mar 2023 14: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 1pg4yD-0008RI-Lf
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4yD-0004dT-Ke
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4yD-0003Ey-Jm
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=UVmUkix3nRR5rLuILBinAtu2ZuX6VvbXheNjYVaYKcE=; b=wvN1PAInvvw7k6y+M6BWm+c/ON
	u9ExBvn00O6+m02h5AWA6xjmmqvBX2dq4bxnYsIeWkln0jj161100Mqnk957B+Dh9mlvFoMdA0h0L
	IWQe1VHAv5KC1aEIorP4Q7go0qrVYlE289D4lab680W669x/JdmV9jQNxZZi70jVtIC4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: fix and improve sh_page_has_multiple_shadows()
Message-Id: <E1pg4yD-0003Ey-Jm@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:34:13 +0000

commit 2896224a4e294652c33f487b603d20bd30955f21
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 24 11:07:08 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:07:08 2023 +0100

    x86/shadow: fix and improve sh_page_has_multiple_shadows()
    
    While no caller currently invokes the function without first making sure
    there is at least one shadow [1], we'd better eliminate UB here:
    find_first_set_bit() requires input to be non-zero to return a well-
    defined result.
    
    Further, using find_first_set_bit() isn't very efficient in the first
    place for the intended purpose.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    
    [1] The function has exactly two uses, and both are from OOS code, which
        is HVM-only. For HVM (but not for PV) sh_mfn_is_a_page_table(),
        guarding the call to sh_unsync(), guarantees at least one shadow.
        Hence even if sh_page_has_multiple_shadows() returned a bogus value
        when invoked for a PV domain, the subsequent is_hvm_vcpu() and
        oos_active checks (the former being redundant with the latter) will
        compensate. (Arguably that oos_active check should come first, for
        both clarity and efficiency reasons.)
---
 xen/arch/x86/mm/shadow/private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 296a2f6113..1c3d15fa2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -332,7 +332,7 @@ static inline int sh_page_has_multiple_shadows(struct page_info *pg)
         return 0;
     shadows = pg->shadow_flags & SHF_page_type_mask;
     /* More than one type bit set in shadow-flags? */
-    return ( (shadows & ~(1UL << find_first_set_bit(shadows))) != 0 );
+    return shadows && (shadows & (shadows - 1));
 }
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:34:25 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:34:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514662.797030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4yP-0008Ub-B0; Sat, 25 Mar 2023 14:34:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514662.797030; Sat, 25 Mar 2023 14: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 1pg4yP-0008UT-8M; Sat, 25 Mar 2023 14:34:25 +0000
Received: by outflank-mailman (input) for mailman id 514662;
 Sat, 25 Mar 2023 14: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 1pg4yN-0008UD-QG
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4yN-0004db-PM
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4yN-0003Fn-No
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=du/56i4X+RvmuocBeLaPoFrrE1fgCeG7ijju2Oc0lCU=; b=OjbnlQU7em5FGdMwHsPpULVY88
	R3exoGwYGHJVhZ8+FMu/M2zMvOac7hC3wboZxyRY2UqmTfWhtL7IqcHEr7qLfaFuWN5QMIPQEvVGb
	QIS2aNx6xd80ZYc6CP0nr8dv8HikGkcTUHX2h0dSGHTAM2M5ei+f+RxNS5VwsKv+31Os=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: fold/rename sh_unhook_*_mappings()
Message-Id: <E1pg4yN-0003Fn-No@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:34:23 +0000

commit 55ec42b857d85268aab513a9b056249d62aba953
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 24 11:08:36 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:08:36 2023 +0100

    x86/shadow: fold/rename sh_unhook_*_mappings()
    
    The "32b" and "pae" functions are identical at the source level (they
    differ in what they get compiled to, due to differences in
    SHADOW_FOREACH_L2E()), leaving aside a comment the PAE variant has and
    the non-PAE one doesn't. Replace these infixes by the more usual l<N>
    ones (and then also for the "64b" one for consistency; that'll also
    allow for re-use once we support 5-level paging, if need be). The two
    different instances are still distinguishable by their "level" suffix.
    
    While fiddling with the names, convert the last parameter to boolean
    as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c |  6 +++---
 xen/arch/x86/mm/shadow/multi.c  | 18 +++---------------
 xen/arch/x86/mm/shadow/multi.h  | 11 ++++-------
 xen/arch/x86/mm/shadow/types.h  |  5 ++---
 4 files changed, 12 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 7ced6aec0a..0e5e0bdbd6 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -898,14 +898,14 @@ void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only)
     {
 #ifdef CONFIG_HVM
     case SH_type_l2_32_shadow:
-        SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, 2)(d, smfn, user_only);
+        SHADOW_INTERNAL_NAME(sh_unhook_l2_mappings, 2)(d, smfn, user_only);
         break;
     case SH_type_l2_pae_shadow:
-        SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, 3)(d, smfn, user_only);
+        SHADOW_INTERNAL_NAME(sh_unhook_l2_mappings, 3)(d, smfn, user_only);
         break;
 #endif
     case SH_type_l4_64_shadow:
-        SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, 4)(d, smfn, user_only);
+        SHADOW_INTERNAL_NAME(sh_unhook_l4_mappings, 4)(d, smfn, user_only);
         break;
     default:
         printk(XENLOG_ERR "Bad top-level shadow type %08x\n", sp->u.sh.type);
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 415e18a8df..106f95cccc 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -1416,21 +1416,9 @@ void sh_destroy_l1_shadow(struct domain *d, mfn_t smfn)
  * This implementation is pretty crude and slow, but we hope that it won't
  * be called very often. */
 
-#if GUEST_PAGING_LEVELS == 2
-
-void sh_unhook_32b_mappings(struct domain *d, mfn_t sl2mfn, int user_only)
-{
-    shadow_l2e_t *sl2e;
-    SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, d, {
-        if ( !user_only || (sl2e->l2 & _PAGE_USER) )
-            shadow_set_l2e(d, sl2e, shadow_l2e_empty(), sl2mfn);
-    });
-}
-
-#elif GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS < 4
 
-void sh_unhook_pae_mappings(struct domain *d, mfn_t sl2mfn, int user_only)
-/* Walk a PAE l2 shadow, unhooking entries from all the subshadows */
+void sh_unhook_l2_mappings(struct domain *d, mfn_t sl2mfn, bool user_only)
 {
     shadow_l2e_t *sl2e;
     SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, d, {
@@ -1441,7 +1429,7 @@ void sh_unhook_pae_mappings(struct domain *d, mfn_t sl2mfn, int user_only)
 
 #elif GUEST_PAGING_LEVELS == 4
 
-void sh_unhook_64b_mappings(struct domain *d, mfn_t sl4mfn, int user_only)
+void sh_unhook_l4_mappings(struct domain *d, mfn_t sl4mfn, bool user_only)
 {
     shadow_l4e_t *sl4e;
     SHADOW_FOREACH_L4E(sl4mfn, sl4e, 0, 0, d, {
diff --git a/xen/arch/x86/mm/shadow/multi.h b/xen/arch/x86/mm/shadow/multi.h
index 0918df753c..222c31bd10 100644
--- a/xen/arch/x86/mm/shadow/multi.h
+++ b/xen/arch/x86/mm/shadow/multi.h
@@ -50,14 +50,11 @@ SHADOW_INTERNAL_NAME(sh_destroy_l4_shadow, GUEST_LEVELS)(
     struct domain *d, mfn_t smfn);
 
 extern void
-SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, GUEST_LEVELS)
-    (struct domain *d, mfn_t sl2mfn, int user_only);
+SHADOW_INTERNAL_NAME(sh_unhook_l2_mappings, GUEST_LEVELS)
+    (struct domain *d, mfn_t sl2mfn, bool user_only);
 extern void
-SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, GUEST_LEVELS)
-    (struct domain *d, mfn_t sl3mfn, int user_only);
-extern void
-SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, GUEST_LEVELS)
-    (struct domain *d, mfn_t sl4mfn, int user_only);
+SHADOW_INTERNAL_NAME(sh_unhook_l4_mappings, GUEST_LEVELS)
+    (struct domain *d, mfn_t sl4mfn, bool user_only);
 
 int cf_check
 SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, GUEST_LEVELS)
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index fac59522b0..e81a3c2c5c 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -232,9 +232,8 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define sh_destroy_l3_shadow       INTERNAL_NAME(sh_destroy_l3_shadow)
 #define sh_destroy_l2_shadow       INTERNAL_NAME(sh_destroy_l2_shadow)
 #define sh_destroy_l1_shadow       INTERNAL_NAME(sh_destroy_l1_shadow)
-#define sh_unhook_32b_mappings     INTERNAL_NAME(sh_unhook_32b_mappings)
-#define sh_unhook_pae_mappings     INTERNAL_NAME(sh_unhook_pae_mappings)
-#define sh_unhook_64b_mappings     INTERNAL_NAME(sh_unhook_64b_mappings)
+#define sh_unhook_l2_mappings      INTERNAL_NAME(sh_unhook_l2_mappings)
+#define sh_unhook_l4_mappings      INTERNAL_NAME(sh_unhook_l4_mappings)
 #define sh_paging_mode             INTERNAL_NAME(sh_paging_mode)
 #define sh_audit_l1_table          INTERNAL_NAME(sh_audit_l1_table)
 #define sh_audit_fl1_table         INTERNAL_NAME(sh_audit_fl1_table)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:34:35 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:34:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514663.797034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4yZ-00006w-E3; Sat, 25 Mar 2023 14:34:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514663.797034; Sat, 25 Mar 2023 14: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 1pg4yZ-00006o-BI; Sat, 25 Mar 2023 14:34:35 +0000
Received: by outflank-mailman (input) for mailman id 514663;
 Sat, 25 Mar 2023 14: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 1pg4yX-00006V-U1
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4yX-0004e5-T6
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4yX-0003Gc-S8
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=Y0/9LOWDB0LlcL/v/W9X2SaE8tNVxTe+2/J+bSacy7Y=; b=HbyOrgbzmrVS2oV1bVFCfPgyUl
	U2io1Q2j5w8W1oMnn4a3LGesXZcdXSTWot521hT2WXQDuPmrTjhdxpGkv8enPFZK7zMEjviX9Ci79
	+irpp0sbANJ2CzNASif0c4RwLKLZ3GdaQ2gvYJ1B+xnhQ3svb0cGBoAlYW/2th+G1zJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: replace memcmp() in sh_resync_l1()
Message-Id: <E1pg4yX-0003Gc-S8@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:34:33 +0000

commit 189e4dd36a0940b490f9844d75b2843717216da5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 24 11:10:41 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:10:41 2023 +0100

    x86/shadow: replace memcmp() in sh_resync_l1()
    
    Ordinary scalar operations are used in a multitude of other places, so
    do so here as well. In fact take the opportunity and drop a local
    variable then as well, first and foremost to get rid of a bogus cast.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 106f95cccc..e4dd50e01c 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -1668,9 +1668,8 @@ void sh_resync_l1(struct vcpu *v, mfn_t gl1mfn, mfn_t snpmfn)
 
    SHADOW_FOREACH_L1E(sl1mfn, sl1p, &gl1p, 0, {
         guest_l1e_t gl1e = *gl1p;
-        guest_l1e_t *snpl1p = (guest_l1e_t *)snp + guest_index(gl1p);
 
-        if ( memcmp(snpl1p, &gl1e, sizeof(gl1e)) )
+        if ( snp[guest_index(gl1p)].l1 != gl1e.l1 )
         {
             gfn_t gfn;
             mfn_t gmfn = INVALID_MFN;
@@ -1686,7 +1685,7 @@ void sh_resync_l1(struct vcpu *v, mfn_t gl1mfn, mfn_t snpmfn)
 
             l1e_propagate_from_guest(v, gl1e, gmfn, &nsl1e, ft_prefetch, p2mt);
             rc |= shadow_set_l1e(d, sl1p, nsl1e, p2mt, sl1mfn);
-            *snpl1p = gl1e;
+            snp[guest_index(gl1p)] = gl1e;
         }
     });
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:34:45 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:34:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514664.797038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4yj-00009g-FM; Sat, 25 Mar 2023 14:34:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514664.797038; Sat, 25 Mar 2023 14: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 1pg4yj-00009Y-Cm; Sat, 25 Mar 2023 14:34:45 +0000
Received: by outflank-mailman (input) for mailman id 514664;
 Sat, 25 Mar 2023 14: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 1pg4yi-00009H-1H
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4yi-0004eG-0M
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:34:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4yh-0003HQ-Vi
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=JGcOxgvWd4VSVQXibEHNLOnveuiHmtm0mz8gThENzg8=; b=fsilbOS1kKHcokHqKkvwW+Kjmn
	qTLxAUnTAlVEtacjZir15vL1GZAjd+/30TC/hCwTXS2UrJePRlrEOOe/IM+pMt2G8XxsEgC+7Zikc
	mKqS2N5BJPGjHODrcTWtolkSYasB0eiISU0AnuUi71wcvD9OLr4jy/fpdkKrj5wAktQI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: conditionalize arch_set_info_guest()'s call to update_cr3()
Message-Id: <E1pg4yh-0003HQ-Vi@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:34:43 +0000

commit 1bbfdc1636c272c48fa74afa69526911d3c2c3aa
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 24 11:11:48 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:11:48 2023 +0100

    x86/PV: conditionalize arch_set_info_guest()'s call to update_cr3()
    
    sh_update_paging_modes() as its last action already invokes
    sh_update_cr3(). Therefore there is no reason to invoke update_cr3()
    another time immediately after calling paging_update_paging_modes(),
    especially as sh_update_cr3() does not short-circuit the "nothing
    changed" case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index a42f03e8e5..6b2e32d244 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1445,8 +1445,8 @@ int arch_set_info_guest(
 
     if ( paging_mode_enabled(d) )
         paging_update_paging_modes(v);
-
-    update_cr3(v);
+    else
+        update_cr3(v);
 #endif /* CONFIG_PV */
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:34:55 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:34:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514665.797042 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4yt-0000Ce-Gz; Sat, 25 Mar 2023 14:34:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514665.797042; Sat, 25 Mar 2023 14: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 1pg4yt-0000CU-EF; Sat, 25 Mar 2023 14:34:55 +0000
Received: by outflank-mailman (input) for mailman id 514665;
 Sat, 25 Mar 2023 14: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 1pg4ys-0000CK-57
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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 1pg4ys-0004fz-4D
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:34:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4ys-0003IF-2y
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14: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=3XW4WVO1SifnleWAUiVAp6e2SCLXzk4egJ7va9a9SDA=; b=gzDoQtHfmN/Hdm0tte6tzuB18r
	o7giS+cEhXJj2v7oh1o/f2ReD5tPgETxL6qPXG4ac0V6xSmcuimp8asViNe/yA1NCv6ZXk7s6eG06
	ZOoxfoKu3mNe7T6JQJ2MCHSUQbXRxAKwk3YuPkRTRpcgthH/ZAZi2QK0OEjMfRKNz71Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: get rid of additional min() and max() definitions
Message-Id: <E1pg4ys-0003IF-2y@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:34:54 +0000

commit 32eafe88aa7a1478f1149b2bc89aa079e17f5673
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 24 11:12:32 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:12:32 2023 +0100

    tools: get rid of additional min() and max() definitions
    
    Defining min(), min_t(), max() and max_t() at other places than
    xen-tools/common-macros.h isn't needed, as the definitions in said
    header can be used instead.
    
    Same applies to BUILD_BUG_ON() in hvmloader.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/firmware/hvmloader/util.h |  8 ++------
 tools/libs/vchan/init.c         |  3 +--
 tools/tests/vpci/Makefile       |  2 +-
 tools/tests/vpci/emul.h         | 18 ++----------------
 4 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index 8d95eab28a..e04990ee97 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -9,6 +9,8 @@
 #include <xen/hvm/hvm_info_table.h>
 #include "e820.h"
 
+#include <xen-tools/common-macros.h>
+
 /* Request un-prefixed values from errno.h. */
 #define XEN_ERRNO(name, value) name = value,
 enum {
@@ -41,12 +43,6 @@ void __assert_failed(const char *assertion, const char *file, int line)
 void __bug(const char *file, int line) __attribute__((noreturn));
 #define BUG() __bug(__FILE__, __LINE__)
 #define BUG_ON(p) do { if (p) BUG(); } while (0)
-#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
-
-#define min_t(type,x,y) \
-        ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#define max_t(type,x,y) \
-        ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
 
 #define MB(mb) (mb##ULL << 20)
 #define GB(gb) (gb##ULL << 30)
diff --git a/tools/libs/vchan/init.c b/tools/libs/vchan/init.c
index 9195bd3b98..021e1f29e1 100644
--- a/tools/libs/vchan/init.c
+++ b/tools/libs/vchan/init.c
@@ -45,6 +45,7 @@
 #include <xen/sys/gntalloc.h>
 #include <xen/sys/gntdev.h>
 #include <libxenvchan.h>
+#include <xen-tools/common-macros.h>
 
 #include "vchan.h"
 
@@ -72,8 +73,6 @@
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 #endif
 
-#define max(a,b) ((a > b) ? a : b)
-
 static int init_gnt_srv(struct libxenvchan *ctrl, int domain)
 {
 	int pages_left = ctrl->read.order >= PAGE_SHIFT ? 1 << (ctrl->read.order - PAGE_SHIFT) : 0;
diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile
index 5075bc2be2..62f21f341a 100644
--- a/tools/tests/vpci/Makefile
+++ b/tools/tests/vpci/Makefile
@@ -11,7 +11,7 @@ run: $(TARGET)
 	./$(TARGET)
 
 $(TARGET): vpci.c vpci.h list.h main.c emul.h
-	$(HOSTCC) -g -o $@ vpci.c main.c
+	$(HOSTCC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c
 
 .PHONY: clean
 clean:
diff --git a/tools/tests/vpci/emul.h b/tools/tests/vpci/emul.h
index f03e3a56d1..d26e00b9d7 100644
--- a/tools/tests/vpci/emul.h
+++ b/tools/tests/vpci/emul.h
@@ -27,6 +27,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <xen-tools/common-macros.h>
+
 #define container_of(ptr, type, member) ({                      \
         typeof(((type *)0)->member) *mptr = (ptr);              \
                                                                 \
@@ -110,22 +112,6 @@ typedef union {
 #define BUG() assert(0)
 #define ASSERT_UNREACHABLE() assert(0)
 
-#define min(x, y) ({                    \
-        const typeof(x) tx = (x);       \
-        const typeof(y) ty = (y);       \
-                                        \
-        (void) (&tx == &ty);            \
-        tx < ty ? tx : ty;              \
-})
-
-#define max(x, y) ({                    \
-        const typeof(x) tx = (x);       \
-        const typeof(y) ty = (y);       \
-                                        \
-        (void) (&tx == &ty);            \
-        tx > ty ? tx : ty;              \
-})
-
 #endif
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:35:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:35:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514666.797047 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4z3-0000Er-Jh; Sat, 25 Mar 2023 14:35:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514666.797047; Sat, 25 Mar 2023 14:35: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 1pg4z3-0000Ej-Fo; Sat, 25 Mar 2023 14:35:05 +0000
Received: by outflank-mailman (input) for mailman id 514666;
 Sat, 25 Mar 2023 14:35: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 1pg4z2-0000Ec-8j
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35: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 1pg4z2-0004gL-7o
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4z2-0003Jk-6x
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35: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=r/DgyEyziQt9AyvWp0/MRoi+ioAfQs88weJ07pxHUx8=; b=FirABGsi9N+2ByEaLl14v4WT4W
	waM7sGaIAz9JxygmuNryNdDlZSh5BgLWasJ641RiaF8KZKfFH7pkG/+rgX4DsAHQ9rPEWmPZU+9qk
	5qeEUwoPk/FYVazT+OSGxFJ2QCJ8njoTvMX4AY/PGDNlSsDAKHLQoR77J1rG7w6YZIDo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: add container_of() macro to xen-tools/common-macros.h
Message-Id: <E1pg4z2-0003Jk-6x@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:35:04 +0000

commit ea0358b666ee2562dee61293a1cf1a354826aa26
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 24 11:13:43 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:13:43 2023 +0100

    tools: add container_of() macro to xen-tools/common-macros.h
    
    Instead of having 3 identical copies of the definition of a
    container_of() macro in different tools header files, add that macro
    to xen-tools/common-macros.h and use that instead.
    
    Delete the other copies of that macro.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/include/xen-tools/common-macros.h | 5 +++++
 tools/tests/vpci/emul.h                 | 6 ------
 tools/tests/x86_emulator/x86-emulate.h  | 5 -----
 tools/xenstore/list.h                   | 6 ++----
 4 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/tools/include/xen-tools/common-macros.h b/tools/include/xen-tools/common-macros.h
index a372b9ecf2..76b55bf620 100644
--- a/tools/include/xen-tools/common-macros.h
+++ b/tools/include/xen-tools/common-macros.h
@@ -76,4 +76,9 @@
 #define __must_check __attribute__((__warn_unused_result__))
 #endif
 
+#define container_of(ptr, type, member) ({              \
+    typeof(((type *)0)->member) *mptr__ = (ptr);        \
+    (type *)((char *)mptr__ - offsetof(type, member));  \
+})
+
 #endif	/* __XEN_TOOLS_COMMON_MACROS__ */
diff --git a/tools/tests/vpci/emul.h b/tools/tests/vpci/emul.h
index d26e00b9d7..8c5bcadd5f 100644
--- a/tools/tests/vpci/emul.h
+++ b/tools/tests/vpci/emul.h
@@ -29,12 +29,6 @@
 
 #include <xen-tools/common-macros.h>
 
-#define container_of(ptr, type, member) ({                      \
-        typeof(((type *)0)->member) *mptr = (ptr);              \
-                                                                \
-        (type *)((char *)mptr - offsetof(type, member));        \
-})
-
 #define smp_wmb()
 #define prefetch(x) __builtin_prefetch(x)
 #define ASSERT(x) assert(x)
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 46d4e43cea..1af986f78d 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -56,11 +56,6 @@
 
 #define cf_check /* No Control Flow Integriy checking */
 
-#define container_of(ptr, type, member) ({             \
-    typeof(((type *)0)->member) *mptr__ = (ptr);       \
-    (type *)((char *)mptr__ - offsetof(type, member)); \
-})
-
 #define AC_(n,t) (n##t)
 #define _AC(n,t) AC_(n,t)
 
diff --git a/tools/xenstore/list.h b/tools/xenstore/list.h
index b17d13e0ec..a464a38b61 100644
--- a/tools/xenstore/list.h
+++ b/tools/xenstore/list.h
@@ -3,6 +3,8 @@
 /* Taken from Linux kernel code, but de-kernelized for userspace. */
 #include <stddef.h>
 
+#include <xen-tools/common-macros.h>
+
 #undef LIST_HEAD_INIT
 #undef LIST_HEAD
 #undef INIT_LIST_HEAD
@@ -15,10 +17,6 @@
 #define LIST_POISON1  ((void *) 0x00100100)
 #define LIST_POISON2  ((void *) 0x00200200)
 
-#define container_of(ptr, type, member) ({			\
-        typeof( ((type *)0)->member ) *__mptr = (ptr);	\
-        (type *)( (char *)__mptr - offsetof(type,member) );})
-
 /*
  * Simple doubly linked list implementation.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:35:15 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:35:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514667.797049 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4zD-0000Jk-Jx; Sat, 25 Mar 2023 14:35:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514667.797049; Sat, 25 Mar 2023 14:35: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 1pg4zD-0000Jd-HO; Sat, 25 Mar 2023 14:35:15 +0000
Received: by outflank-mailman (input) for mailman id 514667;
 Sat, 25 Mar 2023 14:35: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 1pg4zC-0000JG-CD
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35: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 1pg4zC-0004gU-BN
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4zC-0003KX-AU
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/4igF4RKsjkCUd2lMrEmGBReNwt7yibC5Kc7Vl1Gfho=; b=ZRJo8dmcmuCSSPrGXxANCujcls
	NquHK4572wSs9qfWiRsamLF8tm07epJJn0F15yCADVfESW02xySZqZGAah3NN++RUGKo5M6sHVIdK
	PKJ2LUCFoLSsdfNaOf7xEUjD+VrBLyLhPxBZ0aXp9OAfJ9Ulg2zOTv2Djqji+iiRl8h0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/hvmloader: remove private offsetof() definition
Message-Id: <E1pg4zC-0003KX-AU@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:35:14 +0000

commit 606ff39a11063e70240ed8c03656f5be7ef95636
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 24 11:13:57 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:13:57 2023 +0100

    tools/hvmloader: remove private offsetof() definition
    
    util.h contains a definition of offsetof(), which isn't needed, as
    firmware/include/stddef.h's doesn't really need overriding.
    
    Remove it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/util.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index e04990ee97..7249773eeb 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -30,9 +30,6 @@ enum {
 #define SEL_DATA32          0x0020
 #define SEL_CODE64          0x0028
 
-#undef offsetof
-#define offsetof(t, m) ((unsigned long)&((t *)0)->m)
-
 #undef NULL
 #define NULL ((void*)0)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:35:25 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:35:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514668.797054 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4zN-0000MN-Lj; Sat, 25 Mar 2023 14:35:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514668.797054; Sat, 25 Mar 2023 14:35:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4zN-0000MD-Ir; Sat, 25 Mar 2023 14:35:25 +0000
Received: by outflank-mailman (input) for mailman id 514668;
 Sat, 25 Mar 2023 14: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 1pg4zM-0000M3-Fe
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35: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 1pg4zM-0004gm-Ei
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4zM-0003LI-Dw
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yTOT58Vuj1H3Mig3pRMk1YiS0iXArj0xyyODNKMybwE=; b=VWfU+X2bsesJquznxmjEFfchI1
	0kYFmi3HbUNJLcVr+U1iYlgTYuDiNv0f/rl8X5YQ7iookQE88Kg6MPL1QhcVGhKXnhLlWuaBxe8pF
	io2t0nfz2Q9eacdvrmvxdJCtT7FDmvziN13oa7Z+rGWMYkkMg13vM8XvJQq5R7TOvaXM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libfsimage: remove private offsetof() definition
Message-Id: <E1pg4zM-0003LI-Dw@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:35:24 +0000

commit 6ca13bec086c361079b91e130921acc8d5de7ef8
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 24 11:14:11 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:14:11 2023 +0100

    tools/libfsimage: remove private offsetof() definition
    
    xfs/fsys_xfs.c is defining offsetof privately. Remove that definition
    and just use stddef.h instead.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libfsimage/xfs/fsys_xfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/libfsimage/xfs/fsys_xfs.c b/tools/libfsimage/xfs/fsys_xfs.c
index d735a88e55..b8b4ca928c 100644
--- a/tools/libfsimage/xfs/fsys_xfs.c
+++ b/tools/libfsimage/xfs/fsys_xfs.c
@@ -17,6 +17,7 @@
  *  along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <stddef.h>
 #include <xenfsimage_grub.h>
 #include "xfs.h"
 
@@ -182,9 +183,6 @@ fsb2daddr (xfs_fsblock_t fsbno)
 			 (xfs_agblock_t)(fsbno & mask32lo(xfs.agblklog)));
 }
 
-#undef offsetof
-#define offsetof(t,m)	((size_t)&(((t *)0)->m))
-
 static inline int
 btroot_maxrecs (fsi_file_t *ffi)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:35:36 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:35:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514669.797058 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4zX-0000Pn-My; Sat, 25 Mar 2023 14:35:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514669.797058; Sat, 25 Mar 2023 14:35:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4zX-0000Pf-KG; Sat, 25 Mar 2023 14:35:35 +0000
Received: by outflank-mailman (input) for mailman id 514669;
 Sat, 25 Mar 2023 14:35: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 1pg4zW-0000PO-Ip
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35: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 1pg4zW-0004hC-Hz
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4zW-0003MG-HI
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kaVAeIBJ4Ohz/4dxYykYAesf17iIcuoF5wdz4U0gKmQ=; b=nCRS0CirSDnDnIvaVd5MXsSzdz
	exLi83z455LADYFjse4FcqUslTJZvu16tYmJ6VGMcYKkZ/8WRrmvvzETTkjGUx3d1I57AY+3/gN+O
	NaBg4Xo+OGfnP1y5hKC8Q6v54f31mK5oFwC5W/a8bDjkCqsC3KSlVapC6Mjhj0cqsmuw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/vchan: remove private offsetof() definition
Message-Id: <E1pg4zW-0003MG-HI@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:35:34 +0000

commit 809882cb34c8f275c8901c62b5cb1f62b86048d8
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 24 11:14:25 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:14:25 2023 +0100

    tools/libs/vchan: remove private offsetof() definition
    
    vchan/init.c is defining offsetof privately. Remove that definition
    and just use stddef.h instead.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/vchan/init.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/libs/vchan/init.c b/tools/libs/vchan/init.c
index 021e1f29e1..a081dd4c9a 100644
--- a/tools/libs/vchan/init.c
+++ b/tools/libs/vchan/init.c
@@ -32,6 +32,7 @@
 #include <sys/mman.h>
 #include <sys/ioctl.h>
 #include <sys/user.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -69,10 +70,6 @@
 #define MAX_RING_SHIFT 20
 #define MAX_RING_SIZE (1 << MAX_RING_SHIFT)
 
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
 static int init_gnt_srv(struct libxenvchan *ctrl, int domain)
 {
 	int pages_left = ctrl->read.order >= PAGE_SHIFT ? 1 << (ctrl->read.order - PAGE_SHIFT) : 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:35:46 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:35:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514670.797062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4zi-0000Sh-Oy; Sat, 25 Mar 2023 14:35:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514670.797062; Sat, 25 Mar 2023 14:35: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 1pg4zi-0000SZ-M4; Sat, 25 Mar 2023 14:35:46 +0000
Received: by outflank-mailman (input) for mailman id 514670;
 Sat, 25 Mar 2023 14:35: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 1pg4zg-0000SN-O7
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35: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 1pg4zg-0004hN-N9
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4zg-0003N3-Ky
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=axIkjbAVAd85MID1Y99crIDJyBjX8YOJJIEwzOD2umU=; b=yo0CT/iRaA62foM/WrOY+md/Z1
	BD6yEIMS2vkV2f8L4vbXgTeD/XDC5qnsxT+z/E64Fr1wN7jfJ1TbshE8P+NpA4ULZFhc667YNtqFf
	rxup8LgYsaXtJNYm5S7oUMZPW/dcaSNOkMsVNo8Irf+J056TQP4c6mohmQUo1OyD62ig=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: purge {write,cmpxchg}_guest_entry() hooks
Message-Id: <E1pg4zg-0003N3-Ky@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:35:44 +0000

commit 36053bdddec20b0209c7f485e33c162410454324
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 24 11:19:37 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:19:37 2023 +0100

    x86/shadow: purge {write,cmpxchg}_guest_entry() hooks
    
    These aren't mode dependent (see 06f04f54ba97 ["x86/shadow:
    sh_{write,cmpxchg}_guest_entry() are PV-only"], where they were moved
    out of multi.c) and hence there's no need to have pointers to the
    functions in struct shadow_paging_mode. Due to include dependencies,
    however, the "paging" wrappers need to move out of paging.h; they're
    needed from PV memory management code only anyway, so by moving them
    their exposure is reduced at the same time.
    
    By carefully placing the (moved and renamed) shadow function
    declarations, #ifdef can also be dropped from the "paging" wrappers
    (paging_mode_shadow() is constant false when !SHADOW_PAGING).
    
    While moving the code, drop the (largely wrong) comment from
    paging_write_guest_entry() and reduce that of
    paging_cmpxchg_guest_entry().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/paging.h | 45 ---------------------------------------
 xen/arch/x86/include/asm/shadow.h |  6 ++++++
 xen/arch/x86/mm/shadow/multi.c    |  4 ----
 xen/arch/x86/mm/shadow/private.h  |  6 ------
 xen/arch/x86/mm/shadow/pv.c       | 12 +++++------
 xen/arch/x86/pv/mm.h              | 21 ++++++++++++++++++
 6 files changed, 33 insertions(+), 61 deletions(-)

diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index 38bec8af2e..289a83156a 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -98,13 +98,6 @@
 
 struct shadow_paging_mode {
 #ifdef CONFIG_SHADOW_PAGING
-#ifdef CONFIG_PV
-    void          (*write_guest_entry     )(struct vcpu *v, intpte_t *p,
-                                            intpte_t new, mfn_t gmfn);
-    intpte_t      (*cmpxchg_guest_entry   )(struct vcpu *v, intpte_t *p,
-                                            intpte_t old, intpte_t new,
-                                            mfn_t gmfn);
-#endif
 #ifdef CONFIG_HVM
     int           (*guess_wrmap           )(struct vcpu *v, 
                                             unsigned long vaddr, mfn_t gmfn);
@@ -326,44 +319,6 @@ static inline void paging_update_paging_modes(struct vcpu *v)
     v->domain->arch.paging.update_paging_modes(v);
 }
 
-#ifdef CONFIG_PV
-
-/*
- * Write a new value into the guest pagetable, and update the
- * paging-assistance state appropriately.  Returns false if we page-faulted,
- * true for success.
- */
-static inline void paging_write_guest_entry(
-    struct vcpu *v, intpte_t *p, intpte_t new, mfn_t gmfn)
-{
-#ifdef CONFIG_SHADOW_PAGING
-    if ( unlikely(paging_mode_shadow(v->domain)) && paging_get_hostmode(v) )
-        paging_get_hostmode(v)->shadow.write_guest_entry(v, p, new, gmfn);
-    else
-#endif
-        write_atomic(p, new);
-}
-
-
-/*
- * Cmpxchg a new value into the guest pagetable, and update the
- * paging-assistance state appropriately.  Returns false if we page-faulted,
- * true if not.  N.B. caller should check the value of "old" to see if the
- * cmpxchg itself was successful.
- */
-static inline intpte_t paging_cmpxchg_guest_entry(
-    struct vcpu *v, intpte_t *p, intpte_t old, intpte_t new, mfn_t gmfn)
-{
-#ifdef CONFIG_SHADOW_PAGING
-    if ( unlikely(paging_mode_shadow(v->domain)) && paging_get_hostmode(v) )
-        return paging_get_hostmode(v)->shadow.cmpxchg_guest_entry(v, p, old,
-                                                                  new, gmfn);
-#endif
-    return cmpxchg(p, old, new);
-}
-
-#endif /* CONFIG_PV */
-
 /* Helper function that writes a pte in such a way that a concurrent read 
  * never sees a half-written entry that has _PAGE_PRESENT set */
 static inline void safe_write_pte(l1_pgentry_t *p, l1_pgentry_t new)
diff --git a/xen/arch/x86/include/asm/shadow.h b/xen/arch/x86/include/asm/shadow.h
index 73122f0312..ba2b0e170b 100644
--- a/xen/arch/x86/include/asm/shadow.h
+++ b/xen/arch/x86/include/asm/shadow.h
@@ -248,6 +248,12 @@ static inline void pv_l1tf_domain_destroy(struct domain *d)
 #endif
 }
 
+/* Functions that atomically write PV guest PT entries */
+void shadow_write_guest_entry(
+    struct vcpu *v, intpte_t *p, intpte_t new, mfn_t gmfn);
+intpte_t shadow_cmpxchg_guest_entry(
+    struct vcpu *v, intpte_t *p, intpte_t old, intpte_t new, mfn_t gmfn);
+
 #endif /* CONFIG_PV */
 
 /* Remove all shadows of the guest mfn. */
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index e4dd50e01c..8699de0501 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4155,10 +4155,6 @@ const struct paging_mode sh_paging_mode = {
 #endif
     .update_cr3                    = sh_update_cr3,
     .guest_levels                  = GUEST_PAGING_LEVELS,
-#ifdef CONFIG_PV
-    .shadow.write_guest_entry      = sh_write_guest_entry,
-    .shadow.cmpxchg_guest_entry    = sh_cmpxchg_guest_entry,
-#endif
 #ifdef CONFIG_HVM
 #if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC
     .shadow.guess_wrmap            = sh_guess_wrmap,
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 1c3d15fa2e..59443c3171 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -428,12 +428,6 @@ static inline int sh_remove_write_access(struct domain *d, mfn_t readonly_mfn,
 }
 #endif
 
-/* Functions that atomically write PV guest PT entries */
-void cf_check sh_write_guest_entry(
-    struct vcpu *v, intpte_t *p, intpte_t new, mfn_t gmfn);
-intpte_t cf_check sh_cmpxchg_guest_entry(
-    struct vcpu *v, intpte_t *p, intpte_t old, intpte_t new, mfn_t gmfn);
-
 /* Unhook the non-Xen mappings in this top-level shadow mfn.
  * With user_only == 1, unhooks only the user-mode mappings. */
 void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only);
diff --git a/xen/arch/x86/mm/shadow/pv.c b/xen/arch/x86/mm/shadow/pv.c
index ed10d5479c..0ef8e53d12 100644
--- a/xen/arch/x86/mm/shadow/pv.c
+++ b/xen/arch/x86/mm/shadow/pv.c
@@ -28,8 +28,8 @@
  * Write a new value into the guest pagetable, and update the shadows
  * appropriately.
  */
-void cf_check
-sh_write_guest_entry(struct vcpu *v, intpte_t *p, intpte_t new, mfn_t gmfn)
+void
+shadow_write_guest_entry(struct vcpu *v, intpte_t *p, intpte_t new, mfn_t gmfn)
 {
     paging_lock(v->domain);
     write_atomic(p, new);
@@ -38,13 +38,13 @@ sh_write_guest_entry(struct vcpu *v, intpte_t *p, intpte_t new, mfn_t gmfn)
 }
 
 /*
- * Cmpxchg a new value into the guest pagetable, and update the shadows
+ * Compare and exchange a guest pagetable entry, and update the shadows
  * appropriately.  Returns the previous entry found, which the caller is
  * expected to check to see if the cmpxchg was successful.
  */
-intpte_t cf_check
-sh_cmpxchg_guest_entry(struct vcpu *v, intpte_t *p, intpte_t old,
-                       intpte_t new, mfn_t gmfn)
+intpte_t
+shadow_cmpxchg_guest_entry(struct vcpu *v, intpte_t *p, intpte_t old,
+                           intpte_t new, mfn_t gmfn)
 {
     intpte_t t;
 
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
index 5a117c735d..4564cab9fc 100644
--- a/xen/arch/x86/pv/mm.h
+++ b/xen/arch/x86/pv/mm.h
@@ -1,6 +1,8 @@
 #ifndef __PV_MM_H__
 #define __PV_MM_H__
 
+#include <asm/shadow.h>
+
 l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn);
 
 int new_guest_cr3(mfn_t mfn);
@@ -31,6 +33,25 @@ static inline l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
     return l1e;
 }
 
+static inline void paging_write_guest_entry(
+    struct vcpu *v, intpte_t *p, intpte_t new, mfn_t gmfn)
+{
+    if ( unlikely(paging_mode_shadow(v->domain)) )
+        shadow_write_guest_entry(v, p, new, gmfn);
+    else
+        write_atomic(p, new);
+}
+
+
+/* Compare and exchange a guest pagetable entry.  Returns the old value. */
+static inline intpte_t paging_cmpxchg_guest_entry(
+    struct vcpu *v, intpte_t *p, intpte_t old, intpte_t new, mfn_t gmfn)
+{
+    if ( unlikely(paging_mode_shadow(v->domain)) )
+        return shadow_cmpxchg_guest_entry(v, p, old, new, gmfn);
+    return cmpxchg(p, old, new);
+}
+
 /*
  * PTE updates can be done with ordinary writes except:
  *  1. Debug builds get extra checking by using CMPXCHG[8B].
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:35:56 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:35:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514671.797067 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg4zs-0000W2-Sa; Sat, 25 Mar 2023 14:35:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514671.797067; Sat, 25 Mar 2023 14:35: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 1pg4zs-0000Vu-Pk; Sat, 25 Mar 2023 14:35:56 +0000
Received: by outflank-mailman (input) for mailman id 514671;
 Sat, 25 Mar 2023 14:35: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 1pg4zq-0000Vc-S2
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35: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 1pg4zq-0004ha-R9
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg4zq-0003Nt-Q7
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:35:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OXCFYrp+vS23lbxTIsJeJRzaDyfwLYcsd7ZvviimHdc=; b=wEebBQlnp5S2W6/YkD6H/lyZuf
	xdkzJUyJ6pNSFeLOooHwKqY5/xKbe7S94JjcDGwTyFIOUpd5XKBxTVsOxSYaaUFxoo9Nmv7L7xZwD
	Fc3khmP7whdK+xeHD3AmfUhq1HAchvdhBQu03sgqOwILERh6Dy05EqNy7xjj96I8o7e8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: OOS mode is HVM-only
Message-Id: <E1pg4zq-0003Nt-Q7@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:35:54 +0000

commit 9fa425875362cfdb4717a68455fa7ba5dd969780
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 24 11:20:59 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 24 11:20:59 2023 +0100

    x86/shadow: OOS mode is HVM-only
    
    XEN_DOMCTL_CDF_oos_off is forced set for PV domains, so the logic can't
    ever be engaged for them. Conditionalize respective fields and remove
    the respective bit from SHADOW_OPTIMIZATIONS when !HVM. As a result the
    SH_type_oos_snapshot constant can disappear altogether in that case, and
    a couple of #ifdef-s can also be dropped/combined.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/domain.h | 4 +---
 xen/arch/x86/mm/shadow/common.c   | 2 --
 xen/arch/x86/mm/shadow/private.h  | 9 +++------
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 0ccb58b72e..d072ba038d 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -113,10 +113,10 @@ struct shadow_domain {
     /* Fast MMIO path heuristic */
     bool has_fast_mmio_entries;
 
+#ifdef CONFIG_HVM
     /* OOS */
     bool_t oos_active;
 
-#ifdef CONFIG_HVM
     /* Has this domain ever used HVMOP_pagetable_dying? */
     bool_t pagetable_dying_op;
 #endif
@@ -152,7 +152,6 @@ struct shadow_vcpu {
     unsigned long last_emulated_frame;
     /* Last MFN that we emulated a write successfully */
     unsigned long last_emulated_mfn;
-#endif
 
     /* Shadow out-of-sync: pages that this vcpu has let go out of sync */
     mfn_t oos[SHADOW_OOS_PAGES];
@@ -163,7 +162,6 @@ struct shadow_vcpu {
         unsigned long off[SHADOW_OOS_FIXUPS];
     } oos_fixup[SHADOW_OOS_PAGES];
 
-#ifdef CONFIG_HVM
     bool_t pagetable_dying;
 #endif
 #endif
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 0e5e0bdbd6..1c1b0ad0d8 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -296,7 +296,6 @@ static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn,
 
     switch ( mfn_to_page(smfn)->u.sh.type )
     {
-#ifdef CONFIG_HVM
     case SH_type_l1_32_shadow:
     case SH_type_fl1_32_shadow:
         return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 2)
@@ -306,7 +305,6 @@ static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn,
     case SH_type_fl1_pae_shadow:
         return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 3)
             (d, gmfn, smfn, off);
-#endif
 
     case SH_type_l1_64_shadow:
     case SH_type_fl1_64_shadow:
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 59443c3171..d9a127e15d 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -69,7 +69,8 @@ extern int shadow_audit_enable;
 #ifdef CONFIG_HVM
 #define SHADOW_OPTIMIZATIONS     0x1ff
 #else
-#define SHADOW_OPTIMIZATIONS     (0x1ff & ~SHOPT_FAST_EMULATION)
+#define SHADOW_OPTIMIZATIONS     (0x1ff & ~(SHOPT_OUT_OF_SYNC | \
+                                            SHOPT_FAST_EMULATION))
 #endif
 
 
@@ -205,8 +206,7 @@ extern void shadow_audit_tables(struct vcpu *v);
 #define SH_type_max_shadow     6U
 #define SH_type_p2m_table      7U /* in use as the p2m table */
 #define SH_type_monitor_table  8U /* in use as a monitor table */
-#define SH_type_oos_snapshot   9U /* in use as OOS snapshot */
-#define SH_type_unused        10U
+#define SH_type_unused         9U
 #endif
 
 #ifndef CONFIG_PV32 /* Unused (but uglier to #ifdef above): */
@@ -323,8 +323,6 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_out_of_sync (1u << (SH_type_max_shadow + 1))
 #define SHF_oos_may_write (1u << (SH_type_max_shadow + 2))
 
-#endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */
-
 static inline int sh_page_has_multiple_shadows(struct page_info *pg)
 {
     u32 shadows;
@@ -335,7 +333,6 @@ static inline int sh_page_has_multiple_shadows(struct page_info *pg)
     return shadows && (shadows & (shadows - 1));
 }
 
-#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
 /* The caller must verify this is reasonable to call; i.e., valid mfn,
  * domain is translated, &c */
 static inline int page_is_out_of_sync(struct page_info *p)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:36:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:36:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514672.797070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg502-0000YV-Ty; Sat, 25 Mar 2023 14:36:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514672.797070; Sat, 25 Mar 2023 14:36: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 1pg502-0000YN-RD; Sat, 25 Mar 2023 14:36:06 +0000
Received: by outflank-mailman (input) for mailman id 514672;
 Sat, 25 Mar 2023 14:36: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 1pg500-0000YB-VX
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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 1pg500-0004hz-Ud
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg500-0003Ot-Tp
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vJyZMglyjgd6Dp7A7bfU0KVXaIJUHHH1pJkoWLGldnQ=; b=Bf/IETr1nap0EIWWXBNE9oZz8u
	Yz10UIjDV16DCzNpWuMPEB3tUXQas0YbghIbmNezIW5ND8qL/p/eLP6NzZd3FihGTs7f9GfI/UrLz
	NjUfY+AxbY3D+6PEJxCmeAYNLh9VeUqLQMfmj4nAG95sGctUAv4yFmu/PRjfKLhQ3lqE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/argo: Fixes to argo_dprintk()
Message-Id: <E1pg500-0003Ot-Tp@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:36:04 +0000

commit d33ccc98750aed4168df44c9a3274e24b49e2aec
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 14 14:39:55 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    xen/argo: Fixes to argo_dprintk()
    
    Rewrite argo_dprintk() so printk() format typechecking can always be
    performed.  This also fixes the fact that parameters are not evaulated at all
    in the default case.
    
    Emit the messages at XENLOG_DEBUG.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
---
 xen/common/argo.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/common/argo.c b/xen/common/argo.c
index 9ad2ecaa1e..f29fa720fc 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -313,14 +313,12 @@ static DEFINE_RWLOCK(L1_global_argo_rwlock); /* L1 */
     ((LOCKING_Read_L1 && spin_is_locked(&(d)->argo->send_L2_lock)) || \
      LOCKING_Write_L1)
 
-/* Change this to #define ARGO_DEBUG here to enable more debug messages */
-#undef ARGO_DEBUG
-
-#ifdef ARGO_DEBUG
-#define argo_dprintk(format, args...) printk("argo: " format, ## args )
-#else
-#define argo_dprintk(format, ... ) ((void)0)
-#endif
+#define ARGO_DEBUG 0
+#define argo_dprintk(fmt, args...)                      \
+    do {                                                \
+        if ( ARGO_DEBUG )                               \
+            printk(XENLOG_DEBUG "argo: " fmt, ##args);  \
+    } while ( 0 )
 
 /*
  * This hash function is used to distribute rings within the per-domain
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:36:16 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:36:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514673.797073 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg50C-0000az-VD; Sat, 25 Mar 2023 14:36:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514673.797073; Sat, 25 Mar 2023 14:36: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 1pg50C-0000as-Sf; Sat, 25 Mar 2023 14:36:16 +0000
Received: by outflank-mailman (input) for mailman id 514673;
 Sat, 25 Mar 2023 14:36: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 1pg50B-0000aZ-3G
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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 1pg50B-0004i7-2L
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg50B-0003Pk-11
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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=l5Tn2IfhPxZsExoI9uJnf3h06eRBbEw6hVGYC+XabtA=; b=5Bq5gIQ49IkIPtRhVVeeBRSP9V
	Bu6XXQ5dF/8zTAlsZimSF4AHP/K7oZcYfPcuqdCCSqNWNbgTTadWh749C2s7XrZtgpllmkOPRaZx5
	ytK0pAUl8V7igvy2gPUp5qV6VBjNm0Lr+BvGawbe3vzqGY5w6sRtVOH6vkxDcYpTXeec=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/check-endbr.sh: Explain the purpose of the script
Message-Id: <E1pg50B-0003Pk-11@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:36:15 +0000

commit cc338b48dc8c18d8c63b1c2392e3b2bd75c0ff44
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jul 5 15:51:58 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    xen/check-endbr.sh: Explain the purpose of the script
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/tools/check-endbr.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xen/tools/check-endbr.sh b/xen/tools/check-endbr.sh
index b97684ac25..bf153a570d 100755
--- a/xen/tools/check-endbr.sh
+++ b/xen/tools/check-endbr.sh
@@ -2,6 +2,15 @@
 #
 # Usage ./$0 xen-syms
 #
+# When CET-IBT (Control-flow Enforcement Technology, Indirect Branch Tracking)
+# is active, ENDBR instructions mark legal indirect branch targets in the
+# .text section.
+#
+# However x86 is a variable length instruction set so the same byte pattern
+# can exist embedded in other instructions, or crossing multiple instructions.
+# This script searches .text for any problematic byte patterns which aren't
+# legitimate ENDBR instructions.
+#
 set -e
 
 # Pretty-print parameters a little for message
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:36:27 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:36:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514674.797078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg50N-0000dv-0g; Sat, 25 Mar 2023 14:36:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514674.797078; Sat, 25 Mar 2023 14:36: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 1pg50M-0000dn-UF; Sat, 25 Mar 2023 14:36:26 +0000
Received: by outflank-mailman (input) for mailman id 514674;
 Sat, 25 Mar 2023 14:36: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 1pg50L-0000db-6l
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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 1pg50L-0004iK-5h
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg50L-0003QX-4p
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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=IjR0YHMGqOAB+JLZMd6ylZSJBiAhCyiFxHZc5Dh5Y9I=; b=mHCHaz8+a4YME24UD798XlFGse
	GBaKL9cVB2H1xwsitWlZqIxRFMIutYY0C4TflmKC3ae4DLTI2mCr4Mr3VecMnUleMjnG0oivs2T65
	YmB1a1OccyqfiEauhSjnr0lJU9H5VBdSLzfSDh44ZmYi/l8kffWqFf77jL8mbrtWbxdE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: Fix early_puts() newline handling
Message-Id: <E1pg50L-0003QX-4p@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:36:25 +0000

commit 8e7b7a7cd692113f6ae7d03bc2e81b337ec797ca
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 2 20:35:28 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    xen/riscv: Fix early_puts() newline handling
    
    OpenSBI already expands \n to \r\n.  Don't repeat the expansion, as it doubles
    the size of the resulting log with every other line being blank.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/early_printk.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/arch/riscv/early_printk.c b/xen/arch/riscv/early_printk.c
index dfe4ad77e2..610c814f54 100644
--- a/xen/arch/riscv/early_printk.c
+++ b/xen/arch/riscv/early_printk.c
@@ -27,8 +27,6 @@ void early_puts(const char *s, size_t nr)
 {
     while ( nr-- > 0 )
     {
-        if ( *s == '\n' )
-            sbi_console_putchar('\r');
         sbi_console_putchar(*s);
         s++;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:36:36 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:36:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514675.797081 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg50W-0000gV-1w; Sat, 25 Mar 2023 14:36:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514675.797081; Sat, 25 Mar 2023 14:36: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 1pg50V-0000gO-Va; Sat, 25 Mar 2023 14:36:35 +0000
Received: by outflank-mailman (input) for mailman id 514675;
 Sat, 25 Mar 2023 14:36: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 1pg50V-0000gG-A8
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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 1pg50V-0004ih-9C
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg50V-0003RP-8N
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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=IVpoTGwZJy1lIBpGMpLfH+/ObpEoHcKAP5mdrSo7xrQ=; b=QHWWgPw6kItSfPqkhYWehI9PvQ
	vkVPDmBYR1DIBoySx0oABtTDOOX/aAOrR8eYCfI34QDnwxBvNFfJv/NnPBNjfHmbF/oF4jF6fH/En
	Vr+eI3ifDQSMfd93ajpv3MoZwL8D1bNrpZTVpuz6GbE7XRfJA1+c3ANqM0Yxf6tgr68s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/migration: Fix iovec handling in send_checkpoint_dirty_pfn_list()
Message-Id: <E1pg50V-0003RP-8N@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:36:35 +0000

commit efe8de1f91deb42f5a3b8aaf9c813c7479e6d53a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 5 21:05:14 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    tools/migration: Fix iovec handling in send_checkpoint_dirty_pfn_list()
    
    We shouldn't be using two struct iovec's to write half of 'rec' each, and
    there is no need to malloc() for two struct iovec's at all.
    
    Simplify down to just two - one covering the whole of 'rec', and one covering
    the pfns array.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Olaf Hering <olaf@aepfle.de>
---
 tools/libs/guest/xg_sr_restore.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/tools/libs/guest/xg_sr_restore.c b/tools/libs/guest/xg_sr_restore.c
index 074b56d263..7314a24cf9 100644
--- a/tools/libs/guest/xg_sr_restore.c
+++ b/tools/libs/guest/xg_sr_restore.c
@@ -425,11 +425,13 @@ static int send_checkpoint_dirty_pfn_list(struct xc_sr_context *ctx)
     int rc = -1;
     unsigned int count, written;
     uint64_t i, *pfns = NULL;
-    struct iovec *iov = NULL;
     xc_shadow_op_stats_t stats = { 0, ctx->restore.p2m_size };
     struct xc_sr_record rec = {
         .type = REC_TYPE_CHECKPOINT_DIRTY_PFN_LIST,
     };
+    struct iovec iov[2] = {
+        { &rec, sizeof(rec) },
+    };
     DECLARE_HYPERCALL_BUFFER_SHADOW(unsigned long, dirty_bitmap,
                                     &ctx->restore.dirty_bitmap_hbuf);
 
@@ -471,26 +473,12 @@ static int send_checkpoint_dirty_pfn_list(struct xc_sr_context *ctx)
         pfns[written++] = i;
     }
 
-    /* iovec[] for writev(). */
-    iov = malloc(3 * sizeof(*iov));
-    if ( !iov )
-    {
-        ERROR("Unable to allocate memory for sending dirty bitmap");
-        goto err;
-    }
-
     rec.length = count * sizeof(*pfns);
 
-    iov[0].iov_base = &rec.type;
-    iov[0].iov_len = sizeof(rec.type);
-
-    iov[1].iov_base = &rec.length;
-    iov[1].iov_len = sizeof(rec.length);
-
-    iov[2].iov_base = pfns;
-    iov[2].iov_len = count * sizeof(*pfns);
+    iov[1].iov_base = pfns;
+    iov[1].iov_len = rec.length;
 
-    if ( writev_exact(ctx->restore.send_back_fd, iov, 3) )
+    if ( writev_exact(ctx->restore.send_back_fd, iov, ARRAY_SIZE(iov)) )
     {
         PERROR("Failed to write dirty bitmap to stream");
         goto err;
@@ -499,7 +487,6 @@ static int send_checkpoint_dirty_pfn_list(struct xc_sr_context *ctx)
     rc = 0;
  err:
     free(pfns);
-    free(iov);
     return rc;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:36:46 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:36:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514676.797086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg50g-0000jI-3Q; Sat, 25 Mar 2023 14:36:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514676.797086; Sat, 25 Mar 2023 14:36: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 1pg50g-0000jA-0o; Sat, 25 Mar 2023 14:36:46 +0000
Received: by outflank-mailman (input) for mailman id 514676;
 Sat, 25 Mar 2023 14:36: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 1pg50f-0000j2-DL
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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 1pg50f-0004io-CS
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg50f-0003SD-Bk
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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=cI78/TtBYrSku56iUbxVpAGX2T28Em5Lv5zEi7bm4mo=; b=GMvcez88CHCIppugxZsIeWjlRG
	kjxSFDi1neFr3zDa72D2Xs0WRQQnINjOQ4s3kAmQT1wXmNoPoeV9aSpAidG7rg5IXCi7cNtae/cZh
	HSlMtWstXJ4oOGpqc6r1xPr8XX2l2U2QfUGrLF7JM2G6ODDWLOu9ArLtbfvY39ANu5Hw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/nospec: Fix evaluate_nospec() code generation under Clang
Message-Id: <E1pg50f-0003SD-Bk@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:36:45 +0000

commit bc3c133841435829ba5c0a48427e2a77633502ab
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Apr 25 17:25:53 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    x86/nospec: Fix evaluate_nospec() code generation under Clang
    
    It turns out that evaluate_nospec() code generation is not safe under Clang.
    Given:
    
      void eval_nospec_test(int x)
      {
          if ( evaluate_nospec(x) )
              asm volatile ("nop #true" ::: "memory");
          else
              asm volatile ("nop #false" ::: "memory");
      }
    
    Clang emits:
    
      <eval_nospec_test>:
             0f ae e8                lfence
             85 ff                   test   %edi,%edi
             74 02                   je     <eval_nospec_test+0x9>
             90                      nop
             c3                      ret
             90                      nop
             c3                      ret
    
    which is not safe because the lfence has been hoisted above the conditional
    jump.  Clang concludes that both barrier_nospec_true()'s have identical side
    effects and can safely be merged.
    
    Clang can be persuaded that the side effects are different if there are
    different comments in the asm blocks.  This is fragile, but no more fragile
    that other aspects of this construct.
    
    Introduce barrier_nospec_false() with a separate internal comment to prevent
    Clang merging it with barrier_nospec_true() despite the otherwise-identical
    content.  The generated code now becomes:
    
      <eval_nospec_test>:
             85 ff                   test   %edi,%edi
             74 05                   je     <eval_nospec_test+0x9>
             0f ae e8                lfence
             90                      nop
             c3                      ret
             0f ae e8                lfence
             90                      nop
             c3                      ret
    
    which has the correct number of lfence's, and in the correct place.
    
    Link: https://github.com/llvm/llvm-project/issues/55084
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/nospec.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/nospec.h b/xen/arch/x86/include/asm/nospec.h
index 5312ae4c6f..7150e76b87 100644
--- a/xen/arch/x86/include/asm/nospec.h
+++ b/xen/arch/x86/include/asm/nospec.h
@@ -10,15 +10,26 @@
 static always_inline bool barrier_nospec_true(void)
 {
 #ifdef CONFIG_SPECULATIVE_HARDEN_BRANCH
-    alternative("lfence", "", X86_FEATURE_SC_NO_BRANCH_HARDEN);
+    alternative("lfence #nospec-true", "", X86_FEATURE_SC_NO_BRANCH_HARDEN);
 #endif
     return true;
 }
 
+static always_inline bool barrier_nospec_false(void)
+{
+#ifdef CONFIG_SPECULATIVE_HARDEN_BRANCH
+    alternative("lfence #nospec-false", "", X86_FEATURE_SC_NO_BRANCH_HARDEN);
+#endif
+    return false;
+}
+
 /* Allow to protect evaluation of conditionals with respect to speculation */
 static always_inline bool evaluate_nospec(bool condition)
 {
-    return condition ? barrier_nospec_true() : !barrier_nospec_true();
+    if ( condition )
+        return barrier_nospec_true();
+    else
+        return barrier_nospec_false();
 }
 
 /* Allow to block speculative execution in generic code */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:36:56 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:36:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514677.797090 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg50q-0000ld-53; Sat, 25 Mar 2023 14:36:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514677.797090; Sat, 25 Mar 2023 14:36: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 1pg50q-0000lV-2J; Sat, 25 Mar 2023 14:36:56 +0000
Received: by outflank-mailman (input) for mailman id 514677;
 Sat, 25 Mar 2023 14:36: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 1pg50p-0000lN-H4
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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 1pg50p-0004iz-G6
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg50p-0003Sv-FD
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:36: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=fjPBPNEMW3wILLkKUEtHt2l3gnj2U1UgaiQ1KB/iHU4=; b=VGSmA1evIv5IURcezaOwJ/Oq+u
	ZcAU6vBV89mha9KgOz8tS9oX55J+p7d3Neu1lOJv9+vuem8LTYnhDJmtpo+h8jp9nkr3woZgWJ9sw
	AL5HldJ6T10nloxy/f8elhyzOfbIGMAp9qdAP2XK1DEEE0Fl/F10ks/nGJcuI0MIIr6s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Modify domain_crash() to take a print string
Message-Id: <E1pg50p-0003Sv-FD@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:36:55 +0000

commit d7aaecd3e172eb30c79eba7049efd3c44ba4f213
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 20 15:45:02 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    xen: Modify domain_crash() to take a print string
    
    There are two problems with domain_crash().
    
    First, that it is frequently not preceded by a printk() at all, or only by a
    dprintk().  Either way, critical diagnostic information is missing for an
    event which is fatal to the guest.
    
    Second, the embedded __LINE__ is an issue for livepatching, creating unwanted
    churn in the binary diff.  This is the final __LINE__ remaining in
    livepatching-relevant contexts.
    
    The end goal is to have domain_crash() require a print string which gets fed
    to printk(), making it far less easy to omit relevant diagnostic information.
    
    However, modifying all callers at once is far too big and complicated, so use
    some macro magic to tolerate the old API (no print string) in the short term.
    
    Adjust two callers in load_segments() to demonstrate the new API.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c   | 14 ++++----------
 xen/include/xen/sched.h | 13 +++++++++----
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 6b2e32d244..d5847f70f8 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1704,11 +1704,8 @@ static void load_segments(struct vcpu *n)
                  put_guest(uregs->fs,   esp - 5) |
                  put_guest(uregs->es,   esp - 6) |
                  put_guest(uregs->ds,   esp - 7) )
-            {
-                gprintk(XENLOG_ERR,
-                        "error while creating compat failsafe callback frame\n");
-                domain_crash(n->domain);
-            }
+                domain_crash(n->domain,
+                             "Error creating compat failsafe callback frame\n");
 
             if ( n->arch.pv.vgc_flags & VGCF_failsafe_disables_events )
                 vcpu_info(n, evtchn_upcall_mask) = 1;
@@ -1743,11 +1740,8 @@ static void load_segments(struct vcpu *n)
              put_guest(uregs->ds,   rsp -  9) |
              put_guest(regs->r11,   rsp - 10) |
              put_guest(regs->rcx,   rsp - 11) )
-        {
-            gprintk(XENLOG_ERR,
-                    "error while creating failsafe callback frame\n");
-            domain_crash(n->domain);
-        }
+            domain_crash(n->domain,
+                         "Error creating failsafe callback frame\n");
 
         if ( n->arch.pv.vgc_flags & VGCF_failsafe_disables_events )
             vcpu_info(n, evtchn_upcall_mask) = 1;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 12be794002..85242a73d3 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -766,10 +766,15 @@ void vcpu_end_shutdown_deferral(struct vcpu *v);
  * from any processor.
  */
 void __domain_crash(struct domain *d);
-#define domain_crash(d) do {                                              \
-    printk("domain_crash called from %s:%d\n", __FILE__, __LINE__);       \
-    __domain_crash(d);                                                    \
-} while (0)
+#define domain_crash(d, ...)                                        \
+    do {                                                            \
+        if ( count_args(__VA_ARGS__) == 0 )                         \
+            printk(XENLOG_ERR "domain_crash called from %s:%d\n",   \
+                   __FILE__, __LINE__);                             \
+        else                                                        \
+            printk(XENLOG_ERR __VA_ARGS__);                         \
+        __domain_crash(d);                                          \
+    } while ( 0 )
 
 /*
  * Called from assembly code, with an optional address to help indicate why
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:37:06 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:37:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514678.797093 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg510-0000pV-7v; Sat, 25 Mar 2023 14:37:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514678.797093; Sat, 25 Mar 2023 14:37: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 1pg510-0000pN-59; Sat, 25 Mar 2023 14:37:06 +0000
Received: by outflank-mailman (input) for mailman id 514678;
 Sat, 25 Mar 2023 14:37: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 1pg50z-0000pG-Ko
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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 1pg50z-0004jO-Jv
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg50z-0003Vc-Ip
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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=M+nEcOHMNfTJxMcg0Q5kAdIxt6qP0ymqHetx8PAJzpE=; b=kSi+Haq33Jz5RQOU/+f1+5293Y
	nsXXA7NiQ7+JI+b/pm9A2hrY5sSYK3S/hxoYC/6TrU8iTe5Hu5mWs99IcvNx/GZCqCaWU06gT055X
	HVveUzlE4uCLtZLXzBI76HMBXobjK3IlxN3hHuw/oPUZna2pm6UIGkTycsE/Qex++tUg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvmloader: Don't build as PIC
Message-Id: <E1pg50z-0003Vc-Ip@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:37:05 +0000

commit 90b1307ffbcea76f0b31b4c5f79b18a05d2b4a17
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 24 10:48:48 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    x86/hvmloader: Don't build as PIC
    
    HVMLoader is not relocatable in memory, and 32bit PIC code has a large
    overhead.  Override the compilers choice of pic/no-pic and force it to be
    non-relocatable.
    
    Bloat-o-meter reports a net:
      add/remove: 0/0 grow/shrink: 3/107 up/down: 14/-3370 (-3356)
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile
index 4f31c88161..e5de1ade17 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -23,7 +23,7 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk
 # SMBIOS spec requires format mm/dd/yyyy
 SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y)
 
-CFLAGS += $(CFLAGS_xeninclude)
+CFLAGS += $(CFLAGS_xeninclude) -fno-pic
 
 # We mustn't use tools-only public interfaces.
 CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:37:16 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:37:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514679.797098 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg51A-0000sQ-9M; Sat, 25 Mar 2023 14:37:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514679.797098; Sat, 25 Mar 2023 14:37: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 1pg51A-0000sJ-6l; Sat, 25 Mar 2023 14:37:16 +0000
Received: by outflank-mailman (input) for mailman id 514679;
 Sat, 25 Mar 2023 14:37: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 1pg519-0000sD-OA
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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 1pg519-0004jb-NH
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg519-0003WV-MX
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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=qNr4xS8y8eyCJPQnNNLutmFOv8zRort7VP1nWTejS4M=; b=T3q1mmNujKUbsrm+C+ADaZQuMy
	2GP3k+k7mfuyJm2AcucKFir8Vn5F5Z1IiF3Lk5SgFnbUgrAV+2IA7VHO1hkVahW6aN2bLZWkXbG7L
	lqmumgcbQ+JyEFFZPcowrg3MOtOsoQrdhXcsFQNMKPifqQrUgs8tIEDIINQZl/CJw1Js=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvmloader: Don't override stddef.h
Message-Id: <E1pg519-0003WV-MX@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:37:15 +0000

commit 136f69dc66f2ea123f29fd6b058ef3abe2367036
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 24 11:06:18 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    x86/hvmloader: Don't override stddef.h
    
    Since c/s 73b13705af7c ("firmware: provide a stand alone set of headers"),
    we've had a proper stddef.h.  Actually use it.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/util.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index 7249773eeb..87be213dec 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -30,9 +30,6 @@ enum {
 #define SEL_DATA32          0x0020
 #define SEL_CODE64          0x0028
 
-#undef NULL
-#define NULL ((void*)0)
-
 void __assert_failed(const char *assertion, const char *file, int line)
     __attribute__((noreturn));
 #define ASSERT(p) \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:37:26 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:37:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514680.797102 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg51K-0000vF-As; Sat, 25 Mar 2023 14:37:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514680.797102; Sat, 25 Mar 2023 14:37: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 1pg51K-0000v7-8H; Sat, 25 Mar 2023 14:37:26 +0000
Received: by outflank-mailman (input) for mailman id 514680;
 Sat, 25 Mar 2023 14:37: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 1pg51J-0000v1-Rf
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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 1pg51J-0004ji-Qj
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg51J-0003XG-Px
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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=75lG3PcbThuQU1VmAbYM0kxjn9IpnN2P65tyTwmTdes=; b=jeXlyISUMwky5u5aXA+a3kn2qT
	gZB8TZQnXbxQf6AGvIIfcHUjiAz6W7g549gfa4C55sfeMmcv80oXmXr+XG8MHd4X2T9lPUAWkuRG8
	effHH0OK5QR4YBn2TvhTtr0KxBXHW9uT5dTr/kyEjSnPFuqfM9cD7PMfUg3ZD5hVQ/vU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: Fix build with no PG_log_dirty
Message-Id: <E1pg51J-0003XG-Px@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:37:25 +0000

commit 6d14cb105b1c54ad7b4228d858ae85aa8a672bbd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 23 23:41:20 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    x86/shadow: Fix build with no PG_log_dirty
    
    Gitlab Randconfig found:
    
      arch/x86/mm/shadow/common.c: In function 'shadow_prealloc':
      arch/x86/mm/shadow/common.c:1023:18: error: implicit declaration of function
          'paging_logdirty_levels'; did you mean 'paging_log_dirty_init'? [-Werror=implicit-function-declaration]
       1023 |         count += paging_logdirty_levels();
            |                  ^~~~~~~~~~~~~~~~~~~~~~
            |                  paging_log_dirty_init
      arch/x86/mm/shadow/common.c:1023:18: error: nested extern declaration of 'paging_logdirty_levels' [-Werror=nested-externs]
    
    The '#if PG_log_dirty' expression is currently SHADOW_PAGING && !HVM &&
    PV_SHIM_EXCLUSIVE.  Move the declaration outside.
    
    Fixes: 33fb3a661223 ("x86/shadow: account for log-dirty mode when pre-allocating")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/paging.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index 289a83156a..2647b95e67 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -142,6 +142,10 @@ struct paging_mode {
 /*****************************************************************************
  * Log dirty code */
 
+#define paging_logdirty_levels() \
+    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
+                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
+
 #if PG_log_dirty
 
 /* get the dirty bitmap for a specific range of pfns */
@@ -180,10 +184,6 @@ bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
-#define paging_logdirty_levels() \
-    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
-                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
-
 #ifdef CONFIG_HVM
 /* VRAM dirty tracking support */
 struct sh_dirty_vram {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:37:37 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:37:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514681.797106 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg51V-0000xw-Cq; Sat, 25 Mar 2023 14:37:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514681.797106; Sat, 25 Mar 2023 14:37: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 1pg51V-0000xm-9n; Sat, 25 Mar 2023 14:37:37 +0000
Received: by outflank-mailman (input) for mailman id 514681;
 Sat, 25 Mar 2023 14:37: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 1pg51T-0000xZ-VB
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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 1pg51T-0004kC-UL
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg51T-0003Y1-TV
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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=Zn+yGUzUdbqeBlN7gmqlhnBVq08DYRMrEUuqxcGIvps=; b=w8wCm9DuyIK1K4Pz0qLyFtjOH3
	QaTUNjVGuQcxIXcQUvwsDRpylSDy11ofd3MNPxDvNDBXI4AdQOCIm5uvCHVEeoqnbKxEkgXy5+MEY
	vmMvvIk4t4ehCrXNzaHBwGPVIlwv3LLgruNb9SBrf2IDSUOBl5bzbF1jIOAZU+YHknSM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Factor move_xen() out of __start_xen()
Message-Id: <E1pg51T-0003Y1-TV@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:37:35 +0000

commit 6e8973b96c3bb03808118bbc6e872c824731ce3e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 3 20:33:57 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    x86/boot: Factor move_xen() out of __start_xen()
    
    Partly for clarity because there is a lot of subtle magic at work here.
    Expand the commentary of what's going on.
    
    Also because there is no need to double copy the stack (32kB).  Spilled
    content does need accounting for, but this can be sorted by only copying only
    a handful of words.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/setup.c | 189 ++++++++++++++++++++++++++++++++-------------------
 1 file changed, 119 insertions(+), 70 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 38bf18b087..2b44a3ae26 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -464,6 +464,124 @@ static void __init move_memory(
     }
 }
 
+static void __init noinline move_xen(void)
+{
+    l4_pgentry_t *pl4e;
+    l3_pgentry_t *pl3e;
+    l2_pgentry_t *pl2e;
+    unsigned long tmp;
+    unsigned int i, j, k;
+
+    /*
+     * The caller has selected xen_phys_start, ensuring that the old and new
+     * locations do not overlap, and mapped the new location into the
+     * directmap.
+     *
+     * Prevent the compiler from reordering anything across this point.  Such
+     * things will end badly.
+     */
+    barrier();
+
+    /*
+     * Copy out of the current alias, into the directmap at the new location.
+     * This includes a snapshot of the current stack.
+     */
+    memcpy(__va(__pa(_start)), _start, _end - _start);
+
+    /*
+     * We are now in a critical region.  Any write modifying global state
+     * inside the main Xen image via the current alias will get lost when we
+     * switch to the new pagetables.
+     *
+     * This puts printk()'s in a weird position.  Xen's record of the printk()
+     * will get lost (e.g. from the console ring), but messages which properly
+     * escape the system (e.g. through the UART) may be of some use for
+     * debugging purposes.
+     *
+     * Walk the soon-to-be-used pagetables in the new location, relocating all
+     * intermediate (non-leaf) entries to point to their new-location
+     * equivalents.  All writes are via the directmap alias.
+     */
+    pl4e = __va(__pa(idle_pg_table));
+    for ( i = 0 ; i < L4_PAGETABLE_ENTRIES; i++, pl4e++ )
+    {
+        if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
+            continue;
+
+        *pl4e = l4e_from_intpte(l4e_get_intpte(*pl4e) + xen_phys_start);
+        pl3e = __va(l4e_get_paddr(*pl4e));
+        for ( j = 0; j < L3_PAGETABLE_ENTRIES; j++, pl3e++ )
+        {
+            if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) ||
+                 (l3e_get_flags(*pl3e) & _PAGE_PSE) )
+                continue;
+
+            *pl3e = l3e_from_intpte(l3e_get_intpte(*pl3e) + xen_phys_start);
+            pl2e = __va(l3e_get_paddr(*pl3e));
+            for ( k = 0; k < L2_PAGETABLE_ENTRIES; k++, pl2e++ )
+            {
+                if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ||
+                     (l2e_get_flags(*pl2e) & _PAGE_PSE) )
+                    continue;
+
+                *pl2e = l2e_from_intpte(l2e_get_intpte(*pl2e) + xen_phys_start);
+            }
+        }
+    }
+
+    /*
+     * Walk the soon-to-be-used l2_xenmap[], relocating all the leaf superpage
+     * mappings so text/data/bss etc refer to the new location in memory.
+     * Non-leaf mappings, e.g. fixmap_x, were relocated above.
+     */
+    pl2e = __va(__pa(l2_xenmap));
+    for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++, pl2e++ )
+    {
+        if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ||
+             !(l2e_get_flags(*pl2e) & _PAGE_PSE) )
+            continue;
+
+        *pl2e = l2e_from_intpte(l2e_get_intpte(*pl2e) + xen_phys_start);
+    }
+
+    asm volatile (
+        /*
+         * Resync the local stack frame.  The compiler expects any spilled
+         * expression to retain its value.  This is usually only a few words.
+         */
+        "mov    %%rsp, %%rsi\n\t"       /* SRC = %rsp */
+        "mov    %%esp, %k[tmp]\n\t"
+        "and    %[mask], %k[tmp]\n\t"
+        "add    %[tmp], %%rdi\n\t"      /* DST = cpu0_stack + (%rsp & 0x7fff) */
+        "sub    %%esp, %%ecx\n\t"       /* NR  = frame - %rsp */
+        "rep movsb\n\t"
+
+        /*
+         * Switch to the relocated pagetables, shooting down global mappings.
+         */
+        "mov    %%cr4, %[tmp]\n\t"
+        "andb   $~%c[pge], %b[tmp]\n\t"
+        "mov    %[tmp], %%cr4\n\t"     /* CR4.PGE = 0 */
+        "mov    %[cr3], %%cr3\n\t"     /* CR3 = new pagetables */
+        "orb    %[pge], %b[tmp]\n\t"
+        "mov    %[tmp], %%cr4\n\t"     /* CR4.PGE = 1 */
+        : [tmp]     "=&a" (tmp), /* Could be "r", but "a" makes better asm */
+          [dst]     "=&D" (tmp),
+          [frame]   "=&c" (tmp),
+                    "=&S" (tmp)
+        : [cr3]     "r"   (__pa(idle_pg_table)),
+          [pge]     "i"   (X86_CR4_PGE),
+          [mask]    "i"   (STACK_SIZE - 1),
+          "[dst]"         (__va(__pa(cpu0_stack))),
+          "[frame]"       (__builtin_frame_address(0))
+        : "memory" );
+
+    /*
+     * End of the critical region.  Updates to globals now work as expected.
+     */
+    printk("New Xen image base address: %#lx\n", xen_phys_start);
+}
+
 #undef BOOTSTRAP_MAP_LIMIT
 
 static uint64_t __init consider_modules(
@@ -1292,81 +1410,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
          */
         if ( (end > s) && (end - reloc_size + XEN_IMG_OFFSET >= __pa(_end)) )
         {
-            l4_pgentry_t *pl4e;
-            l3_pgentry_t *pl3e;
-            l2_pgentry_t *pl2e;
-            int i, j, k;
-
             /* Select relocation address. */
             xen_phys_start = end - reloc_size;
             e = xen_phys_start + XEN_IMG_OFFSET;
             bootsym(trampoline_xen_phys_start) = xen_phys_start;
 
-            /*
-             * Perform relocation to new physical address.
-             * Before doing so we must sync static/global data with main memory
-             * with a barrier(). After this we must *not* modify static/global
-             * data until after we have switched to the relocated pagetables!
-             */
-            barrier();
-            memcpy(__va(__pa(_start)), _start, _end - _start);
-
-            /* Walk idle_pg_table, relocating non-leaf entries. */
-            pl4e = __va(__pa(idle_pg_table));
-            for ( i = 0 ; i < L4_PAGETABLE_ENTRIES; i++, pl4e++ )
-            {
-                if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
-                    continue;
-                *pl4e = l4e_from_intpte(l4e_get_intpte(*pl4e) +
-                                        xen_phys_start);
-                pl3e = __va(l4e_get_paddr(*pl4e));
-                for ( j = 0; j < L3_PAGETABLE_ENTRIES; j++, pl3e++ )
-                {
-                    /* Not present, 1GB mapping, or already relocated? */
-                    if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) ||
-                         (l3e_get_flags(*pl3e) & _PAGE_PSE) )
-                        continue;
-                    *pl3e = l3e_from_intpte(l3e_get_intpte(*pl3e) +
-                                            xen_phys_start);
-                    pl2e = __va(l3e_get_paddr(*pl3e));
-                    for ( k = 0; k < L2_PAGETABLE_ENTRIES; k++, pl2e++ )
-                    {
-                        /* Not present, PSE, or already relocated? */
-                        if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ||
-                             (l2e_get_flags(*pl2e) & _PAGE_PSE) )
-                            continue;
-                        *pl2e = l2e_from_intpte(l2e_get_intpte(*pl2e) +
-                                                xen_phys_start);
-                    }
-                }
-            }
-
-            /* Walk l2_xenmap[], relocating 2M superpage leaves. */
-            pl2e = __va(__pa(l2_xenmap));
-            for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++, pl2e++ )
-            {
-                if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ||
-                     !(l2e_get_flags(*pl2e) & _PAGE_PSE) )
-                    continue;
-
-                *pl2e = l2e_from_intpte(l2e_get_intpte(*pl2e) + xen_phys_start);
-            }
-
-            /* Re-sync the stack and then switch to relocated pagetables. */
-            asm volatile (
-                "rep movsq        ; " /* re-sync the stack */
-                "movq %%cr4,%%rsi ; "
-                "andb $0x7f,%%sil ; "
-                "movq %%rsi,%%cr4 ; " /* CR4.PGE == 0 */
-                "movq %[pg],%%cr3 ; " /* CR3 == new pagetables */
-                "orb $0x80,%%sil  ; "
-                "movq %%rsi,%%cr4   " /* CR4.PGE == 1 */
-                : "=&S" (i), "=&D" (i), "=&c" (i) /* All outputs discarded. */
-                :  [pg] "r" (__pa(idle_pg_table)), "0" (cpu0_stack),
-                   "1" (__va(__pa(cpu0_stack))), "2" (STACK_SIZE / 8)
-                : "memory" );
-
-            printk("New Xen image base address: %#lx\n", xen_phys_start);
+            move_xen();
         }
 
         /* Is the region suitable for relocating the multiboot modules? */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:37:47 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:37:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514682.797110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg51f-00010V-E2; Sat, 25 Mar 2023 14:37:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514682.797110; Sat, 25 Mar 2023 14:37: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 1pg51f-00010M-BN; Sat, 25 Mar 2023 14:37:47 +0000
Received: by outflank-mailman (input) for mailman id 514682;
 Sat, 25 Mar 2023 14:37: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 1pg51e-00010A-2Q
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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 1pg51e-0004kJ-1a
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg51e-0003Yu-0q
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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=NcovJBKn6phApn+r+nH71McHA1i/8tn9ft8uvXbq+YM=; b=MRvYswLLhzCXAGDWt9/3MOs8Fz
	i9f72TmOi6QGfqiu9nbhcuOdDHe1+57FIgYDrMhZDx1OUPide3UjzexzTIoCZurNExS5y7pkR8qaD
	iN7TSgds+qHB6Cqhoa4f0pusR1HQ+fbMXetqWsYoroe6G7AVk9debv7yTq8Mesd1Ry/o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Improve hvm_set_guest_pat() code generation again
Message-Id: <E1pg51e-0003Yu-0q@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:37:46 +0000

commit 715b92ba30f792e326bdd37b5a4969da9c5d4a6c
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Mon May 16 20:45:13 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 12:16:31 2023 +0000

    x86/hvm: Improve hvm_set_guest_pat() code generation again
    
    Following on from cset 9ce0a5e207f3 ("x86/hvm: Improve hvm_set_guest_pat()
    code generation"), and the discovery that Clang/LLVM makes some especially
    disastrous code generation for the loop at -O2
    
      https://github.com/llvm/llvm-project/issues/54644
    
    Edvin decided to remove the loop entirely by fully vectorising it.  This is
    substantially more efficient than the loop, and rather harder for a typical
    compiler to mess up.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 51 ++++++++++++++++++++++++++++++++++----------------
 1 file changed, 35 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0c81e2afc7..7342408233 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -299,24 +299,43 @@ void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat)
         *guest_pat = v->arch.hvm.pat_cr;
 }
 
-int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
+/*
+ * MSR_PAT takes 8 uniform fields, each of which must be a valid architectural
+ * memory type (0-1, 4-7).  This is a fully vectorised form of the 8-iteration
+ * loop over bytes looking for X86_MT_* constants.
+ */
+static bool pat_valid(uint64_t val)
 {
-    unsigned int i;
-    uint64_t tmp;
+    /* Yields a non-zero value in any lane which had value greater than 7. */
+    uint64_t any_gt_7   =  val & 0xf8f8f8f8f8f8f8f8ull;
 
-    for ( i = 0, tmp = guest_pat; i < 8; i++, tmp >>= 8 )
-        switch ( tmp & 0xff )
-        {
-        case X86_MT_UCM:
-        case X86_MT_UC:
-        case X86_MT_WB:
-        case X86_MT_WC:
-        case X86_MT_WP:
-        case X86_MT_WT:
-            break;
-        default:
-            return 0;
-        }
+    /*
+     * With the > 7 case covered, identify lanes with the value 0-3 by finding
+     * lanes with bit 2 clear.
+     *
+     * Yields bit 2 set in each lane which has a value <= 3.
+     */
+    uint64_t any_le_3   = ~val & 0x0404040404040404ull;
+
+    /*
+     * Logically, any_2_or_3 is "any_le_3 && bit 1 set".
+     *
+     * We could calculate any_gt_1 as val & 0x02 and resolve the two vectors
+     * of booleans (shift one of them until the mask lines up, then bitwise
+     * and), but that is unnecessary calculation.
+     *
+     * Shift any_le_3 so it becomes bit 1 in each lane which has a value <= 3,
+     * and look for bit 1 in a subset of lanes.
+     */
+    uint64_t any_2_or_3 =  val & (any_le_3 >> 1);
+
+    return !(any_gt_7 | any_2_or_3);
+}
+
+int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
+{
+    if ( !pat_valid(guest_pat) )
+        return 0;
 
     if ( !alternative_call(hvm_funcs.set_guest_pat, v, guest_pat) )
         v->arch.hvm.pat_cr = guest_pat;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:37:56 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:37:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514685.797124 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg51o-0001IF-PH; Sat, 25 Mar 2023 14:37:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514685.797124; Sat, 25 Mar 2023 14:37: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 1pg51o-0001I1-Lv; Sat, 25 Mar 2023 14:37:56 +0000
Received: by outflank-mailman (input) for mailman id 514685;
 Sat, 25 Mar 2023 14:37: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 1pg51o-0001ET-5w
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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 1pg51o-0004kU-58
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg51o-0003Zg-4P
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:37: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=0fQ2zUva3TKvZ2ds8Qws+yPQVPGthpXk1fitWXBD7ps=; b=re85qs+B6W8rHo729jdcDXHNHy
	t6Wf1qJVO+iUFt4DtuSjldpDpXuF7aIHiBuB9+uCuyY74bQvigGmSdrPxGiP99kJ7ETy+iEkv8tFd
	kWEJOFJBahRxnSKA1H8BRJ8rHQBiSuJHUvusb7P/Q16smV3MgFiw4lV00RFJ2TzRbCRw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/trace: Don't over-read trace objects
Message-Id: <E1pg51o-0003Zg-4P@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:37:56 +0000

commit 6835f93573ad282a7cb01a6af9ee5c3add5cb4a8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 16 10:24:26 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 15:35:37 2023 +0000

    xen/trace: Don't over-read trace objects
    
    In the case that 'extra' isn't a multiple of uint32_t, the calculation rounds
    the number of bytes up, causing later logic to read unrelated bytes beyond the
    end of the object.
    
    Also, asserting that the object is within TRACE_EXTRA_MAX, but truncating it
    in release builds is rude.  Instead, reject any out-of-spec records, leaving
    enough of a message to identify the faulty caller.
    
    There is one buggy trace record, TRC_RTDS_BUDGET_BURN.  As it must remain
    __packed (as cur_budget is misaligned), change bool has_extratime to uint32_t
    to compensate.
    
    It turns out that the new printk() can also be hit by HVMOP_xentrace, because
    the hypercall is broken.  It cannot be used outside of custom debugging, as
    none of the tooling was ever updated to understand TRC_GUEST, nor is there any
    evidence of hypercall ever being used in public.
    
    While the hypercall was clearly intended to be used with units if uint32_t's,
    that's not how the API/ABI works - Xen will in fact read the entire structure
    rather than the initialised subset out of guest memory (most likely, stack
    rubble), then copy up to 3 bytes of it (rounding up to the next uint32_t) into
    the real tracebuffer.
    
    There are several possible ways to fix this, but as the hypercall, and does
    not plausibly have any users, go with the one that is least logic in Xen, by
    rejecting tracing attempts that are not of uint32_t size.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c |  5 +++--
 xen/common/sched/rt.c  | 24 +++++++++++++-----------
 xen/common/trace.c     | 21 ++++++++++-----------
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7342408233..d326fa1c01 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -5112,8 +5112,9 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( copy_from_guest(&tr, arg, 1 ) )
             return -EFAULT;
 
-        if ( tr.extra_bytes > sizeof(tr.extra)
-             || (tr.event & ~((1u<<TRC_SUBCLS_SHIFT)-1)) )
+        if ( tr.extra_bytes % sizeof(uint32_t) ||
+             tr.extra_bytes > sizeof(tr.extra) ||
+             tr.event >> TRC_SUBCLS_SHIFT )
             return -EINVAL;
 
         /* Cycles will be taken at the vmexit and vmenter */
diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index d443cd5831..b279f957f6 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -989,18 +989,20 @@ burn_budget(const struct scheduler *ops, struct rt_unit *svc, s_time_t now)
     /* TRACE */
     {
         struct __packed {
-            unsigned unit:16, dom:16;
+            uint16_t unit, dom;
             uint64_t cur_budget;
-            int delta;
-            unsigned priority_level;
-            bool has_extratime;
-        } d;
-        d.dom = svc->unit->domain->domain_id;
-        d.unit = svc->unit->unit_id;
-        d.cur_budget = (uint64_t) svc->cur_budget;
-        d.delta = delta;
-        d.priority_level = svc->priority_level;
-        d.has_extratime = svc->flags & RTDS_extratime;
+            uint32_t delta;
+            uint32_t priority_level;
+            uint32_t has_extratime;
+        } d = {
+            .unit           = svc->unit->unit_id,
+            .dom            = svc->unit->domain->domain_id,
+            .cur_budget     = svc->cur_budget,
+            .delta          = delta, /* TODO: truncation? */
+            .priority_level = svc->priority_level,
+            .has_extratime  = !!(svc->flags & RTDS_extratime),
+        };
+
         trace_var(TRC_RTDS_BUDGET_BURN, 1,
                   sizeof(d),
                   (unsigned char *) &d);
diff --git a/xen/common/trace.c b/xen/common/trace.c
index 9b4c696843..2fce3c5d71 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -686,22 +686,21 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra,
     unsigned long flags;
     u32 bytes_to_tail, bytes_to_wrap;
     unsigned int rec_size, total_size;
-    unsigned int extra_word;
     bool_t started_below_highwater;
 
     if( !tb_init_done )
         return;
 
-    /* Convert byte count into word count, rounding up */
-    extra_word = (extra / sizeof(u32));
-    if ( (extra % sizeof(u32)) != 0 )
-        extra_word++;
-    
-    ASSERT(extra_word <= TRACE_EXTRA_MAX);
-    extra_word = min_t(int, extra_word, TRACE_EXTRA_MAX);
-
-    /* Round size up to nearest word */
-    extra = extra_word * sizeof(u32);
+    /*
+     * extra data needs to be an exact multiple of uint32_t to prevent the
+     * later logic over-reading the object.  Reject out-of-spec records.  Any
+     * failure here is an error in the caller.
+     */
+    if ( extra % sizeof(uint32_t) ||
+         extra / sizeof(uint32_t) > TRACE_EXTRA_MAX )
+        return printk_once(XENLOG_WARNING
+                           "Trace event %#x bad size %u, discarding\n",
+                           event, extra);
 
     if ( (tb_event_mask & event) == 0 )
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:38:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:38:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514687.797128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg51z-0001O7-Rx; Sat, 25 Mar 2023 14:38:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514687.797128; Sat, 25 Mar 2023 14:38: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 1pg51z-0001O0-PS; Sat, 25 Mar 2023 14:38:07 +0000
Received: by outflank-mailman (input) for mailman id 514687;
 Sat, 25 Mar 2023 14:38: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 1pg51y-0001NU-BQ
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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 1pg51y-0004kw-99
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg51y-0003am-8N
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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=6szsxYC5yRstxYH8dDpJLzofPxJ5Q6jlAr2DuZ0oetM=; b=x5r5bWILBIdD6LiqUKdCVBHw2F
	/u5zDW3trNAnkbjM+fiYoXj8FGrRcvO2abyo20dehcFSOiQPcAB/EmmNU1BfFuB5nd508SlIEag7U
	/SaPZVwSGBpc/YUL+wDIEHosJ4XxgFkJOc4hsd9952YDSm828EyCQTaTzXqsRYTZ3qKE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/memory: Remove tail padding from TRC_MEM_* records
Message-Id: <E1pg51y-0003am-8N@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:38:06 +0000

commit 83af664db3366d9c3047abd67655dce1796d005c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 15 16:49:01 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 15:35:37 2023 +0000

    xen/memory: Remove tail padding from TRC_MEM_* records
    
    Four TRC_MEM_* records supply custom structures with tail padding, leaking
    stack rubble into the trace buffer.  Three of the records were fine in 32-bit
    builds of Xen, due to the relaxed alignment of 64-bit integers, but
    POD_SUPERPAGE_SPLITER was broken right from the outset.
    
    We could pack the datastructures to remove the padding, but xentrace_format
    has no way of rendering the upper half of a 16-bit field.  Instead, expand all
    16-bit fields to 32-bit.
    
    For POD_SUPERPAGE_SPLINTER, introduce an order field as it is relevant
    information, and to match DECREASE_RESERVATION, and so it doesn't require a
    __packed attribute to drop tail padding.
    
    Update xenalyze's structures to match, and introduce xentrace_format rendering
    which was absent previously.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
---
 tools/xentrace/formats    |  4 ++++
 tools/xentrace/xenalyze.c | 12 ++++++------
 xen/arch/x86/mm/p2m-pod.c | 17 +++++++++--------
 xen/common/memory.c       |  4 ++--
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/tools/xentrace/formats b/tools/xentrace/formats
index deac4d8598..0fcc327a40 100644
--- a/tools/xentrace/formats
+++ b/tools/xentrace/formats
@@ -136,6 +136,10 @@
 0x0010f001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  page_grant_map      [ domid = %(1)d ]
 0x0010f002  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  page_grant_unmap    [ domid = %(1)d ]
 0x0010f003  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  page_grant_transfer [ domid = %(1)d ]
+0x0010f005  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  decrease_reservation   [ d%(3)d gfn 0x%(2)08x%(1)08x, order %(4)u ]
+0x0010f010  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  pod_populate           [ d%(5)d gfn 0x%(2)08x%(1)08x => mfn 0x%(4)08x%(3)08x, order %(6)u ]
+0x0010f011  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  pod_zero_reclaim       [ d%(5)d gfn 0x%(2)08x%(1)08x => mfn 0x%(4)08x%(3)08x, order %(6)u ]
+0x0010f012  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  pod_superpage_splinter [ d%(3)d gfn 0x%(2)08x%(1)08x, order %(4)u ]
 
 0x00201001  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  hypercall  [ eip = 0x%(1)08x, eax = 0x%(2)08x ]
 0x00201101  CPU%(cpu)d  %(tsc)d (+%(reltsc)8d)  hypercall  [ rip = 0x%(2)08x%(1)08x, eax = 0x%(3)08x ]
diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 5de167031e..12dcca9646 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -8121,7 +8121,7 @@ void mem_pod_zero_reclaim_process(struct pcpu_info *p)
 
     struct {
         uint64_t gfn, mfn;
-        int d:16,order:16;
+        uint32_t d, order;
     } *r = (typeof(r))ri->d;
 
     if ( v && v->hvm.vmexit_valid )
@@ -8171,7 +8171,7 @@ void mem_pod_populate_process(struct pcpu_info *p)
 
     struct {
         uint64_t gfn, mfn;
-        int d:16,order:16;
+        uint32_t d, order;
     } *r = (typeof(r))ri->d;
 
     if ( opt.dump_all )
@@ -8204,14 +8204,14 @@ void mem_pod_superpage_splinter_process(struct pcpu_info *p)
 
     struct {
         uint64_t gfn;
-        int d:16;
+        uint32_t d, order;
     } *r = (typeof(r))ri->d;
 
     if ( opt.dump_all )
     {
-        printf(" %s pod_spage_splinter d%d g %llx\n",
+        printf(" %s pod_spage_splinter d%d o%d g %"PRIx64"\n",
                ri->dump_header,
-               r->d, (unsigned long long)r->gfn);
+               r->d, r->order, r->gfn);
     }
 }
 
@@ -8255,7 +8255,7 @@ void mem_decrease_reservation_process(struct pcpu_info *p)
 
     struct {
         uint64_t gfn;
-        int d:16,order:16;
+        uint32_t d, order;
     } *r = (typeof(r))ri->d;
 
     if ( opt.dump_all )
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 2edab5e5cd..c75a60c19f 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -868,8 +868,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn)
     if ( tb_init_done )
     {
         struct {
-            u64 gfn, mfn;
-            int d:16,order:16;
+            uint64_t gfn, mfn;
+            uint32_t d, order;
         } t;
 
         t.gfn = gfn_x(gfn);
@@ -1036,8 +1036,8 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count
             if ( tb_init_done )
             {
                 struct {
-                    u64 gfn, mfn;
-                    int d:16,order:16;
+                    uint64_t gfn, mfn;
+                    uint32_t d, order;
                 } t;
 
                 t.gfn = gfn_x(gfns[i]);
@@ -1276,8 +1276,8 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn,
     if ( tb_init_done )
     {
         struct {
-            u64 gfn, mfn;
-            int d:16,order:16;
+            uint64_t gfn, mfn;
+            uint32_t d, order;
         } t;
 
         t.gfn = gfn_x(gfn);
@@ -1322,12 +1322,13 @@ remap_and_retry:
     if ( tb_init_done )
     {
         struct {
-            u64 gfn;
-            int d:16;
+            uint64_t gfn;
+            uint32_t d, order;
         } t;
 
         t.gfn = gfn_x(gfn);
         t.d = d->domain_id;
+        t.order = order;
 
         __trace_var(TRC_MEM_POD_SUPERPAGE_SPLINTER, 0, sizeof(t), &t);
     }
diff --git a/xen/common/memory.c b/xen/common/memory.c
index a15e5580f3..c206fa4808 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -474,8 +474,8 @@ static void decrease_reservation(struct memop_args *a)
         if ( tb_init_done )
         {
             struct {
-                u64 gfn;
-                int d:16,order:16;
+                uint64_t gfn;
+                uint32_t d, order;
             } t;
 
             t.gfn = gmfn;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:38:18 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:38:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514689.797132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg529-0001VW-To; Sat, 25 Mar 2023 14:38:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514689.797132; Sat, 25 Mar 2023 14:38: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 1pg529-0001VO-Qw; Sat, 25 Mar 2023 14:38:17 +0000
Received: by outflank-mailman (input) for mailman id 514689;
 Sat, 25 Mar 2023 14:38: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 1pg528-0001TY-DU
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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 1pg528-0004l0-Cb
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg528-0003bh-Bq
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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=kgMaxv/AfqPA/d+/piDzpdiZOgDJ8Zg7WBLPW9sP4Bo=; b=o2DW+rqDZtrpfDpO033AyY7xYk
	VS2XAGPq+++lz8PhXHXDeS5zL/RWy+LgM3bPSS8TPcGxcfUL6TJFUTf54h2vviQGEzsEo0ET74wGM
	wFz/zSwhvS8RmfFdy4HxCwacXup9svAIUu6eCkU3C+8Ntbnzut2bSau0VOxvdc2yCLts=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/credit2: Remove tail padding from TRC_CSCHED2_* records
Message-Id: <E1pg528-0003bh-Bq@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:38:16 +0000

commit 2992f4dcd5e981360cef3fe0e7aef670d5e02eb9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 15 17:01:43 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 15:35:37 2023 +0000

    xen/credit2: Remove tail padding from TRC_CSCHED2_* records
    
    All three of these records have tail padding, leaking stack rubble into the
    trace buffer.  Introduce an explicit _pad field and have the compiler zero the
    padding automatically.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
---
 xen/common/sched/credit2.c | 47 +++++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index ae55feea34..87a1e31ee9 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -1111,12 +1111,14 @@ _runq_assign(struct csched2_unit *svc, struct csched2_runqueue_data *rqd)
     if ( unlikely(tb_init_done) )
     {
         struct {
-            unsigned unit:16, dom:16;
-            unsigned rqi:16;
-        } d;
-        d.dom = svc->unit->domain->domain_id;
-        d.unit = svc->unit->unit_id;
-        d.rqi=rqd->id;
+            uint16_t unit, dom;
+            uint16_t rqi, _pad;
+        } d = {
+            .unit = svc->unit->unit_id,
+            .dom  = svc->unit->domain->domain_id,
+            .rqi  = rqd->id,
+        };
+
         __trace_var(TRC_CSCHED2_RUNQ_ASSIGN, 1,
                     sizeof(d),
                     (unsigned char *)&d);
@@ -1341,13 +1343,17 @@ update_runq_load(const struct scheduler *ops,
     {
         struct {
             uint64_t rq_avgload, b_avgload;
-            unsigned rq_load:16, rq_id:8, shift:8;
-        } d;
-        d.rq_id = rqd->id;
-        d.rq_load = rqd->load;
-        d.rq_avgload = rqd->avgload;
-        d.b_avgload = rqd->b_avgload;
-        d.shift = P;
+            uint16_t rq_load;
+            uint8_t  rq_id, shift;
+            uint32_t _pad;
+        } d = {
+            .rq_avgload = rqd->avgload,
+            .b_avgload  = rqd->b_avgload,
+            .rq_load    = rqd->load,
+            .rq_id      = rqd->id,
+            .shift      = P,
+        };
+
         __trace_var(TRC_CSCHED2_UPDATE_RUNQ_LOAD, 1,
                     sizeof(d),
                     (unsigned char *)&d);
@@ -2804,12 +2810,15 @@ retry:
     {
         struct {
             uint64_t lb_avgload, ob_avgload;
-            unsigned lrq_id:16, orq_id:16;
-        } d;
-        d.lrq_id = st.lrqd->id;
-        d.lb_avgload = st.lrqd->b_avgload;
-        d.orq_id = st.orqd->id;
-        d.ob_avgload = st.orqd->b_avgload;
+            uint16_t lrq_id, orq_id;
+            uint32_t _pad;
+        } d = {
+            .lb_avgload = st.lrqd->b_avgload,
+            .ob_avgload = st.orqd->b_avgload,
+            .lrq_id     = st.lrqd->id,
+            .orq_id     = st.orqd->id,
+        };
+
         __trace_var(TRC_CSCHED2_LOAD_BALANCE, 1,
                     sizeof(d),
                     (unsigned char *)&d);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:38:28 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:38:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514690.797135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg52J-0001cr-VG; Sat, 25 Mar 2023 14:38:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514690.797135; Sat, 25 Mar 2023 14:38: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 1pg52J-0001cl-SQ; Sat, 25 Mar 2023 14:38:27 +0000
Received: by outflank-mailman (input) for mailman id 514690;
 Sat, 25 Mar 2023 14:38: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 1pg52I-0001cS-H4
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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 1pg52I-0004lB-GH
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg52I-0003cS-FP
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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=z7AqWlXCMVHlOCvknaVe2ctUB058uI6TuY6ZQQfPvpo=; b=IkSspvcNOiAJ5HdsimILxm1VZG
	ACxwITmZCg3ACbYt8AqwfKbWyKW5PgLJw7ZsWVjvYFyXwEB6n6ZaK04x+B5P8n1JPUb2lnAoSLDCi
	9RZlQqms05yX3q3MlspNsT9ZnMLxtG38GK932RV1mUvmr9fbp+Si1FsouaFY4COdPOZ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/trace: Minor code cleanup
Message-Id: <E1pg52I-0003cS-FP@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:38:26 +0000

commit 79493f2b33eeeccc78db25435181a03f5c46b3e6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 15 18:24:19 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 15:35:37 2023 +0000

    xen/trace: Minor code cleanup
    
     * Delete trailing whitespace
     * Replace an opencoded DIV_ROUND_UP()
     * Drop bogus smp_rmb() - spin_lock_irqsave() has full smp_mb() semantics.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/trace.h |  2 +-
 xen/common/trace.c                   | 37 +++++++++++++++---------------------
 2 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/trace.h b/xen/arch/x86/include/asm/hvm/trace.h
index 145b59f6ac..696e42eb94 100644
--- a/xen/arch/x86/include/asm/hvm/trace.h
+++ b/xen/arch/x86/include/asm/hvm/trace.h
@@ -52,7 +52,7 @@
 #define DO_TRC_HVM_CLTS        DEFAULT_HVM_MISC
 #define DO_TRC_HVM_LMSW        DEFAULT_HVM_MISC
 #define DO_TRC_HVM_LMSW64      DEFAULT_HVM_MISC
-#define DO_TRC_HVM_REALMODE_EMULATE DEFAULT_HVM_MISC 
+#define DO_TRC_HVM_REALMODE_EMULATE DEFAULT_HVM_MISC
 #define DO_TRC_HVM_TRAP             DEFAULT_HVM_MISC
 #define DO_TRC_HVM_TRAP_DEBUG       DEFAULT_HVM_MISC
 #define DO_TRC_HVM_VLAPIC           DEFAULT_HVM_MISC
diff --git a/xen/common/trace.c b/xen/common/trace.c
index 2fce3c5d71..df4a719e4b 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -75,10 +75,6 @@ static cpumask_t tb_cpu_mask;
 /* which tracing events are enabled */
 static u32 tb_event_mask = TRC_ALL;
 
-/* Return the number of elements _type necessary to store at least _x bytes of data
- * i.e., sizeof(_type) * ans >= _x. */
-#define fit_to_type(_type, _x) (((_x)+sizeof(_type)-1) / sizeof(_type))
-
 static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
@@ -96,8 +92,8 @@ static struct notifier_block cpu_nfb = {
 
 static uint32_t calc_tinfo_first_offset(void)
 {
-    int offset_in_bytes = offsetof(struct t_info, mfn_offset[NR_CPUS]);
-    return fit_to_type(uint32_t, offset_in_bytes);
+    return DIV_ROUND_UP(offsetof(struct t_info, mfn_offset[NR_CPUS]),
+                        sizeof(uint32_t));
 }
 
 /**
@@ -148,7 +144,7 @@ static int calculate_tbuf_size(unsigned int pages, uint16_t t_info_first_offset)
         pages = max_pages;
     }
 
-    /* 
+    /*
      * NB this calculation is correct, because t_info_first_offset is
      * in words, not bytes
      */
@@ -167,7 +163,7 @@ static int calculate_tbuf_size(unsigned int pages, uint16_t t_info_first_offset)
  * trace buffers.  The trace buffers are then available for debugging use, via
  * the %TRACE_xD macros exported in <xen/trace.h>.
  *
- * This function may also be called later when enabling trace buffers 
+ * This function may also be called later when enabling trace buffers
  * via the SET_SIZE hypercall.
  */
 static int alloc_trace_bufs(unsigned int pages)
@@ -401,7 +397,7 @@ int tb_control(struct xen_sysctl_tbuf_op *tbc)
         break;
     case XEN_SYSCTL_TBUFOP_enable:
         /* Enable trace buffers. Check buffers are already allocated. */
-        if ( opt_tbuf_size == 0 ) 
+        if ( opt_tbuf_size == 0 )
             rc = -EINVAL;
         else
             tb_init_done = 1;
@@ -438,7 +434,7 @@ int tb_control(struct xen_sysctl_tbuf_op *tbc)
     return rc;
 }
 
-static inline unsigned int calc_rec_size(bool_t cycles, unsigned int extra) 
+static inline unsigned int calc_rec_size(bool_t cycles, unsigned int extra)
 {
     unsigned int rec_size = 4;
 
@@ -597,7 +593,7 @@ static inline void __insert_record(struct t_buf *buf,
         rec->u.cycles.cycles_lo = (uint32_t)tsc;
         rec->u.cycles.cycles_hi = (uint32_t)(tsc >> 32);
         dst = rec->u.cycles.extra_u32;
-    } 
+    }
 
     if ( extra_data && extra )
         memcpy(dst, extra_data, extra);
@@ -717,9 +713,6 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra,
     if ( !cpumask_test_cpu(smp_processor_id(), &tb_cpu_mask) )
         return;
 
-    /* Read tb_init_done /before/ t_bufs. */
-    smp_rmb();
-
     spin_lock_irqsave(&this_cpu(t_lock), flags);
 
     buf = this_cpu(t_bufs);
@@ -735,14 +728,14 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra,
 
     /* Calculate the record size */
     rec_size = calc_rec_size(cycles, extra);
- 
+
     /* How many bytes are available in the buffer? */
     bytes_to_tail = calc_bytes_avail(buf);
-    
+
     /* How many bytes until the next wrap-around? */
     bytes_to_wrap = calc_bytes_to_wrap(buf);
-    
-    /* 
+
+    /*
      * Calculate expected total size to commit this record by
      * doing a dry-run.
      */
@@ -756,7 +749,7 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra,
         {
             total_size += bytes_to_wrap;
             bytes_to_wrap = data_size;
-        } 
+        }
         total_size += LOST_REC_SIZE;
         bytes_to_wrap -= LOST_REC_SIZE;
 
@@ -768,7 +761,7 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra,
     if ( rec_size > bytes_to_wrap )
     {
         total_size += bytes_to_wrap;
-    } 
+    }
     total_size += rec_size;
 
     /* Do we have enough space for everything? */
@@ -781,7 +774,7 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra,
     }
 
     /*
-     * Now, actually write information 
+     * Now, actually write information
      */
     bytes_to_wrap = calc_bytes_to_wrap(buf);
 
@@ -791,7 +784,7 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra,
         {
             insert_wrap_record(buf, LOST_REC_SIZE);
             bytes_to_wrap = data_size;
-        } 
+        }
         insert_lost_records(buf);
         bytes_to_wrap -= LOST_REC_SIZE;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:38:38 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:38:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514692.797139 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg52U-0001hs-0H; Sat, 25 Mar 2023 14:38:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514692.797139; Sat, 25 Mar 2023 14:38: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 1pg52T-0001hl-Ty; Sat, 25 Mar 2023 14:38:37 +0000
Received: by outflank-mailman (input) for mailman id 514692;
 Sat, 25 Mar 2023 14:38: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 1pg52S-0001hP-Kr
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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 1pg52S-0004lb-Jv
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg52S-0003dQ-J4
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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=aHnYzkAcWtYh9Knz0yRJBwNRDBerkZxWOiHeM5Qvr/k=; b=BIzbEviD6gXEFCEAIEIfSwvzUi
	oU/hQPigosEcLA3YMPufFOQCXowfLTzhzkq3Ub42ZFOide+jYHG3AFqJ6+eRpC2LlW5nVZbxw5cu0
	HxXmafxx1wumyLkO3MDifwTFBbllfCgVlU0hC2DmZnWeyeaJs+SLNuwZUVEx51hsjhpQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: Use HTTPS for all xenbits.xen.org Git repos
Message-Id: <E1pg52S-0003dQ-J4@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:38:36 +0000

commit eb23eef476bf44f933fcff42e55119473a1d6e19
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Mar 21 13:33:34 2023 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 16:29:13 2023 +0000

    build: Use HTTPS for all xenbits.xen.org Git repos
    
    Obtaining code over an insecure transport is a terrible idea for
    blatently obvious reasons.  Even for non-executable data, insecure
    transports are considered deprecated.
    
    This patch enforces the use of secure transports for all xenbits git
    repositories.  It was generated with the following shell script:
    
        git ls-files -z |
        xargs -0 -- sed -Ei -- 's@(git://xenbits\.xen\.org|http://xenbits\.xen\.org/git-http)/@https://xenbits.xen.org/git-http/@g'
    
    All altered links have been tested and are known to work.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk                                  | 20 +++++++-------------
 docs/misc/livepatch.pandoc                 |  2 +-
 docs/process/xen-release-management.pandoc |  2 +-
 scripts/get_maintainer.pl                  |  2 +-
 4 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/Config.mk b/Config.mk
index 10eb443b17..a90d093010 100644
--- a/Config.mk
+++ b/Config.mk
@@ -215,28 +215,22 @@ ifneq (,$(QEMU_TAG))
 QEMU_TRADITIONAL_REVISION ?= $(QEMU_TAG)
 endif
 
-ifeq ($(GIT_HTTP),y)
-OVMF_UPSTREAM_URL ?= http://xenbits.xen.org/git-http/ovmf.git
-QEMU_UPSTREAM_URL ?= http://xenbits.xen.org/git-http/qemu-xen.git
-QEMU_TRADITIONAL_URL ?= http://xenbits.xen.org/git-http/qemu-xen-traditional.git
-SEABIOS_UPSTREAM_URL ?= http://xenbits.xen.org/git-http/seabios.git
-MINIOS_UPSTREAM_URL ?= http://xenbits.xen.org/git-http/mini-os.git
-else
-OVMF_UPSTREAM_URL ?= git://xenbits.xen.org/ovmf.git
-QEMU_UPSTREAM_URL ?= git://xenbits.xen.org/qemu-xen.git
-QEMU_TRADITIONAL_URL ?= git://xenbits.xen.org/qemu-xen-traditional.git
-SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
-MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
-endif
+OVMF_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/ovmf.git
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
+
+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 ?= 5bcb28aaeba1c2506a82fab0cdad0201cd9b54b3
 
+SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.1
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
+QEMU_TRADITIONAL_URL ?= https://xenbits.xen.org/git-http/qemu-xen-traditional.git
 QEMU_TRADITIONAL_REVISION ?= 3d273dd05e51e5a1ffba3d98c7437ee84e8f8764
 # Wed Jul 15 10:01:40 2020 +0100
 # qemu-trad: remove Xen path dependencies
diff --git a/docs/misc/livepatch.pandoc b/docs/misc/livepatch.pandoc
index d38e4ce074..a94fb57eb5 100644
--- a/docs/misc/livepatch.pandoc
+++ b/docs/misc/livepatch.pandoc
@@ -993,7 +993,7 @@ The design of that is not discussed in this design.
 This is implemented in a seperate tool which lives in a seperate
 GIT repo.
 
-Currently it resides at git://xenbits.xen.org/livepatch-build-tools.git
+Currently it resides at https://xenbits.xen.org/git-http/livepatch-build-tools.git
 
 ### Exception tables and symbol tables growth
 
diff --git a/docs/process/xen-release-management.pandoc b/docs/process/xen-release-management.pandoc
index 8f80d61d2f..7826419dad 100644
--- a/docs/process/xen-release-management.pandoc
+++ b/docs/process/xen-release-management.pandoc
@@ -271,7 +271,7 @@ Hi all,
 
 Xen X.Y rcZ is tagged. You can check that out from xen.git:
 
-git://xenbits.xen.org/xen.git X.Y.0-rcZ
+https://xenbits.xen.org/git-http/xen.git X.Y.0-rcZ
 
 For your convenience there is also a tarball at:
 https://downloads.xenproject.org/release/xen/X.Y.0-rcZ/xen-X.Y.0-rcZ.tar.gz
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 48e07370e8..cf629cdf3c 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -1457,7 +1457,7 @@ sub vcs_exists {
 	warn("$P: No supported VCS found.  Add --nogit to options?\n");
 	warn("Using a git repository produces better results.\n");
 	warn("Try latest git repository using:\n");
-	warn("git clone git://xenbits.xen.org/xen.git\n");
+	warn("git clone https://xenbits.xen.org/git-http/xen.git\n");
 	$printed_novcs = 1;
     }
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:38:48 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:38:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514693.797145 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg52e-0001lx-2Q; Sat, 25 Mar 2023 14:38:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514693.797145; Sat, 25 Mar 2023 14:38: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 1pg52d-0001lp-Va; Sat, 25 Mar 2023 14:38:47 +0000
Received: by outflank-mailman (input) for mailman id 514693;
 Sat, 25 Mar 2023 14:38: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 1pg52c-0001la-OL
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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 1pg52c-0004lj-NR
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg52c-0003eH-MR
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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=sYcK5gy/Re3yinQsoDqpoSOJc70rtRiO2vTIqk7AdBw=; b=POuX8hJN9TsVUWvQEbIoP8QTJv
	CpFFTkYOTYVMOX3fdasDrAhhcMv0em/KzwjhsxFabviv1yuaX/f1Ngj1eucmhifvG/XmuHjgR1rMs
	vwv0DTiFzvRW6nRP91RTEnLbZHhyCFHYtq4WxzkU1dh96juPT7nnkQVeuTv82Cz0DKek=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: Change remaining xenbits.xen.org link to HTTPS
Message-Id: <E1pg52c-0003eH-MR@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:38:46 +0000

commit e1d75084443f676be681fdaf47585cc9a5f5b820
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Mar 21 13:33:36 2023 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 16:29:15 2023 +0000

    build: Change remaining xenbits.xen.org link to HTTPS
    
    Obtaining code over an insecure transport is a terrible idea for
    blatently obvious reasons.  Even for non-executable data, insecure
    transports are considered deprecated.
    
    This patch enforces the use of secure transports for all xenbits.xen.org
    URLs.  All altered links have been tested and are known to work.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.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 a90d093010..63c807a30a 100644
--- a/Config.mk
+++ b/Config.mk
@@ -191,7 +191,7 @@ APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 EMBEDDED_EXTRA_CFLAGS := -fno-pie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
-XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
+XEN_EXTFILES_URL ?= https://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
 # the internet.  The original download URL is preserved as a comment
 # near the place in the Xen Makefiles where the file is used.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:38:58 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:38:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514694.797148 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg52o-0001rB-5i; Sat, 25 Mar 2023 14:38:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514694.797148; Sat, 25 Mar 2023 14:38: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 1pg52o-0001r3-2o; Sat, 25 Mar 2023 14:38:58 +0000
Received: by outflank-mailman (input) for mailman id 514694;
 Sat, 25 Mar 2023 14:38: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 1pg52m-0001qG-Ru
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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 1pg52m-0004lq-Qx
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg52m-0003f2-QC
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:38: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=P8do34iu6s21KAC99jJk5sG1Q6ztXMqfMYjdk8xUUBs=; b=ejSc4fXAV/V6uQeKcA+JMlPB+k
	WevkN/VfpW2SeA7MGpYZYiL6cVp8A+ynTzRrr2lPZahy1ariFevw0g2eNDiovaby1Eq47vgTR8SMA
	VPrxesBWX9nVo5QE10D811c0ZCRq/SNa0DduFZvZAcbCDVLUjmdV24GXzGsiidEsBfqg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] configure: Do not try to use broken links
Message-Id: <E1pg52m-0003f2-QC@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:38:56 +0000

commit 47ee23f05ac945e5fedf118b8e85af95c5da3276
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Mar 21 13:33:38 2023 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 16:29:15 2023 +0000

    configure: Do not try to use broken links
    
    The upstream URLs for zlib, PolarSSL, and the TPM emulator do not work
    anymore, so do not attempt to use them.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 m4/stubdom.m4        |  5 +++--
 stubdom/configure    | 21 +++------------------
 stubdom/configure.ac |  6 +++---
 3 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/m4/stubdom.m4 b/m4/stubdom.m4
index 6aa488b8e2..26f10595d1 100644
--- a/m4/stubdom.m4
+++ b/m4/stubdom.m4
@@ -78,10 +78,11 @@ done
 AC_DEFUN([AX_STUBDOM_LIB], [
 AC_ARG_VAR([$1_URL], [Download url for $2])
 AS_IF([test "x$$1_URL" = "x"], [
-	AS_IF([test "x$extfiles" = "xy"],
+	m4_if([$#],[3],[$1_URL=\@S|@\@{:@XEN_EXTFILES_URL\@:}@],
+	      [$#],[4],[AS_IF([test "x$extfiles" = "xy"],
 		[$1_URL=\@S|@\@{:@XEN_EXTFILES_URL\@:}@],
 		[$1_URL="$4"])
-	])
+],[m4_fatal([AX_STUBDOM_LIB expects 3 or 4 arguments, not $#])])])
 $1_VERSION="$3"
 AC_SUBST($1_URL)
 AC_SUBST($1_VERSION)
diff --git a/stubdom/configure b/stubdom/configure
index b8bffceafd..4ea95baa91 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -3532,12 +3532,7 @@ fi
 
 if test "x$ZLIB_URL" = "x"; then :
 
-	if test "x$extfiles" = "xy"; then :
-  ZLIB_URL=\$\(XEN_EXTFILES_URL\)
-else
-  ZLIB_URL="http://www.zlib.net"
-fi
-
+	ZLIB_URL=\$\(XEN_EXTFILES_URL\)
 fi
 ZLIB_VERSION="1.2.3"
 
@@ -3633,12 +3628,7 @@ GMP_VERSION="4.3.2"
 
 if test "x$POLARSSL_URL" = "x"; then :
 
-	if test "x$extfiles" = "xy"; then :
-  POLARSSL_URL=\$\(XEN_EXTFILES_URL\)
-else
-  POLARSSL_URL="http://polarssl.org/code/releases"
-fi
-
+	POLARSSL_URL=\$\(XEN_EXTFILES_URL\)
 fi
 POLARSSL_VERSION="1.1.4"
 
@@ -3648,12 +3638,7 @@ POLARSSL_VERSION="1.1.4"
 
 if test "x$TPMEMU_URL" = "x"; then :
 
-	if test "x$extfiles" = "xy"; then :
-  TPMEMU_URL=\$\(XEN_EXTFILES_URL\)
-else
-  TPMEMU_URL="http://download.berlios.de/tpm-emulator"
-fi
-
+	TPMEMU_URL=\$\(XEN_EXTFILES_URL\)
 fi
 TPMEMU_VERSION="0.7.4"
 
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index e20d99edac..c648b1602c 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -55,15 +55,15 @@ AC_PROG_INSTALL
 AX_DEPENDS_PATH_PROG([vtpm], [CMAKE], [cmake])
 
 # Stubdom libraries version and url setup
-AX_STUBDOM_LIB([ZLIB], [zlib], [1.2.3], [http://www.zlib.net])
+AX_STUBDOM_LIB([ZLIB], [zlib], [1.2.3])
 AX_STUBDOM_LIB([LIBPCI], [libpci], [2.2.9], [http://www.kernel.org/pub/software/utils/pciutils])
 AX_STUBDOM_LIB([NEWLIB], [newlib], [1.16.0], [ftp://sources.redhat.com/pub/newlib])
 AX_STUBDOM_LIB([LWIP], [lwip], [1.3.0], [http://download.savannah.gnu.org/releases/lwip])
 AX_STUBDOM_LIB([GRUB], [grub], [0.97], [http://alpha.gnu.org/gnu/grub])
 AX_STUBDOM_LIB_NOEXT([OCAML], [ocaml], [4.02.0], [http://caml.inria.fr/pub/distrib/ocaml-4.02])
 AX_STUBDOM_LIB([GMP], [libgmp], [4.3.2], [ftp://ftp.gmplib.org/pub/gmp-4.3.2])
-AX_STUBDOM_LIB([POLARSSL], [polarssl], [1.1.4], [http://polarssl.org/code/releases])
-AX_STUBDOM_LIB([TPMEMU], [berlios tpm emulator], [0.7.4], [http://download.berlios.de/tpm-emulator])
+AX_STUBDOM_LIB([POLARSSL], [polarssl], [1.1.4])
+AX_STUBDOM_LIB([TPMEMU], [berlios tpm emulator], [0.7.4])
 
 #These stubdoms should be enabled if the dependent one is
 AX_STUBDOM_AUTO_DEPENDS([vtpmmgr], [vtpm])
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:39:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:39:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514697.797152 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg52y-0001y1-7N; Sat, 25 Mar 2023 14:39:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514697.797152; Sat, 25 Mar 2023 14:39: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 1pg52y-0001xu-4G; Sat, 25 Mar 2023 14:39:08 +0000
Received: by outflank-mailman (input) for mailman id 514697;
 Sat, 25 Mar 2023 14:39: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 1pg52w-0001xZ-Ve
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39: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 1pg52w-0004mG-Ul
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg52w-0003g4-Tk
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39: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=iOu5KxXzVAfv0SCX82wJEDHHwnnQU47oAS1vfjZWQXY=; b=og1Uk8jpvOwuuXvi5Tfy924Cji
	Mzh669UtMFIXa5Ukgi9aYv3hCEy1tzbG7ymzCrR5sRMtZFy95qqC05e+/XqfPjW046CyNW/qgG4gR
	JThDo6ZgU2qW9PJBV8J1lgqLbZVJIoNpllHQHDjm3qLKcum30nEvI3w9TBNn+Bxi6DKo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] configure: Replace git:// and http:// with https://
Message-Id: <E1pg52w-0003g4-Tk@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:39:06 +0000

commit 04988f1c595330fd39cdac2c6034ebb30616557e
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Mar 21 13:33:40 2023 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 16:29:15 2023 +0000

    configure: Replace git:// and http:// with https://
    
    Obtaining code over an insecure transport is a terrible idea for
    blatently obvious reasons.  Even for non-executable data, insecure
    transports are considered deprecated.
    
    This patch enforces the use of secure transports in the build system.
    Some URLs returned 301 or 302 redirects, so I replaced them with the
    URLs that were redirected to.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 stubdom/configure                 | 12 ++++++------
 stubdom/configure.ac              | 12 ++++++------
 tools/firmware/etherboot/Makefile |  6 +-----
 3 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/stubdom/configure b/stubdom/configure
index 4ea95baa91..540e9cd331 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -3545,7 +3545,7 @@ if test "x$LIBPCI_URL" = "x"; then :
 	if test "x$extfiles" = "xy"; then :
   LIBPCI_URL=\$\(XEN_EXTFILES_URL\)
 else
-  LIBPCI_URL="http://www.kernel.org/pub/software/utils/pciutils"
+  LIBPCI_URL="https://mirrors.edge.kernel.org/pub/software/utils/pciutils"
 fi
 
 fi
@@ -3560,7 +3560,7 @@ if test "x$NEWLIB_URL" = "x"; then :
 	if test "x$extfiles" = "xy"; then :
   NEWLIB_URL=\$\(XEN_EXTFILES_URL\)
 else
-  NEWLIB_URL="ftp://sources.redhat.com/pub/newlib"
+  NEWLIB_URL="https://sourceware.org/ftp/newlib"
 fi
 
 fi
@@ -3575,7 +3575,7 @@ if test "x$LWIP_URL" = "x"; then :
 	if test "x$extfiles" = "xy"; then :
   LWIP_URL=\$\(XEN_EXTFILES_URL\)
 else
-  LWIP_URL="http://download.savannah.gnu.org/releases/lwip"
+  LWIP_URL="https://download.savannah.gnu.org/releases/lwip"
 fi
 
 fi
@@ -3590,7 +3590,7 @@ if test "x$GRUB_URL" = "x"; then :
 	if test "x$extfiles" = "xy"; then :
   GRUB_URL=\$\(XEN_EXTFILES_URL\)
 else
-  GRUB_URL="http://alpha.gnu.org/gnu/grub"
+  GRUB_URL="https://alpha.gnu.org/gnu/grub"
 fi
 
 fi
@@ -3602,7 +3602,7 @@ GRUB_VERSION="0.97"
 
 if test "x$OCAML_URL" = "x"; then :
 
-	OCAML_URL="http://caml.inria.fr/pub/distrib/ocaml-4.02"
+	OCAML_URL="https://caml.inria.fr/pub/distrib/ocaml-4.02"
 
 fi
 OCAML_VERSION="4.02.0"
@@ -3616,7 +3616,7 @@ if test "x$GMP_URL" = "x"; then :
 	if test "x$extfiles" = "xy"; then :
   GMP_URL=\$\(XEN_EXTFILES_URL\)
 else
-  GMP_URL="ftp://ftp.gmplib.org/pub/gmp-4.3.2"
+  GMP_URL="https://gmplib.org/download/gmp/archive"
 fi
 
 fi
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index c648b1602c..471e371e14 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -56,12 +56,12 @@ AX_DEPENDS_PATH_PROG([vtpm], [CMAKE], [cmake])
 
 # Stubdom libraries version and url setup
 AX_STUBDOM_LIB([ZLIB], [zlib], [1.2.3])
-AX_STUBDOM_LIB([LIBPCI], [libpci], [2.2.9], [http://www.kernel.org/pub/software/utils/pciutils])
-AX_STUBDOM_LIB([NEWLIB], [newlib], [1.16.0], [ftp://sources.redhat.com/pub/newlib])
-AX_STUBDOM_LIB([LWIP], [lwip], [1.3.0], [http://download.savannah.gnu.org/releases/lwip])
-AX_STUBDOM_LIB([GRUB], [grub], [0.97], [http://alpha.gnu.org/gnu/grub])
-AX_STUBDOM_LIB_NOEXT([OCAML], [ocaml], [4.02.0], [http://caml.inria.fr/pub/distrib/ocaml-4.02])
-AX_STUBDOM_LIB([GMP], [libgmp], [4.3.2], [ftp://ftp.gmplib.org/pub/gmp-4.3.2])
+AX_STUBDOM_LIB([LIBPCI], [libpci], [2.2.9], [https://mirrors.edge.kernel.org/pub/software/utils/pciutils])
+AX_STUBDOM_LIB([NEWLIB], [newlib], [1.16.0], [https://sourceware.org/ftp/newlib])
+AX_STUBDOM_LIB([LWIP], [lwip], [1.3.0], [https://download.savannah.gnu.org/releases/lwip])
+AX_STUBDOM_LIB([GRUB], [grub], [0.97], [https://alpha.gnu.org/gnu/grub])
+AX_STUBDOM_LIB_NOEXT([OCAML], [ocaml], [4.02.0], [https://caml.inria.fr/pub/distrib/ocaml-4.02])
+AX_STUBDOM_LIB([GMP], [libgmp], [4.3.2], [https://gmplib.org/download/gmp/archive])
 AX_STUBDOM_LIB([POLARSSL], [polarssl], [1.1.4])
 AX_STUBDOM_LIB([TPMEMU], [berlios tpm emulator], [0.7.4])
 
diff --git a/tools/firmware/etherboot/Makefile b/tools/firmware/etherboot/Makefile
index 4bc3633ba3..6ab9e5bc6b 100644
--- a/tools/firmware/etherboot/Makefile
+++ b/tools/firmware/etherboot/Makefile
@@ -4,11 +4,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 include Config
 
-ifeq ($(GIT_HTTP),y)
-IPXE_GIT_URL ?= http://git.ipxe.org/ipxe.git
-else
-IPXE_GIT_URL ?= git://git.ipxe.org/ipxe.git
-endif
+IPXE_GIT_URL ?= https://github.com/ipxe/ipxe.git
 
 # put an updated tar.gz on xenbits after changes to this variable
 IPXE_GIT_TAG := 3c040ad387099483102708bb1839110bc788cefb
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:39:18 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:39:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514699.797155 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg538-00024H-8R; Sat, 25 Mar 2023 14:39:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514699.797155; Sat, 25 Mar 2023 14:39: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 1pg538-000249-5p; Sat, 25 Mar 2023 14:39:18 +0000
Received: by outflank-mailman (input) for mailman id 514699;
 Sat, 25 Mar 2023 14:39: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 1pg537-00023j-2x
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39: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 1pg537-0004mP-2A
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg537-0003gf-1H
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39: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=otUodHupAYUtz/ZqbL66v8id4khF473XalPn9ngBH48=; b=phcwneVbdmzHGoWJwdWEPS7vIV
	H5LuVYv8TiwpKURCz04rOA5p+pjtx8ilalWxRu1I2S/Bnlp8il4QhJ/m+xHPwN++S17e17u9bcuEg
	O0sQMWfXE65DD/ZihBm/gp45TJBkaVpHXeDeTRCN0o3oaZudq9ylib6jJXtHN2x/XmH8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] misc: Replace git:// and http:// with https://
Message-Id: <E1pg537-0003gf-1H@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:39:17 +0000

commit 054acfc4443cda51bc000c2e3ba08d9fd1bd77f1
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Mar 21 13:33:42 2023 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 16:29:15 2023 +0000

    misc: Replace git:// and http:// with https://
    
    Obtaining code over an insecure transport is a terrible idea for
    blatently obvious reasons.  Even for non-executable data, insecure
    transports are considered deprecated.
    
    This patch enforces the use of secure transports in misc places.
    All URLs are known to work.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 README                                      | 4 ++--
 automation/build/debian/stretch-llvm-8.list | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/README b/README
index 755b3d8eaf..f8cc426f78 100644
--- a/README
+++ b/README
@@ -181,7 +181,7 @@ Python Runtime Libraries
 Various tools, such as pygrub, have the following runtime dependencies:
 
     * Python 2.6 or later.
-          URL:    http://www.python.org/
+          URL:    https://www.python.org/
           Debian: python
 
 Note that the build system expects `python` to be available. If your system
@@ -197,7 +197,7 @@ Intel(R) Trusted Execution Technology Support
 Intel's technology for safer computing, Intel(R) Trusted Execution Technology
 (Intel(R) TXT), defines platform-level enhancements that provide the building
 blocks for creating trusted platforms.  For more information, see
-http://www.intel.com/technology/security/.
+https://www.intel.com/technology/security/.
 
 Intel(R) TXT support is provided by the Trusted Boot (tboot) module in
 conjunction with minimal logic in the Xen hypervisor.
diff --git a/automation/build/debian/stretch-llvm-8.list b/automation/build/debian/stretch-llvm-8.list
index 09fe843fb2..590001ca81 100644
--- a/automation/build/debian/stretch-llvm-8.list
+++ b/automation/build/debian/stretch-llvm-8.list
@@ -1,3 +1,3 @@
 # Strech LLVM 8 repos
-deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
-deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
+deb https://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
+deb-src https://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 25 14:39:28 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Mar 2023 14:39:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514700.797160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pg53I-0002E0-9v; Sat, 25 Mar 2023 14:39:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514700.797160; Sat, 25 Mar 2023 14:39: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 1pg53I-0002Ds-7H; Sat, 25 Mar 2023 14:39:28 +0000
Received: by outflank-mailman (input) for mailman id 514700;
 Sat, 25 Mar 2023 14:39: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 1pg53H-0002Da-7C
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39: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 1pg53H-0004rw-6F
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pg53H-0003hI-4j
 for xen-changelog@lists.xenproject.org; Sat, 25 Mar 2023 14:39: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=c67dg72cLHw8tQDHUr9gsYIr0UB8szURpu1F/SaBGqA=; b=yvwU/UkopZzff/EdRqQ5AutGhg
	7sK1GAeNx3E6AelmhZbkvgxHgVTAdR5Q5cYKH5d/sRFBW55nsCk9bDkA0PiKIqlAL4qj0ynlbosIe
	nWwIG+R7o5rd3ACnKhf/e4Cx6WojTH8PO/Q7BfB9ZXOtVooUHa1RFiUX5cSqV23O96Gg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "build: Change remaining xenbits.xen.org link to HTTPS"
Message-Id: <E1pg53H-0003hI-4j@xenbits.xenproject.org>
Date: Sat, 25 Mar 2023 14:39:27 +0000

commit b5cc3c25a242ddb9c5b108884061b17f35c3084b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 24 20:32:24 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 20:34:53 2023 +0000

    Revert "build: Change remaining xenbits.xen.org link to HTTPS"
    
    This reverts commit e1d75084443f676be681fdaf47585cc9a5f5b820.
    
    After spending ages sorting out Gitlab CI, it appears that OSSTest too has an
    out-of-date Lets Encrypt cert.  Revert again in the short term while we fix
    this up.
    
    Signed-off-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 63c807a30a..a90d093010 100644
--- a/Config.mk
+++ b/Config.mk
@@ -191,7 +191,7 @@ APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 EMBEDDED_EXTRA_CFLAGS := -fno-pie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
-XEN_EXTFILES_URL ?= https://xenbits.xen.org/xen-extfiles
+XEN_EXTFILES_URL ?= http://xenbits.xen.org/xen-extfiles
 # All the files at that location were downloaded from elsewhere on
 # the internet.  The original download URL is preserved as a comment
 # near the place in the Xen Makefiles where the file is used.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Mar 26 06:22:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 26 Mar 2023 06:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.514827.797337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pgJlS-0006xX-T0; Sun, 26 Mar 2023 06:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 514827.797337; Sun, 26 Mar 2023 06: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 1pgJlS-0006xO-Oe; Sun, 26 Mar 2023 06:22:02 +0000
Received: by outflank-mailman (input) for mailman id 514827;
 Sun, 26 Mar 2023 06: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 1pgJlR-0006xG-Nx
 for xen-changelog@lists.xenproject.org; Sun, 26 Mar 2023 06: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 1pgJlR-0001aQ-Mp
 for xen-changelog@lists.xenproject.org; Sun, 26 Mar 2023 06:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pgJlR-00071Q-Lq
 for xen-changelog@lists.xenproject.org; Sun, 26 Mar 2023 06: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=vFJiVZj5vVALFJIKl1e8HSMlu+k2mJ3hCir5YU4VALY=; b=oYt4dr1iqIkfPaEGUTnkOwidER
	+yobgZTmpT4r4i/I2PvMQEjerQhYK/dqAKSMeHs4ZGj3f6OmIdijs/ePCEQJRk50IGaW29C+DC+lH
	P82v2GgWGnOKgow0FbEFXS4kl0mSESOH5S4nTIMMpnpITl20BxXP0nG/zRhIZ9kYPuRA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: Don't spuriously crash the domain when INIT is received
Message-Id: <E1pgJlR-00071Q-Lq@xenbits.xenproject.org>
Date: Sun, 26 Mar 2023 06:22:01 +0000

commit b1f11273d5a774cc88a3685c96c2e7cf6385e3b6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 24 19:40:15 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 24 22:49:58 2023 +0000

    x86/vmx: Don't spuriously crash the domain when INIT is received
    
    In VMX operation, the handling of INIT IPIs is changed.  Instead of the CPU
    resetting, the next VMEntry fails with EXIT_REASON_INIT.  From the TXT spec,
    the intent of this behaviour is so that an entity which cares can scrub
    secrets from RAM before participating in an orderly shutdown.
    
    Right now, Xen's behaviour is that when an INIT arrives, the HVM VM which
    schedules next is killed (citing an unknown VMExit), *and* we ignore the INIT
    and continue blindly onwards anyway.
    
    This patch addresses only the first of these two problems by ignoring the INIT
    and continuing without crashing the VM in question.
    
    The second wants addressing too, just as soon as we've figured out something
    better to do...
    
    Discovered as collateral damage from when an AP triple faults on S3 resume on
    Intel TigerLake platforms.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/7283
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 78ac9ece6f..7d5ed8d470 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4094,6 +4094,10 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
     case EXIT_REASON_MCE_DURING_VMENTRY:
         do_machine_check(regs);
         break;
+
+    case EXIT_REASON_INIT:
+        printk(XENLOG_ERR "Error: INIT received - ignoring\n");
+        return; /* Renter the guest without further processing */
     }
 
     /* Now enable interrupts so it's safe to take locks. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 27 23:11:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 27 Mar 2023 23:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.515486.798404 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pgvzS-0003QG-L2; Mon, 27 Mar 2023 23:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 515486.798404; Mon, 27 Mar 2023 23:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pgvzS-0003Q8-IG; Mon, 27 Mar 2023 23:11:02 +0000
Received: by outflank-mailman (input) for mailman id 515486;
 Mon, 27 Mar 2023 23: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 1pgvzR-0003Q0-Ui
 for xen-changelog@lists.xenproject.org; Mon, 27 Mar 2023 23:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pgvzR-00028P-TX
 for xen-changelog@lists.xenproject.org; Mon, 27 Mar 2023 23:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pgvzR-0007Fm-SB
 for xen-changelog@lists.xenproject.org; Mon, 27 Mar 2023 23: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=UNuE+w+b7iEFZk1rvKe1A9WkcjhJPAdnLkJzZzGrIgw=; b=X30HGgVg/OCwbwc0ZNf+Q64DRc
	ZuhEVndskNyYQh2XLoesFuIpacN7afkvzTlEq1OcFH6mbNWF4JT68JWwvwMAPn0HiBfpjkLeLETHz
	LMCV/zsqV6EK2oS4PZrwMBFLT6GGKI3WIk/qR8WvuWyweA/7fnDlUbC3O/S3bk+Cnuoc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/xen/xen_pt: fix uninitialized variable
Message-Id: <E1pgvzR-0007Fm-SB@xenbits.xenproject.org>
Date: Mon, 27 Mar 2023 23:11:01 +0000

commit 8c51cd970509b97d8378d175646ec32889828158
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Jan 27 06:08:14 2023 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Mon Mar 27 14:26:19 2023 +0100

    hw/xen/xen_pt: fix uninitialized variable
    
    xen_pt_config_reg_init() reads only that many bytes as the size of the
    register that is being initialized. It uses
    xen_host_pci_get_{byte,word,long} and casts its last argument to
    expected pointer type. This means for smaller registers higher bits of
    'val' are not initialized. Then, the function fails if any of those
    higher bits are set.
    
    Fix this by initializing 'val' with zero.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Message-Id: <20230127050815.4155276-1-marmarek@invisiblethingslab.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    (cherry picked from commit 3856734d80fbf46683e4080117ed961f5ab1300b)
---
 hw/xen/xen_pt_config_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c
index cde898b744..8b9b554352 100644
--- a/hw/xen/xen_pt_config_init.c
+++ b/hw/xen/xen_pt_config_init.c
@@ -1924,7 +1924,7 @@ static void xen_pt_config_reg_init(XenPCIPassthroughState *s,
     if (reg->init) {
         uint32_t host_mask, size_mask;
         unsigned int offset;
-        uint32_t val;
+        uint32_t val = 0;
 
         /* initialize emulate register */
         rc = reg->init(s, reg_entry->reg,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 28 22:44:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Mar 2023 22:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516033.799530 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phI2t-0004aI-C1; Tue, 28 Mar 2023 22:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516033.799530; Tue, 28 Mar 2023 22: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 1phI2t-0004aA-8q; Tue, 28 Mar 2023 22:44:03 +0000
Received: by outflank-mailman (input) for mailman id 516033;
 Tue, 28 Mar 2023 22: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 1phI2r-0004Zr-R9
 for xen-changelog@lists.xenproject.org; Tue, 28 Mar 2023 22: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 1phI2r-0003b3-Py
 for xen-changelog@lists.xenproject.org; Tue, 28 Mar 2023 22:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phI2r-0008Od-OK
 for xen-changelog@lists.xenproject.org; Tue, 28 Mar 2023 22: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=65/jcp6D/Cv3o9G95mhOuox5zrt+IBkWc78SuyhdlGk=; b=gJ9aoVgSXMl8mL/cJN97JQ3TEs
	ZyTUmAQEP5dU99BdNXTw5NJcwi/zE540+SJ8xvEUCLFJ6VQvpKEgKCFjHVwSqfDvQW8yB46GcTj9y
	YIG6LyopoxDvVkS/iRN1TZ2xlOTfB0ASDEvlUPCQQ+61Mtr+D4TF4f3S02HQvdBAuX8s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: update x86-64 tests to Linux 6.1.19
Message-Id: <E1phI2r-0008Od-OK@xenbits.xenproject.org>
Date: Tue, 28 Mar 2023 22:44:01 +0000

commit c51a823946949c229bffe0ee34be18b975ebf944
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Sat Mar 25 22:11:57 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 27 15:15:06 2023 -0700

    automation: update x86-64 tests to Linux 6.1.19
    
    It will be used in tests added in subsequent patches.
    Enable config options needed for those tests.
    While at it, migrate all the x86 tests to the newer kernel, and
    introduce x86-64-test-needs to allow deduplication later (for now it's
    used only once).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml                    |  4 +--
 automation/gitlab-ci/test.yaml                     |  7 ++--
 .../tests-artifacts/kernel/5.10.74.dockerfile      | 38 --------------------
 .../tests-artifacts/kernel/6.1.19.dockerfile       | 40 ++++++++++++++++++++++
 4 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 820cc0af83..0817f11055 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -798,9 +798,9 @@ alpine-3.12-rootfs-export:
   tags:
     - x86_64
 
-kernel-5.10.74-export:
+kernel-6.1.19-export:
   extends: .test-jobs-artifact-common
-  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:5.10.74
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:6.1.19
   script:
     - mkdir binaries && cp /bzImage binaries/bzImage
   artifacts:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index d75662358f..ee9e321077 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -15,6 +15,10 @@
 .arm32-test-needs: &arm32-test-needs
   - qemu-system-aarch64-6.0.0-arm32-export
 
+.x86-64-test-needs: &x86-64-test-needs
+  - alpine-3.12-rootfs-export
+  - kernel-6.1.19-export
+
 .qemu-arm64:
   extends: .test-jobs-common
   variables:
@@ -299,9 +303,8 @@ qemu-alpine-x86_64-gcc:
   script:
     - ./automation/scripts/qemu-alpine-x86_64.sh 2>&1 | tee ${LOGFILE}
   needs:
+    - *x86-64-test-needs
     - alpine-3.12-gcc
-    - alpine-3.12-rootfs-export
-    - kernel-5.10.74-export
 
 qemu-smoke-x86-64-gcc:
   extends: .qemu-x86-64
diff --git a/automation/tests-artifacts/kernel/5.10.74.dockerfile b/automation/tests-artifacts/kernel/5.10.74.dockerfile
deleted file mode 100644
index 112e27fe45..0000000000
--- a/automation/tests-artifacts/kernel/5.10.74.dockerfile
+++ /dev/null
@@ -1,38 +0,0 @@
-FROM debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV LINUX_VERSION=5.10.74
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        libssl-dev \
-        bc \
-        curl \
-        flex \
-        bison \
-        libelf-dev \
-        && \
-    apt-get autoremove -y && \
-    apt-get clean && \
-    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-
-# Build the kernel
-RUN curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$LINUX_VERSION".tar.xz && \
-    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
-    cd linux-"$LINUX_VERSION" && \
-    make defconfig && \
-    make xen.config && \
-    cp .config .config.orig && \
-    cat .config.orig | grep XEN | grep =m |sed 's/=m/=y/g' >> .config && \
-    make -j$(nproc) bzImage && \
-    cp arch/x86/boot/bzImage / && \
-    cd /build && \
-    rm -rf linux-"$LINUX_VERSION"*
diff --git a/automation/tests-artifacts/kernel/6.1.19.dockerfile b/automation/tests-artifacts/kernel/6.1.19.dockerfile
new file mode 100644
index 0000000000..c2171555a0
--- /dev/null
+++ b/automation/tests-artifacts/kernel/6.1.19.dockerfile
@@ -0,0 +1,40 @@
+FROM debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LINUX_VERSION=6.1.19
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        libssl-dev \
+        bc \
+        curl \
+        flex \
+        bison \
+        libelf-dev \
+        && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+# Build the kernel
+RUN curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-"$LINUX_VERSION".tar.xz && \
+    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
+    cd linux-"$LINUX_VERSION" && \
+    make defconfig && \
+    make xen.config && \
+    scripts/config --enable BRIDGE && \
+    scripts/config --enable IGC && \
+    cp .config .config.orig && \
+    cat .config.orig | grep XEN | grep =m |sed 's/=m/=y/g' >> .config && \
+    make -j$(nproc) bzImage && \
+    cp arch/x86/boot/bzImage / && \
+    cd /build && \
+    rm -rf linux-"$LINUX_VERSION"*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 28 22:44:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Mar 2023 22:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516034.799534 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phI33-0004ee-DK; Tue, 28 Mar 2023 22:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516034.799534; Tue, 28 Mar 2023 22: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 1phI33-0004eW-AP; Tue, 28 Mar 2023 22:44:13 +0000
Received: by outflank-mailman (input) for mailman id 516034;
 Tue, 28 Mar 2023 22: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 1phI31-0004dr-V2
 for xen-changelog@lists.xenproject.org; Tue, 28 Mar 2023 22:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phI31-0003bB-Ta
 for xen-changelog@lists.xenproject.org; Tue, 28 Mar 2023 22:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phI31-0008P8-SR
 for xen-changelog@lists.xenproject.org; Tue, 28 Mar 2023 22: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=sYvj8jU8FQolY/brtEIL55MJA+rD3ribrGHu4v+IIG0=; b=QlJK8rgj+Xgg257eZd2IdUdqcg
	SxkbC2kLAM5lXXxQwj0zlo9yXYnxMP3YeLtb8f+BW58pUTSwqfgTAPu3xjKmG0sTMx907kN9RCO+H
	FhwS6v6UMaY1cbjBcydjqPcA4g1B0df8L53j1QcL8vlthCkHI6rprYnRAuK3X1DOGXcs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add a smoke and suspend test on an Alder Lake system
Message-Id: <E1phI31-0008P8-SR@xenbits.xenproject.org>
Date: Tue, 28 Mar 2023 22:44:11 +0000

commit 0ab316e7e15f895c983e853512cfe0bb71ee3053
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Sat Mar 25 22:11:58 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 27 15:15:15 2023 -0700

    automation: add a smoke and suspend test on an Alder Lake system
    
    This is a first test using Qubes OS CI infra. The gitlab-runner has
    access to ssh-based control interface (control@thor.testnet, ssh key
    exposed to the test via ssh-agent) and pre-configured HTTP dir for boot
    files (mapped under /scratch/gitlab-runner/tftp inside the container).
    Details about the setup are described on
    https://www.qubes-os.org/news/2022/05/05/automated-os-testing-on-physical-laptops/
    
    There are two test. First is a simple dom0+domU boot smoke test, similar
    to other existing tests. The second is one boots Xen, and try if S3
    works. It runs on a ADL-based desktop system. The test script is based
    on the Xilinx one.
    
    The machine needs newer kernel than other x86 tests run, so use 6.1.x
    kernel added in previous commit.
    
    The usage of fakeroot is necessary to preserve device nodes (/dev/null
    etc) when repacking rootfs. The test runs in a rootless podman
    container, which doesn't have full root permissions. BTW the same
    applies to docker with user namespaces enabled (but it's only opt-in
    feature there).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/build/alpine/3.12-arm64v8.dockerfile |   3 +
 automation/gitlab-ci/test.yaml                  |  33 +++++
 automation/scripts/qubes-x86-64.sh              | 174 ++++++++++++++++++++++++
 3 files changed, 210 insertions(+)

diff --git a/automation/build/alpine/3.12-arm64v8.dockerfile b/automation/build/alpine/3.12-arm64v8.dockerfile
index 180c978964..3f1e6a3fc6 100644
--- a/automation/build/alpine/3.12-arm64v8.dockerfile
+++ b/automation/build/alpine/3.12-arm64v8.dockerfile
@@ -41,3 +41,6 @@ RUN apk --no-cache add \
   libattr \
   libcap-ng-dev \
   pixman-dev \
+  # qubes test deps
+  openssh-client \
+  fakeroot \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index ee9e321077..0916b367ea 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -88,6 +88,23 @@
   tags:
     - xilinx
 
+.adl-x86-64:
+  extends: .test-jobs-common
+  variables:
+    # the test controller runs on RPi4
+    CONTAINER: alpine:3.12-arm64v8
+    LOGFILE: smoke-test.log
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  only:
+    variables:
+      - $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+  tags:
+    - qubes-hw2
+
 # Test jobs
 build-each-commit-gcc:
   extends: .test-jobs-common
@@ -114,6 +131,22 @@ xilinx-smoke-dom0less-arm64-gcc:
     - *arm64-test-needs
     - alpine-3.12-gcc-arm64
 
+adl-smoke-x86-64-gcc:
+  extends: .adl-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.12-gcc
+
+adl-suspend-x86-64-gcc:
+  extends: .adl-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh s3 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.12-gcc
+
 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
new file mode 100755
index 0000000000..2d4cf2e226
--- /dev/null
+++ b/automation/scripts/qubes-x86-64.sh
@@ -0,0 +1,174 @@
+#!/bin/sh
+
+set -ex
+
+test_variant=$1
+
+wait_and_wakeup=
+timeout=120
+if [ -z "${test_variant}" ]; then
+    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="
+until grep -q \"${passed}\" /var/log/xen/console/guest-domU.log; do
+    sleep 1
+done
+# get domU console content into test log
+tail -n 100 /var/log/xen/console/guest-domU.log
+echo \"${passed}\"
+"
+elif [ "${test_variant}" = "s3" ]; then
+    passed="suspend test passed"
+    wait_and_wakeup="started, suspending"
+    domU_check="
+ifconfig eth0 192.168.0.2
+echo domU started
+"
+    dom0_check="
+until grep 'domU started' /var/log/xen/console/guest-domU.log; do
+    sleep 1
+done
+echo \"${wait_and_wakeup}\"
+set -x
+echo deep > /sys/power/mem_sleep
+echo mem > /sys/power/state
+# now wait for resume
+sleep 5
+# get domU console content into test log
+tail -n 100 /var/log/xen/console/guest-domU.log
+xl list
+xl dmesg | grep 'Finishing wakeup from ACPI S3 state' || exit 1
+# check if domU is still alive
+ping -c 10 192.168.0.2 || exit 1
+echo \"${passed}\"
+"
+fi
+
+# DomU
+mkdir -p rootfs
+cd rootfs
+# fakeroot is needed to preserve device nodes in rootless podman container
+fakeroot -s ../fakeroot-save tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+echo "#!/bin/sh
+
+${domU_check}
+/bin/sh" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+cd ..
+rm -rf rootfs
+
+# DOM0 rootfs
+mkdir -p rootfs
+cd rootfs
+fakeroot -s ../fakeroot-save tar xzf ../binaries/initrd.tar.gz
+mkdir boot
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+
+xl create /etc/xen/domU.cfg
+${dom0_check}
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+# just PVH for now
+echo '
+type = "pvh"
+name = "domU"
+kernel = "/boot/vmlinuz"
+ramdisk = "/boot/initrd-domU"
+extra = "root=/dev/ram0 console=hvc0"
+memory = 512
+vif = [ "bridge=xenbr0", ]
+disk = [ ]
+' > etc/xen/domU.cfg
+
+echo "rc_verbose=yes" >> etc/rc.conf
+echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
+echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
+mkdir -p var/log/xen/console
+cp ../binaries/bzImage boot/vmlinuz
+cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cd ..
+
+
+TFTP=/scratch/gitlab-runner/tftp
+CONTROLLER=control@thor.testnet
+
+echo '
+multiboot2 (http)/gitlab-ci/xen console=com1 com1=115200,8n1 loglvl=all guest_loglvl=all
+module2 (http)/gitlab-ci/vmlinuz console=hvc0 root=/dev/ram0
+module2 (http)/gitlab-ci/initrd-dom0
+' > $TFTP/grub.cfg
+
+cp -f binaries/xen $TFTP/xen
+cp -f binaries/bzImage $TFTP/vmlinuz
+cp -f binaries/dom0-rootfs.cpio.gz $TFTP/initrd-dom0
+
+# start logging the serial; this gives interactive console, don't close its
+# stdin to not close it; the 'cat' is important, plain redirection would hang
+# until somebody opens the pipe; opening and closing the pipe is used to close
+# the console
+mkfifo /tmp/console-stdin
+cat /tmp/console-stdin |\
+ssh $CONTROLLER console | tee smoke.serial &
+
+# start the system pointing at gitlab-ci predefined config
+ssh $CONTROLLER gitlabci poweron
+trap "ssh $CONTROLLER poweroff; : > /tmp/console-stdin" EXIT
+
+if [ -n "$wait_and_wakeup" ]; then
+    # wait for suspend or a timeout
+    until grep "$wait_and_wakeup" smoke.serial || [ $timeout -le 0 ]; do
+        sleep 1;
+        : $((--timeout))
+    done
+    if [ $timeout -le 0 ]; then
+        echo "ERROR: suspend timeout, aborting"
+        exit 1
+    fi
+    # keep it suspended a bit, then wakeup
+    sleep 30
+    ssh $CONTROLLER wake
+fi
+
+until grep "$passed" smoke.serial || [ $timeout -le 0 ]; do
+    sleep 1;
+    : $((--timeout))
+done
+if [ $timeout -le 0 ]; then
+    echo "ERROR: test timeout, aborting"
+    exit 1
+fi
+
+sleep 1
+
+(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
+exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 29 12:22:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Mar 2023 12:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516255.800079 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUoV-0001nH-Tu; Wed, 29 Mar 2023 12:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516255.800079; Wed, 29 Mar 2023 12:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUoV-0001n9-Py; Wed, 29 Mar 2023 12:22:03 +0000
Received: by outflank-mailman (input) for mailman id 516255;
 Wed, 29 Mar 2023 12: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 1phUoU-0001ms-Ed
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12: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 1phUoU-0000lG-DC
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUoU-0004Ve-C0
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pjGPG/uxaQxGqZtEQFxpH3BlgwDfD6d/teYJ17oBPHk=; b=F/wxvV8iDKgHa5zpChdHDerK/y
	pspUXaEIx6J5PHw/t6RLS1FrRJeM7aQJTzaucfadsY7ybF/AWKTlA3r8zwLEnMuxlW0cnVqFrEyAF
	QzxLP5t3QRYH3T9TJUKoDkChM+tAwSDxiDPbUiq5q7fXtHIhqnwHNmV5nJjZtjKdcTBY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Fix error paths control_thread_fn()
Message-Id: <E1phUoU-0004Ve-C0@xenbits.xenproject.org>
Date: Wed, 29 Mar 2023 12:22:02 +0000

commit fc2e1f3aad602a66c14b8285a1bd38a82f8fd02d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 4 13:32:21 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 28 11:57:56 2023 +0100

    x86/ucode: Fix error paths control_thread_fn()
    
    These two early exits skipped re-enabling the watchdog, restoring the NMI
    callback, and clearing the nmi_patch global pointer.  Always execute the tail
    of the function on the way out.
    
    Fixes: 8dd4dfa92d62 ("x86/microcode: Synchronize late microcode loading")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/core.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index cfa2d5053a..61cd36d601 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -492,10 +492,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
     ret = wait_for_condition(wait_cpu_callin, num_online_cpus(),
                              MICROCODE_CALLIN_TIMEOUT_US);
     if ( ret )
-    {
-        set_state(LOADING_EXIT);
-        return ret;
-    }
+        goto out;
 
     /* Control thread loads ucode first while others are in NMI handler. */
     ret = alternative_call(ucode_ops.apply_microcode, patch);
@@ -507,8 +504,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
     {
         printk(XENLOG_ERR
                "Late loading aborted: CPU%u failed to update ucode\n", cpu);
-        set_state(LOADING_EXIT);
-        return ret;
+        goto out;
     }
 
     /* Let primary threads load the given ucode update */
@@ -539,6 +535,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
         }
     }
 
+ out:
     /* Mark loading is done to unblock other threads */
     set_state(LOADING_EXIT);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 29 12:22:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Mar 2023 12:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516256.800082 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUof-0001pU-U6; Wed, 29 Mar 2023 12:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516256.800082; Wed, 29 Mar 2023 12:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUof-0001pN-RV; Wed, 29 Mar 2023 12:22:13 +0000
Received: by outflank-mailman (input) for mailman id 516256;
 Wed, 29 Mar 2023 12: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 1phUoe-0001pB-Hn
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12: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 1phUoe-0000lY-Gn
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUoe-0004WH-Fu
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LkvWunVBEJnrZJhB8rTpP3rShuA+GxfgyWSzHxydDzA=; b=s808gNKK+WgO801nmTg0w39Un/
	kComJgsuzSQwbrZtQZ4mZ+Rne+PrGIMGCuMYQXASv0e1bg7KyXV3LP9XE89lrR+ffRVrvYekML/1f
	uBGd92M68jNikM5GWOzw3yxkbbX6olhTjYjRhO1OrmGitAkTG02gOju6CjIR3GaW0guQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Restrict directmap permissions for .text/.rodata
Message-Id: <E1phUoe-0004WH-Fu@xenbits.xenproject.org>
Date: Wed, 29 Mar 2023 12:22:12 +0000

commit 631369b38ed468d30d781b82f7bbd16c70330152
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 6 13:07:40 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 28 11:57:56 2023 +0100

    x86/boot: Restrict directmap permissions for .text/.rodata
    
    While we've been diligent to ensure that the main text/data/rodata mappings
    have suitable restrictions, their aliases via the directmap were left fully
    read/write.  Worse, we even had pieces of code making use of this as a
    feature.
    
    Restrict the permissions for .text/rodata, as we have no legitimate need for
    writeability of these areas via the directmap alias.  Note that the
    compile-time allocated pagetables do get written through their directmap
    alias, so need to remain writeable.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/setup.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2b44a3ae26..b29229933d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1667,6 +1667,16 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         destroy_xen_mappings((unsigned long)&__2M_rwdata_end,
                              ROUNDUP((unsigned long)&__2M_rwdata_end, MB(2)));
 
+    /*
+     * Mark all of .text and .rodata as RO in the directmap - we don't want
+     * these sections writeable via any alias.  The compile-time allocated
+     * pagetables are written via their directmap alias, so data/bss needs to
+     * remain writeable.
+     */
+    modify_xen_mappings((unsigned long)__va(__pa(_start)),
+                        (unsigned long)__va(__pa(__2M_rodata_end)),
+                        PAGE_HYPERVISOR_RO);
+
     nr_pages = 0;
     for ( i = 0; i < e820.nr_map; i++ )
         if ( e820.map[i].type == E820_RAM )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 29 12:22:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Mar 2023 12:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516257.800085 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUop-0001tB-Vf; Wed, 29 Mar 2023 12:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516257.800085; Wed, 29 Mar 2023 12:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUop-0001t3-Sz; Wed, 29 Mar 2023 12:22:23 +0000
Received: by outflank-mailman (input) for mailman id 516257;
 Wed, 29 Mar 2023 12: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 1phUoo-0001so-Ou
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12: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 1phUoo-0000lj-Ln
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUoo-0004Ws-KY
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3CdcuC7Nq7eq9z92YhIdr3m+acCiquUK1dtdxWr2BAc=; b=FURA6HX4T+KAPUrhQD8R87FZo5
	JPnAA2j6+G3Twy6ahcvX94i2p03cH80EIl/ZKnOr55yVXwWGHIeLT/stk3IGkWdQEYjxBAhqytGc5
	dP3YE1IF80klkMYMgQSzJ4BtF6ZK3AlyNmxsgo041s8NgeBuaSMjSEMwVlz6SVF1di5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] configure: Drop --enable-githttp
Message-Id: <E1phUoo-0004Ws-KY@xenbits.xenproject.org>
Date: Wed, 29 Mar 2023 12:22:22 +0000

commit c3724462f17c0decb54fac014f9dc83007f95940
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 24 20:09:33 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 28 11:57:56 2023 +0100

    configure: Drop --enable-githttp
    
    Following Demi's work to use HTTPS everywhere, all users of GIT_HTTP have
    been removed from the build system.  Drop the configure knob.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 INSTALL               |  5 -----
 config/Tools.mk.in    |  6 ------
 config/Toplevel.mk.in |  1 -
 configure             | 27 ---------------------------
 configure.ac          |  1 -
 tools/configure       | 27 ---------------------------
 tools/configure.ac    |  1 -
 7 files changed, 68 deletions(-)

diff --git a/INSTALL b/INSTALL
index 0d3eb89f02..3816c17dcd 100644
--- a/INSTALL
+++ b/INSTALL
@@ -89,11 +89,6 @@ from a wrong location. Compiling the tools with rpath will force the
 linker to look in the correct location.
   --enable-rpath
 
-During build in a git checkout the buildsystem needs to download
-additional tools such as qemu. This is done with either the native git
-protocol, or via http if this option is enabled.
-  --enable-githttp
-
 Disable xenstat and xentop monitoring tools.
   --disable-monitors
 
diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index d0d460f922..6abb377564 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -37,12 +37,6 @@ LIBNL3_LIBS         := @LIBNL3_LIBS@
 LIBNL3_CFLAGS       := @LIBNL3_CFLAGS@
 XEN_TOOLS_RPATH     := @rpath@
 
-# Download GIT repositories via HTTP or GIT's own protocol?
-# GIT's protocol is faster and more robust, when it works at all (firewalls
-# may block it). We make it the default, but if your GIT repository downloads
-# fail or hang, please pass --enable-githttp to configure.
-GIT_HTTP            ?= @githttp@
-
 # Optional components
 XENSTAT_XENTOP      := @monitors@
 OCAML_TOOLS         := @ocamltools@
diff --git a/config/Toplevel.mk.in b/config/Toplevel.mk.in
index 4ecacbb37d..4db7eafcab 100644
--- a/config/Toplevel.mk.in
+++ b/config/Toplevel.mk.in
@@ -1,2 +1 @@
 SUBSYSTEMS               := @SUBSYSTEMS@
-GIT_HTTP                 ?= @githttp@
diff --git a/configure b/configure
index f5cd3c286b..99f8434cbf 100755
--- a/configure
+++ b/configure
@@ -594,7 +594,6 @@ stubdom
 tools
 xen
 subdirs
-githttp
 DEBUG_DIR
 XEN_DUMP_DIR
 XEN_PAGING_DIR
@@ -673,7 +672,6 @@ with_xen_scriptdir
 with_xen_dumpdir
 with_rundir
 with_debugdir
-enable_githttp
 enable_xen
 enable_tools
 enable_stubdom
@@ -1309,8 +1307,6 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-githttp        Download GIT repositories via HTTP (default is
-                          DISABLED)
   --disable-xen           Disable build and install of xen
   --disable-tools         Disable build and install of tools
   --enable-stubdom        Enable build and install of stubdom
@@ -2124,29 +2120,6 @@ DEBUG_DIR=$debugdir_path
 
 
 
-# Check whether --enable-githttp was given.
-if test "${enable_githttp+set}" = set; then :
-  enableval=$enable_githttp;
-fi
-
-
-if test "x$enable_githttp" = "xno"; then :
-
-    ax_cv_githttp="n"
-
-elif test "x$enable_githttp" = "xyes"; then :
-
-    ax_cv_githttp="y"
-
-elif test -z $ax_cv_githttp; then :
-
-    ax_cv_githttp="n"
-
-fi
-githttp=$ax_cv_githttp
-
-
-
 case "$host_cpu" in
     i[3456]86|x86_64)
         arch_enable_stubdom=y
diff --git a/configure.ac b/configure.ac
index 3aea407153..19d9311c2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,6 @@ m4_include([m4/subsystem.m4])
 m4_include([m4/paths.m4])
 
 AX_XEN_EXPAND_CONFIG()
-AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
 
 dnl mini-os is only ported to certain platforms
 case "$host_cpu" in
diff --git a/tools/configure b/tools/configure
index dae377c982..bb5b1ae450 100755
--- a/tools/configure
+++ b/tools/configure
@@ -714,7 +714,6 @@ ovmf
 xsmpolicy
 ocamltools
 monitors
-githttp
 rpath
 werror
 DEBUG_DIR
@@ -807,7 +806,6 @@ with_rundir
 with_debugdir
 enable_werror
 enable_rpath
-enable_githttp
 enable_monitors
 enable_ocamltools
 enable_xsmpolicy
@@ -1494,8 +1492,6 @@ Optional Features:
   --disable-werror        Build tools without -Werror (default is ENABLED)
   --enable-rpath          Build tools with -Wl,-rpath,LIBDIR (default is
                           DISABLED)
-  --enable-githttp        Download GIT repositories via HTTP (default is
-                          DISABLED)
   --disable-monitors      Disable xenstat and xentop monitoring tools (default
                           is ENABLED)
   --disable-ocamltools    Disable Ocaml tools (default is ENABLED)
@@ -4156,29 +4152,6 @@ rpath=$ax_cv_rpath
 
 
 
-# Check whether --enable-githttp was given.
-if test "${enable_githttp+set}" = set; then :
-  enableval=$enable_githttp;
-fi
-
-
-if test "x$enable_githttp" = "xno"; then :
-
-    ax_cv_githttp="n"
-
-elif test "x$enable_githttp" = "xyes"; then :
-
-    ax_cv_githttp="y"
-
-elif test -z $ax_cv_githttp; then :
-
-    ax_cv_githttp="n"
-
-fi
-githttp=$ax_cv_githttp
-
-
-
 # Check whether --enable-monitors was given.
 if test "${enable_monitors+set}" = set; then :
   enableval=$enable_monitors;
diff --git a/tools/configure.ac b/tools/configure.ac
index 3a2f6a2da9..9bcf42f233 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -84,7 +84,6 @@ AX_XEN_EXPAND_CONFIG()
 # Enable/disable options
 AX_ARG_DEFAULT_ENABLE([werror], [Build tools without -Werror])
 AX_ARG_DEFAULT_DISABLE([rpath], [Build tools with -Wl,-rpath,LIBDIR])
-AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
 AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
 AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 29 12:22:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Mar 2023 12:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516258.800090 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUp0-0001vi-0k; Wed, 29 Mar 2023 12:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516258.800090; Wed, 29 Mar 2023 12:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUoz-0001va-UQ; Wed, 29 Mar 2023 12:22:33 +0000
Received: by outflank-mailman (input) for mailman id 516258;
 Wed, 29 Mar 2023 12: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 1phUoy-0001vL-R4
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12: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 1phUoy-0000m1-Pe
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUoy-0004Xl-OV
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MkSCvgN5YIUpRppq0qaIzw2uKUtQSnqJELGoKydCd0Q=; b=ulx3zjL2U0EX4pBvKwMVtCR9fa
	2oUUGxZmVOQKQaQxv95/GrUE201vRAvKexlsJXKihrYjeJg9O6YuRZz5G+Bhm+AkP5RLsvegsjTMr
	S/L/2Z7LXNdLe8LZChk/CkItMSwN+nHZSnTqpPp1JMvi8jQi2qzifhUhojbfVvbUkoSk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Remove llvm-8 from the Debian Stretch container
Message-Id: <E1phUoy-0004Xl-OV@xenbits.xenproject.org>
Date: Wed, 29 Mar 2023 12:22:32 +0000

commit 7a298375721636290a57f31bb0f7c2a5a38956a4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 24 17:59:56 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 28 11:57:56 2023 +0100

    CI: Remove llvm-8 from the Debian Stretch container
    
    For similar reasons to c/s a6b1e2b80fe20.  While this container is still
    build-able for now, all the other problems with explicitly-versioned compilers
    remain.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/stretch-llvm-8.list |  3 ---
 automation/build/debian/stretch.dockerfile  | 12 ------------
 automation/gitlab-ci/build.yaml             | 27 ---------------------------
 3 files changed, 42 deletions(-)

diff --git a/automation/build/debian/stretch-llvm-8.list b/automation/build/debian/stretch-llvm-8.list
deleted file mode 100644
index 590001ca81..0000000000
--- a/automation/build/debian/stretch-llvm-8.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# Strech LLVM 8 repos
-deb https://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
-deb-src https://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
index 2c086b197c..1af6c691f8 100644
--- a/automation/build/debian/stretch.dockerfile
+++ b/automation/build/debian/stretch.dockerfile
@@ -54,15 +54,3 @@ RUN apt-get update && \
         apt-get autoremove -y && \
         apt-get clean && \
         rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-
-RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
-COPY stretch-llvm-8.list /etc/apt/sources.list.d/
-
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        clang-8 \
-        lld-8 \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 0817f11055..d323c30a83 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -28,13 +28,6 @@
     CXX: clang++
     clang: y
 
-.clang-8-tmpl:
-  variables: &clang-8
-    CC: clang-8
-    CXX: clang++-8
-    LD: ld.lld-8
-    clang: y
-
 .x86-64-build-tmpl:
   <<: *build
   variables:
@@ -99,16 +92,6 @@
   variables:
     <<: *clang
 
-.clang-8-x86-64-build:
-  extends: .x86-64-build
-  variables:
-    <<: *clang-8
-
-.clang-8-x86-64-build-debug:
-  extends: .x86-64-build-debug
-  variables:
-    <<: *clang-8
-
 .clang-x86-32-build:
   extends: .x86-32-build
   variables:
@@ -285,16 +268,6 @@ debian-stretch-clang-debug:
   variables:
     CONTAINER: debian:stretch
 
-debian-stretch-clang-8:
-  extends: .clang-8-x86-64-build
-  variables:
-    CONTAINER: debian:stretch
-
-debian-stretch-clang-8-debug:
-  extends: .clang-8-x86-64-build-debug
-  variables:
-    CONTAINER: debian:stretch
-
 debian-stretch-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 29 12:22:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Mar 2023 12:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516259.800094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUpA-0001yW-2H; Wed, 29 Mar 2023 12:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516259.800094; Wed, 29 Mar 2023 12:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUp9-0001yO-Vs; Wed, 29 Mar 2023 12:22:43 +0000
Received: by outflank-mailman (input) for mailman id 516259;
 Wed, 29 Mar 2023 12:22: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 1phUp8-0001yC-VR
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12: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 1phUp8-0000mA-UJ
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUp8-0004Yo-SD
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WA3s8GXq0XSAvKH7VinvRie8WMzNXxt767J0cr9QVuE=; b=dI+D11sKtxrf1FEL7Y5he/jN4V
	wSkK0wrYJeRQgPmOmj4Y5BL8wkl5GA/oaQcVs3oHhMX/1Q7Cdp9W01et54ZB9HBj0hUzaSs1qFgPm
	OiqiJAQd6lL7MWYcIGkJI4ppa1igSmfQdU7jg+8AMNCUQtq9BHRHsQiOrg3Cqv+UEYu0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Minor updates to buster-gcc-ibt
Message-Id: <E1phUp8-0004Yo-SD@xenbits.xenproject.org>
Date: Wed, 29 Mar 2023 12:22:42 +0000

commit fc84960385c0c9b131fd03bda97f64cab2567fb5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 24 18:23:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 28 11:57:56 2023 +0100

    CI: Minor updates to buster-gcc-ibt
    
     * Update from GCC 11.2 to 11.3
     * Use python3-minimal instead of python
     * Use --no-install-recommends, requiring ca-certificates, g++-multilib and
       build-essential to be listed explicitly
    
    The resulting container is ~50M smaller
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/buster-gcc-ibt.dockerfile | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/automation/build/debian/buster-gcc-ibt.dockerfile b/automation/build/debian/buster-gcc-ibt.dockerfile
index 441d9a9ab3..96ab4fe8a2 100644
--- a/automation/build/debian/buster-gcc-ibt.dockerfile
+++ b/automation/build/debian/buster-gcc-ibt.dockerfile
@@ -4,10 +4,12 @@ ENV DEBIAN_FRONTEND=noninteractive
 ENV USER root
 
 RUN apt-get update && \
-    apt-get --quiet --yes install \
+    apt-get --quiet --yes --no-install-recommends install \
         bison \
         build-essential \
+        ca-certificates \
         flex \
+        g++-multilib \
         libc6-dev-i386 \
         libgmp-dev \
         libisl-dev \
@@ -19,7 +21,7 @@ RUN apt-get update && \
 RUN mkdir /build
 WORKDIR /build
 
-RUN wget -q https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz -O - | tar xJ --strip=1
+RUN wget -q https://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.xz -O - | tar xJ --strip=1
 RUN wget -q https://xenbits.xen.org/people/andrewcoop/gcc-11.2-Add-fcf-check-attribute-yes-no.patch -O - | patch -p1
 RUN ./configure \
         --prefix=/opt/gcc-11-ibt \
@@ -53,13 +55,14 @@ RUN mkdir /build
 WORKDIR /build
 
 RUN apt-get update && \
-    apt-get --quiet --yes install \
+    apt-get --quiet --yes --no-install-recommends install \
         bison \
+        build-essential \
         checkpolicy \
         flex \
         gawk \
         make \
-        python3 \
+        python3-minimal \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 29 12:22:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Mar 2023 12:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516260.800099 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUpK-00021j-5Z; Wed, 29 Mar 2023 12:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516260.800099; Wed, 29 Mar 2023 12:22:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUpK-00021Z-15; Wed, 29 Mar 2023 12:22:54 +0000
Received: by outflank-mailman (input) for mailman id 516260;
 Wed, 29 Mar 2023 12:22:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpJ-00021N-3B
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpJ-0000mJ-2H
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpJ-0004ZG-1I
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:22: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=UTLNlQgpU9z4yRqpFM6rJxDBEzsuhp+hC/z2n35stTY=; b=AJkiFWkGMTpEjD12DcKILxNIXU
	6zQ4G2vL4x6Uu6XrF8VvyPVlmy0z4Itk/7AqtchPAt3wFKZpwuT+uCFClnQAf4taaeF57AzsYmwma
	iCjraOWP1bkc1IRLcCVJ30aZkEOf3d11iBW+iuWIPt8M2EbWb9cvj557lniNIyUYS8gc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/monitor: add new monitor event to catch I/O instructions
Message-Id: <E1phUpJ-0004ZG-1I@xenbits.xenproject.org>
Date: Wed, 29 Mar 2023 12:22:53 +0000

commit 0c2fe426bc8b14318a4645e8e1def6e61d25a2ec
Author:     Dmitry Isaykin <isaikin-dmitry@yandex.ru>
AuthorDate: Tue Mar 28 14:18:46 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 28 14:18:46 2023 +0200

    x86/monitor: add new monitor event to catch I/O instructions
    
    Adds monitor support for I/O instructions.
    
    Signed-off-by: Dmitry Isaykin <isaikin-dmitry@yandex.ru>
    Signed-off-by: Anton Belousov <abelousov@ptsecurity.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 tools/include/xenctrl.h                |  1 +
 tools/libs/ctrl/xc_monitor.c           | 13 +++++++++++++
 xen/arch/x86/hvm/monitor.c             | 21 +++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c             |  9 +++++++++
 xen/arch/x86/hvm/vmx/vmx.c             |  7 +++++++
 xen/arch/x86/include/asm/domain.h      |  1 +
 xen/arch/x86/include/asm/hvm/monitor.h |  3 +++
 xen/arch/x86/include/asm/monitor.h     |  3 ++-
 xen/arch/x86/monitor.c                 | 13 +++++++++++++
 xen/include/public/domctl.h            |  1 +
 xen/include/public/vm_event.h          | 10 ++++++++++
 11 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 23037874d3..05967ecc92 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2102,6 +2102,7 @@ int xc_monitor_emul_unimplemented(xc_interface *xch, uint32_t domain_id,
                                   bool enable);
 int xc_monitor_vmexit(xc_interface *xch, uint32_t domain_id, bool enable,
                       bool sync);
+int xc_monitor_io(xc_interface *xch, uint32_t domain_id, bool enable);
 /**
  * This function enables / disables emulation for each REP for a
  * REP-compatible instruction.
diff --git a/tools/libs/ctrl/xc_monitor.c b/tools/libs/ctrl/xc_monitor.c
index c5fa62ff30..3cb96f444f 100644
--- a/tools/libs/ctrl/xc_monitor.c
+++ b/tools/libs/ctrl/xc_monitor.c
@@ -261,6 +261,19 @@ int xc_monitor_vmexit(xc_interface *xch, uint32_t domain_id, bool enable,
     return do_domctl(xch, &domctl);
 }
 
+int xc_monitor_io(xc_interface *xch, uint32_t domain_id, bool enable)
+{
+    DECLARE_DOMCTL;
+
+    domctl.cmd = XEN_DOMCTL_monitor_op;
+    domctl.domain = domain_id;
+    domctl.u.monitor_op.op = enable ? XEN_DOMCTL_MONITOR_OP_ENABLE
+                                    : XEN_DOMCTL_MONITOR_OP_DISABLE;
+    domctl.u.monitor_op.event = XEN_DOMCTL_MONITOR_EVENT_IO;
+
+    return do_domctl(xch, &domctl);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index a11cd76f4d..4f500beaf5 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -346,6 +346,27 @@ int hvm_monitor_vmexit(unsigned long exit_reason,
     return monitor_traps(curr, ad->monitor.vmexit_sync, &req);
 }
 
+int hvm_monitor_io(unsigned int port, unsigned int bytes,
+                   bool in, bool str)
+{
+    struct vcpu *curr = current;
+    struct arch_domain *ad = &curr->domain->arch;
+    vm_event_request_t req = {
+        .reason = VM_EVENT_REASON_IO_INSTRUCTION,
+        .u.io.bytes = bytes,
+        .u.io.port = port,
+        .u.io.in = in,
+        .u.io.str = str,
+    };
+
+    if ( !ad->monitor.io_enabled )
+        return 0;
+
+    set_npt_base(curr, &req);
+
+    return monitor_traps(curr, true, &req);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index bfe03316de..02563e4b70 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2939,6 +2939,15 @@ void svm_vmexit_handler(void)
         break;
 
     case VMEXIT_IOIO:
+        rc = hvm_monitor_io(vmcb->ei.io.port,
+                            vmcb->ei.io.bytes,
+                            vmcb->ei.io.in,
+                            vmcb->ei.io.str);
+        if ( rc < 0 )
+            goto unexpected_exit_type;
+        if ( rc )
+            break;
+
         if ( !vmcb->ei.io.str )
         {
             if ( handle_pio(vmcb->ei.io.port,
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 7d5ed8d470..e055885058 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4578,10 +4578,17 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
             };
         } io_qual;
         unsigned int bytes;
+        int rc;
 
         __vmread(EXIT_QUALIFICATION, &io_qual.raw);
         bytes = io_qual.size + 1;
 
+        rc = hvm_monitor_io(io_qual.port, bytes, io_qual.in, io_qual.str);
+        if ( rc < 0 )
+            goto exit_and_crash;
+        if ( rc )
+            break;
+
         if ( io_qual.str )
         {
             if ( !hvm_emulate_one_insn(x86_insn_is_portio, "port I/O") )
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index d072ba038d..17780ad9db 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -433,6 +433,7 @@ struct arch_domain
         unsigned int descriptor_access_enabled                             : 1;
         unsigned int guest_request_userspace_enabled                       : 1;
         unsigned int emul_unimplemented_enabled                            : 1;
+        unsigned int io_enabled                                            : 1;
         /*
          * By default all events are sent.
          * This is used to filter out pagefaults.
diff --git a/xen/arch/x86/include/asm/hvm/monitor.h b/xen/arch/x86/include/asm/hvm/monitor.h
index 639f6dfa37..6884f38d73 100644
--- a/xen/arch/x86/include/asm/hvm/monitor.h
+++ b/xen/arch/x86/include/asm/hvm/monitor.h
@@ -54,6 +54,9 @@ bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, uint32_t pfec,
 int hvm_monitor_vmexit(unsigned long exit_reason,
                        unsigned long exit_qualification);
 
+int hvm_monitor_io(unsigned int port, unsigned int bytes,
+                   bool in, bool str);
+
 #endif /* __ASM_X86_HVM_MONITOR_H__ */
 
 /*
diff --git a/xen/arch/x86/include/asm/monitor.h b/xen/arch/x86/include/asm/monitor.h
index d8d54c5f23..96e6a9d0d8 100644
--- a/xen/arch/x86/include/asm/monitor.h
+++ b/xen/arch/x86/include/asm/monitor.h
@@ -90,7 +90,8 @@ static inline uint32_t arch_monitor_get_capabilities(struct domain *d)
                     (1U << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) |
                     (1U << XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED) |
                     (1U << XEN_DOMCTL_MONITOR_EVENT_INGUEST_PAGEFAULT) |
-                    (1U << XEN_DOMCTL_MONITOR_EVENT_VMEXIT));
+                    (1U << XEN_DOMCTL_MONITOR_EVENT_VMEXIT) |
+                    (1U << XEN_DOMCTL_MONITOR_EVENT_IO));
 
     if ( hvm_is_singlestep_supported() )
         capabilities |= (1U << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP);
diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
index 30ca71432c..d4857faf8a 100644
--- a/xen/arch/x86/monitor.c
+++ b/xen/arch/x86/monitor.c
@@ -346,6 +346,19 @@ int arch_monitor_domctl_event(struct domain *d,
         break;
     }
 
+    case XEN_DOMCTL_MONITOR_EVENT_IO:
+    {
+        bool old_status = ad->monitor.io_enabled;
+
+        if ( unlikely(old_status == requested_status) )
+            return -EEXIST;
+
+        domain_pause(d);
+        ad->monitor.io_enabled = requested_status;
+        domain_unpause(d);
+        break;
+    }
+
     default:
         /*
          * Should not be reached unless arch_monitor_get_capabilities() is
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 51be28c3de..7280e9f968 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1063,6 +1063,7 @@ struct xen_domctl_psr_cmt_op {
 /* Enabled by default */
 #define XEN_DOMCTL_MONITOR_EVENT_INGUEST_PAGEFAULT     11
 #define XEN_DOMCTL_MONITOR_EVENT_VMEXIT                12
+#define XEN_DOMCTL_MONITOR_EVENT_IO                    13
 
 struct xen_domctl_monitor_op {
     uint32_t op; /* XEN_DOMCTL_MONITOR_OP_* */
diff --git a/xen/include/public/vm_event.h b/xen/include/public/vm_event.h
index 0035c26e12..3a86f0e208 100644
--- a/xen/include/public/vm_event.h
+++ b/xen/include/public/vm_event.h
@@ -160,6 +160,8 @@
 #define VM_EVENT_REASON_EMUL_UNIMPLEMENTED      14
 /* VMEXIT */
 #define VM_EVENT_REASON_VMEXIT                  15
+/* IN/OUT Instruction executed */
+#define VM_EVENT_REASON_IO_INSTRUCTION          16
 
 /* Supported values for the vm_event_write_ctrlreg index. */
 #define VM_EVENT_X86_CR0    0
@@ -388,6 +390,13 @@ struct vm_event_vmexit {
     } arch;
 };
 
+struct vm_event_io {
+    uint32_t bytes; /* size of access */
+    uint16_t port;  /* port number */
+    uint8_t  in;    /* direction (0 = OUT, 1 = IN) */
+    uint8_t  str;   /* string instruction (0 = not string, 1 = string) */
+};
+
 typedef struct vm_event_st {
     uint32_t version;   /* VM_EVENT_INTERFACE_VERSION */
     uint32_t flags;     /* VM_EVENT_FLAG_* */
@@ -409,6 +418,7 @@ typedef struct vm_event_st {
         struct vm_event_debug                 debug_exception;
         struct vm_event_cpuid                 cpuid;
         struct vm_event_vmexit                vmexit;
+        struct vm_event_io                    io;
         union {
             struct vm_event_interrupt_x86     x86;
         } interrupt;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 29 12:23:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Mar 2023 12:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516261.800101 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUpU-00024v-7d; Wed, 29 Mar 2023 12:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516261.800101; Wed, 29 Mar 2023 12:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUpU-00024o-4x; Wed, 29 Mar 2023 12:23:04 +0000
Received: by outflank-mailman (input) for mailman id 516261;
 Wed, 29 Mar 2023 12:23:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpT-00024c-6Y
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:23:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpT-0000n3-5W
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpT-0004aE-4i
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ieolBFVNmzsVi89M1IRFKCsq4XGi76b9AX2mJLgBcQE=; b=OgGjBIC93q4KVDKiAOQCtj/IUS
	Hp3NqFgoJMXXbM7YfSYOALHIL2LSFP4AZfF6s4MH98OYNhU//xTJK5pkAlK1VL7+VqsQARwvAX6FT
	8nCV1rU701hlpN7biRPnYIu1Vso3kUhghix/wP5ILweg+mVz3IA2YkYcdgdiyk1KQwmk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] include: don't mention stub headers more than once in a make rule
Message-Id: <E1phUpT-0004aE-4i@xenbits.xenproject.org>
Date: Wed, 29 Mar 2023 12:23:03 +0000

commit 231ab79704cbb5b9be7700287c3b185225d34f1b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 28 14:20:16 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 28 14:20:16 2023 +0200

    include: don't mention stub headers more than once in a make rule
    
    When !GRANT_TABLE and !PV_SHIM headers-n contains grant_table.h twice,
    causing make to complain "target '...' given more than once in the same
    rule" for the rule generating the stub headers. We don't need duplicate
    entries in headers-n anywhere, so zap them (by using $(sort ...)) right
    where the final value of the variable is constructed.
    
    Fixes: 6bec713f871f ("include/compat: produce stubs for headers not otherwise generated")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/include/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/Makefile b/xen/include/Makefile
index 2da842b3ee..edd5322e88 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -34,7 +34,7 @@ headers-$(CONFIG_TRACEBUFFER) += compat/trace.h
 headers-$(CONFIG_XENOPROF) += compat/xenoprof.h
 headers-$(CONFIG_XSM_FLASK) += compat/xsm/flask_op.h
 
-headers-n := $(filter-out $(headers-y),$(headers-n) $(headers-))
+headers-n := $(sort $(filter-out $(headers-y),$(headers-n) $(headers-)))
 
 cppflags-y                := -include public/xen-compat.h -DXEN_GENERATING_COMPAT_HEADERS
 cppflags-$(CONFIG_X86)    += -m32
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 29 12:23:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Mar 2023 12:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516262.800106 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phUpe-000284-9L; Wed, 29 Mar 2023 12:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516262.800106; Wed, 29 Mar 2023 12: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 1phUpe-00027w-6V; Wed, 29 Mar 2023 12:23:14 +0000
Received: by outflank-mailman (input) for mailman id 516262;
 Wed, 29 Mar 2023 12:23:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpd-00027k-A3
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:23:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpd-0000nA-9A
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phUpd-0004be-8D
 for xen-changelog@lists.xenproject.org; Wed, 29 Mar 2023 12:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6wmxBwn4E0+ugMVIZurzVFBIKcGVKdOSbhri1FQRoiY=; b=Y6jxi8BvlTcE2rXl1cfVzgsS8D
	Xs+Mu9FUVkmhZ1riPs5JDsZk/9N76TCTAquaj4tCeCgwROIaOWKvMDuScBPRj/4sl+o9jK5tpiuA0
	+BfPHMPuXFVAE3IADnWrFHAlK34Gkz0+db8aNYKywr0Wj6ei24sA7GtPz3a8CLis6FNE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vpci/msix: handle accesses adjacent to the MSI-X table
Message-Id: <E1phUpd-0004be-8D@xenbits.xenproject.org>
Date: Wed, 29 Mar 2023 12:23:13 +0000

commit b177892d2d0e8a31122c218989f43130aeba5282
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Mar 28 14:20:35 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 28 14:20:35 2023 +0200

    vpci/msix: handle accesses adjacent to the MSI-X table
    
    The handling of the MSI-X table accesses by Xen requires that any
    pages part of the MSI-X related tables are not mapped into the domain
    physmap.  As a result, any device registers in the same pages as the
    start or the end of the MSIX or PBA tables is not currently
    accessible, as the accesses are just dropped.
    
    Note the spec forbids such placing of registers, as the MSIX and PBA
    tables must be 4K isolated from any other registers:
    
    "If a Base Address register that maps address space for the MSI-X
    Table or MSI-X PBA also maps other usable address space that is not
    associated with MSI-X structures, locations (e.g., for CSRs) used in
    the other address space must not share any naturally aligned 4-KB
    address range with one where either MSI-X structure resides."
    
    Yet the 'Intel Wi-Fi 6 AX201' device on one of my boxes has registers
    in the same page as the MSIX tables, and thus won't work on a PVH dom0
    without this fix.
    
    In order to cope with the behavior passthrough any accesses that fall
    on the same page as the MSIX tables (but don't fall in between) to the
    underlying hardware.  Such forwarding also takes care of the PBA
    accesses, so it allows to remove the code doing this handling in
    msix_{read,write}.  Note that as a result accesses to the PBA array
    are no longer limited to 4 and 8 byte sizes, there's no access size
    restriction for PBA accesses documented in the specification.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/vpci/msix.c | 349 +++++++++++++++++++++++++++++++++++-------------
 xen/drivers/vpci/vpci.c |   7 +-
 xen/include/xen/vpci.h  |   8 +-
 3 files changed, 269 insertions(+), 95 deletions(-)

diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index bea0cc7aed..99dd249c15 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -27,6 +27,11 @@
     ((addr) >= vmsix_table_addr(vpci, nr) &&                              \
      (addr) < vmsix_table_addr(vpci, nr) + vmsix_table_size(vpci, nr))
 
+#define VMSIX_ADDR_SAME_PAGE(addr, vpci, nr)                              \
+    (PFN_DOWN(addr) >= PFN_DOWN(vmsix_table_addr(vpci, nr)) &&            \
+     PFN_DOWN(addr) <= PFN_DOWN(vmsix_table_addr(vpci, nr) +              \
+                                vmsix_table_size(vpci, nr) - 1))
+
 static uint32_t cf_check control_read(
     const struct pci_dev *pdev, unsigned int reg, void *data)
 {
@@ -149,7 +154,7 @@ static struct vpci_msix *msix_find(const struct domain *d, unsigned long addr)
 
         for ( i = 0; i < ARRAY_SIZE(msix->tables); i++ )
             if ( bars[msix->tables[i] & PCI_MSIX_BIRMASK].enabled &&
-                 VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, i) )
+                 VMSIX_ADDR_SAME_PAGE(addr, msix->pdev->vpci, i) )
                 return msix;
     }
 
@@ -182,36 +187,167 @@ static struct vpci_msix_entry *get_entry(struct vpci_msix *msix,
     return &msix->entries[(addr - start) / PCI_MSIX_ENTRY_SIZE];
 }
 
-static void __iomem *get_pba(struct vpci *vpci)
+static void __iomem *get_table(const struct vpci *vpci, unsigned int slot)
 {
     struct vpci_msix *msix = vpci->msix;
+    paddr_t addr = 0;
+
+    ASSERT(spin_is_locked(&vpci->lock));
+
+    if ( likely(msix->table[slot]) )
+        return msix->table[slot];
+
+    switch ( slot )
+    {
+    case VPCI_MSIX_TBL_TAIL:
+        addr = vmsix_table_size(vpci, VPCI_MSIX_TABLE);
+        fallthrough;
+    case VPCI_MSIX_TBL_HEAD:
+        addr += vmsix_table_addr(vpci, VPCI_MSIX_TABLE);
+        break;
+
+    case VPCI_MSIX_PBA_TAIL:
+        addr = vmsix_table_size(vpci, VPCI_MSIX_PBA);
+        fallthrough;
+    case VPCI_MSIX_PBA_HEAD:
+        addr += vmsix_table_addr(vpci, VPCI_MSIX_PBA);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        return NULL;
+    }
+
+    msix->table[slot] = ioremap(round_pgdown(addr), PAGE_SIZE);
+
+    return msix->table[slot];
+}
+
+unsigned int get_slot(const struct vpci *vpci, unsigned long addr)
+{
+    unsigned long pfn = PFN_DOWN(addr);
+
     /*
-     * PBA will only be unmapped when the device is deassigned, so access it
-     * without holding the vpci lock.
+     * The logic below relies on having the tables identity mapped to the guest
+     * address space, or for the `addr` parameter to be translated into its
+     * host physical memory address equivalent.
      */
-    void __iomem *pba = read_atomic(&msix->pba);
 
-    if ( likely(pba) )
-        return pba;
+    if ( pfn == PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_TABLE)) )
+        return VPCI_MSIX_TBL_HEAD;
+    if ( pfn == PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_TABLE) +
+                         vmsix_table_size(vpci, VPCI_MSIX_TABLE) - 1) )
+        return VPCI_MSIX_TBL_TAIL;
+    if ( pfn == PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_PBA)) )
+        return VPCI_MSIX_PBA_HEAD;
+    if ( pfn == PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_PBA) +
+                         vmsix_table_size(vpci, VPCI_MSIX_PBA) - 1) )
+        return VPCI_MSIX_PBA_TAIL;
+
+    ASSERT_UNREACHABLE();
+    return -1;
+}
+
+static bool adjacent_handle(const struct vpci_msix *msix, unsigned long addr)
+{
+    unsigned int i;
+
+    if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) )
+        return true;
+
+    if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_TABLE) )
+        return false;
+
+    for ( i = 0; i < ARRAY_SIZE(msix->tables); i++ )
+        if ( VMSIX_ADDR_SAME_PAGE(addr, msix->pdev->vpci, i) )
+            return true;
+
+    return false;
+}
+
+static int adjacent_read(const struct domain *d, const struct vpci_msix *msix,
+                         unsigned long addr, unsigned int len,
+                         unsigned long *data)
+{
+    const void __iomem *mem;
+    struct vpci *vpci = msix->pdev->vpci;
+    unsigned int slot;
+
+    *data = ~0ul;
+
+    if ( !adjacent_handle(msix, addr + len - 1) )
+        return X86EMUL_OKAY;
+
+    slot = get_slot(vpci, addr);
+    if ( slot >= ARRAY_SIZE(msix->table) )
+        return X86EMUL_OKAY;
+
+    if ( unlikely(!IS_ALIGNED(addr, len)) )
+    {
+        unsigned int i;
+
+        gprintk(XENLOG_DEBUG, "%pp: unaligned read to MSI-X related page\n",
+                &msix->pdev->sbdf);
+
+        /*
+         * Split unaligned accesses into byte sized ones. Shouldn't happen in
+         * the first place, but devices shouldn't have registers in the same 4K
+         * page as the MSIX tables either.
+         *
+         * It's unclear whether this could cause issues if a guest expects
+         * registers to be accessed atomically, it better use an aligned access
+         * if it has such expectations.
+         */
+        for ( i = 0; i < len; i++ )
+        {
+            unsigned long partial = ~0ul;
+            int rc = adjacent_read(d, msix, addr + i, 1, &partial);
+
+            if ( rc != X86EMUL_OKAY )
+                return rc;
+
+            *data &= ~(0xfful << (i * 8));
+            *data |= (partial & 0xff) << (i * 8);
+        }
 
-    pba = ioremap(vmsix_table_addr(vpci, VPCI_MSIX_PBA),
-                  vmsix_table_size(vpci, VPCI_MSIX_PBA));
-    if ( !pba )
-        return read_atomic(&msix->pba);
+        return X86EMUL_OKAY;
+    }
 
     spin_lock(&vpci->lock);
-    if ( !msix->pba )
+    mem = get_table(vpci, slot);
+    if ( !mem )
     {
-        write_atomic(&msix->pba, pba);
         spin_unlock(&vpci->lock);
+        gprintk(XENLOG_WARNING,
+                "%pp: unable to map MSI-X page, returning all bits set\n",
+                &msix->pdev->sbdf);
+        return X86EMUL_OKAY;
     }
-    else
+
+    switch ( len )
     {
-        spin_unlock(&vpci->lock);
-        iounmap(pba);
+    case 1:
+        *data = readb(mem + PAGE_OFFSET(addr));
+        break;
+
+    case 2:
+        *data = readw(mem + PAGE_OFFSET(addr));
+        break;
+
+    case 4:
+        *data = readl(mem + PAGE_OFFSET(addr));
+        break;
+
+    case 8:
+        *data = readq(mem + PAGE_OFFSET(addr));
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
     }
+    spin_unlock(&vpci->lock);
 
-    return read_atomic(&msix->pba);
+    return X86EMUL_OKAY;
 }
 
 static int cf_check msix_read(
@@ -227,47 +363,11 @@ static int cf_check msix_read(
     if ( !msix )
         return X86EMUL_RETRY;
 
-    if ( !access_allowed(msix->pdev, addr, len) )
-        return X86EMUL_OKAY;
-
-    if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) )
-    {
-        struct vpci *vpci = msix->pdev->vpci;
-        unsigned int idx = addr - vmsix_table_addr(vpci, VPCI_MSIX_PBA);
-        const void __iomem *pba = get_pba(vpci);
-
-        /*
-         * Access to PBA.
-         *
-         * TODO: note that this relies on having the PBA identity mapped to the
-         * guest address space. If this changes the address will need to be
-         * translated.
-         */
-        if ( !pba )
-        {
-            gprintk(XENLOG_WARNING,
-                    "%pp: unable to map MSI-X PBA, report all pending\n",
-                    &msix->pdev->sbdf);
-            return X86EMUL_OKAY;
-        }
-
-        switch ( len )
-        {
-        case 4:
-            *data = readl(pba + idx);
-            break;
-
-        case 8:
-            *data = readq(pba + idx);
-            break;
-
-        default:
-            ASSERT_UNREACHABLE();
-            break;
-        }
+    if ( adjacent_handle(msix, addr) )
+        return adjacent_read(d, msix, addr, len, data);
 
+    if ( !access_allowed(msix->pdev, addr, len) )
         return X86EMUL_OKAY;
-    }
 
     spin_lock(&msix->pdev->vpci->lock);
     entry = get_entry(msix, addr);
@@ -303,56 +403,103 @@ static int cf_check msix_read(
     return X86EMUL_OKAY;
 }
 
-static int cf_check msix_write(
-    struct vcpu *v, unsigned long addr, unsigned int len, unsigned long data)
+static int adjacent_write(const struct domain *d, const struct vpci_msix *msix,
+                          unsigned long addr, unsigned int len,
+                          unsigned long data)
 {
-    const struct domain *d = v->domain;
-    struct vpci_msix *msix = msix_find(d, addr);
-    struct vpci_msix_entry *entry;
-    unsigned int offset;
+    void __iomem *mem;
+    struct vpci *vpci = msix->pdev->vpci;
+    unsigned int slot;
 
-    if ( !msix )
-        return X86EMUL_RETRY;
+    if ( !adjacent_handle(msix, addr + len - 1) )
+        return X86EMUL_OKAY;
 
-    if ( !access_allowed(msix->pdev, addr, len) )
+    /*
+     * Only check start and end of the access because the size of the PBA is
+     * assumed to be equal or bigger (8 bytes) than the length of any access
+     * handled here.
+     */
+    if ( (VMSIX_ADDR_IN_RANGE(addr, vpci, VPCI_MSIX_PBA) ||
+          VMSIX_ADDR_IN_RANGE(addr + len - 1, vpci, VPCI_MSIX_PBA)) &&
+         !is_hardware_domain(d) )
+        /* Ignore writes to PBA for DomUs, it's undefined behavior. */
         return X86EMUL_OKAY;
 
-    if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) )
+    slot = get_slot(vpci, addr);
+    if ( slot >= ARRAY_SIZE(msix->table) )
+        return X86EMUL_OKAY;
+
+    if ( unlikely(!IS_ALIGNED(addr, len)) )
     {
-        struct vpci *vpci = msix->pdev->vpci;
-        unsigned int idx = addr - vmsix_table_addr(vpci, VPCI_MSIX_PBA);
-        const void __iomem *pba = get_pba(vpci);
+        unsigned int i;
 
-        if ( !is_hardware_domain(d) )
-            /* Ignore writes to PBA for DomUs, it's behavior is undefined. */
-            return X86EMUL_OKAY;
+        gprintk(XENLOG_DEBUG, "%pp: unaligned write to MSI-X related page\n",
+                &msix->pdev->sbdf);
 
-        if ( !pba )
+        for ( i = 0; i < len; i++ )
         {
-            /* Unable to map the PBA, ignore write. */
-            gprintk(XENLOG_WARNING,
-                    "%pp: unable to map MSI-X PBA, write ignored\n",
-                    &msix->pdev->sbdf);
-            return X86EMUL_OKAY;
+            int rc = adjacent_write(d, msix, addr + i, 1, data >> (i * 8));
+
+            if ( rc != X86EMUL_OKAY )
+                return rc;
         }
 
-        switch ( len )
-        {
-        case 4:
-            writel(data, pba + idx);
-            break;
+        return X86EMUL_OKAY;
+    }
 
-        case 8:
-            writeq(data, pba + idx);
-            break;
+    spin_lock(&vpci->lock);
+    mem = get_table(vpci, slot);
+    if ( !mem )
+    {
+        spin_unlock(&vpci->lock);
+        gprintk(XENLOG_WARNING,
+                "%pp: unable to map MSI-X page, dropping write\n",
+                &msix->pdev->sbdf);
+        return X86EMUL_OKAY;
+    }
 
-        default:
-            ASSERT_UNREACHABLE();
-            break;
-        }
+    switch ( len )
+    {
+    case 1:
+        writeb(data, mem + PAGE_OFFSET(addr));
+        break;
 
-        return X86EMUL_OKAY;
+    case 2:
+        writew(data, mem + PAGE_OFFSET(addr));
+        break;
+
+    case 4:
+        writel(data, mem + PAGE_OFFSET(addr));
+        break;
+
+    case 8:
+        writeq(data, mem + PAGE_OFFSET(addr));
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
     }
+    spin_unlock(&vpci->lock);
+
+    return X86EMUL_OKAY;
+}
+
+static int cf_check msix_write(
+    struct vcpu *v, unsigned long addr, unsigned int len, unsigned long data)
+{
+    const struct domain *d = v->domain;
+    struct vpci_msix *msix = msix_find(d, addr);
+    struct vpci_msix_entry *entry;
+    unsigned int offset;
+
+    if ( !msix )
+        return X86EMUL_RETRY;
+
+    if ( adjacent_handle(msix, addr) )
+        return adjacent_write(d, msix, addr, len, data);
+
+    if ( !access_allowed(msix->pdev, addr, len) )
+        return X86EMUL_OKAY;
 
     spin_lock(&msix->pdev->vpci->lock);
     entry = get_entry(msix, addr);
@@ -482,6 +629,26 @@ int vpci_make_msix_hole(const struct pci_dev *pdev)
         }
     }
 
+    if ( is_hardware_domain(d) )
+    {
+        /*
+         * For dom0 only: remove any hypervisor mappings of the MSIX or PBA
+         * related areas, as dom0 is capable of moving the position of the BARs
+         * in the host address space.
+         *
+         * We rely on being called with the vPCI lock held once the domain is
+         * running, so the maps are not in use.
+         */
+        for ( i = 0; i < ARRAY_SIZE(pdev->vpci->msix->table); i++ )
+            if ( pdev->vpci->msix->table[i] )
+            {
+                /* If there are any maps, the domain must be running. */
+                ASSERT(spin_is_locked(&pdev->vpci->lock));
+                iounmap(pdev->vpci->msix->table[i]);
+                pdev->vpci->msix->table[i] = NULL;
+            }
+    }
+
     return 0;
 }
 
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 6d48d496bb..652807a4a4 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -54,9 +54,12 @@ void vpci_remove_device(struct pci_dev *pdev)
     spin_unlock(&pdev->vpci->lock);
     if ( pdev->vpci->msix )
     {
+        unsigned int i;
+
         list_del(&pdev->vpci->msix->next);
-        if ( pdev->vpci->msix->pba )
-            iounmap(pdev->vpci->msix->pba);
+        for ( i = 0; i < ARRAY_SIZE(pdev->vpci->msix->table); i++ )
+            if ( pdev->vpci->msix->table[i] )
+                iounmap(pdev->vpci->msix->table[i]);
     }
     xfree(pdev->vpci->msix);
     xfree(pdev->vpci->msi);
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index d8acfeba8a..0b8a2a3c74 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -133,8 +133,12 @@ struct vpci {
         bool enabled         : 1;
         /* Masked? */
         bool masked          : 1;
-        /* PBA map */
-        void __iomem *pba;
+        /* Partial table map. */
+#define VPCI_MSIX_TBL_HEAD 0
+#define VPCI_MSIX_TBL_TAIL 1
+#define VPCI_MSIX_PBA_HEAD 2
+#define VPCI_MSIX_PBA_TAIL 3
+        void __iomem *table[4];
         /* Entries. */
         struct vpci_msix_entry {
             uint64_t addr;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 30 20:33:10 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 30 Mar 2023 20:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516872.801688 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phyxD-0004Lm-2Z; Thu, 30 Mar 2023 20:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516872.801688; Thu, 30 Mar 2023 20: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 1phyxC-0004Le-VF; Thu, 30 Mar 2023 20:33:02 +0000
Received: by outflank-mailman (input) for mailman id 516872;
 Thu, 30 Mar 2023 20: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 1phyxB-0004LB-US
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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 1phyxB-0001Dq-TJ
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phyxB-00019F-S1
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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=OiKUAfkM6xTfP1XSiREZx5Bqp+Ce7EjKAXBW6nWoDkw=; b=wnoTWZNiMr3ZHGoGHUvV8uu2L9
	K4V46+Z54euA+o6P/f9RApK/5mjtGrGTYQ9ZwxYsi6XJQguhFVEufE8FlTvBvKEVo8Y3u0MLOJ1Tz
	zlK86XcS34X5+kc0tXThTT2IM0zACO8VKw+Yszv7xXZHu/DLmtBkRd+dpq1UKz9qVX5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: remove stale comment in create_node()
Message-Id: <E1phyxB-00019F-S1@xenbits.xenproject.org>
Date: Thu, 30 Mar 2023 20:33:01 +0000

commit 747b86153e492c3785d60fd2baca08556293ed27
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Mar 29 14:54:20 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 29 14:54:20 2023 +0200

    tools/xenstore: remove stale comment in create_node()
    
    There is a part of a comment in create_node() which should have been
    deleted when modifying the related coding.
    
    Fixes: 1cd3cc7ea27c ("tools/xenstore: create_node: Don't defer work to undo any changes on failure")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 7348f935bc..a61db2db2d 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1480,9 +1480,6 @@ static struct node *create_node(struct connection *conn, const void *ctx,
 	 * All new created nodes will have i->parent set, while the final
 	 * node will be already existing and won't have i->parent set.
 	 * New nodes are subject to quota handling.
-	 * Initially set a destructor for all new nodes removing them from
-	 * TDB again and undoing quota accounting for the case of an error
-	 * during the write loop.
 	 */
 	for (i = node; i; i = i->parent) {
 		/* i->parent is set for each new node, so check quota. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 30 20:33:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 30 Mar 2023 20:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516875.801690 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phyxN-0004WO-3P; Thu, 30 Mar 2023 20:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516875.801690; Thu, 30 Mar 2023 20: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 1phyxN-0004WE-0W; Thu, 30 Mar 2023 20:33:13 +0000
Received: by outflank-mailman (input) for mailman id 516875;
 Thu, 30 Mar 2023 20: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 1phyxM-0004W1-37
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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 1phyxM-0001Dx-26
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phyxL-0001B1-W1
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QZ1MMUyO11cpj6cyqBOHYuMxedXVxSsyfWuzrQPh4IY=; b=DKuR86Y8jjh20iL8pKOJ50Moo5
	iVFkgOT6Y0YEsq6XlchzxMGISYMCwF9/fercixU3PkWPYn6W3oWLbZO3lNR6qtEXaCAICJR2aKhSh
	osjKCesQDObinbwLV7HDfK+UjN/CGG7zSNvrVAxxljRNZK6IeXBV3ba50kNgmHr6DvdQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ns16550: correct name/value pair parsing for PCI port/bridge
Message-Id: <E1phyxL-0001B1-W1@xenbits.xenproject.org>
Date: Thu, 30 Mar 2023 20:33:11 +0000

commit e692b22230b411d762ac9e278a398e28df474eae
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 29 14:55:37 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 29 14:55:37 2023 +0200

    ns16550: correct name/value pair parsing for PCI port/bridge
    
    First of all these were inverted: "bridge=" caused the port coordinates
    to be established, while "port=" controlled the bridge coordinates. And
    then the error messages being identical also wasn't helpful. While
    correcting this also move both case blocks close together.
    
    Fixes: 97fd49a7e074 ("ns16550: add support for UART parameters to be specifed with name-value pairs")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/char/ns16550.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 092f6b9c4b..1b21eb93c4 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1631,13 +1631,6 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
             break;
 
 #ifdef CONFIG_HAS_PCI
-        case bridge_bdf:
-            if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0],
-                            &uart->ps_bdf[1], &uart->ps_bdf[2]) )
-                PARSE_ERR_RET("Bad port PCI coordinates\n");
-            uart->ps_bdf_enable = true;
-            break;
-
         case device:
             if ( strncmp(param_value, "pci", 3) == 0 )
             {
@@ -1652,9 +1645,16 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
             break;
 
         case port_bdf:
+            if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0],
+                            &uart->ps_bdf[1], &uart->ps_bdf[2]) )
+                PARSE_ERR_RET("Bad port PCI coordinates\n");
+            uart->ps_bdf_enable = true;
+            break;
+
+        case bridge_bdf:
             if ( !parse_pci(param_value, NULL, &uart->pb_bdf[0],
                             &uart->pb_bdf[1], &uart->pb_bdf[2]) )
-                PARSE_ERR_RET("Bad port PCI coordinates\n");
+                PARSE_ERR_RET("Bad bridge PCI coordinates\n");
             uart->pb_bdf_enable = true;
             break;
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 30 20:33:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 30 Mar 2023 20:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516876.801694 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phyxX-0004ZC-4l; Thu, 30 Mar 2023 20:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516876.801694; Thu, 30 Mar 2023 20: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 1phyxX-0004Z5-1x; Thu, 30 Mar 2023 20:33:23 +0000
Received: by outflank-mailman (input) for mailman id 516876;
 Thu, 30 Mar 2023 20: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 1phyxW-0004Yn-7A
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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 1phyxW-0001EC-69
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phyxW-0001BT-4g
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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=ZDKMLnjms0B+x1Tp6OwtXleHby9vYy7D4AFZ+7y4tuU=; b=mnNcweWo6gWtYnJSKxFqL6vcFV
	y8SdEuQQdwtNk4teoq8KStv4NqMUXTSpzlC34ceRDNPrV00sBdmzD+CHOcK52R/VJddWPNsndOmsN
	PtXvhEuamtiZCyWno8Q+wsylpqR//SbNePM3Z6IexDAYm5ujNaC99rCee6P1oYI6ViNE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vpci/msix: restore PBA access length and alignment restrictions
Message-Id: <E1phyxW-0001BT-4g@xenbits.xenproject.org>
Date: Thu, 30 Mar 2023 20:33:22 +0000

commit 7a502b4fbc339e9d3d3d45fb37f09da06bc3081c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Mar 29 14:56:33 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 29 14:56:33 2023 +0200

    vpci/msix: restore PBA access length and alignment restrictions
    
    Accesses to the PBA array have the same length and alignment
    limitations as accesses to the MSI-X table:
    
    "For all accesses to MSI-X Table and MSI-X PBA fields, software must
    use aligned full DWORD or aligned full QWORD transactions; otherwise,
    the result is undefined."
    
    Introduce such length and alignment checks into the handling of PBA
    accesses for vPCI.  This was a mistake of mine for not reading the
    specification correctly.
    
    Note that accesses must now be aligned, and hence there's no longer a
    need to check that the end of the access falls into the PBA region as
    both the access and the region addresses must be aligned.
    
    Fixes: b177892d2d ('vpci/msix: handle accesses adjacent to the MSI-X table')
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/vpci/msix.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 99dd249c15..25bde77586 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -278,6 +278,11 @@ static int adjacent_read(const struct domain *d, const struct vpci_msix *msix,
     if ( !adjacent_handle(msix, addr + len - 1) )
         return X86EMUL_OKAY;
 
+    if ( VMSIX_ADDR_IN_RANGE(addr, vpci, VPCI_MSIX_PBA) &&
+         !access_allowed(msix->pdev, addr, len) )
+        /* PBA accesses must be aligned and 4 or 8 bytes in size. */
+        return X86EMUL_OKAY;
+
     slot = get_slot(vpci, addr);
     if ( slot >= ARRAY_SIZE(msix->table) )
         return X86EMUL_OKAY;
@@ -419,9 +424,8 @@ static int adjacent_write(const struct domain *d, const struct vpci_msix *msix,
      * assumed to be equal or bigger (8 bytes) than the length of any access
      * handled here.
      */
-    if ( (VMSIX_ADDR_IN_RANGE(addr, vpci, VPCI_MSIX_PBA) ||
-          VMSIX_ADDR_IN_RANGE(addr + len - 1, vpci, VPCI_MSIX_PBA)) &&
-         !is_hardware_domain(d) )
+    if ( VMSIX_ADDR_IN_RANGE(addr, vpci, VPCI_MSIX_PBA) &&
+         (!access_allowed(msix->pdev, addr, len) || !is_hardware_domain(d)) )
         /* Ignore writes to PBA for DomUs, it's undefined behavior. */
         return X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 30 20:33:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 30 Mar 2023 20:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516877.801698 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phyxh-0004cf-6M; Thu, 30 Mar 2023 20:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516877.801698; Thu, 30 Mar 2023 20: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 1phyxh-0004cX-3c; Thu, 30 Mar 2023 20:33:33 +0000
Received: by outflank-mailman (input) for mailman id 516877;
 Thu, 30 Mar 2023 20: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 1phyxg-0004cF-Av
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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 1phyxg-0001Ed-9m
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phyxg-0001C2-8n
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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=/k+VmrefC8PCYCcLQI6Uafg/wcXgGs4TVNe22VczFqc=; b=vkUDw5GNhjJ+iy0nCqP1jAjjlS
	RL5J9oBmRzU1BAyM9cXw5TVcX5ubn0dqi0N9Ox1RWpjlUw+6xY9lAmtVkF3TFQfnzfiIrDaVSIFxB
	V9UcDhp8XQd0seyyjoqj0WHgxDjfNZCEjqVI8vGLcr8EKPzZIy+oWPfMQrHGPhHycwkk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: fix quota check in acc_fix_domains()
Message-Id: <E1phyxg-0001C2-8n@xenbits.xenproject.org>
Date: Thu, 30 Mar 2023 20:33:32 +0000

commit f6b801c36bd5e4ab22a9f80c8d57121b62b139af
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Mar 28 16:43:27 2023 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Mar 29 22:02:36 2023 +0100

    tools/xenstore: fix quota check in acc_fix_domains()
    
    Today when finalizing a transaction the number of node quota is checked
    to not being exceeded after the transaction. This check is always done,
    even if the transaction is being performed by a privileged connection,
    or if there were no nodes created in the transaction.
    
    Correct that by checking quota only if:
    - the transaction is being performed by an unprivileged guest, and
    - at least one node was created in the transaction
    
    Reported-by: Julien Grall <julien@xen.org>
    Fixes: f2bebf72c4d5 ("xenstore: rework of transaction handling")
    Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_core.c        |  3 +++
 tools/xenstore/xenstored_domain.c      |  4 ++--
 tools/xenstore/xenstored_domain.h      |  7 ++++++-
 tools/xenstore/xenstored_transaction.c | 16 ++++++++++++++--
 tools/xenstore/xenstored_transaction.h |  3 +++
 5 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index a61db2db2d..3ca68681e3 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1472,6 +1472,9 @@ static struct node *create_node(struct connection *conn, const void *ctx,
 	if (!node)
 		return NULL;
 
+	if (conn && conn->transaction)
+		ta_node_created(conn->transaction);
+
 	node->data = data;
 	node->datalen = datalen;
 
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index d7fc2fafc7..f62be2245c 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -544,7 +544,7 @@ static struct domain *find_domain_by_domid(unsigned int domid)
 	return (d && d->introduced) ? d : NULL;
 }
 
-int acc_fix_domains(struct list_head *head, bool update)
+int acc_fix_domains(struct list_head *head, bool chk_quota, bool update)
 {
 	struct changed_domain *cd;
 	int cnt;
@@ -552,7 +552,7 @@ int acc_fix_domains(struct list_head *head, bool update)
 	list_for_each_entry(cd, head, list) {
 		cnt = domain_nbentry_fix(cd->domid, cd->nbentry, update);
 		if (!update) {
-			if (cnt >= quota_nb_entry_per_domain)
+			if (chk_quota && cnt >= quota_nb_entry_per_domain)
 				return ENOSPC;
 			if (cnt < 0)
 				return ENOMEM;
diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_domain.h
index dc4660861e..279cccb3ad 100644
--- a/tools/xenstore/xenstored_domain.h
+++ b/tools/xenstore/xenstored_domain.h
@@ -96,7 +96,12 @@ void domain_outstanding_dec(struct connection *conn);
 void domain_outstanding_domid_dec(unsigned int domid);
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid);
-int acc_fix_domains(struct list_head *head, bool update);
+
+/*
+ * Update or check number of nodes per domain at the end of a transaction.
+ * If "update" is true, "chk_quota" is ignored.
+ */
+int acc_fix_domains(struct list_head *head, bool chk_quota, bool update);
 
 /* Write rate limiting */
 
diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.c
index 1aa9d3cb3d..2b15506953 100644
--- a/tools/xenstore/xenstored_transaction.c
+++ b/tools/xenstore/xenstored_transaction.c
@@ -160,12 +160,20 @@ struct transaction
 	/* List of changed domains - to record the changed domain entry number */
 	struct list_head changed_domains;
 
+	/* There was at least one node created in the transaction. */
+	bool node_created;
+
 	/* Flag for letting transaction fail. */
 	bool fail;
 };
 
 uint64_t generation;
 
+void ta_node_created(struct transaction *trans)
+{
+	trans->node_created = true;
+}
+
 static struct accessed_node *find_accessed_node(struct transaction *trans,
 						const char *name)
 {
@@ -509,6 +517,7 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 	const char *arg = onearg(in);
 	struct transaction *trans;
 	bool is_corrupt = false;
+	bool chk_quota;
 	int ret;
 
 	if (!arg || (!streq(arg, "T") && !streq(arg, "F")))
@@ -523,13 +532,16 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 	if (!conn->transaction_started)
 		conn->ta_start_time = 0;
 
+	chk_quota = trans->node_created && domain_is_unprivileged(conn);
+
 	/* Attach transaction to ctx for auto-cleanup */
 	talloc_steal(ctx, trans);
 
 	if (streq(arg, "T")) {
 		if (trans->fail)
 			return ENOMEM;
-		ret = acc_fix_domains(&trans->changed_domains, false);
+		ret = acc_fix_domains(&trans->changed_domains, chk_quota,
+				      false);
 		if (ret)
 			return ret;
 		ret = finalize_transaction(conn, trans, &is_corrupt);
@@ -539,7 +551,7 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 		wrl_apply_debit_trans_commit(conn);
 
 		/* fix domain entry for each changed domain */
-		acc_fix_domains(&trans->changed_domains, true);
+		acc_fix_domains(&trans->changed_domains, false, true);
 
 		if (is_corrupt)
 			corrupt(conn, "transaction inconsistency");
diff --git a/tools/xenstore/xenstored_transaction.h b/tools/xenstore/xenstored_transaction.h
index b6f8cb7d0a..883145163f 100644
--- a/tools/xenstore/xenstored_transaction.h
+++ b/tools/xenstore/xenstored_transaction.h
@@ -36,6 +36,9 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 
 struct transaction *transaction_lookup(struct connection *conn, uint32_t id);
 
+/* Set flag for created node. */
+void ta_node_created(struct transaction *trans);
+
 /* This node was accessed. */
 int __must_check access_node(struct connection *conn, struct node *node,
                              enum node_access_type type, TDB_DATA *key);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 30 20:33:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 30 Mar 2023 20:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516878.801701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phyxr-0004fu-7g; Thu, 30 Mar 2023 20:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516878.801701; Thu, 30 Mar 2023 20:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phyxr-0004fn-5B; Thu, 30 Mar 2023 20:33:43 +0000
Received: by outflank-mailman (input) for mailman id 516878;
 Thu, 30 Mar 2023 20: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 1phyxq-0004fY-Ed
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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 1phyxq-0001Ek-DX
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phyxq-0001CR-CP
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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=vJaLFMn+LFXjRyNCGp6xE79uh1UXkZ1/wpOCqjz9Yc0=; b=boMMXANKnGXi19i+SnBzrnC0OB
	CpwYMatLF0xWlNFjk9tYB2w+S/SpzKILEjts/6afZv/7gaxR2+sEYaIXHN8Opcw8Jb7zL+qTUE0K+
	hG3CG67yuiCOuB5MX86z55T8/7jse6X5LlNHM7l5f8TNwRa8ayEUnOoWQ6OOZSj1Fhho=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: domain_build: Check return code of domain_vpl011_init
Message-Id: <E1phyxq-0001CR-CP@xenbits.xenproject.org>
Date: Thu, 30 Mar 2023 20:33:42 +0000

commit 3643eed7d021b73e7fb87bcc4e999c3b0eba6d91
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Mar 23 14:56:35 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Mar 29 22:14:52 2023 +0100

    xen/arm: domain_build: Check return code of domain_vpl011_init
    
    We are assigning return code of domain_vpl011_init() to a variable
    without checking it for an error. Fix it.
    
    Fixes: 3580c8b2dfc3 ("xen/arm: if direct-map domain use native UART address and IRQ number for vPL011")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 9707eb7b1b..3195c5b6d6 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3826,7 +3826,11 @@ static int __init construct_domU(struct domain *d,
      * shall be done first.
      */
     if ( kinfo.vpl011 )
+    {
         rc = domain_vpl011_init(d, NULL);
+        if ( rc < 0 )
+            return rc;
+    }
 
     rc = prepare_dtb_domU(d, &kinfo);
     if ( rc < 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 30 20:33:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 30 Mar 2023 20:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516879.801705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phyy1-0004iU-9F; Thu, 30 Mar 2023 20:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516879.801705; Thu, 30 Mar 2023 20: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 1phyy1-0004iM-6e; Thu, 30 Mar 2023 20:33:53 +0000
Received: by outflank-mailman (input) for mailman id 516879;
 Thu, 30 Mar 2023 20: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 1phyy0-0004iC-IU
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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 1phyy0-0001Ez-He
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phyy0-0001Cs-G6
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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=hb+bo66AX6NMDkrmzJ+jsGrsaUZ3i/UbfCYXcjXA+Ww=; b=Y53/yCsD9TPFw/+te7nbptCs/G
	kRRalEhDVccosi7bnjIGxTjtdsG0qxiqLBX6gx9N2a685lDHDnKNINyJaAusizGvhX0b4Ozj0+QAJ
	VJjQzTZYl+W2oMsB7umch6C00iAicw2i864lSsXVg4IfX6YPVTFyZcvFLpTMg4WO/5So=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vpl011: Fix domain_vpl011_init error path
Message-Id: <E1phyy0-0001Cs-G6@xenbits.xenproject.org>
Date: Thu, 30 Mar 2023 20:33:52 +0000

commit 08bbc1c02d6b382cf52fa02bb34097eb0b003461
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Mar 23 14:56:36 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Mar 29 22:20:20 2023 +0100

    xen/arm: vpl011: Fix domain_vpl011_init error path
    
    When vgic_reserve_virq() fails and backend is in domain, we should also
    free the allocated event channel.
    
    When backend is in Xen and call to xzalloc() returns NULL, there is no
    need to call xfree(). This should be done instead on an error path
    from vgic_reserve_virq(). Moreover, we should be calling XFREE() to
    prevent an extra free in domain_vpl011_deinit().
    
    In order not to repeat the same steps twice, call domain_vpl011_deinit()
    on an error path whenever there is more work to do than returning rc.
    Since this function can now be called from different places and more
    than once, add proper guards, use XFREE() instead of xfree() and move
    vgic_free_virq() to it.
    
    Take the opportunity to return -ENOMEM instead of -EINVAL when memory
    allocation fails.
    
    Fixes: 1ee1e4b0d1ff ("xen/arm: Allow vpl011 to be used by DomU")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/vpl011.c | 47 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 541ec962f1..2fa80bc15a 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -696,8 +696,8 @@ int domain_vpl011_init(struct domain *d, struct vpl011_init_info *info)
         vpl011->backend.xen = xzalloc(struct vpl011_xen_backend);
         if ( vpl011->backend.xen == NULL )
         {
-            rc = -EINVAL;
-            goto out1;
+            rc = -ENOMEM;
+            goto out;
         }
     }
 
@@ -705,7 +705,7 @@ int domain_vpl011_init(struct domain *d, struct vpl011_init_info *info)
     if ( !rc )
     {
         rc = -EINVAL;
-        goto out2;
+        goto out1;
     }
 
     vpl011->uartfr = TXFE | RXFE;
@@ -717,15 +717,8 @@ int domain_vpl011_init(struct domain *d, struct vpl011_init_info *info)
 
     return 0;
 
-out2:
-    vgic_free_virq(d, vpl011->virq);
-
 out1:
-    if ( vpl011->backend_in_domain )
-        destroy_ring_for_helper(&vpl011->backend.dom.ring_buf,
-                                vpl011->backend.dom.ring_page);
-    else
-        xfree(vpl011->backend.xen);
+    domain_vpl011_deinit(d);
 
 out:
     return rc;
@@ -735,17 +728,37 @@ void domain_vpl011_deinit(struct domain *d)
 {
     struct vpl011 *vpl011 = &d->arch.vpl011;
 
+    if ( vpl011->virq )
+    {
+        vgic_free_virq(d, vpl011->virq);
+
+        /*
+         * Set to invalid irq (we use SPI) to prevent extra free and to avoid
+         * freeing irq that could have already been reserved by someone else.
+         */
+        vpl011->virq = 0;
+    }
+
     if ( vpl011->backend_in_domain )
     {
-        if ( !vpl011->backend.dom.ring_buf )
-            return;
+        if ( vpl011->backend.dom.ring_buf )
+            destroy_ring_for_helper(&vpl011->backend.dom.ring_buf,
+                                    vpl011->backend.dom.ring_page);
+
+        if ( vpl011->evtchn )
+        {
+            free_xen_event_channel(d, vpl011->evtchn);
 
-        free_xen_event_channel(d, vpl011->evtchn);
-        destroy_ring_for_helper(&vpl011->backend.dom.ring_buf,
-                                vpl011->backend.dom.ring_page);
+            /*
+             * Set to invalid event channel port to prevent extra free and to
+             * avoid freeing port that could have already been allocated for
+             * other purposes.
+             */
+            vpl011->evtchn = 0;
+        }
     }
     else
-        xfree(vpl011->backend.xen);
+        XFREE(vpl011->backend.xen);
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 30 20:34:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 30 Mar 2023 20:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.516880.801710 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1phyyC-0004lW-BL; Thu, 30 Mar 2023 20:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 516880.801710; Thu, 30 Mar 2023 20: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 1phyyC-0004lO-8H; Thu, 30 Mar 2023 20:34:04 +0000
Received: by outflank-mailman (input) for mailman id 516880;
 Thu, 30 Mar 2023 20: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 1phyyA-0004l7-Lz
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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 1phyyA-0001FJ-L3
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1phyyA-0001DY-K7
 for xen-changelog@lists.xenproject.org; Thu, 30 Mar 2023 20: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=C84EqVYc22/FRMzwyLOhUn+MCRGkwBsUfcMubgmfVkk=; b=KaHkPVh5NXPt+ktunlbnTfZhP7
	qAAeO1dTFXzDsduiK631hZNIA7/7o3jO8btGAxkRKiBlUj1Z8f9qmMVvzr/BxHMlFOvmVjCLQn+sD
	25zi2tUNTh23EFI9rHI6mPBYavFLo+5CIbeg7d04XPHmP3OEmMCGKi+mAsRFjolIC3cU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: irq: Constify the first parameter of platform_get_irq_byname()
Message-Id: <E1phyyA-0001DY-K7@xenbits.xenproject.org>
Date: Thu, 30 Mar 2023 20:34:02 +0000

commit eef4608fe71feddb5fea86678cf3acaf84d10fd2
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Mar 21 17:17:21 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Mar 29 22:24:12 2023 +0100

    xen/arm: irq: Constify the first parameter of platform_get_irq_byname()
    
    platform_get_irq_byname() is not meant to modify the parameter 'np'. So
    constify it.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/irq.h | 2 +-
 xen/arch/arm/irq.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index af94f41994..11bc85d111 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -89,7 +89,7 @@ int irq_set_type(unsigned int irq, unsigned int type);
 
 int platform_get_irq(const struct dt_device_node *device, int index);
 
-int platform_get_irq_byname(struct dt_device_node *np, const char *name);
+int platform_get_irq_byname(const struct dt_device_node *np, const char *name);
 
 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index ded495792b..16e56f8945 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -718,7 +718,7 @@ int platform_get_irq(const struct dt_device_node *device, int index)
     return irq;
 }
 
-int platform_get_irq_byname(struct dt_device_node *np, const char *name)
+int platform_get_irq_byname(const struct dt_device_node *np, const char *name)
 {
 	int index;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:55:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517062.802077 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piOaF-0005Lg-Vy; Fri, 31 Mar 2023 23:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517062.802077; Fri, 31 Mar 2023 23: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 1piOaF-0005LY-Sx; Fri, 31 Mar 2023 23:55:03 +0000
Received: by outflank-mailman (input) for mailman id 517062;
 Fri, 31 Mar 2023 23: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 1piOaE-0005LS-AG
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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 1piOaE-0005vu-7J
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piOaE-00063R-65
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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=6EZJRK1VEL6H76Lz0UXuxKf9e0MZXtHAUWPxsNOqrcE=; b=P36MKo51kv4rA0LAR5jAi3N4ev
	a6AJdbyIAcZjnz/4796Cpbyt34x06BmJgmP0LBjjyqFsLGnvoeh5pzjZxFNKONAjDe+1G5Rb/OMyL
	9W+nrhTld0JwqkLqGM+2i2H/N2Zh1iEug4vJMR4nngztgv2yqaFBbTYvr6XIWJLbfVoY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] AMD/IOMMU: without XT, x2APIC needs to be forced into physical mode
Message-Id: <E1piOaE-00063R-65@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:55:02 +0000

commit 8e9690a2252eda09537275a951ee0af0b3b330f2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 31 08:36:59 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:36:59 2023 +0200

    AMD/IOMMU: without XT, x2APIC needs to be forced into physical mode
    
    An earlier change with the same title (commit 1ba66a870eba) altered only
    the path where x2apic_phys was already set to false (perhaps from the
    command line). The same of course needs applying when the variable
    wasn't modified yet from its initial value.
    
    Reported-by: Elliott Mitchell <ehem+xen@m5p.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 0d2686f6b66b4b1b3c72c3525083b0ce02830054
    master date: 2023-03-21 09:23:25 +0100
---
 xen/arch/x86/genapic/x2apic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 628b441da5..247364af58 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -239,11 +239,11 @@ const struct genapic *__init apic_x2apic_probe(void)
     if ( x2apic_phys < 0 )
     {
         /*
-         * Force physical mode if there's no interrupt remapping support: The
-         * ID in clustered mode requires a 32 bit destination field due to
+         * Force physical mode if there's no (full) interrupt remapping support:
+         * The ID in clustered mode requires a 32 bit destination field due to
          * the usage of the high 16 bits to hold the cluster ID.
          */
-        x2apic_phys = !iommu_intremap ||
+        x2apic_phys = iommu_intremap != iommu_intremap_full ||
                       (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL);
     }
     else if ( !x2apic_phys )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:55:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517063.802081 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piOaQ-0005Oh-1a; Fri, 31 Mar 2023 23:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517063.802081; Fri, 31 Mar 2023 23: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 1piOaP-0005OT-Ua; Fri, 31 Mar 2023 23:55:13 +0000
Received: by outflank-mailman (input) for mailman id 517063;
 Fri, 31 Mar 2023 23: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 1piOaO-0005N0-Bp
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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 1piOaO-0005vy-Ar
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piOaO-00063u-9v
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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=xApwSSS8sJ1TK7QCxH0kJg7Glj6HqX5ig7Q+XsW50o0=; b=hdnh4z9OUqPaLA/9LVrlrADJ9r
	66A4UW3QIY1mK8Vzzp5APG38gkUmQPJs9BxhAKXwk0jO06McDCXuE1yd7F1h83/H0Ye3gQCq89Z9A
	1kX2DjeIEKA/R62i5Me7kqIL8TNJJjtyDvkxBWdWG2N9yncYS0pI38hGILfbiXPKx1jY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] VT-d: fix iommu=no-igfx if the IOMMU scope contains fake device(s)
Message-Id: <E1piOaO-00063u-9v@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:55:12 +0000

commit 07e8f5b3d1300327a9f2e67b03dead0e2138b92f
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Mar 31 08:38:07 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:38:07 2023 +0200

    VT-d: fix iommu=no-igfx if the IOMMU scope contains fake device(s)
    
    If the scope for IGD's IOMMU contains additional device that doesn't
    actually exist, iommu=no-igfx would not disable that IOMMU. In this
    particular case (Thinkpad x230) it included 00:02.1, but there is no
    such device on this platform. Consider only existing devices for the
    "gfx only" check as well as the establishing of IGD DRHD address
    (underlying is_igd_drhd(), which is used to determine applicability of
    two workarounds).
    
    Fixes: 2d7f191b392e ("VT-d: generalize and correct "iommu=no-igfx" handling")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 49de6749baa8d0addc3048defd4ef3e85cb135e9
    master date: 2023-03-23 09:16:41 +0100
---
 xen/drivers/passthrough/vtd/dmar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 9ec49936b8..bfec40f47d 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -389,7 +389,7 @@ static int __init acpi_parse_dev_scope(
                 printk(VTDPREFIX " endpoint: %pp\n",
                        &PCI_SBDF(seg, bus, path->dev, path->fn));
 
-            if ( drhd )
+            if ( drhd && pci_device_detect(seg, bus, path->dev, path->fn) )
             {
                 if ( pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
                                     PCI_CLASS_DEVICE + 1) != 0x03
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:55:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517064.802085 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piOaa-0005R8-2X; Fri, 31 Mar 2023 23:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517064.802085; Fri, 31 Mar 2023 23: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 1piOaZ-0005R0-W2; Fri, 31 Mar 2023 23:55:23 +0000
Received: by outflank-mailman (input) for mailman id 517064;
 Fri, 31 Mar 2023 23: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 1piOaY-0005Qe-G3
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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 1piOaY-0005w9-Ez
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piOaY-00064m-DR
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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=rqFUH57YUT4sItVniYM0FY/DDDa4Ze4A/vhwHAW+ij8=; b=wnaoTHpxzbIl8xJl68jSSdRc+h
	ncvAFQYbxVb/x0OvXNAdRUisTLqMMRMGThlw0z3wYJuMlM50SEuksgKQjC4+DtGI4PKfiMrB6gMTS
	32uQiMEzp0OV4be0i9rMpx2ymOatksepZjmapfkb6TH+hnHtPPevhsyeGvXCku91MWAE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/shadow: fix and improve sh_page_has_multiple_shadows()
Message-Id: <E1piOaY-00064m-DR@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:55:22 +0000

commit cab866ee62d860e9ff4abe701163972d4e9f896d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 31 08:38:42 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:38:42 2023 +0200

    x86/shadow: fix and improve sh_page_has_multiple_shadows()
    
    While no caller currently invokes the function without first making sure
    there is at least one shadow [1], we'd better eliminate UB here:
    find_first_set_bit() requires input to be non-zero to return a well-
    defined result.
    
    Further, using find_first_set_bit() isn't very efficient in the first
    place for the intended purpose.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    
    [1] The function has exactly two uses, and both are from OOS code, which
        is HVM-only. For HVM (but not for PV) sh_mfn_is_a_page_table(),
        guarding the call to sh_unsync(), guarantees at least one shadow.
        Hence even if sh_page_has_multiple_shadows() returned a bogus value
        when invoked for a PV domain, the subsequent is_hvm_vcpu() and
        oos_active checks (the former being redundant with the latter) will
        compensate. (Arguably that oos_active check should come first, for
        both clarity and efficiency reasons.)
    master commit: 2896224a4e294652c33f487b603d20bd30955f21
    master date: 2023-03-24 11:07:08 +0100
---
 xen/arch/x86/mm/shadow/private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 738214f75e..762214f73c 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -324,7 +324,7 @@ static inline int sh_page_has_multiple_shadows(struct page_info *pg)
         return 0;
     shadows = pg->shadow_flags & SHF_page_type_mask;
     /* More than one type bit set in shadow-flags? */
-    return ( (shadows & ~(1UL << find_first_set_bit(shadows))) != 0 );
+    return shadows && (shadows & (shadows - 1));
 }
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:55:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517065.802088 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piOak-0005UA-3v; Fri, 31 Mar 2023 23:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517065.802088; Fri, 31 Mar 2023 23: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 1piOak-0005U4-1H; Fri, 31 Mar 2023 23:55:34 +0000
Received: by outflank-mailman (input) for mailman id 517065;
 Fri, 31 Mar 2023 23: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 1piOai-0005TW-JZ
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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 1piOai-0005wJ-IV
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piOai-00065G-HU
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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=HidEX0KpZ9vYBzpX2nXLG0XYSaISzlGKLU0GIfR8Pa0=; b=1Kg9INJDxi+98MITg0zO0Zll3Y
	g/zQV+XaAr1M6LVm1Mt+7JNMRmVxRXmOJqZJyKl6OQdEoLcI7x1yP+r+jdxyjasSqAiwWCHXcPO5m
	3jn+Piqy+OmZIDgmsJSgaqXFGejcgxwNkzsfYEit+ZRbi6mYvk/YS0UsJVM6tUTMAwaA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/nospec: Fix evaluate_nospec() code generation under Clang
Message-Id: <E1piOai-00065G-HU@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:55:32 +0000

commit 90320fd05991d7817cea85e1d45674b757abf03c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 31 08:39:32 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:39:32 2023 +0200

    x86/nospec: Fix evaluate_nospec() code generation under Clang
    
    It turns out that evaluate_nospec() code generation is not safe under Clang.
    Given:
    
      void eval_nospec_test(int x)
      {
          if ( evaluate_nospec(x) )
              asm volatile ("nop #true" ::: "memory");
          else
              asm volatile ("nop #false" ::: "memory");
      }
    
    Clang emits:
    
      <eval_nospec_test>:
             0f ae e8                lfence
             85 ff                   test   %edi,%edi
             74 02                   je     <eval_nospec_test+0x9>
             90                      nop
             c3                      ret
             90                      nop
             c3                      ret
    
    which is not safe because the lfence has been hoisted above the conditional
    jump.  Clang concludes that both barrier_nospec_true()'s have identical side
    effects and can safely be merged.
    
    Clang can be persuaded that the side effects are different if there are
    different comments in the asm blocks.  This is fragile, but no more fragile
    that other aspects of this construct.
    
    Introduce barrier_nospec_false() with a separate internal comment to prevent
    Clang merging it with barrier_nospec_true() despite the otherwise-identical
    content.  The generated code now becomes:
    
      <eval_nospec_test>:
             85 ff                   test   %edi,%edi
             74 05                   je     <eval_nospec_test+0x9>
             0f ae e8                lfence
             90                      nop
             c3                      ret
             0f ae e8                lfence
             90                      nop
             c3                      ret
    
    which has the correct number of lfence's, and in the correct place.
    
    Link: https://github.com/llvm/llvm-project/issues/55084
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3c133841435829ba5c0a48427e2a77633502ab
    master date: 2023-03-24 12:16:31 +0000
---
 xen/include/asm-x86/nospec.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-x86/nospec.h b/xen/include/asm-x86/nospec.h
index 5312ae4c6f..7150e76b87 100644
--- a/xen/include/asm-x86/nospec.h
+++ b/xen/include/asm-x86/nospec.h
@@ -10,15 +10,26 @@
 static always_inline bool barrier_nospec_true(void)
 {
 #ifdef CONFIG_SPECULATIVE_HARDEN_BRANCH
-    alternative("lfence", "", X86_FEATURE_SC_NO_BRANCH_HARDEN);
+    alternative("lfence #nospec-true", "", X86_FEATURE_SC_NO_BRANCH_HARDEN);
 #endif
     return true;
 }
 
+static always_inline bool barrier_nospec_false(void)
+{
+#ifdef CONFIG_SPECULATIVE_HARDEN_BRANCH
+    alternative("lfence #nospec-false", "", X86_FEATURE_SC_NO_BRANCH_HARDEN);
+#endif
+    return false;
+}
+
 /* Allow to protect evaluation of conditionals with respect to speculation */
 static always_inline bool evaluate_nospec(bool condition)
 {
-    return condition ? barrier_nospec_true() : !barrier_nospec_true();
+    if ( condition )
+        return barrier_nospec_true();
+    else
+        return barrier_nospec_false();
 }
 
 /* Allow to block speculative execution in generic code */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:55:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517066.802094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piOau-0005XB-5i; Fri, 31 Mar 2023 23:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517066.802094; Fri, 31 Mar 2023 23: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 1piOau-0005Wy-2k; Fri, 31 Mar 2023 23:55:44 +0000
Received: by outflank-mailman (input) for mailman id 517066;
 Fri, 31 Mar 2023 23: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 1piOas-0005Wi-PO
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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 1piOas-0005wY-OJ
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piOas-00065f-LA
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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=O5qZZicRvh1qSOjenF+5W9LPDWdj7lauxvA7y3sRxTE=; b=Rr39Z+du6M83jKYdGANX7kmUTp
	KAgI1VmbQ/BjsRGVBySvdpuw7/FhewJV5GTvmWbEHUSsfKD+B0ivPGjFGWaZR9dzVd0ilqHPMhWlD
	uQn3Ky0JJYxsg3tlqYL/aRNieqyvgk/rN4QDjWnYUxA9cTeXjR3QA03KT5+YimX/jvQE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/shadow: Fix build with no PG_log_dirty
Message-Id: <E1piOas-00065f-LA@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:55:42 +0000

commit 7e1fe95c79d55a1c1a65f71a078b8e31c69ffe94
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 31 08:39:49 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:39:49 2023 +0200

    x86/shadow: Fix build with no PG_log_dirty
    
    Gitlab Randconfig found:
    
      arch/x86/mm/shadow/common.c: In function 'shadow_prealloc':
      arch/x86/mm/shadow/common.c:1023:18: error: implicit declaration of function
          'paging_logdirty_levels'; did you mean 'paging_log_dirty_init'? [-Werror=implicit-function-declaration]
       1023 |         count += paging_logdirty_levels();
            |                  ^~~~~~~~~~~~~~~~~~~~~~
            |                  paging_log_dirty_init
      arch/x86/mm/shadow/common.c:1023:18: error: nested extern declaration of 'paging_logdirty_levels' [-Werror=nested-externs]
    
    The '#if PG_log_dirty' expression is currently SHADOW_PAGING && !HVM &&
    PV_SHIM_EXCLUSIVE.  Move the declaration outside.
    
    Fixes: 33fb3a661223 ("x86/shadow: account for log-dirty mode when pre-allocating")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6d14cb105b1c54ad7b4228d858ae85aa8a672bbd
    master date: 2023-03-24 12:16:31 +0000
---
 xen/include/asm-x86/paging.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index c6b429c691..43abaa5bd1 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -154,6 +154,10 @@ struct paging_mode {
 /*****************************************************************************
  * Log dirty code */
 
+#define paging_logdirty_levels() \
+    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
+                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
+
 #if PG_log_dirty
 
 /* get the dirty bitmap for a specific range of pfns */
@@ -192,10 +196,6 @@ int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn);
 #define L4_LOGDIRTY_IDX(pfn) ((pfn_x(pfn) >> (PAGE_SHIFT + 3 + PAGETABLE_ORDER * 2)) & \
                               (LOGDIRTY_NODE_ENTRIES-1))
 
-#define paging_logdirty_levels() \
-    (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
-                  PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
-
 #ifdef CONFIG_HVM
 /* VRAM dirty tracking support */
 struct sh_dirty_vram {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:55:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517067.802096 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piOb4-0005b0-6q; Fri, 31 Mar 2023 23:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517067.802096; Fri, 31 Mar 2023 23:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piOb4-0005at-4E; Fri, 31 Mar 2023 23:55:54 +0000
Received: by outflank-mailman (input) for mailman id 517067;
 Fri, 31 Mar 2023 23: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 1piOb2-0005aj-U0
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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 1piOb2-0005wk-T4
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piOb2-000665-Qy
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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=B4ma8C/o3D0S5ieJn1Vcxg+bmqsmzzkIP2AdZg5UIJI=; b=gtDQbz4bjOk1I9qRK/BQBMdJLI
	nBfaphECcNTlT8+LEtbJ9CUbgHKvUJTMBSIc1ZEsRFORnD4Ky/hW3Vv68PN+GOHlxb0o0zkHN3tVd
	WyomjU6glBNLO3NzH9ucwVdC9ERLB3bxYc8RJnDpddvQ+IyfBkjEdAxhUZjm4L+cQJoQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/vmx: Don't spuriously crash the domain when INIT is received
Message-Id: <E1piOb2-000665-Qy@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:55:52 +0000

commit b1022b65de59828d40d9d71cc734a42c1c30c972
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 31 08:40:27 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:40:27 2023 +0200

    x86/vmx: Don't spuriously crash the domain when INIT is received
    
    In VMX operation, the handling of INIT IPIs is changed.  Instead of the CPU
    resetting, the next VMEntry fails with EXIT_REASON_INIT.  From the TXT spec,
    the intent of this behaviour is so that an entity which cares can scrub
    secrets from RAM before participating in an orderly shutdown.
    
    Right now, Xen's behaviour is that when an INIT arrives, the HVM VM which
    schedules next is killed (citing an unknown VMExit), *and* we ignore the INIT
    and continue blindly onwards anyway.
    
    This patch addresses only the first of these two problems by ignoring the INIT
    and continuing without crashing the VM in question.
    
    The second wants addressing too, just as soon as we've figured out something
    better to do...
    
    Discovered as collateral damage from when an AP triple faults on S3 resume on
    Intel TigerLake platforms.
    
    Link: https://github.com/QubesOS/qubes-issues/issues/7283
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: b1f11273d5a774cc88a3685c96c2e7cf6385e3b6
    master date: 2023-03-24 22:49:58 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index c8a839cd5e..cebe46ef6a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4002,6 +4002,10 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
     case EXIT_REASON_MCE_DURING_VMENTRY:
         do_machine_check(regs);
         break;
+
+    case EXIT_REASON_INIT:
+        printk(XENLOG_ERR "Error: INIT received - ignoring\n");
+        return; /* Renter the guest without further processing */
     }
 
     /* Now enable interrupts so it's safe to take locks. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:56:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517068.802100 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piObE-0005dy-8p; Fri, 31 Mar 2023 23:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517068.802100; Fri, 31 Mar 2023 23: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 1piObE-0005dq-5m; Fri, 31 Mar 2023 23:56:04 +0000
Received: by outflank-mailman (input) for mailman id 517068;
 Fri, 31 Mar 2023 23:56: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 1piObD-0005df-1J
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:56: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 1piObD-0005xN-0N
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piObC-00066n-VX
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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=mS3/joJ9tcS9PkU0fRosX4OXreTDm0bcXA1Nfoj3VaQ=; b=fxfC8ZUHIUSGBgaPIgcbsCin3D
	Sv5sCDxLkEG/9nMCUTuJNa2TN3658iCptcChbtAUwod2N2N6zM4ZEzrJxYvjSd+XXSv8r5/Z6IE3+
	/ijLZu+xOKDbxaMYmGwWaZlq8IVsUe0jzKJgquYOHGi9cGbl9YCrQAoGgpd+9hPoG9uU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/ucode: Fix error paths control_thread_fn()
Message-Id: <E1piObC-00066n-VX@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:56:02 +0000

commit 0f81c5a2c8e0432d5af3d9f4e6398376cd514516
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 31 08:40:56 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:40:56 2023 +0200

    x86/ucode: Fix error paths control_thread_fn()
    
    These two early exits skipped re-enabling the watchdog, restoring the NMI
    callback, and clearing the nmi_patch global pointer.  Always execute the tail
    of the function on the way out.
    
    Fixes: 8dd4dfa92d62 ("x86/microcode: Synchronize late microcode loading")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: fc2e1f3aad602a66c14b8285a1bd38a82f8fd02d
    master date: 2023-03-28 11:57:56 +0100
---
 xen/arch/x86/cpu/microcode/core.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index ee7df9a591..ad150e5963 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -488,10 +488,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
     ret = wait_for_condition(wait_cpu_callin, num_online_cpus(),
                              MICROCODE_CALLIN_TIMEOUT_US);
     if ( ret )
-    {
-        set_state(LOADING_EXIT);
-        return ret;
-    }
+        goto out;
 
     /* Control thread loads ucode first while others are in NMI handler. */
     ret = microcode_ops->apply_microcode(patch);
@@ -503,8 +500,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
     {
         printk(XENLOG_ERR
                "Late loading aborted: CPU%u failed to update ucode\n", cpu);
-        set_state(LOADING_EXIT);
-        return ret;
+        goto out;
     }
 
     /* Let primary threads load the given ucode update */
@@ -535,6 +531,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
         }
     }
 
+ out:
     /* Mark loading is done to unblock other threads */
     set_state(LOADING_EXIT);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:56:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517069.802105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piObO-0005h2-CE; Fri, 31 Mar 2023 23:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517069.802105; Fri, 31 Mar 2023 23: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 1piObO-0005gu-9Q; Fri, 31 Mar 2023 23:56:14 +0000
Received: by outflank-mailman (input) for mailman id 517069;
 Fri, 31 Mar 2023 23: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 1piObN-0005gl-54
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:56: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 1piObN-0005xX-40
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piObN-00067C-32
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:56:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ng7irASSlvSoa7UEfHQgogT55WDWnW8QUBiaWHxlDqE=; b=EB3G0Mw8+pQkM8CzfKOr9uk/dM
	zRkktYwMt9q+Jxn/5kRku1cRcmVhvx0XHL1Y5eTqi7hjXBKG+VJBidF90bwjD3veyY6UvwnYV8NYP
	+xFeWUOEk0WWKRptQDYYiWIhdPgzHIZsfWQxQGW+m37/O1EVW8bBetUuZa8Rrktmn46w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] vpci/msix: handle accesses adjacent to the MSI-X table
Message-Id: <E1piObN-00067C-32@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:56:13 +0000

commit d080287c2a8dce11baee1d7bbf9276757e8572e4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Mar 31 08:41:27 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:41:27 2023 +0200

    vpci/msix: handle accesses adjacent to the MSI-X table
    
    The handling of the MSI-X table accesses by Xen requires that any
    pages part of the MSI-X related tables are not mapped into the domain
    physmap.  As a result, any device registers in the same pages as the
    start or the end of the MSIX or PBA tables is not currently
    accessible, as the accesses are just dropped.
    
    Note the spec forbids such placing of registers, as the MSIX and PBA
    tables must be 4K isolated from any other registers:
    
    "If a Base Address register that maps address space for the MSI-X
    Table or MSI-X PBA also maps other usable address space that is not
    associated with MSI-X structures, locations (e.g., for CSRs) used in
    the other address space must not share any naturally aligned 4-KB
    address range with one where either MSI-X structure resides."
    
    Yet the 'Intel Wi-Fi 6 AX201' device on one of my boxes has registers
    in the same page as the MSIX tables, and thus won't work on a PVH dom0
    without this fix.
    
    In order to cope with the behavior passthrough any accesses that fall
    on the same page as the MSIX tables (but don't fall in between) to the
    underlying hardware.  Such forwarding also takes care of the PBA
    accesses, so it allows to remove the code doing this handling in
    msix_{read,write}.  Note that as a result accesses to the PBA array
    are no longer limited to 4 and 8 byte sizes, there's no access size
    restriction for PBA accesses documented in the specification.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    
    vpci/msix: restore PBA access length and alignment restrictions
    
    Accesses to the PBA array have the same length and alignment
    limitations as accesses to the MSI-X table:
    
    "For all accesses to MSI-X Table and MSI-X PBA fields, software must
    use aligned full DWORD or aligned full QWORD transactions; otherwise,
    the result is undefined."
    
    Introduce such length and alignment checks into the handling of PBA
    accesses for vPCI.  This was a mistake of mine for not reading the
    specification correctly.
    
    Note that accesses must now be aligned, and hence there's no longer a
    need to check that the end of the access falls into the PBA region as
    both the access and the region addresses must be aligned.
    
    Fixes: b177892d2d ('vpci/msix: handle accesses adjacent to the MSI-X table')
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b177892d2d0e8a31122c218989f43130aeba5282
    master date: 2023-03-28 14:20:35 +0200
    master commit: 7a502b4fbc339e9d3d3d45fb37f09da06bc3081c
    master date: 2023-03-29 14:56:33 +0200
---
 xen/drivers/vpci/msix.c | 357 +++++++++++++++++++++++++++++++++++-------------
 xen/drivers/vpci/vpci.c |   7 +-
 xen/include/xen/vpci.h  |   8 +-
 3 files changed, 275 insertions(+), 97 deletions(-)

diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index ea5d73a02a..7e1bfb2f0a 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -27,6 +27,11 @@
     ((addr) >= vmsix_table_addr(vpci, nr) &&                              \
      (addr) < vmsix_table_addr(vpci, nr) + vmsix_table_size(vpci, nr))
 
+#define VMSIX_ADDR_SAME_PAGE(addr, vpci, nr)                              \
+    (PFN_DOWN(addr) >= PFN_DOWN(vmsix_table_addr(vpci, nr)) &&            \
+     PFN_DOWN(addr) <= PFN_DOWN(vmsix_table_addr(vpci, nr) +              \
+                                vmsix_table_size(vpci, nr) - 1))
+
 static uint32_t control_read(const struct pci_dev *pdev, unsigned int reg,
                              void *data)
 {
@@ -149,7 +154,7 @@ static struct vpci_msix *msix_find(const struct domain *d, unsigned long addr)
 
         for ( i = 0; i < ARRAY_SIZE(msix->tables); i++ )
             if ( bars[msix->tables[i] & PCI_MSIX_BIRMASK].enabled &&
-                 VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, i) )
+                 VMSIX_ADDR_SAME_PAGE(addr, msix->pdev->vpci, i) )
                 return msix;
     }
 
@@ -182,36 +187,172 @@ static struct vpci_msix_entry *get_entry(struct vpci_msix *msix,
     return &msix->entries[(addr - start) / PCI_MSIX_ENTRY_SIZE];
 }
 
-static void __iomem *get_pba(struct vpci *vpci)
+static void __iomem *get_table(struct vpci *vpci, unsigned int slot)
 {
     struct vpci_msix *msix = vpci->msix;
+    paddr_t addr = 0;
+
+    ASSERT(spin_is_locked(&vpci->lock));
+
+    if ( likely(msix->table[slot]) )
+        return msix->table[slot];
+
+    switch ( slot )
+    {
+    case VPCI_MSIX_TBL_TAIL:
+        addr = vmsix_table_size(vpci, VPCI_MSIX_TABLE);
+        fallthrough;
+    case VPCI_MSIX_TBL_HEAD:
+        addr += vmsix_table_addr(vpci, VPCI_MSIX_TABLE);
+        break;
+
+    case VPCI_MSIX_PBA_TAIL:
+        addr = vmsix_table_size(vpci, VPCI_MSIX_PBA);
+        fallthrough;
+    case VPCI_MSIX_PBA_HEAD:
+        addr += vmsix_table_addr(vpci, VPCI_MSIX_PBA);
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        return NULL;
+    }
+
+    msix->table[slot] = ioremap(round_pgdown(addr), PAGE_SIZE);
+
+    return msix->table[slot];
+}
+
+unsigned int get_slot(const struct vpci *vpci, unsigned long addr)
+{
+    unsigned long pfn = PFN_DOWN(addr);
+
     /*
-     * PBA will only be unmapped when the device is deassigned, so access it
-     * without holding the vpci lock.
+     * The logic below relies on having the tables identity mapped to the guest
+     * address space, or for the `addr` parameter to be translated into its
+     * host physical memory address equivalent.
      */
-    void __iomem *pba = read_atomic(&msix->pba);
 
-    if ( likely(pba) )
-        return pba;
+    if ( pfn == PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_TABLE)) )
+        return VPCI_MSIX_TBL_HEAD;
+    if ( pfn == PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_TABLE) +
+                         vmsix_table_size(vpci, VPCI_MSIX_TABLE) - 1) )
+        return VPCI_MSIX_TBL_TAIL;
+    if ( pfn == PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_PBA)) )
+        return VPCI_MSIX_PBA_HEAD;
+    if ( pfn == PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_PBA) +
+                         vmsix_table_size(vpci, VPCI_MSIX_PBA) - 1) )
+        return VPCI_MSIX_PBA_TAIL;
+
+    ASSERT_UNREACHABLE();
+    return -1;
+}
+
+static bool adjacent_handle(const struct vpci_msix *msix, unsigned long addr)
+{
+    unsigned int i;
+
+    if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) )
+        return true;
+
+    if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_TABLE) )
+        return false;
+
+    for ( i = 0; i < ARRAY_SIZE(msix->tables); i++ )
+        if ( VMSIX_ADDR_SAME_PAGE(addr, msix->pdev->vpci, i) )
+            return true;
+
+    return false;
+}
+
+static int adjacent_read(const struct domain *d, const struct vpci_msix *msix,
+                         unsigned long addr, unsigned int len,
+                         unsigned long *data)
+{
+    const void __iomem *mem;
+    struct vpci *vpci = msix->pdev->vpci;
+    unsigned int slot;
+
+    *data = ~0ul;
+
+    if ( !adjacent_handle(msix, addr + len - 1) )
+        return X86EMUL_OKAY;
+
+    if ( VMSIX_ADDR_IN_RANGE(addr, vpci, VPCI_MSIX_PBA) &&
+         !access_allowed(msix->pdev, addr, len) )
+        /* PBA accesses must be aligned and 4 or 8 bytes in size. */
+        return X86EMUL_OKAY;
+
+    slot = get_slot(vpci, addr);
+    if ( slot >= ARRAY_SIZE(msix->table) )
+        return X86EMUL_OKAY;
+
+    if ( unlikely(!IS_ALIGNED(addr, len)) )
+    {
+        unsigned int i;
 
-    pba = ioremap(vmsix_table_addr(vpci, VPCI_MSIX_PBA),
-                  vmsix_table_size(vpci, VPCI_MSIX_PBA));
-    if ( !pba )
-        return read_atomic(&msix->pba);
+        gprintk(XENLOG_DEBUG, "%pp: unaligned read to MSI-X related page\n",
+                &msix->pdev->sbdf);
+
+        /*
+         * Split unaligned accesses into byte sized ones. Shouldn't happen in
+         * the first place, but devices shouldn't have registers in the same 4K
+         * page as the MSIX tables either.
+         *
+         * It's unclear whether this could cause issues if a guest expects
+         * registers to be accessed atomically, it better use an aligned access
+         * if it has such expectations.
+         */
+        for ( i = 0; i < len; i++ )
+        {
+            unsigned long partial = ~0ul;
+            int rc = adjacent_read(d, msix, addr + i, 1, &partial);
+
+            if ( rc != X86EMUL_OKAY )
+                return rc;
+
+            *data &= ~(0xfful << (i * 8));
+            *data |= (partial & 0xff) << (i * 8);
+        }
+
+        return X86EMUL_OKAY;
+    }
 
     spin_lock(&vpci->lock);
-    if ( !msix->pba )
+    mem = get_table(vpci, slot);
+    if ( !mem )
     {
-        write_atomic(&msix->pba, pba);
         spin_unlock(&vpci->lock);
+        gprintk(XENLOG_WARNING,
+                "%pp: unable to map MSI-X page, returning all bits set\n",
+                &msix->pdev->sbdf);
+        return X86EMUL_OKAY;
     }
-    else
+
+    switch ( len )
     {
-        spin_unlock(&vpci->lock);
-        iounmap(pba);
+    case 1:
+        *data = readb(mem + PAGE_OFFSET(addr));
+        break;
+
+    case 2:
+        *data = readw(mem + PAGE_OFFSET(addr));
+        break;
+
+    case 4:
+        *data = readl(mem + PAGE_OFFSET(addr));
+        break;
+
+    case 8:
+        *data = readq(mem + PAGE_OFFSET(addr));
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
     }
+    spin_unlock(&vpci->lock);
 
-    return read_atomic(&msix->pba);
+    return X86EMUL_OKAY;
 }
 
 static int msix_read(struct vcpu *v, unsigned long addr, unsigned int len,
@@ -227,47 +368,11 @@ static int msix_read(struct vcpu *v, unsigned long addr, unsigned int len,
     if ( !msix )
         return X86EMUL_RETRY;
 
-    if ( !access_allowed(msix->pdev, addr, len) )
-        return X86EMUL_OKAY;
-
-    if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) )
-    {
-        struct vpci *vpci = msix->pdev->vpci;
-        unsigned int idx = addr - vmsix_table_addr(vpci, VPCI_MSIX_PBA);
-        const void __iomem *pba = get_pba(vpci);
-
-        /*
-         * Access to PBA.
-         *
-         * TODO: note that this relies on having the PBA identity mapped to the
-         * guest address space. If this changes the address will need to be
-         * translated.
-         */
-        if ( !pba )
-        {
-            gprintk(XENLOG_WARNING,
-                    "%pp: unable to map MSI-X PBA, report all pending\n",
-                    &msix->pdev->sbdf);
-            return X86EMUL_OKAY;
-        }
-
-        switch ( len )
-        {
-        case 4:
-            *data = readl(pba + idx);
-            break;
-
-        case 8:
-            *data = readq(pba + idx);
-            break;
-
-        default:
-            ASSERT_UNREACHABLE();
-            break;
-        }
+    if ( adjacent_handle(msix, addr) )
+        return adjacent_read(d, msix, addr, len, data);
 
+    if ( !access_allowed(msix->pdev, addr, len) )
         return X86EMUL_OKAY;
-    }
 
     spin_lock(&msix->pdev->vpci->lock);
     entry = get_entry(msix, addr);
@@ -303,57 +408,103 @@ static int msix_read(struct vcpu *v, unsigned long addr, unsigned int len,
     return X86EMUL_OKAY;
 }
 
-static int msix_write(struct vcpu *v, unsigned long addr, unsigned int len,
-                      unsigned long data)
+static int adjacent_write(const struct domain *d, const struct vpci_msix *msix,
+                          unsigned long addr, unsigned int len,
+                          unsigned long data)
 {
-    const struct domain *d = v->domain;
-    struct vpci_msix *msix = msix_find(d, addr);
-    struct vpci_msix_entry *entry;
-    unsigned int offset;
+    void __iomem *mem;
+    struct vpci *vpci = msix->pdev->vpci;
+    unsigned int slot;
 
-    if ( !msix )
-        return X86EMUL_RETRY;
+    if ( !adjacent_handle(msix, addr + len - 1) )
+        return X86EMUL_OKAY;
 
-    if ( !access_allowed(msix->pdev, addr, len) )
+    /*
+     * Only check start and end of the access because the size of the PBA is
+     * assumed to be equal or bigger (8 bytes) than the length of any access
+     * handled here.
+     */
+    if ( VMSIX_ADDR_IN_RANGE(addr, vpci, VPCI_MSIX_PBA) &&
+         (!access_allowed(msix->pdev, addr, len) || !is_hardware_domain(d)) )
+        /* Ignore writes to PBA for DomUs, it's undefined behavior. */
         return X86EMUL_OKAY;
 
-    if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) )
-    {
-        /* Ignore writes to PBA for DomUs, it's behavior is undefined. */
-        if ( is_hardware_domain(d) )
-        {
-            struct vpci *vpci = msix->pdev->vpci;
-            unsigned int idx = addr - vmsix_table_addr(vpci, VPCI_MSIX_PBA);
-            const void __iomem *pba = get_pba(vpci);
+    slot = get_slot(vpci, addr);
+    if ( slot >= ARRAY_SIZE(msix->table) )
+        return X86EMUL_OKAY;
 
-            if ( !pba )
-            {
-                /* Unable to map the PBA, ignore write. */
-                gprintk(XENLOG_WARNING,
-                        "%pp: unable to map MSI-X PBA, write ignored\n",
-                        &msix->pdev->sbdf);
-                return X86EMUL_OKAY;
-            }
+    if ( unlikely(!IS_ALIGNED(addr, len)) )
+    {
+        unsigned int i;
 
-            switch ( len )
-            {
-            case 4:
-                writel(data, pba + idx);
-                break;
+        gprintk(XENLOG_DEBUG, "%pp: unaligned write to MSI-X related page\n",
+                &msix->pdev->sbdf);
 
-            case 8:
-                writeq(data, pba + idx);
-                break;
+        for ( i = 0; i < len; i++ )
+        {
+            int rc = adjacent_write(d, msix, addr + i, 1, data >> (i * 8));
 
-            default:
-                ASSERT_UNREACHABLE();
-                break;
-            }
+            if ( rc != X86EMUL_OKAY )
+                return rc;
         }
 
         return X86EMUL_OKAY;
     }
 
+    spin_lock(&vpci->lock);
+    mem = get_table(vpci, slot);
+    if ( !mem )
+    {
+        spin_unlock(&vpci->lock);
+        gprintk(XENLOG_WARNING,
+                "%pp: unable to map MSI-X page, dropping write\n",
+                &msix->pdev->sbdf);
+        return X86EMUL_OKAY;
+    }
+
+    switch ( len )
+    {
+    case 1:
+        writeb(data, mem + PAGE_OFFSET(addr));
+        break;
+
+    case 2:
+        writew(data, mem + PAGE_OFFSET(addr));
+        break;
+
+    case 4:
+        writel(data, mem + PAGE_OFFSET(addr));
+        break;
+
+    case 8:
+        writeq(data, mem + PAGE_OFFSET(addr));
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+    }
+    spin_unlock(&vpci->lock);
+
+    return X86EMUL_OKAY;
+}
+
+static int msix_write(struct vcpu *v, unsigned long addr, unsigned int len,
+                      unsigned long data)
+{
+    const struct domain *d = v->domain;
+    struct vpci_msix *msix = msix_find(d, addr);
+    struct vpci_msix_entry *entry;
+    unsigned int offset;
+
+    if ( !msix )
+        return X86EMUL_RETRY;
+
+    if ( adjacent_handle(msix, addr) )
+        return adjacent_write(d, msix, addr, len, data);
+
+    if ( !access_allowed(msix->pdev, addr, len) )
+        return X86EMUL_OKAY;
+
     spin_lock(&msix->pdev->vpci->lock);
     entry = get_entry(msix, addr);
     offset = addr & (PCI_MSIX_ENTRY_SIZE - 1);
@@ -482,6 +633,26 @@ int vpci_make_msix_hole(const struct pci_dev *pdev)
         }
     }
 
+    if ( is_hardware_domain(d) )
+    {
+        /*
+         * For dom0 only: remove any hypervisor mappings of the MSIX or PBA
+         * related areas, as dom0 is capable of moving the position of the BARs
+         * in the host address space.
+         *
+         * We rely on being called with the vPCI lock held once the domain is
+         * running, so the maps are not in use.
+         */
+        for ( i = 0; i < ARRAY_SIZE(pdev->vpci->msix->table); i++ )
+            if ( pdev->vpci->msix->table[i] )
+            {
+                /* If there are any maps, the domain must be running. */
+                ASSERT(spin_is_locked(&pdev->vpci->lock));
+                iounmap(pdev->vpci->msix->table[i]);
+                pdev->vpci->msix->table[i] = NULL;
+            }
+    }
+
     return 0;
 }
 
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index b9339f8f3e..60b5f45cd1 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -53,9 +53,12 @@ void vpci_remove_device(struct pci_dev *pdev)
     spin_unlock(&pdev->vpci->lock);
     if ( pdev->vpci->msix )
     {
+        unsigned int i;
+
         list_del(&pdev->vpci->msix->next);
-        if ( pdev->vpci->msix->pba )
-            iounmap(pdev->vpci->msix->pba);
+        for ( i = 0; i < ARRAY_SIZE(pdev->vpci->msix->table); i++ )
+            if ( pdev->vpci->msix->table[i] )
+                iounmap(pdev->vpci->msix->table[i]);
     }
     xfree(pdev->vpci->msix);
     xfree(pdev->vpci->msi);
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 755b4fd5c8..3326d9026e 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -129,8 +129,12 @@ struct vpci {
         bool enabled         : 1;
         /* Masked? */
         bool masked          : 1;
-        /* PBA map */
-        void __iomem *pba;
+        /* Partial table map. */
+#define VPCI_MSIX_TBL_HEAD 0
+#define VPCI_MSIX_TBL_TAIL 1
+#define VPCI_MSIX_PBA_HEAD 2
+#define VPCI_MSIX_PBA_TAIL 3
+        void __iomem *table[4];
         /* Entries. */
         struct vpci_msix_entry {
             uint64_t addr;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Mar 31 23:56:25 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Mar 2023 23:56:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.517070.802108 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piObZ-0005jq-Dt; Fri, 31 Mar 2023 23:56:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 517070.802108; Fri, 31 Mar 2023 23:56:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1piObZ-0005jf-BB; Fri, 31 Mar 2023 23:56:25 +0000
Received: by outflank-mailman (input) for mailman id 517070;
 Fri, 31 Mar 2023 23: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 1piObX-0005jS-8U
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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 1piObX-0005xi-7U
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1piObX-00067c-6c
 for xen-changelog@lists.xenproject.org; Fri, 31 Mar 2023 23: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=PZ5qUcqaU45f8lAw9EVQdfBlCmW0RZ6iTfFfJgE0bRc=; b=hJWa+epKBmegVykgEXtd/TFSZ4
	jPk9/jX64PRtSHrVm9pY2zr5fYBR3WIjVs6ANgmTJ0R5CAR7wU0xI1i1Iqq5poA76s0a9ArbWG8bq
	NDCFeVyAKSVWV+ZApUo4cGR6bS5FscXh1Msfm5g0WvS4JXsHxTNXXZ87IN0haB7wJnzs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] ns16550: correct name/value pair parsing for PCI port/bridge
Message-Id: <E1piObX-00067c-6c@xenbits.xenproject.org>
Date: Fri, 31 Mar 2023 23:56:23 +0000

commit 06264af090ac69a95cdadbc261cc82d964dcb568
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 31 08:42:02 2023 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 31 08:42:02 2023 +0200

    ns16550: correct name/value pair parsing for PCI port/bridge
    
    First of all these were inverted: "bridge=" caused the port coordinates
    to be established, while "port=" controlled the bridge coordinates. And
    then the error messages being identical also wasn't helpful. While
    correcting this also move both case blocks close together.
    
    Fixes: 97fd49a7e074 ("ns16550: add support for UART parameters to be specifed with name-value pairs")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: e692b22230b411d762ac9e278a398e28df474eae
    master date: 2023-03-29 14:55:37 +0200
---
 xen/drivers/char/ns16550.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 5dd4d723f5..3651e0c0d4 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1536,13 +1536,6 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
             break;
 
 #ifdef CONFIG_HAS_PCI
-        case bridge_bdf:
-            if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0],
-                            &uart->ps_bdf[1], &uart->ps_bdf[2]) )
-                PARSE_ERR_RET("Bad port PCI coordinates\n");
-            uart->ps_bdf_enable = true;
-            break;
-
         case device:
             if ( strncmp(param_value, "pci", 3) == 0 )
             {
@@ -1557,9 +1550,16 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
             break;
 
         case port_bdf:
+            if ( !parse_pci(param_value, NULL, &uart->ps_bdf[0],
+                            &uart->ps_bdf[1], &uart->ps_bdf[2]) )
+                PARSE_ERR_RET("Bad port PCI coordinates\n");
+            uart->ps_bdf_enable = true;
+            break;
+
+        case bridge_bdf:
             if ( !parse_pci(param_value, NULL, &uart->pb_bdf[0],
                             &uart->pb_bdf[1], &uart->pb_bdf[2]) )
-                PARSE_ERR_RET("Bad port PCI coordinates\n");
+                PARSE_ERR_RET("Bad bridge PCI coordinates\n");
             uart->pb_bdf_enable = true;
             break;
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


