From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 09:22:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 09:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253072.434066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g18-0006aS-G3; Tue, 04 Jan 2022 09:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253072.434066; Tue, 04 Jan 2022 09:22: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 1n4g18-0006aK-D0; Tue, 04 Jan 2022 09:22:06 +0000
Received: by outflank-mailman (input) for mailman id 253072;
 Tue, 04 Jan 2022 09:22: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 1n4g17-0006aE-1f
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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 1n4g16-0007o8-VQ
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4g16-0001di-UL
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cla5SdGWlTb6nLGXBMnQhUF42bIkUHI3kAJ2QMQWYg0=; b=xlohoZgTGbkI5ZuixkXPQaTz7Q
	X6OufSMYygvOgr8hNMmjaYqsLdnRwYRYK8q13motHOqE6Qyy/g37TwimwCsyCVxnF9Dz+cbPXdF9X
	iLtVIVT2eVGXQza1sOQg6ZWGMpqOnH6JZ1WsOYLK7P+EekPDau96F2pQEnaEaEAUxk68=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EPT: squash meaningless TLB flush
Message-Id: <E1n4g16-0001di-UL@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 09:22:04 +0000

commit 4a59e6bb3a96f5ebca95d162b2a81b3e68b076a2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:13:06 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:13:06 2022 +0100

    x86/EPT: squash meaningless TLB flush
    
    ept_free_entry() gets called after a flush was already issued, if one is
    necessary in the first place. That behavior is similar to NPT, which
    also doesn't have any further flush in p2m_free_entry(). (Furthermore,
    the function being recursive, in case of recursiveness way too many
    flushes would have been issued.)
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/mm/p2m-ept.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index a4f5fc4b0d..b7ee441d45 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -246,8 +246,7 @@ static void ept_free_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry, int l
             ept_free_entry(p2m, epte + i, level - 1);
         unmap_domain_page(epte);
     }
-    
-    p2m_tlb_flush_sync(p2m);
+
     p2m_free_ptp(p2m, mfn_to_page(_mfn(ept_entry->mfn)));
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 09:22:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 09:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253073.434070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1H-0006c9-Hb; Tue, 04 Jan 2022 09:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253073.434070; Tue, 04 Jan 2022 09:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1H-0006c1-Eb; Tue, 04 Jan 2022 09:22:15 +0000
Received: by outflank-mailman (input) for mailman id 253073;
 Tue, 04 Jan 2022 09:22: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 1n4g1H-0006bv-3A
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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 1n4g1H-0007oC-2P
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4g1H-0001eU-1N
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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=/w65fkVuIldIdo1j83zDWwrEQEtnA8Hr43JNuhr1SAY=; b=CCTFbciqj7ap65RnJ1Pnfjg1ef
	t25rNLJYW33Eq15eAedRQ1uHpIcd5R/etgYo4qeuCC8HhE430ohDW52kyRQlYDRwdI+DvbnXiy/cg
	gDRiVcG/saGpmwiWj8Q+8DDkf6M2pvuSGPSEUinXwNEwGuWwiSUGD+qt+LvxOStEkRDg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: avoid allocating domid_{bit,}map[] when possible
Message-Id: <E1n4g1H-0001eU-1N@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 09:22:15 +0000

commit 0ea20d36473511beb8dca0a071e1b7473291e5d3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:16:04 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:16:04 2022 +0100

    VT-d: avoid allocating domid_{bit,}map[] when possible
    
    When an IOMMU implements the full 16 bits worth of DID in context
    entries, there's no point going through a memory base translation table.
    For IOMMUs not using Caching Mode we can simply use the domain IDs
    verbatim, while for Caching Mode we need to avoid DID 0.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 102 ++++++++++++++++++++++++++----------
 xen/drivers/passthrough/vtd/iommu.h |   2 +-
 2 files changed, 75 insertions(+), 29 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index b329b5d14f..806dd32485 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -62,11 +62,32 @@ static struct tasklet vtd_fault_tasklet;
 static int setup_hwdom_device(u8 devfn, struct pci_dev *);
 static void setup_hwdom_rmrr(struct domain *d);
 
+static bool domid_mapping(const struct vtd_iommu *iommu)
+{
+    return (const void *)iommu->domid_bitmap != (const void *)iommu->domid_map;
+}
+
+static domid_t convert_domid(const struct vtd_iommu *iommu, domid_t domid)
+{
+    /*
+     * While we need to avoid DID 0 for caching-mode IOMMUs, maintain
+     * the property of the transformation being the same in either
+     * direction. By clipping to 16 bits we ensure that the resulting
+     * DID will fit in the respective context entry field.
+     */
+    BUILD_BUG_ON(DOMID_MASK >= 0xffff);
+
+    return !cap_caching_mode(iommu->cap) ? domid : ~domid;
+}
+
 static int domain_iommu_domid(const struct domain *d,
                               const struct vtd_iommu *iommu)
 {
     unsigned int nr_dom, i;
 
+    if ( !domid_mapping(iommu) )
+        return convert_domid(iommu, d->domain_id);
+
     nr_dom = cap_ndoms(iommu->cap);
     i = find_first_bit(iommu->domid_bitmap, nr_dom);
     while ( i < nr_dom )
@@ -91,26 +112,32 @@ static int context_set_domain_id(struct context_entry *context,
                                  const struct domain *d,
                                  struct vtd_iommu *iommu)
 {
-    unsigned int nr_dom, i;
+    unsigned int i;
 
     ASSERT(spin_is_locked(&iommu->lock));
 
-    nr_dom = cap_ndoms(iommu->cap);
-    i = find_first_bit(iommu->domid_bitmap, nr_dom);
-    while ( i < nr_dom && iommu->domid_map[i] != d->domain_id )
-        i = find_next_bit(iommu->domid_bitmap, nr_dom, i + 1);
-
-    if ( i >= nr_dom )
+    if ( domid_mapping(iommu) )
     {
-        i = find_first_zero_bit(iommu->domid_bitmap, nr_dom);
+        unsigned int nr_dom = cap_ndoms(iommu->cap);
+
+        i = find_first_bit(iommu->domid_bitmap, nr_dom);
+        while ( i < nr_dom && iommu->domid_map[i] != d->domain_id )
+            i = find_next_bit(iommu->domid_bitmap, nr_dom, i + 1);
+
         if ( i >= nr_dom )
         {
-            dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no free domain ids\n");
-            return -EBUSY;
+            i = find_first_zero_bit(iommu->domid_bitmap, nr_dom);
+            if ( i >= nr_dom )
+            {
+                dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no free domain id\n");
+                return -EBUSY;
+            }
+            iommu->domid_map[i] = d->domain_id;
+            set_bit(i, iommu->domid_bitmap);
         }
-        iommu->domid_map[i] = d->domain_id;
-        set_bit(i, iommu->domid_bitmap);
     }
+    else
+        i = convert_domid(iommu, d->domain_id);
 
     context->hi |= (i & ((1 << DID_FIELD_WIDTH) - 1)) << DID_HIGH_OFFSET;
     return 0;
@@ -140,7 +167,12 @@ static int context_get_domain_id(const struct context_entry *context,
 
 static void cleanup_domid_map(struct domain *domain, struct vtd_iommu *iommu)
 {
-    int iommu_domid = domain_iommu_domid(domain, iommu);
+    int iommu_domid;
+
+    if ( !domid_mapping(iommu) )
+        return;
+
+    iommu_domid = domain_iommu_domid(domain, iommu);
 
     if ( iommu_domid >= 0 )
     {
@@ -196,7 +228,13 @@ static void check_cleanup_domid_map(struct domain *d,
 
 domid_t did_to_domain_id(const struct vtd_iommu *iommu, unsigned int did)
 {
-    if ( did >= cap_ndoms(iommu->cap) || !test_bit(did, iommu->domid_bitmap) )
+    if ( did >= min(cap_ndoms(iommu->cap), DOMID_MASK + 1) )
+        return DOMID_INVALID;
+
+    if ( !domid_mapping(iommu) )
+        return convert_domid(iommu, did);
+
+    if ( !test_bit(did, iommu->domid_bitmap) )
         return DOMID_INVALID;
 
     return iommu->domid_map[did];
@@ -1297,24 +1335,32 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     if ( !ecap_coherent(iommu->ecap) )
         vtd_ops.sync_cache = sync_cache;
 
-    /* allocate domain id bitmap */
     nr_dom = cap_ndoms(iommu->cap);
-    iommu->domid_bitmap = xzalloc_array(unsigned long, BITS_TO_LONGS(nr_dom));
-    if ( !iommu->domid_bitmap )
-        return -ENOMEM;
 
-    iommu->domid_map = xzalloc_array(domid_t, nr_dom);
-    if ( !iommu->domid_map )
-        return -ENOMEM;
+    if ( nr_dom <= DOMID_MASK + cap_caching_mode(iommu->cap) )
+    {
+        /* Allocate domain id (bit) maps. */
+        iommu->domid_bitmap = xzalloc_array(unsigned long,
+                                            BITS_TO_LONGS(nr_dom));
+        iommu->domid_map = xzalloc_array(domid_t, nr_dom);
+        if ( !iommu->domid_bitmap || !iommu->domid_map )
+            return -ENOMEM;
 
-    /*
-     * If Caching mode is set, then invalid translations are tagged with
-     * domain id 0. Hence reserve bit/slot 0.
-     */
-    if ( cap_caching_mode(iommu->cap) )
+        /*
+         * If Caching mode is set, then invalid translations are tagged
+         * with domain id 0. Hence reserve bit/slot 0.
+         */
+        if ( cap_caching_mode(iommu->cap) )
+        {
+            iommu->domid_map[0] = DOMID_INVALID;
+            __set_bit(0, iommu->domid_bitmap);
+        }
+    }
+    else
     {
-        iommu->domid_map[0] = DOMID_INVALID;
-        __set_bit(0, iommu->domid_bitmap);
+        /* Don't leave dangling NULL pointers. */
+        iommu->domid_bitmap = ZERO_BLOCK_PTR;
+        iommu->domid_map = ZERO_BLOCK_PTR;
     }
 
     return 0;
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 07501dda4e..48973e87c1 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -82,7 +82,7 @@
 #define cap_plmr(c)        (((c) >> 5) & 1)
 #define cap_rwbf(c)        (((c) >> 4) & 1)
 #define cap_afl(c)        (((c) >> 3) & 1)
-#define cap_ndoms(c)        (1 << (4 + 2 * ((c) & 0x7)))
+#define cap_ndoms(c)        (1U << (4 + 2 * ((c) & 0x7)))
 
 /*
  * Extended Capability Register
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 09:22:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 09:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253074.434074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1R-0006fP-Jh; Tue, 04 Jan 2022 09:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253074.434074; Tue, 04 Jan 2022 09:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1R-0006fH-GB; Tue, 04 Jan 2022 09:22:25 +0000
Received: by outflank-mailman (input) for mailman id 253074;
 Tue, 04 Jan 2022 09:22: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 1n4g1R-0006fB-6N
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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 1n4g1R-0007oT-5Y
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4g1R-0001fM-4Y
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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=W45Oy0EmLaQdgdenUzQVvD3lh4Fva1De3WsswjApc8g=; b=5JDcln7zPzDkWd/f79KGETZLMN
	1iFIOwQq99H+5HWB84dl9fDIenJVxdFpLWjL12jOTvtipqc4XTAh+Fe4yxAVbBbSWd/U8+eiPuyy8
	i/N297agz89VvdH/kJpgqNWwTUkmfJDvhr7j/5B4rrCmDPzE9nyyeiVpmaY/ICF3dN/w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenperf: name "newer" hypercalls
Message-Id: <E1n4g1R-0001fM-4Y@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 09:22:25 +0000

commit 5b3f42001a55f58726201641e18ee8c0f82e2e16
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:16:48 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:16:48 2022 +0100

    xenperf: name "newer" hypercalls
    
    This table must not have got updated in quite a while; tmem_op for
    example has managed to not only appear since then, but also disappear
    again (adding a name for it nevertheless, to make more obvious that
    something strange is going on if the slot would ever have a non-zero
    value).
    
    Also resolve arch_0 and arch_1 to more meaningful names on x86.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xenperf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xenperf.c b/tools/misc/xenperf.c
index a5fbdaa45f..a74fd85b71 100644
--- a/tools/misc/xenperf.c
+++ b/tools/misc/xenperf.c
@@ -18,7 +18,7 @@
 #include <string.h>
 
 #define X(name) [__HYPERVISOR_##name] = #name
-const char *hypercall_name_table[64] =
+static const char *const hypercall_name_table[64] =
 {
     X(set_trap_table),
     X(mmu_update),
@@ -57,8 +57,18 @@ const char *hypercall_name_table[64] =
     X(sysctl),
     X(domctl),
     X(kexec_op),
+    X(tmem_op),
+    X(argo_op),
+    X(xenpmu_op),
+    X(dm_op),
+    X(hypfs_op),
+#if defined(__i386__) || defined(__x86_64__)
+    X(mca),
+    [__HYPERVISOR_arch_1] = "paging-domctl-continuation",
+#else
     X(arch_0),
     X(arch_1),
+#endif
     X(arch_2),
     X(arch_3),
     X(arch_4),
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 09:22:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 09:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253075.434078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1c-0006ic-LH; Tue, 04 Jan 2022 09:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253075.434078; Tue, 04 Jan 2022 09:22:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1c-0006iU-I5; Tue, 04 Jan 2022 09:22:36 +0000
Received: by outflank-mailman (input) for mailman id 253075;
 Tue, 04 Jan 2022 09:22: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 1n4g1b-0006iK-9I
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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 1n4g1b-0007qB-8V
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4g1b-0001g8-7d
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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=rLzMyCZEO25rMGiAzdluShvi9ikDThPWzHqV0R+y5gQ=; b=CK/mBuqTBLyekyuwVqZoYpMP6z
	UAyz5aORUUEQBXqmTHLyjb36l/i6Uv43AOfZYFrZ678+WKDbHZK9sxtyvV7rkNICzPfn+lHjq+WkR
	2yLriSaEtnqMJgbQ39DP9EapO/08dWPnNgn47bB21pLtfyoX/745uRPCfgJntstrxrMo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: properly parenthesize a number of macros
Message-Id: <E1n4g1b-0001g8-7d@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 09:22:35 +0000

commit 7762b7a1ec63b5ef0d5eceb1725de2a50b33ab20
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:17:44 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:17:44 2022 +0100

    VT-d: properly parenthesize a number of macros
    
    Let's eliminate the risk of any of these macros getting used with more
    complex expressions as arguments.
    
    Where touching lines anyway, also
    - switch from u64 to uint64_t,
    - drop unnecessary parentheses,
    - drop pointless 0x prefixes.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.h | 50 ++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 48973e87c1..652b8c9d09 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -90,14 +90,14 @@
 
 #define ecap_niotlb_iunits(e)    ((((e) >> 24) & 0xff) + 1)
 #define ecap_iotlb_offset(e)     ((((e) >> 8) & 0x3ff) * 16)
-#define ecap_coherent(e)         ((e >> 0) & 0x1)
-#define ecap_queued_inval(e)     ((e >> 1) & 0x1)
-#define ecap_dev_iotlb(e)        ((e >> 2) & 0x1)
-#define ecap_intr_remap(e)       ((e >> 3) & 0x1)
-#define ecap_eim(e)              ((e >> 4) & 0x1)
-#define ecap_cache_hints(e)      ((e >> 5) & 0x1)
-#define ecap_pass_thru(e)        ((e >> 6) & 0x1)
-#define ecap_snp_ctl(e)          ((e >> 7) & 0x1)
+#define ecap_coherent(e)         (((e) >> 0) & 1)
+#define ecap_queued_inval(e)     (((e) >> 1) & 1)
+#define ecap_dev_iotlb(e)        (((e) >> 2) & 1)
+#define ecap_intr_remap(e)       (((e) >> 3) & 1)
+#define ecap_eim(e)              (((e) >> 4) & 1)
+#define ecap_cache_hints(e)      (((e) >> 5) & 1)
+#define ecap_pass_thru(e)        (((e) >> 6) & 1)
+#define ecap_snp_ctl(e)          (((e) >> 7) & 1)
 
 /* IOTLB_REG */
 #define DMA_TLB_FLUSH_GRANU_OFFSET  60
@@ -106,14 +106,14 @@
 #define DMA_TLB_PSI_FLUSH (((u64)3) << 60)
 #define DMA_TLB_IIRG(x) (((x) >> 60) & 7) 
 #define DMA_TLB_IAIG(val) (((val) >> 57) & 7)
-#define DMA_TLB_DID(x) (((u64)(x & 0xffff)) << 32)
+#define DMA_TLB_DID(x) (((uint64_t)((x) & 0xffff)) << 32)
 
 #define DMA_TLB_READ_DRAIN (((u64)1) << 49)
 #define DMA_TLB_WRITE_DRAIN (((u64)1) << 48)
 #define DMA_TLB_IVT (((u64)1) << 63)
 
-#define DMA_TLB_IVA_ADDR(x) ((((u64)x) >> 12) << 12)
-#define DMA_TLB_IVA_HINT(x) ((((u64)x) & 1) << 6)
+#define DMA_TLB_IVA_ADDR(x) (((uint64_t)(x) >> 12) << 12)
+#define DMA_TLB_IVA_HINT(x) (((uint64_t)(x) & 1) << 6)
 
 /* GCMD_REG */
 #define DMA_GCMD_TE     (1u << 31)
@@ -144,11 +144,11 @@
 /* CCMD_REG */
 #define DMA_CCMD_INVL_GRANU_OFFSET  61
 #define DMA_CCMD_ICC   (((u64)1) << 63)
-#define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61)
-#define DMA_CCMD_DOMAIN_INVL (((u64)2) << 61)
-#define DMA_CCMD_DEVICE_INVL (((u64)3) << 61)
+#define DMA_CCMD_GLOBAL_INVL ((uint64_t)1 << DMA_CCMD_INVL_GRANU_OFFSET)
+#define DMA_CCMD_DOMAIN_INVL ((uint64_t)2 << DMA_CCMD_INVL_GRANU_OFFSET)
+#define DMA_CCMD_DEVICE_INVL ((uint64_t)3 << DMA_CCMD_INVL_GRANU_OFFSET)
+#define DMA_CCMD_CIRG(x) (((uint64_t)3 << DMA_CCMD_INVL_GRANU_OFFSET) & (x))
 #define DMA_CCMD_FM(m) (((u64)((m) & 0x3)) << 32)
-#define DMA_CCMD_CIRG(x) ((((u64)3) << 61) & x)
 #define DMA_CCMD_MASK_NOBIT 0
 #define DMA_CCMD_MASK_1BIT 1
 #define DMA_CCMD_MASK_2BIT 2
@@ -156,7 +156,7 @@
 #define DMA_CCMD_SID(s) (((u64)((s) & 0xffff)) << 16)
 #define DMA_CCMD_DID(d) ((u64)((d) & 0xffff))
 
-#define DMA_CCMD_CAIG_MASK(x) (((u64)x) & ((u64) 0x3 << 59))
+#define DMA_CCMD_CAIG_MASK(x) ((uint64_t)(x) & ((uint64_t)3 << 59))
 
 /* FECTL_REG */
 #define DMA_FECTL_IM (1u << 31)
@@ -175,10 +175,10 @@
 
 /* FRCD_REG, 32 bits access */
 #define DMA_FRCD_F (1u << 31)
-#define dma_frcd_type(d) ((d >> 30) & 1)
-#define dma_frcd_fault_reason(c) (c & 0xff)
-#define dma_frcd_source_id(c) (c & 0xffff)
-#define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */
+#define dma_frcd_type(d) (((d) >> 30) & 1)
+#define dma_frcd_fault_reason(c) ((c) & 0xff)
+#define dma_frcd_source_id(c) ((c) & 0xffff)
+#define dma_frcd_page_addr(d) ((d) & ((uint64_t)-1 << 12)) /* low 64 bit */
 
 /*
  * 0: Present
@@ -233,16 +233,16 @@ struct context_entry {
 #define PTE_NUM            (1 << LEVEL_STRIDE)
 #define level_to_agaw(val) ((val) - 2)
 #define agaw_to_level(val) ((val) + 2)
-#define agaw_to_width(val) (30 + val * LEVEL_STRIDE)
-#define width_to_agaw(w)   ((w - 30)/LEVEL_STRIDE)
-#define level_to_offset_bits(l) (12 + (l - 1) * LEVEL_STRIDE)
+#define agaw_to_width(val) (30 + (val) * LEVEL_STRIDE)
+#define width_to_agaw(w)   (((w) - 30)/LEVEL_STRIDE)
+#define level_to_offset_bits(l) (12 + ((l) - 1) * LEVEL_STRIDE)
 #define address_level_offset(addr, level) \
-            ((addr >> level_to_offset_bits(level)) & LEVEL_MASK)
+            (((addr) >> level_to_offset_bits(level)) & LEVEL_MASK)
 #define offset_level_address(offset, level) \
             ((u64)(offset) << level_to_offset_bits(level))
 #define level_mask(l) (((u64)(-1)) << level_to_offset_bits(l))
 #define level_size(l) (1 << level_to_offset_bits(l))
-#define align_to_level(addr, l) ((addr + level_size(l) - 1) & level_mask(l))
+#define align_to_level(addr, l) (((addr) + level_size(l) - 1) & level_mask(l))
 
 /*
  * 0: readable
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 09:22:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 09:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253076.434082 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1m-0006lN-Mh; Tue, 04 Jan 2022 09:22:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253076.434082; Tue, 04 Jan 2022 09:22:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1m-0006lF-Jl; Tue, 04 Jan 2022 09:22:46 +0000
Received: by outflank-mailman (input) for mailman id 253076;
 Tue, 04 Jan 2022 09:22: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 1n4g1l-0006kx-CR
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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 1n4g1l-0007qb-Bd
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4g1l-0001h8-Aj
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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=/ScJNvNPFF/g0DYLHV9CS7jUUP3fdPtLoaNUCoBXKUU=; b=08rHCebfnwgEohs66fWj4Pvo3j
	OJMf8AfYEUawSgfnWpy6t4c7T0tzhUUwy5WB3h7H4Rjl4SEMbgl6swGEXcD+jfQ3UkTFIaaEYMIgR
	xnXsUtlVO/2nWJL4zPXZSa+vR4TV1qIV7H9mxinKGo7vFnRGBWeQjqoxodswJyamhYEs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: use DMA_TLB_IVA_ADDR()
Message-Id: <E1n4g1l-0001h8-Aj@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 09:22:45 +0000

commit 635de3c928c63b5b5c6f31349856547c81c03c8e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:18:18 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:18:18 2022 +0100

    VT-d: use DMA_TLB_IVA_ADDR()
    
    Let's use the macro in the one place it's supposed to be used, and in
    favor of then unnecessary manipulations of the address in
    iommu_flush_iotlb_psi(): All leaf functions then already deal correctly
    with the supplied address.
    
    There also has never been a need to require (i.e. assert for) the
    passing in of 4k-aligned addresses - it'll always be the order-sized
    range containing the address which gets flushed.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 806dd32485..2d0946801e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -584,7 +584,8 @@ int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
     if ( type == DMA_TLB_PSI_FLUSH )
     {
         /* Note: always flush non-leaf currently. */
-        dmar_writeq(iommu->reg, tlb_offset, size_order | addr);
+        dmar_writeq(iommu->reg, tlb_offset,
+                    size_order | DMA_TLB_IVA_ADDR(addr));
     }
     dmar_writeq(iommu->reg, tlb_offset + 8, val);
 
@@ -644,8 +645,6 @@ static int __must_check iommu_flush_iotlb_psi(struct vtd_iommu *iommu, u16 did,
 {
     int status;
 
-    ASSERT(!(addr & (~PAGE_MASK_4K)));
-
     /* Fallback to domain selective flush if no PSI support */
     if ( !cap_pgsel_inv(iommu->cap) )
         return iommu_flush_iotlb_dsi(iommu, did, flush_non_present_entry,
@@ -656,9 +655,6 @@ static int __must_check iommu_flush_iotlb_psi(struct vtd_iommu *iommu, u16 did,
         return iommu_flush_iotlb_dsi(iommu, did, flush_non_present_entry,
                                      flush_dev_iotlb);
 
-    addr >>= PAGE_SHIFT_4K + order;
-    addr <<= PAGE_SHIFT_4K + order;
-
     /* apply platform specific errata workarounds */
     vtd_ops_preamble_quirk(iommu);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 09:22:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 09:22:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253077.434086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g1w-0006ob-Ox; Tue, 04 Jan 2022 09:22:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253077.434086; Tue, 04 Jan 2022 09:22: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 1n4g1w-0006oO-LE; Tue, 04 Jan 2022 09:22:56 +0000
Received: by outflank-mailman (input) for mailman id 253077;
 Tue, 04 Jan 2022 09:22: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 1n4g1v-0006oC-FT
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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 1n4g1v-0007ql-Ej
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4g1v-0001ik-Dn
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:22: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=7RnhegNsOwazPVW5pySkE1oxe6GwjuMHQkFhY+aWPbY=; b=R6cv8pjK1G57dQugy/HNwUpePg
	3GnUfNqVYn4LNwieYLR+YRA5sxolv5BzlBeigfs+E1F+5EvfRoHGPGPdtVXy3uWzi4+91kjhBMYfB
	vqQQ8PlVC28BrHLOQWZTG7jctWh7u15PKtzYZlnQ+C7Vo5dUL/1rTSd1pEhMoCTtfYvs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: shorten vtd_flush_{context,iotlb}_reg()
Message-Id: <E1n4g1v-0001ik-Dn@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 09:22:55 +0000

commit 7cd0a787bba5b9c0073cceb1884064393ab719b9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:19:32 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:19:32 2022 +0100

    VT-d: shorten vtd_flush_{context,iotlb}_reg()
    
    Their calculations of the value to write to the respective command
    register can be partly folded, resulting in almost 100 bytes less code
    for these two relatively short functions.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2d0946801e..34ea5f485d 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -479,7 +479,6 @@ int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
                           uint16_t source_id, uint8_t function_mask,
                           uint64_t type, bool flush_non_present_entry)
 {
-    u64 val = 0;
     unsigned long flags;
 
     /*
@@ -500,26 +499,26 @@ int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
     switch ( type )
     {
     case DMA_CCMD_GLOBAL_INVL:
-        val = DMA_CCMD_GLOBAL_INVL;
-        break;
-    case DMA_CCMD_DOMAIN_INVL:
-        val = DMA_CCMD_DOMAIN_INVL|DMA_CCMD_DID(did);
         break;
+
     case DMA_CCMD_DEVICE_INVL:
-        val = DMA_CCMD_DEVICE_INVL|DMA_CCMD_DID(did)
-            |DMA_CCMD_SID(source_id)|DMA_CCMD_FM(function_mask);
+        type |= DMA_CCMD_SID(source_id) | DMA_CCMD_FM(function_mask);
+        fallthrough;
+    case DMA_CCMD_DOMAIN_INVL:
+        type |= DMA_CCMD_DID(did);
         break;
+
     default:
         BUG();
     }
-    val |= DMA_CCMD_ICC;
+    type |= DMA_CCMD_ICC;
 
     spin_lock_irqsave(&iommu->register_lock, flags);
-    dmar_writeq(iommu->reg, DMAR_CCMD_REG, val);
+    dmar_writeq(iommu->reg, DMAR_CCMD_REG, type);
 
     /* Make sure hardware complete it */
     IOMMU_FLUSH_WAIT("context", iommu, DMAR_CCMD_REG, dmar_readq,
-                     !(val & DMA_CCMD_ICC), val);
+                     !(type & DMA_CCMD_ICC), type);
 
     spin_unlock_irqrestore(&iommu->register_lock, flags);
     /* flush context entry will implicitly flush write buffer */
@@ -548,7 +547,7 @@ int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
                         bool flush_non_present_entry, bool flush_dev_iotlb)
 {
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
-    u64 val = 0;
+    uint64_t val = type | DMA_TLB_IVT;
     unsigned long flags;
 
     /*
@@ -562,14 +561,13 @@ int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
     switch ( type )
     {
     case DMA_TLB_GLOBAL_FLUSH:
-        val = DMA_TLB_GLOBAL_FLUSH|DMA_TLB_IVT;
         break;
+
     case DMA_TLB_DSI_FLUSH:
-        val = DMA_TLB_DSI_FLUSH|DMA_TLB_IVT|DMA_TLB_DID(did);
-        break;
     case DMA_TLB_PSI_FLUSH:
-        val = DMA_TLB_PSI_FLUSH|DMA_TLB_IVT|DMA_TLB_DID(did);
+        val |= DMA_TLB_DID(did);
         break;
+
     default:
         BUG();
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 09:23:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 09:23:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253078.434090 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g26-0006rj-RE; Tue, 04 Jan 2022 09:23:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253078.434090; Tue, 04 Jan 2022 09:23: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 1n4g26-0006ra-O8; Tue, 04 Jan 2022 09:23:06 +0000
Received: by outflank-mailman (input) for mailman id 253078;
 Tue, 04 Jan 2022 09:23: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 1n4g25-0006rQ-IU
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:23: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 1n4g25-0007rS-Ho
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:23:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4g25-0001k3-Gq
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:23: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=pzKeVhwfYHQtf3e4YrbBchnJh3zpFxEQzrLOkfsiMd4=; b=2DeWtNL3Qz4W7hpBJgJeaWfv7D
	/515CtTdFYERWSuImAKnYPKMictmvU2lsGDHVphHCrfm3j0VlZ6StM+MggGVpPCxLzbF+tYAj37/H
	MoraiD6R0X/EfD8YRBMa8W3/sbb5UfjUhJ5pw2a7bYuC04tnNBtiuHhJWFhtz8g5QDYk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxc: avoid clobbering errno in xc_domain_pod_target()
Message-Id: <E1n4g25-0001k3-Gq@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 09:23:05 +0000

commit 78688ffa7e86e7cdb57d383e213fd822aaaa5438
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:20:15 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:20:15 2022 +0100

    libxc: avoid clobbering errno in xc_domain_pod_target()
    
    do_memory_op() supplies return value and has "errno" set the usual way.
    Don't overwrite "errno" with 1 (aka EPERM on at least Linux). There's
    also no reason to overwrite "err".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/ctrl/xc_domain.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c
index 20b86d986c..ef62f66009 100644
--- a/tools/libs/ctrl/xc_domain.c
+++ b/tools/libs/ctrl/xc_domain.c
@@ -1230,13 +1230,9 @@ static int xc_domain_pod_target(xc_interface *xch,
     err = do_memory_op(xch, op, &pod_target, sizeof(pod_target));
 
     if ( err < 0 )
-    {
         DPRINTF("Failed %s_pod_target dom %d\n",
                 (op==XENMEM_set_pod_target)?"set":"get",
                 domid);
-        errno = -err;
-        err = -1;
-    }
     else
         err = 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 09:23:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 09:23:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253080.434094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4g2G-0006ua-Se; Tue, 04 Jan 2022 09:23:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253080.434094; Tue, 04 Jan 2022 09:23: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 1n4g2G-0006uS-Pe; Tue, 04 Jan 2022 09:23:16 +0000
Received: by outflank-mailman (input) for mailman id 253080;
 Tue, 04 Jan 2022 09:23: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 1n4g2F-0006uJ-LR
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:23: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 1n4g2F-0007rf-Km
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:23:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4g2F-0001lC-Jy
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 09:23: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=64nrWdr4iSGLBw4WWI2EpSSHNSdBpzw1PWa02mEXPBY=; b=U6Bkc9bt8J7PpcN1Hw0YGDRq/i
	d06xBZ5vZ4gibiT63OLA/D/W9j92NS7/AHlFhyTJUnTMBgGXL8UBP0Ds/NEu7JbbNsubuUIquxcmc
	WdWFRMI5VCKNvk5dPxm3Zu8t+SMW5cwcLH9Ad0dGCndtDhLwnUl49/MxDVMr/AVCiPas=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenperf: omit meaningless trailing zeroes from output
Message-Id: <E1n4g2F-0001lC-Jy@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 09:23:15 +0000

commit af0c5430a82c77432729d61c9b409dd32c477b20
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:21:12 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:21:12 2022 +0100

    xenperf: omit meaningless trailing zeroes from output
    
    There's no point producing a long chain of zeroes when the previously
    calculated total value was zero. To guard against mistakenly skipping
    non-zero individual fields, widen "sum" to "unsigned long long".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/misc/xenperf.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenperf.c b/tools/misc/xenperf.c
index a74fd85b71..6e5f8675d4 100644
--- a/tools/misc/xenperf.c
+++ b/tools/misc/xenperf.c
@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
     DECLARE_HYPERCALL_BUFFER(xc_perfc_val_t, pcv);
     xc_perfc_val_t  *val;
     int num_desc, num_val;
-    unsigned int    sum, reset = 0, full = 0, pretty = 0;
+    unsigned int     reset = 0, full = 0, pretty = 0;
     char hypercall_name[36];
 
     if ( argc > 1 )
@@ -168,14 +168,15 @@ int main(int argc, char *argv[])
     val = pcv;
     for ( i = 0; i < num_desc; i++ )
     {
+        unsigned long long sum = 0;
+
         printf ("%-35s ", pcd[i].name);
         
-        sum = 0;
         for ( j = 0; j < pcd[i].nr_vals; j++ )
             sum += val[j];
-        printf ("T=%10u ", (unsigned int)sum);
+        printf("T=%10llu ", sum);
 
-        if ( full || (pcd[i].nr_vals <= 4) )
+        if ( sum && (full || (pcd[i].nr_vals <= 4)) )
         {
             if ( pretty && (strcmp(pcd[i].name, "hypercalls") == 0) )
             {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 21:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 21:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253406.434552 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rln-0000PA-AJ; Tue, 04 Jan 2022 21:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253406.434552; Tue, 04 Jan 2022 21:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rln-0000P2-7B; Tue, 04 Jan 2022 21:55:03 +0000
Received: by outflank-mailman (input) for mailman id 253406;
 Tue, 04 Jan 2022 21:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rll-0000Ow-Og
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rll-00053Y-N3
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rll-0000C4-Lt
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21: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=vxZX7yX7RibN2UbhDOv3zUVreUHwAauj6hiGNoYTqXc=; b=QOYUNuL60IFI5GO2Z/ZOnETTqu
	+cE95vX/7wG1EDqZprs+8geHl6M2X9P80P3xOjmz0t0xttkoV2Yg4fdDa4hNHMlcEm42LwH9C5C5b
	r5w46gE5gS7pN6O8tVTGsIYUCBQZUgHy2fg8Jbine/88y+/bnYkDP+cI4Lgx5OKxUBJs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EPT: squash meaningless TLB flush
Message-Id: <E1n4rll-0000C4-Lt@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 21:55:01 +0000

commit 4a59e6bb3a96f5ebca95d162b2a81b3e68b076a2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:13:06 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:13:06 2022 +0100

    x86/EPT: squash meaningless TLB flush
    
    ept_free_entry() gets called after a flush was already issued, if one is
    necessary in the first place. That behavior is similar to NPT, which
    also doesn't have any further flush in p2m_free_entry(). (Furthermore,
    the function being recursive, in case of recursiveness way too many
    flushes would have been issued.)
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/mm/p2m-ept.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index a4f5fc4b0d..b7ee441d45 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -246,8 +246,7 @@ static void ept_free_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry, int l
             ept_free_entry(p2m, epte + i, level - 1);
         unmap_domain_page(epte);
     }
-    
-    p2m_tlb_flush_sync(p2m);
+
     p2m_free_ptp(p2m, mfn_to_page(_mfn(ept_entry->mfn)));
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 21:55:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 21:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253407.434556 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rlx-0000R2-Bj; Tue, 04 Jan 2022 21:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253407.434556; Tue, 04 Jan 2022 21:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rlx-0000Qu-8n; Tue, 04 Jan 2022 21:55:13 +0000
Received: by outflank-mailman (input) for mailman id 253407;
 Tue, 04 Jan 2022 21:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rlv-0000Qm-Qz
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rlv-00053d-QD
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rlv-0000Cm-PK
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RrhfVGwwJb1ni4tMrUBHe2odt64i0HRfpQq8GBTVvTQ=; b=VfsMnogWqtFFeLwoLkeOtaLfOw
	vkbbwww3rH9SKhLm/WxvbM2Qd8h7oKCS+2sK9KCSI/iQ0oE808gcs9ZaazJS9GZNsGa/vnXMohtNz
	t1rmk5TRUxw896DpBFAkB2XaL/hty/SbdQjLrpkp1kFeCvYaKPIpnZhgdym5hVf4nuIM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: avoid allocating domid_{bit,}map[] when possible
Message-Id: <E1n4rlv-0000Cm-PK@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 21:55:11 +0000

commit 0ea20d36473511beb8dca0a071e1b7473291e5d3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:16:04 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:16:04 2022 +0100

    VT-d: avoid allocating domid_{bit,}map[] when possible
    
    When an IOMMU implements the full 16 bits worth of DID in context
    entries, there's no point going through a memory base translation table.
    For IOMMUs not using Caching Mode we can simply use the domain IDs
    verbatim, while for Caching Mode we need to avoid DID 0.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 102 ++++++++++++++++++++++++++----------
 xen/drivers/passthrough/vtd/iommu.h |   2 +-
 2 files changed, 75 insertions(+), 29 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index b329b5d14f..806dd32485 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -62,11 +62,32 @@ static struct tasklet vtd_fault_tasklet;
 static int setup_hwdom_device(u8 devfn, struct pci_dev *);
 static void setup_hwdom_rmrr(struct domain *d);
 
+static bool domid_mapping(const struct vtd_iommu *iommu)
+{
+    return (const void *)iommu->domid_bitmap != (const void *)iommu->domid_map;
+}
+
+static domid_t convert_domid(const struct vtd_iommu *iommu, domid_t domid)
+{
+    /*
+     * While we need to avoid DID 0 for caching-mode IOMMUs, maintain
+     * the property of the transformation being the same in either
+     * direction. By clipping to 16 bits we ensure that the resulting
+     * DID will fit in the respective context entry field.
+     */
+    BUILD_BUG_ON(DOMID_MASK >= 0xffff);
+
+    return !cap_caching_mode(iommu->cap) ? domid : ~domid;
+}
+
 static int domain_iommu_domid(const struct domain *d,
                               const struct vtd_iommu *iommu)
 {
     unsigned int nr_dom, i;
 
+    if ( !domid_mapping(iommu) )
+        return convert_domid(iommu, d->domain_id);
+
     nr_dom = cap_ndoms(iommu->cap);
     i = find_first_bit(iommu->domid_bitmap, nr_dom);
     while ( i < nr_dom )
@@ -91,26 +112,32 @@ static int context_set_domain_id(struct context_entry *context,
                                  const struct domain *d,
                                  struct vtd_iommu *iommu)
 {
-    unsigned int nr_dom, i;
+    unsigned int i;
 
     ASSERT(spin_is_locked(&iommu->lock));
 
-    nr_dom = cap_ndoms(iommu->cap);
-    i = find_first_bit(iommu->domid_bitmap, nr_dom);
-    while ( i < nr_dom && iommu->domid_map[i] != d->domain_id )
-        i = find_next_bit(iommu->domid_bitmap, nr_dom, i + 1);
-
-    if ( i >= nr_dom )
+    if ( domid_mapping(iommu) )
     {
-        i = find_first_zero_bit(iommu->domid_bitmap, nr_dom);
+        unsigned int nr_dom = cap_ndoms(iommu->cap);
+
+        i = find_first_bit(iommu->domid_bitmap, nr_dom);
+        while ( i < nr_dom && iommu->domid_map[i] != d->domain_id )
+            i = find_next_bit(iommu->domid_bitmap, nr_dom, i + 1);
+
         if ( i >= nr_dom )
         {
-            dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no free domain ids\n");
-            return -EBUSY;
+            i = find_first_zero_bit(iommu->domid_bitmap, nr_dom);
+            if ( i >= nr_dom )
+            {
+                dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no free domain id\n");
+                return -EBUSY;
+            }
+            iommu->domid_map[i] = d->domain_id;
+            set_bit(i, iommu->domid_bitmap);
         }
-        iommu->domid_map[i] = d->domain_id;
-        set_bit(i, iommu->domid_bitmap);
     }
+    else
+        i = convert_domid(iommu, d->domain_id);
 
     context->hi |= (i & ((1 << DID_FIELD_WIDTH) - 1)) << DID_HIGH_OFFSET;
     return 0;
@@ -140,7 +167,12 @@ static int context_get_domain_id(const struct context_entry *context,
 
 static void cleanup_domid_map(struct domain *domain, struct vtd_iommu *iommu)
 {
-    int iommu_domid = domain_iommu_domid(domain, iommu);
+    int iommu_domid;
+
+    if ( !domid_mapping(iommu) )
+        return;
+
+    iommu_domid = domain_iommu_domid(domain, iommu);
 
     if ( iommu_domid >= 0 )
     {
@@ -196,7 +228,13 @@ static void check_cleanup_domid_map(struct domain *d,
 
 domid_t did_to_domain_id(const struct vtd_iommu *iommu, unsigned int did)
 {
-    if ( did >= cap_ndoms(iommu->cap) || !test_bit(did, iommu->domid_bitmap) )
+    if ( did >= min(cap_ndoms(iommu->cap), DOMID_MASK + 1) )
+        return DOMID_INVALID;
+
+    if ( !domid_mapping(iommu) )
+        return convert_domid(iommu, did);
+
+    if ( !test_bit(did, iommu->domid_bitmap) )
         return DOMID_INVALID;
 
     return iommu->domid_map[did];
@@ -1297,24 +1335,32 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     if ( !ecap_coherent(iommu->ecap) )
         vtd_ops.sync_cache = sync_cache;
 
-    /* allocate domain id bitmap */
     nr_dom = cap_ndoms(iommu->cap);
-    iommu->domid_bitmap = xzalloc_array(unsigned long, BITS_TO_LONGS(nr_dom));
-    if ( !iommu->domid_bitmap )
-        return -ENOMEM;
 
-    iommu->domid_map = xzalloc_array(domid_t, nr_dom);
-    if ( !iommu->domid_map )
-        return -ENOMEM;
+    if ( nr_dom <= DOMID_MASK + cap_caching_mode(iommu->cap) )
+    {
+        /* Allocate domain id (bit) maps. */
+        iommu->domid_bitmap = xzalloc_array(unsigned long,
+                                            BITS_TO_LONGS(nr_dom));
+        iommu->domid_map = xzalloc_array(domid_t, nr_dom);
+        if ( !iommu->domid_bitmap || !iommu->domid_map )
+            return -ENOMEM;
 
-    /*
-     * If Caching mode is set, then invalid translations are tagged with
-     * domain id 0. Hence reserve bit/slot 0.
-     */
-    if ( cap_caching_mode(iommu->cap) )
+        /*
+         * If Caching mode is set, then invalid translations are tagged
+         * with domain id 0. Hence reserve bit/slot 0.
+         */
+        if ( cap_caching_mode(iommu->cap) )
+        {
+            iommu->domid_map[0] = DOMID_INVALID;
+            __set_bit(0, iommu->domid_bitmap);
+        }
+    }
+    else
     {
-        iommu->domid_map[0] = DOMID_INVALID;
-        __set_bit(0, iommu->domid_bitmap);
+        /* Don't leave dangling NULL pointers. */
+        iommu->domid_bitmap = ZERO_BLOCK_PTR;
+        iommu->domid_map = ZERO_BLOCK_PTR;
     }
 
     return 0;
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 07501dda4e..48973e87c1 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -82,7 +82,7 @@
 #define cap_plmr(c)        (((c) >> 5) & 1)
 #define cap_rwbf(c)        (((c) >> 4) & 1)
 #define cap_afl(c)        (((c) >> 3) & 1)
-#define cap_ndoms(c)        (1 << (4 + 2 * ((c) & 0x7)))
+#define cap_ndoms(c)        (1U << (4 + 2 * ((c) & 0x7)))
 
 /*
  * Extended Capability Register
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 21:55:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 21:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253408.434561 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rm7-0000UW-DX; Tue, 04 Jan 2022 21:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253408.434561; Tue, 04 Jan 2022 21:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rm7-0000UO-AH; Tue, 04 Jan 2022 21:55:23 +0000
Received: by outflank-mailman (input) for mailman id 253408;
 Tue, 04 Jan 2022 21:55: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 1n4rm5-0000U9-UC
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rm5-00053w-TT
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rm5-0000DT-SN
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T4WCd/M3+IJtXWT8BuH9TQYTexkiAhNOJkmkDkGeqeE=; b=GCUhYmbxUNiuTMZsB68TVttkfA
	nGw4PhyOTLcQioCVJw+YcAZSdHMNUk8Ob0gVCRNqXP6zbQgTwFIydzGFdVSeSFVwb2DqOSJbXmaXr
	2jPxZwPCNonkUYqYfOS1zXd0fLoYntLMXJdnM2E5Hs6FEvEWQYKzL3BFZg4NdltcHK7s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenperf: name "newer" hypercalls
Message-Id: <E1n4rm5-0000DT-SN@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 21:55:21 +0000

commit 5b3f42001a55f58726201641e18ee8c0f82e2e16
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:16:48 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:16:48 2022 +0100

    xenperf: name "newer" hypercalls
    
    This table must not have got updated in quite a while; tmem_op for
    example has managed to not only appear since then, but also disappear
    again (adding a name for it nevertheless, to make more obvious that
    something strange is going on if the slot would ever have a non-zero
    value).
    
    Also resolve arch_0 and arch_1 to more meaningful names on x86.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xenperf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xenperf.c b/tools/misc/xenperf.c
index a5fbdaa45f..a74fd85b71 100644
--- a/tools/misc/xenperf.c
+++ b/tools/misc/xenperf.c
@@ -18,7 +18,7 @@
 #include <string.h>
 
 #define X(name) [__HYPERVISOR_##name] = #name
-const char *hypercall_name_table[64] =
+static const char *const hypercall_name_table[64] =
 {
     X(set_trap_table),
     X(mmu_update),
@@ -57,8 +57,18 @@ const char *hypercall_name_table[64] =
     X(sysctl),
     X(domctl),
     X(kexec_op),
+    X(tmem_op),
+    X(argo_op),
+    X(xenpmu_op),
+    X(dm_op),
+    X(hypfs_op),
+#if defined(__i386__) || defined(__x86_64__)
+    X(mca),
+    [__HYPERVISOR_arch_1] = "paging-domctl-continuation",
+#else
     X(arch_0),
     X(arch_1),
+#endif
     X(arch_2),
     X(arch_3),
     X(arch_4),
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 21:55:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 21:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253409.434564 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rmH-0000XL-Et; Tue, 04 Jan 2022 21:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253409.434564; Tue, 04 Jan 2022 21:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rmH-0000XD-Bj; Tue, 04 Jan 2022 21:55:33 +0000
Received: by outflank-mailman (input) for mailman id 253409;
 Tue, 04 Jan 2022 21: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 1n4rmG-0000X2-0w
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21: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 1n4rmG-000546-0C
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rmF-0000EH-VW
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dxve/Srb497wrbKmK6sQd1n6gvggkSS7WoMopSGpxP8=; b=wREJbkzzUuLJjviVI7FQ7dMl7f
	w8ERHSwWhbW/U4wn+hKVsYZ9aY3zUz+lZ+lebTBeA+1HI4f2ITLB5Sq2TRyqPHWOIGuDCDG/AhmnH
	u70e3YpZO9QHLe7vL0qh0klNDgGsERL+3apoEmhFmlkwVkqtr4LPk0X5hooMg9v30IJw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: properly parenthesize a number of macros
Message-Id: <E1n4rmF-0000EH-VW@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 21:55:31 +0000

commit 7762b7a1ec63b5ef0d5eceb1725de2a50b33ab20
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:17:44 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:17:44 2022 +0100

    VT-d: properly parenthesize a number of macros
    
    Let's eliminate the risk of any of these macros getting used with more
    complex expressions as arguments.
    
    Where touching lines anyway, also
    - switch from u64 to uint64_t,
    - drop unnecessary parentheses,
    - drop pointless 0x prefixes.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.h | 50 ++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 48973e87c1..652b8c9d09 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -90,14 +90,14 @@
 
 #define ecap_niotlb_iunits(e)    ((((e) >> 24) & 0xff) + 1)
 #define ecap_iotlb_offset(e)     ((((e) >> 8) & 0x3ff) * 16)
-#define ecap_coherent(e)         ((e >> 0) & 0x1)
-#define ecap_queued_inval(e)     ((e >> 1) & 0x1)
-#define ecap_dev_iotlb(e)        ((e >> 2) & 0x1)
-#define ecap_intr_remap(e)       ((e >> 3) & 0x1)
-#define ecap_eim(e)              ((e >> 4) & 0x1)
-#define ecap_cache_hints(e)      ((e >> 5) & 0x1)
-#define ecap_pass_thru(e)        ((e >> 6) & 0x1)
-#define ecap_snp_ctl(e)          ((e >> 7) & 0x1)
+#define ecap_coherent(e)         (((e) >> 0) & 1)
+#define ecap_queued_inval(e)     (((e) >> 1) & 1)
+#define ecap_dev_iotlb(e)        (((e) >> 2) & 1)
+#define ecap_intr_remap(e)       (((e) >> 3) & 1)
+#define ecap_eim(e)              (((e) >> 4) & 1)
+#define ecap_cache_hints(e)      (((e) >> 5) & 1)
+#define ecap_pass_thru(e)        (((e) >> 6) & 1)
+#define ecap_snp_ctl(e)          (((e) >> 7) & 1)
 
 /* IOTLB_REG */
 #define DMA_TLB_FLUSH_GRANU_OFFSET  60
@@ -106,14 +106,14 @@
 #define DMA_TLB_PSI_FLUSH (((u64)3) << 60)
 #define DMA_TLB_IIRG(x) (((x) >> 60) & 7) 
 #define DMA_TLB_IAIG(val) (((val) >> 57) & 7)
-#define DMA_TLB_DID(x) (((u64)(x & 0xffff)) << 32)
+#define DMA_TLB_DID(x) (((uint64_t)((x) & 0xffff)) << 32)
 
 #define DMA_TLB_READ_DRAIN (((u64)1) << 49)
 #define DMA_TLB_WRITE_DRAIN (((u64)1) << 48)
 #define DMA_TLB_IVT (((u64)1) << 63)
 
-#define DMA_TLB_IVA_ADDR(x) ((((u64)x) >> 12) << 12)
-#define DMA_TLB_IVA_HINT(x) ((((u64)x) & 1) << 6)
+#define DMA_TLB_IVA_ADDR(x) (((uint64_t)(x) >> 12) << 12)
+#define DMA_TLB_IVA_HINT(x) (((uint64_t)(x) & 1) << 6)
 
 /* GCMD_REG */
 #define DMA_GCMD_TE     (1u << 31)
@@ -144,11 +144,11 @@
 /* CCMD_REG */
 #define DMA_CCMD_INVL_GRANU_OFFSET  61
 #define DMA_CCMD_ICC   (((u64)1) << 63)
-#define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61)
-#define DMA_CCMD_DOMAIN_INVL (((u64)2) << 61)
-#define DMA_CCMD_DEVICE_INVL (((u64)3) << 61)
+#define DMA_CCMD_GLOBAL_INVL ((uint64_t)1 << DMA_CCMD_INVL_GRANU_OFFSET)
+#define DMA_CCMD_DOMAIN_INVL ((uint64_t)2 << DMA_CCMD_INVL_GRANU_OFFSET)
+#define DMA_CCMD_DEVICE_INVL ((uint64_t)3 << DMA_CCMD_INVL_GRANU_OFFSET)
+#define DMA_CCMD_CIRG(x) (((uint64_t)3 << DMA_CCMD_INVL_GRANU_OFFSET) & (x))
 #define DMA_CCMD_FM(m) (((u64)((m) & 0x3)) << 32)
-#define DMA_CCMD_CIRG(x) ((((u64)3) << 61) & x)
 #define DMA_CCMD_MASK_NOBIT 0
 #define DMA_CCMD_MASK_1BIT 1
 #define DMA_CCMD_MASK_2BIT 2
@@ -156,7 +156,7 @@
 #define DMA_CCMD_SID(s) (((u64)((s) & 0xffff)) << 16)
 #define DMA_CCMD_DID(d) ((u64)((d) & 0xffff))
 
-#define DMA_CCMD_CAIG_MASK(x) (((u64)x) & ((u64) 0x3 << 59))
+#define DMA_CCMD_CAIG_MASK(x) ((uint64_t)(x) & ((uint64_t)3 << 59))
 
 /* FECTL_REG */
 #define DMA_FECTL_IM (1u << 31)
@@ -175,10 +175,10 @@
 
 /* FRCD_REG, 32 bits access */
 #define DMA_FRCD_F (1u << 31)
-#define dma_frcd_type(d) ((d >> 30) & 1)
-#define dma_frcd_fault_reason(c) (c & 0xff)
-#define dma_frcd_source_id(c) (c & 0xffff)
-#define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */
+#define dma_frcd_type(d) (((d) >> 30) & 1)
+#define dma_frcd_fault_reason(c) ((c) & 0xff)
+#define dma_frcd_source_id(c) ((c) & 0xffff)
+#define dma_frcd_page_addr(d) ((d) & ((uint64_t)-1 << 12)) /* low 64 bit */
 
 /*
  * 0: Present
@@ -233,16 +233,16 @@ struct context_entry {
 #define PTE_NUM            (1 << LEVEL_STRIDE)
 #define level_to_agaw(val) ((val) - 2)
 #define agaw_to_level(val) ((val) + 2)
-#define agaw_to_width(val) (30 + val * LEVEL_STRIDE)
-#define width_to_agaw(w)   ((w - 30)/LEVEL_STRIDE)
-#define level_to_offset_bits(l) (12 + (l - 1) * LEVEL_STRIDE)
+#define agaw_to_width(val) (30 + (val) * LEVEL_STRIDE)
+#define width_to_agaw(w)   (((w) - 30)/LEVEL_STRIDE)
+#define level_to_offset_bits(l) (12 + ((l) - 1) * LEVEL_STRIDE)
 #define address_level_offset(addr, level) \
-            ((addr >> level_to_offset_bits(level)) & LEVEL_MASK)
+            (((addr) >> level_to_offset_bits(level)) & LEVEL_MASK)
 #define offset_level_address(offset, level) \
             ((u64)(offset) << level_to_offset_bits(level))
 #define level_mask(l) (((u64)(-1)) << level_to_offset_bits(l))
 #define level_size(l) (1 << level_to_offset_bits(l))
-#define align_to_level(addr, l) ((addr + level_size(l) - 1) & level_mask(l))
+#define align_to_level(addr, l) (((addr) + level_size(l) - 1) & level_mask(l))
 
 /*
  * 0: readable
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 21:55:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 21:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253410.434567 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rmR-0000a3-G5; Tue, 04 Jan 2022 21:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253410.434567; Tue, 04 Jan 2022 21:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rmR-0000Zv-DE; Tue, 04 Jan 2022 21:55:43 +0000
Received: by outflank-mailman (input) for mailman id 253410;
 Tue, 04 Jan 2022 21: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 1n4rmQ-0000Ze-4M
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21: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 1n4rmQ-00054N-3X
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rmQ-0000FK-2U
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21: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=SR4Gr079/J1/pYOwCfM8TteaR9+w02U8hMEAMiY3UB4=; b=Dym4rD+zuN+6twcX5R2xD7tCPM
	5Pm8X9marx5M7JNFgRZEv3gUz182LOgfv5/jnrPVjbJomw2f3ucDYxsS6+XqTLKUOAWYUush4V0E8
	dG7xYYK1USjBwaXIC8VpQgPbMLlNY49vQyCDNnSXH4U01InGchetZhWsyZFhrtg7yC1E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: use DMA_TLB_IVA_ADDR()
Message-Id: <E1n4rmQ-0000FK-2U@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 21:55:42 +0000

commit 635de3c928c63b5b5c6f31349856547c81c03c8e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:18:18 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:18:18 2022 +0100

    VT-d: use DMA_TLB_IVA_ADDR()
    
    Let's use the macro in the one place it's supposed to be used, and in
    favor of then unnecessary manipulations of the address in
    iommu_flush_iotlb_psi(): All leaf functions then already deal correctly
    with the supplied address.
    
    There also has never been a need to require (i.e. assert for) the
    passing in of 4k-aligned addresses - it'll always be the order-sized
    range containing the address which gets flushed.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 806dd32485..2d0946801e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -584,7 +584,8 @@ int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
     if ( type == DMA_TLB_PSI_FLUSH )
     {
         /* Note: always flush non-leaf currently. */
-        dmar_writeq(iommu->reg, tlb_offset, size_order | addr);
+        dmar_writeq(iommu->reg, tlb_offset,
+                    size_order | DMA_TLB_IVA_ADDR(addr));
     }
     dmar_writeq(iommu->reg, tlb_offset + 8, val);
 
@@ -644,8 +645,6 @@ static int __must_check iommu_flush_iotlb_psi(struct vtd_iommu *iommu, u16 did,
 {
     int status;
 
-    ASSERT(!(addr & (~PAGE_MASK_4K)));
-
     /* Fallback to domain selective flush if no PSI support */
     if ( !cap_pgsel_inv(iommu->cap) )
         return iommu_flush_iotlb_dsi(iommu, did, flush_non_present_entry,
@@ -656,9 +655,6 @@ static int __must_check iommu_flush_iotlb_psi(struct vtd_iommu *iommu, u16 did,
         return iommu_flush_iotlb_dsi(iommu, did, flush_non_present_entry,
                                      flush_dev_iotlb);
 
-    addr >>= PAGE_SHIFT_4K + order;
-    addr <<= PAGE_SHIFT_4K + order;
-
     /* apply platform specific errata workarounds */
     vtd_ops_preamble_quirk(iommu);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 21:55:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 21:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253411.434572 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rmb-0000cj-Hs; Tue, 04 Jan 2022 21:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253411.434572; Tue, 04 Jan 2022 21:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rmb-0000cb-Ei; Tue, 04 Jan 2022 21:55:53 +0000
Received: by outflank-mailman (input) for mailman id 253411;
 Tue, 04 Jan 2022 21: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 1n4rma-0000cB-7d
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21: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 1n4rma-00054q-6t
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rma-0000GT-5v
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21: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=zsvFfdDs9Lqvs2xtSAnrXdnBnF8Wmzk1L2CnAbSzLvs=; b=Co8LkNHeUS66h0pn9tx/pPb6aD
	IDQnc0b3U1vmyWVkCpmXJZ5RrlKjtpxPOIkbh3gLfvAgvjNgDABZsNv1jt0u6HiTLv/TJOSwkvOTM
	p76JFqBTzj3nQB9Tj+Q+MnYckEBl2UlZcMNCObwglpe8X4IPvUUkYpDIHVbERpemB0/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: shorten vtd_flush_{context,iotlb}_reg()
Message-Id: <E1n4rma-0000GT-5v@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 21:55:52 +0000

commit 7cd0a787bba5b9c0073cceb1884064393ab719b9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:19:32 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:19:32 2022 +0100

    VT-d: shorten vtd_flush_{context,iotlb}_reg()
    
    Their calculations of the value to write to the respective command
    register can be partly folded, resulting in almost 100 bytes less code
    for these two relatively short functions.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2d0946801e..34ea5f485d 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -479,7 +479,6 @@ int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
                           uint16_t source_id, uint8_t function_mask,
                           uint64_t type, bool flush_non_present_entry)
 {
-    u64 val = 0;
     unsigned long flags;
 
     /*
@@ -500,26 +499,26 @@ int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
     switch ( type )
     {
     case DMA_CCMD_GLOBAL_INVL:
-        val = DMA_CCMD_GLOBAL_INVL;
-        break;
-    case DMA_CCMD_DOMAIN_INVL:
-        val = DMA_CCMD_DOMAIN_INVL|DMA_CCMD_DID(did);
         break;
+
     case DMA_CCMD_DEVICE_INVL:
-        val = DMA_CCMD_DEVICE_INVL|DMA_CCMD_DID(did)
-            |DMA_CCMD_SID(source_id)|DMA_CCMD_FM(function_mask);
+        type |= DMA_CCMD_SID(source_id) | DMA_CCMD_FM(function_mask);
+        fallthrough;
+    case DMA_CCMD_DOMAIN_INVL:
+        type |= DMA_CCMD_DID(did);
         break;
+
     default:
         BUG();
     }
-    val |= DMA_CCMD_ICC;
+    type |= DMA_CCMD_ICC;
 
     spin_lock_irqsave(&iommu->register_lock, flags);
-    dmar_writeq(iommu->reg, DMAR_CCMD_REG, val);
+    dmar_writeq(iommu->reg, DMAR_CCMD_REG, type);
 
     /* Make sure hardware complete it */
     IOMMU_FLUSH_WAIT("context", iommu, DMAR_CCMD_REG, dmar_readq,
-                     !(val & DMA_CCMD_ICC), val);
+                     !(type & DMA_CCMD_ICC), type);
 
     spin_unlock_irqrestore(&iommu->register_lock, flags);
     /* flush context entry will implicitly flush write buffer */
@@ -548,7 +547,7 @@ int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
                         bool flush_non_present_entry, bool flush_dev_iotlb)
 {
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
-    u64 val = 0;
+    uint64_t val = type | DMA_TLB_IVT;
     unsigned long flags;
 
     /*
@@ -562,14 +561,13 @@ int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
     switch ( type )
     {
     case DMA_TLB_GLOBAL_FLUSH:
-        val = DMA_TLB_GLOBAL_FLUSH|DMA_TLB_IVT;
         break;
+
     case DMA_TLB_DSI_FLUSH:
-        val = DMA_TLB_DSI_FLUSH|DMA_TLB_IVT|DMA_TLB_DID(did);
-        break;
     case DMA_TLB_PSI_FLUSH:
-        val = DMA_TLB_PSI_FLUSH|DMA_TLB_IVT|DMA_TLB_DID(did);
+        val |= DMA_TLB_DID(did);
         break;
+
     default:
         BUG();
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 21:56:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 21:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253412.434575 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rml-0000gF-KR; Tue, 04 Jan 2022 21:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253412.434575; Tue, 04 Jan 2022 21:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rml-0000g7-HY; Tue, 04 Jan 2022 21:56:03 +0000
Received: by outflank-mailman (input) for mailman id 253412;
 Tue, 04 Jan 2022 21:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rmk-0000fz-Aq
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rmk-00055D-A2
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rmk-0000J9-96
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21: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=NigdxLcNMRbq6IagY5k3pLm5Eu2dKiL4fDvuvmJWf0Y=; b=NOzoqmX6j84bhU3m18PVWo2chH
	h1mw/SN1VFV4bpA10ByHunSwCFygZtnHluqOTAPV25MVFUaONOjZboadhiAYS+WfxZQBTc/9sJZ86
	laUqqHxDFjrOwkhaOCEqm4Y7H5Iw9plO2yvCOvxt4dcnppZDtC2ctwNtjTW9g7BjbBgU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxc: avoid clobbering errno in xc_domain_pod_target()
Message-Id: <E1n4rmk-0000J9-96@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 21:56:02 +0000

commit 78688ffa7e86e7cdb57d383e213fd822aaaa5438
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:20:15 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:20:15 2022 +0100

    libxc: avoid clobbering errno in xc_domain_pod_target()
    
    do_memory_op() supplies return value and has "errno" set the usual way.
    Don't overwrite "errno" with 1 (aka EPERM on at least Linux). There's
    also no reason to overwrite "err".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/ctrl/xc_domain.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c
index 20b86d986c..ef62f66009 100644
--- a/tools/libs/ctrl/xc_domain.c
+++ b/tools/libs/ctrl/xc_domain.c
@@ -1230,13 +1230,9 @@ static int xc_domain_pod_target(xc_interface *xch,
     err = do_memory_op(xch, op, &pod_target, sizeof(pod_target));
 
     if ( err < 0 )
-    {
         DPRINTF("Failed %s_pod_target dom %d\n",
                 (op==XENMEM_set_pod_target)?"set":"get",
                 domid);
-        errno = -err;
-        err = -1;
-    }
     else
         err = 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 04 21:56:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Jan 2022 21:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253413.434579 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rmv-0000ix-Lv; Tue, 04 Jan 2022 21:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253413.434579; Tue, 04 Jan 2022 21:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n4rmv-0000in-Iw; Tue, 04 Jan 2022 21:56:13 +0000
Received: by outflank-mailman (input) for mailman id 253413;
 Tue, 04 Jan 2022 21:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rmu-0000ic-DY
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rmu-00055P-Cs
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n4rmu-0000Ju-C9
 for xen-changelog@lists.xenproject.org; Tue, 04 Jan 2022 21:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BpqisdZXjmZ1wUivBS7LDSaa89NkC7G+SiqAeXKFLFE=; b=rmFG5k6XMk231jyPHXhlU8t7+b
	1szx3BJT0BJoW0L3zRvNq9Fc12cvLgPZBShWKrrLNFe3AAMy9woL0n8lrSVnwT2CYHfgn8gOx3a25
	ob1xBnrZVxhxkF4MsYY1VZOjqiqwStYNLIiGyBoZuFR/+EW5Gb15MYk7QuSO8/T+p7i8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenperf: omit meaningless trailing zeroes from output
Message-Id: <E1n4rmu-0000Ju-C9@xenbits.xenproject.org>
Date: Tue, 04 Jan 2022 21:56:12 +0000

commit af0c5430a82c77432729d61c9b409dd32c477b20
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 4 10:21:12 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 4 10:21:12 2022 +0100

    xenperf: omit meaningless trailing zeroes from output
    
    There's no point producing a long chain of zeroes when the previously
    calculated total value was zero. To guard against mistakenly skipping
    non-zero individual fields, widen "sum" to "unsigned long long".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/misc/xenperf.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenperf.c b/tools/misc/xenperf.c
index a74fd85b71..6e5f8675d4 100644
--- a/tools/misc/xenperf.c
+++ b/tools/misc/xenperf.c
@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
     DECLARE_HYPERCALL_BUFFER(xc_perfc_val_t, pcv);
     xc_perfc_val_t  *val;
     int num_desc, num_val;
-    unsigned int    sum, reset = 0, full = 0, pretty = 0;
+    unsigned int     reset = 0, full = 0, pretty = 0;
     char hypercall_name[36];
 
     if ( argc > 1 )
@@ -168,14 +168,15 @@ int main(int argc, char *argv[])
     val = pcv;
     for ( i = 0; i < num_desc; i++ )
     {
+        unsigned long long sum = 0;
+
         printf ("%-35s ", pcd[i].name);
         
-        sum = 0;
         for ( j = 0; j < pcd[i].nr_vals; j++ )
             sum += val[j];
-        printf ("T=%10u ", (unsigned int)sum);
+        printf("T=%10llu ", sum);
 
-        if ( full || (pcd[i].nr_vals <= 4) )
+        if ( sum && (full || (pcd[i].nr_vals <= 4)) )
         {
             if ( pretty && (strcmp(pcd[i].name, "hypercalls") == 0) )
             {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 05 12:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Jan 2022 12:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253585.434752 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n55TW-0002ku-M6; Wed, 05 Jan 2022 12:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253585.434752; Wed, 05 Jan 2022 12:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n55TW-0002km-In; Wed, 05 Jan 2022 12:33:06 +0000
Received: by outflank-mailman (input) for mailman id 253585;
 Wed, 05 Jan 2022 12:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n55TV-0002kg-Fa
 for xen-changelog@lists.xenproject.org; Wed, 05 Jan 2022 12:33: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 1n55TV-0007mW-B9
 for xen-changelog@lists.xenproject.org; Wed, 05 Jan 2022 12:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n55TV-0002Gk-A4
 for xen-changelog@lists.xenproject.org; Wed, 05 Jan 2022 12:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tkuXYgTj0qmOOVyMF6jLmLWCTtpAQjQmsAvgTzcs+B4=; b=SXOBmiCT3S8qm134fXAw/andid
	a0HmvjJLFjZSRQNjSjTGJ7ickJERiV8Eb5QLTYL49oJekyNubBjo/zzxyDz+pDqYSekA+uo/A9NE9
	s38NcYNcxFhFdGdTXparnlyFfSHPacDa0hR5BTdwWJhjPtXn2O08ZXcoY6VSndehLpGs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxc: Drop copy-in in xc_physinfo()
Message-Id: <E1n55TV-0002Gk-A4@xenbits.xenproject.org>
Date: Wed, 05 Jan 2022 12:33:05 +0000

commit 06cc1f886f323394004190f931266ab328ec8773
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Dec 23 16:10:15 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 5 09:44:26 2022 +0000

    tools/libxc: Drop copy-in in xc_physinfo()
    
    The first thing XEN_SYSCTL_physinfo does is zero op->u.physinfo.
    
    Do not copy-in.  It's pointless, and most callers don't initialise their
    xc_physinfo_t buffer to begin with.  Remove the redundant zeroing from the
    remaining callers.
    
    Spotted by Coverity.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Wei Chen <Wei.Chen@arm.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/ctrl/xc_misc.c | 2 --
 tools/libs/light/libxl.c  | 2 +-
 tools/libs/stat/xenstat.c | 2 +-
 tools/misc/xenpm.c        | 2 +-
 tools/xenmon/xenbaked.c   | 2 +-
 tools/xentrace/xentrace.c | 2 +-
 6 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c
index 3820394413..265f15ec2d 100644
--- a/tools/libs/ctrl/xc_misc.c
+++ b/tools/libs/ctrl/xc_misc.c
@@ -195,8 +195,6 @@ int xc_physinfo(xc_interface *xch,
 
     sysctl.cmd = XEN_SYSCTL_physinfo;
 
-    memcpy(&sysctl.u.physinfo, put_info, sizeof(*put_info));
-
     if ( (ret = do_sysctl(xch, &sysctl)) != 0 )
         return ret;
 
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index a77aa856fd..667ae6409b 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -351,7 +351,7 @@ const char *libxl_defbool_to_string(libxl_defbool b)
 /******************************************************************************/
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
 {
-    xc_physinfo_t xcphysinfo = { 0 };
+    xc_physinfo_t xcphysinfo;
     int rc;
     long l;
     GC_INIT(ctx);
diff --git a/tools/libs/stat/xenstat.c b/tools/libs/stat/xenstat.c
index e49689aa2d..8bab2e66a7 100644
--- a/tools/libs/stat/xenstat.c
+++ b/tools/libs/stat/xenstat.c
@@ -135,7 +135,7 @@ xenstat_node *xenstat_get_node(xenstat_handle * handle, unsigned int flags)
 {
 #define DOMAIN_CHUNK_SIZE 256
 	xenstat_node *node;
-	xc_physinfo_t physinfo = { 0 };
+	xc_physinfo_t physinfo;
 	xc_domaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
 	int new_domains;
 	unsigned int i;
diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index d0191d4984..4f8cde690a 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -1244,7 +1244,7 @@ struct {
 int main(int argc, char *argv[])
 {
     int i, ret = 0;
-    xc_physinfo_t physinfo = { 0 };
+    xc_physinfo_t physinfo;
     int nr_matches = 0;
     int matches_main_options[ARRAY_SIZE(main_options)];
 
diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index 1ed34334c8..7591de7c60 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -436,7 +436,7 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
  */
 static unsigned int get_num_cpus(void)
 {
-    xc_physinfo_t physinfo = { 0 };
+    xc_physinfo_t physinfo;
     xc_interface *xc_handle = xc_interface_open(0,0,0);
     int ret;
 
diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index a8903ebf46..864e30d50c 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -589,7 +589,7 @@ static void set_evt_mask(uint32_t mask)
  */
 static unsigned int get_num_cpus(void)
 {
-    xc_physinfo_t physinfo = { 0 };
+    xc_physinfo_t physinfo;
     int ret;
     
     ret = xc_physinfo(xc_handle, &physinfo);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 05 12:33:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Jan 2022 12:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253586.434756 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n55Tg-0002mu-NE; Wed, 05 Jan 2022 12:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253586.434756; Wed, 05 Jan 2022 12:33: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 1n55Tg-0002mm-KL; Wed, 05 Jan 2022 12:33:16 +0000
Received: by outflank-mailman (input) for mailman id 253586;
 Wed, 05 Jan 2022 12:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n55Tf-0002me-FG
 for xen-changelog@lists.xenproject.org; Wed, 05 Jan 2022 12:33: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 1n55Tf-0007md-ET
 for xen-changelog@lists.xenproject.org; Wed, 05 Jan 2022 12:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n55Tf-0002HJ-DW
 for xen-changelog@lists.xenproject.org; Wed, 05 Jan 2022 12:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BgJK1WxJ0JzgLXBqE5NMJKUd1y6rASw7V71DPQ8AZpk=; b=BjZaS4G/j+n19xHnFUH9BFwEa5
	14cwEqQExVwkgJxdXoX3O4wLJ8yO1eidzqsnTuM/xGxWG/dKPeEA95/MNfvO4NGPdLP1SRYjDQutd
	KnaolfWO50nbualahbphdFCV91eAppbFdQ+3ocHzlAZC8uZgUwJdPxkBV3f4V87UVg9A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Fix default calculation of opt_srb_lock
Message-Id: <E1n55Tf-0002HJ-DW@xenbits.xenproject.org>
Date: Wed, 05 Jan 2022 12:33:15 +0000

commit 31f3bc97f4508687215e459a5e35676eecf1772b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 4 14:11:55 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 5 09:44:26 2022 +0000

    x86/spec-ctrl: Fix default calculation of opt_srb_lock
    
    Since this logic was introduced, opt_tsx has become more complicated and
    shouldn't be compared to 0 directly.  While there are no buggy logic paths,
    the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
    easier and clearer to use.
    
    Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a5569c7f2b..c18cc8aa49 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1245,7 +1245,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 04:33:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 04:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253822.435096 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5KSV-000141-H9; Thu, 06 Jan 2022 04:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253822.435096; Thu, 06 Jan 2022 04: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 1n5KSV-00013s-Dv; Thu, 06 Jan 2022 04:33:03 +0000
Received: by outflank-mailman (input) for mailman id 253822;
 Thu, 06 Jan 2022 04: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 1n5KST-00012a-WE
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 04: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 1n5KST-0002o4-VM
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 04:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5KST-0005oi-UG
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 04: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=+WEz7uZW3PQLGwZLWAbNIcIBoXbxzqXUJ82wF5zNjWA=; b=3+qVq0PSALSS9QcfOv3Ljfutu9
	HYkvQMUEBq8sPzwqH1l8XB9WGE69TycMwJvXvVldudKv5q7nOu78X8hN0oLIy+Q33n9R2VeUP05z3
	s6sMFFa+Z593+6dTaxszM9b1dEZpYVjv6wffkivM+dVuLXHEz6p8HSYGJ1MKy8oRh66Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxc: Drop copy-in in xc_physinfo()
Message-Id: <E1n5KST-0005oi-UG@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 04:33:01 +0000

commit 06cc1f886f323394004190f931266ab328ec8773
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Dec 23 16:10:15 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 5 09:44:26 2022 +0000

    tools/libxc: Drop copy-in in xc_physinfo()
    
    The first thing XEN_SYSCTL_physinfo does is zero op->u.physinfo.
    
    Do not copy-in.  It's pointless, and most callers don't initialise their
    xc_physinfo_t buffer to begin with.  Remove the redundant zeroing from the
    remaining callers.
    
    Spotted by Coverity.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Wei Chen <Wei.Chen@arm.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/ctrl/xc_misc.c | 2 --
 tools/libs/light/libxl.c  | 2 +-
 tools/libs/stat/xenstat.c | 2 +-
 tools/misc/xenpm.c        | 2 +-
 tools/xenmon/xenbaked.c   | 2 +-
 tools/xentrace/xentrace.c | 2 +-
 6 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c
index 3820394413..265f15ec2d 100644
--- a/tools/libs/ctrl/xc_misc.c
+++ b/tools/libs/ctrl/xc_misc.c
@@ -195,8 +195,6 @@ int xc_physinfo(xc_interface *xch,
 
     sysctl.cmd = XEN_SYSCTL_physinfo;
 
-    memcpy(&sysctl.u.physinfo, put_info, sizeof(*put_info));
-
     if ( (ret = do_sysctl(xch, &sysctl)) != 0 )
         return ret;
 
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index a77aa856fd..667ae6409b 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -351,7 +351,7 @@ const char *libxl_defbool_to_string(libxl_defbool b)
 /******************************************************************************/
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
 {
-    xc_physinfo_t xcphysinfo = { 0 };
+    xc_physinfo_t xcphysinfo;
     int rc;
     long l;
     GC_INIT(ctx);
diff --git a/tools/libs/stat/xenstat.c b/tools/libs/stat/xenstat.c
index e49689aa2d..8bab2e66a7 100644
--- a/tools/libs/stat/xenstat.c
+++ b/tools/libs/stat/xenstat.c
@@ -135,7 +135,7 @@ xenstat_node *xenstat_get_node(xenstat_handle * handle, unsigned int flags)
 {
 #define DOMAIN_CHUNK_SIZE 256
 	xenstat_node *node;
-	xc_physinfo_t physinfo = { 0 };
+	xc_physinfo_t physinfo;
 	xc_domaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
 	int new_domains;
 	unsigned int i;
diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index d0191d4984..4f8cde690a 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -1244,7 +1244,7 @@ struct {
 int main(int argc, char *argv[])
 {
     int i, ret = 0;
-    xc_physinfo_t physinfo = { 0 };
+    xc_physinfo_t physinfo;
     int nr_matches = 0;
     int matches_main_options[ARRAY_SIZE(main_options)];
 
diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index 1ed34334c8..7591de7c60 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -436,7 +436,7 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
  */
 static unsigned int get_num_cpus(void)
 {
-    xc_physinfo_t physinfo = { 0 };
+    xc_physinfo_t physinfo;
     xc_interface *xc_handle = xc_interface_open(0,0,0);
     int ret;
 
diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index a8903ebf46..864e30d50c 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -589,7 +589,7 @@ static void set_evt_mask(uint32_t mask)
  */
 static unsigned int get_num_cpus(void)
 {
-    xc_physinfo_t physinfo = { 0 };
+    xc_physinfo_t physinfo;
     int ret;
     
     ret = xc_physinfo(xc_handle, &physinfo);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 04:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 04:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.253825.435100 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5KSf-0001AR-II; Thu, 06 Jan 2022 04:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 253825.435100; Thu, 06 Jan 2022 04: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 1n5KSf-0001AJ-FN; Thu, 06 Jan 2022 04:33:13 +0000
Received: by outflank-mailman (input) for mailman id 253825;
 Thu, 06 Jan 2022 04: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 1n5KSe-000190-3L
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 04: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 1n5KSe-0002oO-2d
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 04:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5KSe-0005pD-1g
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 04: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=fPnsrDa4Og/F4kWAzg6uB/KSoRq2dt9F4bq/o2GDaGA=; b=Mw4FajjCFzHU1eScKjkCifFzna
	cf4OyqR/yQb9F4uKGjFfejOLCXBYNqhGLaVlm0k0gmu0WAyVJr0zdqwgz7//BwpnWsZm0dj/rZV+Y
	L9F6zG1Aix5+zuX6/z+SKNq5xJaYAfYnVd3C9JmXWM2UsBD8JctORI3NeOfm1SSPjpk8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Fix default calculation of opt_srb_lock
Message-Id: <E1n5KSe-0005pD-1g@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 04:33:12 +0000

commit 31f3bc97f4508687215e459a5e35676eecf1772b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 4 14:11:55 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 5 09:44:26 2022 +0000

    x86/spec-ctrl: Fix default calculation of opt_srb_lock
    
    Since this logic was introduced, opt_tsx has become more complicated and
    shouldn't be compared to 0 directly.  While there are no buggy logic paths,
    the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
    easier and clearer to use.
    
    Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a5569c7f2b..c18cc8aa49 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1245,7 +1245,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:22:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254004.435452 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5SiU-0007bk-0n; Thu, 06 Jan 2022 13:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254004.435452; Thu, 06 Jan 2022 13:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5SiT-0007bc-Tt; Thu, 06 Jan 2022 13:22:05 +0000
Received: by outflank-mailman (input) for mailman id 254004;
 Thu, 06 Jan 2022 13:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5SiS-0007bW-O6
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5SiS-0004ig-Ew
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5SiS-0000OE-Dr
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uSA69DfmRsbnixtt5Klh6O3cR9Ig4QyW/+7KfEd4+yY=; b=CiYNL8NmuELC+VPy0ExcbZQ/l/
	OTrGI6Dn/2oL+Gmw9iVYa8NZYZyJDGQ9eOphbCgOkz2opjQ/gm4ymRRGCRlYnIp9e/DiMcjBGi66g
	Jk26RLrAyCqPSQMrQ9Inhu8J30gY8o6Ih5yHzp2155iI+EVWcaUuk339Rmkicl9ojg28=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] VT-d: split domid map cleanup check into a function
Message-Id: <E1n5SiS-0000OE-Dr@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:22:04 +0000

commit fa45f6b5560e738955993fe061a04d64c6f71c14
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:10:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:10:05 2022 +0100

    VT-d: split domid map cleanup check into a function
    
    This logic will want invoking from elsewhere.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9fdc10abe9457e4c9879a266f82372cb08e88ffb
    master date: 2021-11-24 11:06:20 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 91 +++++++++++++++++++------------------
 1 file changed, 48 insertions(+), 43 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index f9ce402f22..de11c258ca 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -157,6 +157,51 @@ static void cleanup_domid_map(struct domain *domain, struct vtd_iommu *iommu)
     }
 }
 
+static bool any_pdev_behind_iommu(const struct domain *d,
+                                  const struct pci_dev *exclude,
+                                  const struct vtd_iommu *iommu)
+{
+    const struct pci_dev *pdev;
+
+    for_each_pdev ( d, pdev )
+    {
+        const struct acpi_drhd_unit *drhd;
+
+        if ( pdev == exclude )
+            continue;
+
+        drhd = acpi_find_matched_drhd_unit(pdev);
+        if ( drhd && drhd->iommu == iommu )
+            return true;
+    }
+
+    return false;
+}
+
+/*
+ * If no other devices under the same iommu owned by this domain,
+ * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
+ */
+static void check_cleanup_domid_map(struct domain *d,
+                                    const struct pci_dev *exclude,
+                                    struct vtd_iommu *iommu)
+{
+    bool found = any_pdev_behind_iommu(d, exclude, iommu);
+
+    /*
+     * Hidden devices are associated with DomXEN but usable by the hardware
+     * domain. Hence they need considering here as well.
+     */
+    if ( !found && is_hardware_domain(d) )
+        found = any_pdev_behind_iommu(dom_xen, exclude, iommu);
+
+    if ( !found )
+    {
+        clear_bit(iommu->index, &dom_iommu(d)->arch.vtd.iommu_bitmap);
+        cleanup_domid_map(d, iommu);
+    }
+}
+
 static void sync_cache(const void *addr, unsigned int size)
 {
     static unsigned long clflush_size = 0;
@@ -1674,27 +1719,6 @@ int domain_context_unmap_one(
     return rc;
 }
 
-static bool any_pdev_behind_iommu(const struct domain *d,
-                                  const struct pci_dev *exclude,
-                                  const struct vtd_iommu *iommu)
-{
-    const struct pci_dev *pdev;
-
-    for_each_pdev ( d, pdev )
-    {
-        const struct acpi_drhd_unit *drhd;
-
-        if ( pdev == exclude )
-            continue;
-
-        drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd && drhd->iommu == iommu )
-            return true;
-    }
-
-    return false;
-}
-
 static int domain_context_unmap(struct domain *domain, u8 devfn,
                                 struct pci_dev *pdev)
 {
@@ -1703,7 +1727,6 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
     int ret;
     uint16_t seg = pdev->seg;
     uint8_t bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
-    bool found;
 
     switch ( pdev->type )
     {
@@ -1779,28 +1802,10 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
         return -EINVAL;
     }
 
-    if ( ret || QUARANTINE_SKIP(domain) || pdev->devfn != devfn )
-        return ret;
+    if ( !ret && !QUARANTINE_SKIP(domain) && pdev->devfn == devfn )
+        check_cleanup_domid_map(domain, pdev, iommu);
 
-    /*
-     * If no other devices under the same iommu owned by this domain,
-     * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
-     */
-    found = any_pdev_behind_iommu(domain, pdev, iommu);
-    /*
-     * Hidden devices are associated with DomXEN but usable by the hardware
-     * domain. Hence they need considering here as well.
-     */
-    if ( !found && is_hardware_domain(domain) )
-        found = any_pdev_behind_iommu(dom_xen, pdev, iommu);
-
-    if ( !found )
-    {
-        clear_bit(iommu->index, dom_iommu(domain)->arch.vtd.iommu_bitmap);
-        cleanup_domid_map(domain, iommu);
-    }
-
-    return 0;
+    return ret;
 }
 
 static void iommu_clear_root_pgtable(struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:22:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254005.435456 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Sie-0007dR-26; Thu, 06 Jan 2022 13:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254005.435456; Thu, 06 Jan 2022 13:22: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 1n5Sid-0007dJ-VS; Thu, 06 Jan 2022 13:22:15 +0000
Received: by outflank-mailman (input) for mailman id 254005;
 Thu, 06 Jan 2022 13:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sic-0007d9-J9
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sic-0004j3-IM
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sic-0000P0-HC
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cd3yebWjzK6vKQ2jgQ49h2fSQpIvnVMVX430XhCFDTA=; b=X4WhrOR3/SViUyC9qKPzpJhQfp
	yYzDA57I5xuP/fdsZ9oSDx0nb6wPHz0u4b1fnQQIrDX+RIPzJ0ZeRJzvFLoPJpdOgS0Ca+tJgNBvm
	SGPjdX8ng39MfGmztqKJrx6JFqdov6xryufw6XYruXLFmn+OFXhwpMyvGFbSy83FFhec=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] VT-d: don't leak domid mapping on error path
Message-Id: <E1n5Sic-0000P0-HC@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:22:14 +0000

commit 84977e8b53935de9a1123f677213f1b146843a0e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:11:23 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:11:23 2022 +0100

    VT-d: don't leak domid mapping on error path
    
    While domain_context_mapping() invokes domain_context_unmap() in a sub-
    case of handling DEV_TYPE_PCI when encountering an error, thus avoiding
    a leak, individual calls to domain_context_mapping_one() aren't
    similarly covered. Such a leak might persist until domain destruction.
    Leverage that these cases can be recognized by pdev being non-NULL.
    
    Fixes: dec403cc668f ("VT-d: fix iommu_domid for PCI/PCIx devices assignment")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: e6252a51faf42c892eb5fc71f8a2617580832196
    master date: 2021-11-24 11:07:11 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index de11c258ca..3b37bad25e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1517,7 +1517,12 @@ int domain_context_mapping_one(
         rc = me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
 
     if ( rc )
-        domain_context_unmap_one(domain, iommu, bus, devfn);
+    {
+        ret = domain_context_unmap_one(domain, iommu, bus, devfn);
+
+        if ( !ret && pdev && pdev->devfn == devfn )
+            check_cleanup_domid_map(domain, pdev, iommu);
+    }
 
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:22:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254006.435460 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Sio-0007gR-3h; Thu, 06 Jan 2022 13:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254006.435460; Thu, 06 Jan 2022 13:22: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 1n5Sio-0007gG-0d; Thu, 06 Jan 2022 13:22:26 +0000
Received: by outflank-mailman (input) for mailman id 254006;
 Thu, 06 Jan 2022 13:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sim-0007g2-MD
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sim-0004jK-LS
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sim-0000Pg-KX
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BCJkwx1qUh+JcbyPmT9TaHdSfslj8duVg2jOcLOS/VA=; b=5ReUNMM2e08Jl9cobW0CxL3IXr
	fJGWmEW7DW+tFPoj90CoVxpucM4zx0A66YYC6CRF+y788J8NCRrIEFOsGsoIspI33UfWYfgo+jepy
	Jzk1d9waE2zRxVxrqtopdw7TWZ7vVp+Fyt+4U9UYt0UoML65EM4nbSeFqLqetg3vMllI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/Viridian: fix error code use
Message-Id: <E1n5Sim-0000Pg-KX@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:22:24 +0000

commit 481b8bb3311d3a962c795127b7d968d743466654
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:11:58 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:11:58 2022 +0100

    x86/Viridian: fix error code use
    
    Both the wrong use of HV_STATUS_* and the return type of
    hv_vpset_to_vpmask() can lead to viridian_hypercall()'s
    ASSERT_UNREACHABLE() triggering when translating error codes from Xen
    to Viridian representation.
    
    Fixes: b4124682db6e ("viridian: add ExProcessorMasks variants of the flush hypercalls")
    Fixes: 9afa867d42ba ("viridian: add ExProcessorMasks variant of the IPI hypercall")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: 857fee77845be0c5c35fd51bac64455369d32a6f
    master date: 2021-11-24 11:09:56 +0100
---
 xen/arch/x86/hvm/viridian/viridian.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index b906f7b86a..7d1cfc530b 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -628,8 +628,8 @@ static unsigned int hv_vpset_nr_banks(struct hv_vpset *vpset)
     return hweight64(vpset->valid_bank_mask);
 }
 
-static uint16_t hv_vpset_to_vpmask(const struct hv_vpset *set,
-                                   struct hypercall_vpmask *vpmask)
+static int hv_vpset_to_vpmask(const struct hv_vpset *set,
+                              struct hypercall_vpmask *vpmask)
 {
 #define NR_VPS_PER_BANK (HV_VPSET_BANK_SIZE * 8)
 
@@ -919,10 +919,10 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
          input_params.reserved_zero[0] ||
          input_params.reserved_zero[1] ||
          input_params.reserved_zero[2] )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     if ( input_params.vector < 0x10 || input_params.vector > 0xff )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     *set = input_params.set;
     if ( set->format == HV_GENERIC_SET_SPARSE_4K )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:22:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254007.435464 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Siy-0007k8-58; Thu, 06 Jan 2022 13:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254007.435464; Thu, 06 Jan 2022 13:22:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Siy-0007k0-29; Thu, 06 Jan 2022 13:22:36 +0000
Received: by outflank-mailman (input) for mailman id 254007;
 Thu, 06 Jan 2022 13:22:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Siw-0007jm-PP
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Siw-0004l2-Oc
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Siw-0000QN-Nj
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OPKJuFLZUnw9s5YUy7GIArqWNVggt35yoAVI4TX+oQk=; b=0a2NWAF4nQI3RUTVpeF7fstWBS
	9rp6lpqFk0u8IVwJJLTFeiZ4L26dkPCKLw2MkCvaiH/ozHk9a/rRSjfW9zF9roMidWtwtEOlTPlaV
	0F7vp+GR7CCV2R8k9iIfDS331bNiMl8dIf2bpzCkIo6pFhYnAZYnoiyJcEUrDx4DYm04=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
Message-Id: <E1n5Siw-0000QN-Nj@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:22:34 +0000

commit 7bbeff438dfa61e532116d9fbd65bffb896857c5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:12:26 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:12:26 2022 +0100

    x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
    
    Just like (in protected mode) reads may not go to exec-only segments and
    writes may not go to non-writable ones, insn fetches may not access data
    segments.
    
    Fixes: 623e83716791 ("hvm: Support hardware task switching")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 311297f4216a4387bdae6df6cfbb1f5edb06618a
    master date: 2021-12-06 14:15:05 +0100
---
 xen/arch/x86/hvm/hvm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index eee365711d..b680f62892 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2551,6 +2551,9 @@ bool hvm_vcpu_virtual_to_linear(
      */
     ASSERT(seg < x86_seg_none);
 
+    /* However, check that insn fetches only ever specify CS. */
+    ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
+
     if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_PE) )
     {
         /*
@@ -2615,10 +2618,17 @@ bool hvm_vcpu_virtual_to_linear(
                 if ( (reg->type & 0xa) == 0x8 )
                     goto out; /* execute-only code segment */
                 break;
+
             case hvm_access_write:
                 if ( (reg->type & 0xa) != 0x2 )
                     goto out; /* not a writable data segment */
                 break;
+
+            case hvm_access_insn_fetch:
+                if ( !(reg->type & 0x8) )
+                    goto out; /* not a code segment */
+                break;
+
             default:
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:22:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254009.435468 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Sj8-0007n5-6Q; Thu, 06 Jan 2022 13:22:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254009.435468; Thu, 06 Jan 2022 13:22:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Sj8-0007mx-3c; Thu, 06 Jan 2022 13:22:46 +0000
Received: by outflank-mailman (input) for mailman id 254009;
 Thu, 06 Jan 2022 13:22:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sj6-0007mg-SR
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sj6-0004lF-Ri
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sj6-0000R3-Qq
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q4May+/jgyAKwznE4AE11CbNfkECnVdSOzX78nIrxcM=; b=yBLmFNdeIbA/afwq4x/n+2zcxo
	Dzpvp7udkBvChikhMixeBz00Mu7lrLPpcx5YtiFfkFrEt6kkbDCUA9YojvboEUjtaiOul4UpyKXOm
	Z+4upRgcZBH4JEv0/Pb7XQCTk/NvCJ25DLW3tzJQg30gl3k/zQYQfwKrFf+mjLQ77Pzk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86: avoid wrong use of all-but-self IPI shorthand
Message-Id: <E1n5Sj6-0000R3-Qq@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:22:44 +0000

commit 64a35ee749ec3d019929bd5b51f0ed7dae0f7516
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:12:53 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:12:53 2022 +0100

    x86: avoid wrong use of all-but-self IPI shorthand
    
    With "nosmp" I did observe a flood of "APIC error on CPU0: 04(04), Send
    accept error" log messages on an AMD system. And rightly so - nothing
    excludes the use of the shorthand in send_IPI_mask() in this case. Set
    "unaccounted_cpus" to "true" also when command line restrictions are the
    cause.
    
    Note that PV-shim mode is unaffected by this change, first and foremost
    because "nosmp" and "maxcpus=" are ignored in this case.
    
    Fixes: 5500d265a2a8 ("x86/smp: use APIC ALLBUT destination shorthand when possible")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 7621880de0bb40bae6436a5b106babc0e4718f4d
    master date: 2021-12-10 10:26:52 +0100
---
 xen/arch/x86/mpparse.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index dff02b142b..91fa580831 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -85,9 +85,14 @@ void __init set_nr_cpu_ids(unsigned int max_cpus)
 	if (!park_offline_cpus)
 		tot_cpus = max_cpus;
 	nr_cpu_ids = min(tot_cpus, NR_CPUS + 0u);
-	if (park_offline_cpus && nr_cpu_ids < num_processors)
-		printk(XENLOG_WARNING "SMP: Cannot bring up %u further CPUs\n",
-		       num_processors - nr_cpu_ids);
+	if (nr_cpu_ids < num_processors)
+	{
+		unaccounted_cpus = true;
+		if (park_offline_cpus)
+			printk(XENLOG_WARNING
+			       "SMP: Cannot bring up %u further CPUs\n",
+			       num_processors - nr_cpu_ids);
+	}
 
 #ifndef nr_cpumask_bits
 	nr_cpumask_bits = ROUNDUP(nr_cpu_ids, BITS_PER_LONG);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:22:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:22:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254010.435472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5SjI-0007ph-81; Thu, 06 Jan 2022 13:22:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254010.435472; Thu, 06 Jan 2022 13:22: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 1n5SjI-0007pZ-56; Thu, 06 Jan 2022 13:22:56 +0000
Received: by outflank-mailman (input) for mailman id 254010;
 Thu, 06 Jan 2022 13:22: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 1n5SjG-0007pN-Vh
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5SjG-0004lP-Uy
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5SjG-0000S7-U7
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:22:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ceGmLHJpLwCq9lESPN8EjwirjS+BG8bSoYuij++lMDw=; b=5U5/R8JAcDAXiQcJsv8gq3dexg
	BSvCgDnptyvAzr6d/yO208ba030hyU+1XOnjaMklt2aunGTmFAsdsmBkeC/0D2AOA7bOufzBjKayj
	fhLtJA/aQkaD1KgY3xqj+mPxP8nbN7ctaABXEw0lbwerkPRy1c1DywiTjmb1H3SwVGWs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
Message-Id: <E1n5SjG-0000S7-U7@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:22:54 +0000

commit 98ea29cd71e8e177b5fde83e8016c384581897e9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:13:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:13:38 2022 +0100

    x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
    
    Both SDM and PM explicitly permit this.
    
    Fixes: 52dba7bd0b36 ("x86emul: generalize wbinvd() hook")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Paul Durrant <paul@xen.org>
    master commit: df3e1a5efe700a9f59eced801cac73f9fd02a0e2
    master date: 2021-12-10 14:03:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 425c8ddd97..76a2ccfafe 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2310,7 +2310,9 @@ static int hvmemul_cache_op(
         ASSERT(!is_x86_system_segment(seg));
 
         rc = hvmemul_virtual_to_linear(seg, offset, 0, NULL,
-                                       hvm_access_read, hvmemul_ctxt, &addr);
+                                       op != x86emul_clwb ? hvm_access_none
+                                                          : hvm_access_read,
+                                       hvmemul_ctxt, &addr);
         if ( rc != X86EMUL_OKAY )
             break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:23:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:23:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254011.435475 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5SjS-0007sV-9X; Thu, 06 Jan 2022 13:23:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254011.435475; Thu, 06 Jan 2022 13:23: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 1n5SjS-0007sN-6b; Thu, 06 Jan 2022 13:23:06 +0000
Received: by outflank-mailman (input) for mailman id 254011;
 Thu, 06 Jan 2022 13:23: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 1n5SjR-0007sE-2T
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23: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 1n5SjR-0004lp-1n
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5SjR-0000TP-0t
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23: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=4Abt/RY1N11X6nkF4TGU1+uv8GuH7dPFh1RssFm0l04=; b=auW3PIL84UrdISiV6Z1alWxxxs
	5fWXu1VbMLSaaWltc/3DxTXDMt3uysUIeg41WwdF0t8o5xTQ+/d/dIiQfIuN097ND5lzX0X2SjD1C
	91Iz5szE5dzojXoGSjdLuNbIJG9mc9silJ6UwnySP1xLpYRbY6j6kIx95ZHBbt+tkcRU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
Message-Id: <E1n5SjR-0000TP-0t@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:23:05 +0000

commit 1bba0ce1d94e685762827051f722efc96cb180a1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:14:19 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:14:19 2022 +0100

    revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
    
    This reverts commit c22bd567ce22f6ad9bd93318ad0d7fd1c2eadb0d.
    
    While its description is correct from an abstract or real hardware pov,
    the range is special inside HVM guests. The range being UC in particular
    gets in the way of OVMF, which places itself at [FFE00000,FFFFFFFF].
    While this is benign to epte_get_entry_emt() as long as the IOMMU isn't
    enabled for a guest, it becomes a very noticable problem otherwise: It
    takes about half a minute for OVMF to decompress itself into its
    designated address range.
    
    And even beyond OVMF there's no reason to have e.g. the ACPI memory
    range marked UC.
    
    Fixes: c22bd567ce22 ("hvmloader: PA range 0xfc000000-0xffffffff should be UC")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ea187c0b7a73c26258c0e91e4f3656989804555f
    master date: 2021-12-17 08:56:15 +0100
---
 tools/firmware/hvmloader/cacheattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/hvmloader/cacheattr.c b/tools/firmware/hvmloader/cacheattr.c
index 1ac6656c70..1c67819748 100644
--- a/tools/firmware/hvmloader/cacheattr.c
+++ b/tools/firmware/hvmloader/cacheattr.c
@@ -98,12 +98,12 @@ void cacheattr_init(void)
     {
         uint64_t base = pci_mem_start, size;
 
-        for ( i = 0; !(base >> 32) && (i < nr_var_ranges); i++ )
+        for ( i = 0; (base != pci_mem_end) && (i < nr_var_ranges); i++ )
         {
             size = PAGE_SIZE;
             while ( !(base & size) )
                 size <<= 1;
-            while ( ((base + size) < base) || ((base + size - 1) >> 32) )
+            while ( ((base + size) < base) || ((base + size) > pci_mem_end) )
                 size >>= 1;
 
             wrmsr(MSR_MTRRphysBase(i), base);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:23:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:23:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254012.435480 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Sjc-0007vo-D8; Thu, 06 Jan 2022 13:23:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254012.435480; Thu, 06 Jan 2022 13:23: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 1n5Sjc-0007vg-AK; Thu, 06 Jan 2022 13:23:16 +0000
Received: by outflank-mailman (input) for mailman id 254012;
 Thu, 06 Jan 2022 13:23: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 1n5Sjb-0007vT-6H
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23: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 1n5Sjb-0004mI-5b
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sjb-0000UZ-4c
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23: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=QQf5/611GNZ71TF0X3mM95DNTLsUxHDLblWuEpm8Gmo=; b=esgg2uiO2RSgUJlpRCEz3zGKDq
	qk5ixR+lQmMkT6GJwwXJr++q1RUB/qQ2X1jVhPfHjQCljTpRNZ3UXEHcVQ9upbOoSiTSvAATtuPgu
	YxJQjOd6V08b/P+iwyjloNbATE1nbLpGKNwC0zPRTC2vX26VlhDEuTScJEQ8+0BBEwUo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/cpuid: Fix TSXLDTRK definition
Message-Id: <E1n5Sjb-0000UZ-4c@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:23:15 +0000

commit 1172a4359e976cd28de488412ba656ec116ab7eb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 6 14:14:39 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:14:39 2022 +0100

    x86/cpuid: Fix TSXLDTRK definition
    
    TSXLDTRK lives in CPUID leaf 7[0].edx, not 7[0].ecx.
    
    Bit 16 in ecx is LA57.
    
    Fixes: a6d1b558471f ("x86emul: support X{SUS,RES}LDTRK")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 249e0f1d8f203188ccdcced5a05c2149739e1566
    master date: 2021-12-14 12:30:48 +0000
---
 tools/libs/light/libxl_cpuid.c              | 2 +-
 tools/misc/xen-cpuid.c                      | 3 +--
 xen/arch/x86/x86_emulate/x86_emulate.c      | 2 +-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 815498d4f3..e1acf6648d 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -209,7 +209,6 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-vnni",  0x00000007,  0, CPUID_REG_ECX, 11,  1},
         {"avx512-bitalg",0x00000007,  0, CPUID_REG_ECX, 12,  1},
         {"avx512-vpopcntdq",0x00000007,0,CPUID_REG_ECX, 14,  1},
-        {"tsxldtrk",     0x00000007,  0, CPUID_REG_ECX, 16,  1},
         {"rdpid",        0x00000007,  0, CPUID_REG_ECX, 22,  1},
         {"cldemote",     0x00000007,  0, CPUID_REG_ECX, 25,  1},
 
@@ -220,6 +219,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
+        {"tsxldtrk",     0x00000007,  0, CPUID_REG_EDX, 16,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 37989e4a12..34f31326c0 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -128,7 +128,6 @@ static const char *const str_7c0[32] =
     [10] = "vpclmulqdq",       [11] = "avx512-vnni",
     [12] = "avx512-bitalg",
     [14] = "avx512-vpopcntdq",
-    [16] = "tsxldtrk",
 
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
@@ -171,7 +170,7 @@ static const char *const str_7d0[32] =
     [10] = "md-clear",            [11] = "rtm-always-abort",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
-
+    [16] = "tsxldtrk",
     [18] = "pconfig",
     [20] = "cet-ibt",
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 069acde517..f71015ffa1 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2000,7 +2000,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_vnni() (ctxt->cpuid->feat.avx512_vnni)
 #define vcpu_has_avx512_bitalg() (ctxt->cpuid->feat.avx512_bitalg)
 #define vcpu_has_avx512_vpopcntdq() (ctxt->cpuid->feat.avx512_vpopcntdq)
-#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_rdpid()       (ctxt->cpuid->feat.rdpid)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
@@ -2009,6 +2008,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_avx512_vp2intersect() (ctxt->cpuid->feat.avx512_vp2intersect)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
+#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_avx_vnni()    (ctxt->cpuid->feat.avx_vnni)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index f11d5439ae..f62c775b9d 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -239,7 +239,6 @@ XEN_CPUFEATURE(VPCLMULQDQ,    6*32+10) /*A  Vector Carry-less Multiplication Ins
 XEN_CPUFEATURE(AVX512_VNNI,   6*32+11) /*A  Vector Neural Network Instrs */
 XEN_CPUFEATURE(AVX512_BITALG, 6*32+12) /*A  Support for VPOPCNT[B,W] and VPSHUFBITQMB */
 XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
-XEN_CPUFEATURE(TSXLDTRK,      6*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
@@ -278,6 +277,7 @@ XEN_CPUFEATURE(MD_CLEAR,      9*32+10) /*A  VERW clears microarchitectural buffe
 XEN_CPUFEATURE(RTM_ALWAYS_ABORT, 9*32+11) /*! June 2021 TSX defeaturing in microcode. */
 XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*a  SERIALIZE insn */
+XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 13:23:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 13:23:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254013.435485 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Sjm-0007yk-Fh; Thu, 06 Jan 2022 13:23:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254013.435485; Thu, 06 Jan 2022 13:23: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 1n5Sjm-0007ya-Bx; Thu, 06 Jan 2022 13:23:26 +0000
Received: by outflank-mailman (input) for mailman id 254013;
 Thu, 06 Jan 2022 13:23: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 1n5Sjl-0007yP-9D
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23: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 1n5Sjl-0004mN-8X
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Sjl-0000Vm-7j
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 13:23: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=kI/K6SB4/4tNAmQPvsMx10LwPDL/IwzxSF9Ct1Ldp7A=; b=z5P2e2mPkMZ2dCr4meeBC3+i4O
	Zi+HUF70UaK4Lr0BpIkP4D1N1hzIChfpoFa3ThdVI5YGNRlEOiM5cWPz3Nuqi3Sc+EgGnyg2MNYzD
	E1rS6THR97ilF12A2KyKSw84X6OQz1iPcpZyQ9hMjpQMBs87o7s9Pk2xJDWqe6CxV4oc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/spec-ctrl: Fix default calculation of opt_srb_lock
Message-Id: <E1n5Sjl-0000Vm-7j@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 13:23:25 +0000

commit 243026a2c5ad64c05281dc8ed2f1f57c0ee5988c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 6 14:15:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:15:14 2022 +0100

    x86/spec-ctrl: Fix default calculation of opt_srb_lock
    
    Since this logic was introduced, opt_tsx has become more complicated and
    shouldn't be compared to 0 directly.  While there are no buggy logic paths,
    the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
    easier and clearer to use.
    
    Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31f3bc97f4508687215e459a5e35676eecf1772b
    master date: 2022-01-05 09:44:26 +0000
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a5569c7f2b..c18cc8aa49 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1245,7 +1245,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 15:22:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 15:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254106.435638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Uac-0001uk-6y; Thu, 06 Jan 2022 15:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254106.435638; Thu, 06 Jan 2022 15:22: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 1n5Uac-0001uc-41; Thu, 06 Jan 2022 15:22:06 +0000
Received: by outflank-mailman (input) for mailman id 254106;
 Thu, 06 Jan 2022 15:22: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 1n5Uab-0001uS-4Z
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 15:22: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 1n5Uab-0006uP-15
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 15:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Uab-0000mx-03
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 15:22: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=FdJ4QIfi4BZh0K5BwyYjE3Yp80OlX2IS02fWPVOoBTc=; b=EXoLI/m6WEVwOhEnzaEcm2Hn5n
	DDZ4C2UYmxqWaWwhANviDEPJB9NCLbsHj5IiD/TLqeGIjeh2LBvmcY+G3NkQVwglMUalzZU3VZHLm
	YMJao/lkaDS6Rh8fs/Ltog6N1kert4qqaOX/iCcw6lHTX/IR3Vtdy5I9d1qbh6H9uX9c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xen-detect: avoid possible pitfall with cpuid()
Message-Id: <E1n5Uab-0000mx-03@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 15:22:05 +0000

commit 6330e328ba157ed5df417f463ba8621fee731e63
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 16:12:15 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 16:12:15 2022 +0100

    tools/xen-detect: avoid possible pitfall with cpuid()
    
    The 64-bit form forces %ecx to 0 while the 32-bit one so far didn't - it
    only ended up that way when "pv_context" is zero. While presently no
    leaf queried by callers has separate subleaves, let's avoid chancing it.
    
    While there
    - replace references to operands by number,
    - relax constraints where possible,
    - limit PUSH/POP to just the registers not also used as input,
    all where applicable also for the 64-bit variant.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/misc/xen-detect.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tools/misc/xen-detect.c b/tools/misc/xen-detect.c
index 18b28dabf3..4f74c41557 100644
--- a/tools/misc/xen-detect.c
+++ b/tools/misc/xen-detect.c
@@ -52,17 +52,19 @@ static void cpuid(uint32_t idx, uint32_t *regs, int pv_context)
 #ifdef __i386__
     /* Use the stack to avoid reg constraint failures with some gcc flags */
     asm volatile (
-        "push %%eax; push %%ebx; push %%ecx; push %%edx\n\t"
-        "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
-        "mov %%eax,(%2); mov %%ebx,4(%2)\n\t"
-        "mov %%ecx,8(%2); mov %%edx,12(%2)\n\t"
-        "pop %%edx; pop %%ecx; pop %%ebx; pop %%eax\n\t"
-        : : "a" (idx), "c" (pv_context), "S" (regs) : "memory" );
+        "push %%ebx; push %%edx\n\t"
+        "test %[pv],%[pv] ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
+        "mov %%eax,(%[regs]); mov %%ebx,4(%[regs])\n\t"
+        "mov %%ecx,8(%[regs]); mov %%edx,12(%[regs])\n\t"
+        "pop %%edx; pop %%ebx\n\t"
+        : "+a" (idx), "=c" (idx /* dummy */)
+        : "c" (0), [pv] "r" (pv_context), [regs] "SD" (regs)
+        : "memory" );
 #else
     asm volatile (
-        "test %5,%5 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
+        "test %[pv],%[pv] ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
         : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
-        : "0" (idx), "1" (pv_context), "2" (0) );
+        : "0" (idx), "2" (0), [pv] "r" (pv_context) );
 #endif
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 06 15:22:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Jan 2022 15:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254107.435642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5Uam-0001xA-8b; Thu, 06 Jan 2022 15:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254107.435642; Thu, 06 Jan 2022 15:22: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 1n5Uam-0001x2-5V; Thu, 06 Jan 2022 15:22:16 +0000
Received: by outflank-mailman (input) for mailman id 254107;
 Thu, 06 Jan 2022 15:22: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 1n5Ual-0001ws-5U
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 15:22: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 1n5Ual-0006um-4f
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 15:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5Ual-0000na-3j
 for xen-changelog@lists.xenproject.org; Thu, 06 Jan 2022 15:22: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=dj4VZSvjzS7INxFCJE1eZsfiPA3tGPmfoDt7hFbJ+RI=; b=mQMeQOW+T8kCiA2ZHIktPNXhdS
	KlwarDL9Zdrfmb0G3GzIrhMpohJrjcEfxk2lRmn2l5xXxADITv5DA+uWj5JzHmGzmwacPYVY6i2c/
	q3QfaYRqcoO+7vBEdl3C66qCdYrkuDY59BkSTZR5QFJRd+NE1tFR7u0+jBcigAUX0owU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/altp2m: p2m_altp2m_get_or_propagate() should honor present page order
Message-Id: <E1n5Ual-0000na-3j@xenbits.xenproject.org>
Date: Thu, 06 Jan 2022 15:22:15 +0000

commit ced5685208f4525edc3aa86f41eeaee5ccc9fe31
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 16:12:39 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 16:12:39 2022 +0100

    x86/altp2m: p2m_altp2m_get_or_propagate() should honor present page order
    
    Prior to XSA-304 the only caller merely happened to not use any further
    the order value that it passes into the function. Already then this was
    a latent issue: The function really should, in the "get" case, hand back
    the order the underlying mapping actually uses (or actually the smaller
    of the two), such that (going forward) there wouldn't be any action on
    unrelated mappings (in particular ones which did already diverge from
    the host P2M).
    
    Similarly in the "propagate" case only the smaller of the two orders
    should actually get used for creating the new entry, again to avoid
    altering mappings which did already diverge from the host P2M.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/hvm/hvm.c         |  2 +-
 xen/arch/x86/include/asm/p2m.h |  2 +-
 xen/arch/x86/mm/p2m.c          | 14 ++++++++++----
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 350dc396e3..d233550ae4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1832,7 +1832,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
          * altp2m.
          */
         if ( p2m_altp2m_get_or_propagate(p2m, gfn, &mfn, &p2mt,
-                                         &p2ma, page_order) )
+                                         &p2ma, &page_order) )
         {
             /* Entry was copied from host -- retry fault */
             rc = 1;
diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index 357a808748..6e2206874d 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -852,7 +852,7 @@ void p2m_flush_altp2m(struct domain *d);
 /* Alternate p2m paging */
 bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
                                  mfn_t *mfn, p2m_type_t *p2mt,
-                                 p2m_access_t *p2ma, unsigned int page_order);
+                                 p2m_access_t *p2ma, unsigned int *page_order);
 
 /* Make a specific alternate p2m valid */
 int p2m_init_altp2m_by_id(struct domain *d, unsigned int idx);
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1d5a87a969..98c8201f92 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2198,10 +2198,11 @@ bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx)
  */
 bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
                                  mfn_t *mfn, p2m_type_t *p2mt,
-                                 p2m_access_t *p2ma, unsigned int page_order)
+                                 p2m_access_t *p2ma, unsigned int *page_order)
 {
     p2m_type_t ap2mt;
     p2m_access_t ap2ma;
+    unsigned int cur_order;
     unsigned long mask;
     gfn_t gfn;
     mfn_t amfn;
@@ -2214,7 +2215,10 @@ bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
      */
     p2m_lock(ap2m);
 
-    amfn = get_gfn_type_access(ap2m, gfn_l, &ap2mt, &ap2ma, 0, NULL);
+    amfn = get_gfn_type_access(ap2m, gfn_l, &ap2mt, &ap2ma, 0, &cur_order);
+
+    if ( cur_order > *page_order )
+        cur_order = *page_order;
 
     if ( !mfn_eq(amfn, INVALID_MFN) )
     {
@@ -2222,6 +2226,7 @@ bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
         *mfn  = amfn;
         *p2mt = ap2mt;
         *p2ma = ap2ma;
+        *page_order = cur_order;
         return false;
     }
 
@@ -2229,6 +2234,7 @@ bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
     if ( mfn_eq(*mfn, INVALID_MFN) )
     {
         p2m_unlock(ap2m);
+        *page_order = cur_order;
         return false;
     }
 
@@ -2237,11 +2243,11 @@ bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
      * to the start of the superpage.  NB that we repupose `amfn`
      * here.
      */
-    mask = ~((1UL << page_order) - 1);
+    mask = ~((1UL << cur_order) - 1);
     amfn = _mfn(mfn_x(*mfn) & mask);
     gfn = _gfn(gfn_l & mask);
 
-    rc = p2m_set_entry(ap2m, gfn, amfn, page_order, *p2mt, *p2ma);
+    rc = p2m_set_entry(ap2m, gfn, amfn, cur_order, *p2mt, *p2ma);
     p2m_unlock(ap2m);
 
     if ( rc )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254235.435855 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dX5-0006pC-Cp; Fri, 07 Jan 2022 00:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254235.435855; Fri, 07 Jan 2022 00: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 1n5dX5-0006p4-9i; Fri, 07 Jan 2022 00:55:03 +0000
Received: by outflank-mailman (input) for mailman id 254235;
 Fri, 07 Jan 2022 00: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 1n5dX4-0006oy-Df
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dX4-0001DU-Cr
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dX4-0000vy-Bi
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=GcxB4gfc9cT8tBluK4yeBXNDjauNl6c9oZPZ8Oh4BAQ=; b=UY8bvxG9KcObe2z54CVDvWJ2Ii
	TPIDP0/BJG6EnRXg7pyu2ZkAaYjBeaqfF48vVsXuOswVbaE0YcU1bkaNmpp/Z+tI6rde2KRgqhNWK
	60PkCsLkqo7bv2N06SHKUF+BKUV10c3AcYHw4WX851K5q/tOOiqxNVuNZUoZqW54gvyk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] VT-d: split domid map cleanup check into a function
Message-Id: <E1n5dX4-0000vy-Bi@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:55:02 +0000

commit fa45f6b5560e738955993fe061a04d64c6f71c14
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:10:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:10:05 2022 +0100

    VT-d: split domid map cleanup check into a function
    
    This logic will want invoking from elsewhere.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9fdc10abe9457e4c9879a266f82372cb08e88ffb
    master date: 2021-11-24 11:06:20 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 91 +++++++++++++++++++------------------
 1 file changed, 48 insertions(+), 43 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index f9ce402f22..de11c258ca 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -157,6 +157,51 @@ static void cleanup_domid_map(struct domain *domain, struct vtd_iommu *iommu)
     }
 }
 
+static bool any_pdev_behind_iommu(const struct domain *d,
+                                  const struct pci_dev *exclude,
+                                  const struct vtd_iommu *iommu)
+{
+    const struct pci_dev *pdev;
+
+    for_each_pdev ( d, pdev )
+    {
+        const struct acpi_drhd_unit *drhd;
+
+        if ( pdev == exclude )
+            continue;
+
+        drhd = acpi_find_matched_drhd_unit(pdev);
+        if ( drhd && drhd->iommu == iommu )
+            return true;
+    }
+
+    return false;
+}
+
+/*
+ * If no other devices under the same iommu owned by this domain,
+ * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
+ */
+static void check_cleanup_domid_map(struct domain *d,
+                                    const struct pci_dev *exclude,
+                                    struct vtd_iommu *iommu)
+{
+    bool found = any_pdev_behind_iommu(d, exclude, iommu);
+
+    /*
+     * Hidden devices are associated with DomXEN but usable by the hardware
+     * domain. Hence they need considering here as well.
+     */
+    if ( !found && is_hardware_domain(d) )
+        found = any_pdev_behind_iommu(dom_xen, exclude, iommu);
+
+    if ( !found )
+    {
+        clear_bit(iommu->index, &dom_iommu(d)->arch.vtd.iommu_bitmap);
+        cleanup_domid_map(d, iommu);
+    }
+}
+
 static void sync_cache(const void *addr, unsigned int size)
 {
     static unsigned long clflush_size = 0;
@@ -1674,27 +1719,6 @@ int domain_context_unmap_one(
     return rc;
 }
 
-static bool any_pdev_behind_iommu(const struct domain *d,
-                                  const struct pci_dev *exclude,
-                                  const struct vtd_iommu *iommu)
-{
-    const struct pci_dev *pdev;
-
-    for_each_pdev ( d, pdev )
-    {
-        const struct acpi_drhd_unit *drhd;
-
-        if ( pdev == exclude )
-            continue;
-
-        drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd && drhd->iommu == iommu )
-            return true;
-    }
-
-    return false;
-}
-
 static int domain_context_unmap(struct domain *domain, u8 devfn,
                                 struct pci_dev *pdev)
 {
@@ -1703,7 +1727,6 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
     int ret;
     uint16_t seg = pdev->seg;
     uint8_t bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
-    bool found;
 
     switch ( pdev->type )
     {
@@ -1779,28 +1802,10 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
         return -EINVAL;
     }
 
-    if ( ret || QUARANTINE_SKIP(domain) || pdev->devfn != devfn )
-        return ret;
+    if ( !ret && !QUARANTINE_SKIP(domain) && pdev->devfn == devfn )
+        check_cleanup_domid_map(domain, pdev, iommu);
 
-    /*
-     * If no other devices under the same iommu owned by this domain,
-     * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
-     */
-    found = any_pdev_behind_iommu(domain, pdev, iommu);
-    /*
-     * Hidden devices are associated with DomXEN but usable by the hardware
-     * domain. Hence they need considering here as well.
-     */
-    if ( !found && is_hardware_domain(domain) )
-        found = any_pdev_behind_iommu(dom_xen, pdev, iommu);
-
-    if ( !found )
-    {
-        clear_bit(iommu->index, dom_iommu(domain)->arch.vtd.iommu_bitmap);
-        cleanup_domid_map(domain, iommu);
-    }
-
-    return 0;
+    return ret;
 }
 
 static void iommu_clear_root_pgtable(struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:55:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254236.435859 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dXG-0006ra-Ee; Fri, 07 Jan 2022 00:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254236.435859; Fri, 07 Jan 2022 00: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 1n5dXG-0006rQ-BI; Fri, 07 Jan 2022 00:55:14 +0000
Received: by outflank-mailman (input) for mailman id 254236;
 Fri, 07 Jan 2022 00: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 1n5dXE-0006rG-Gt
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dXE-0001De-GD
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dXE-0000wp-FB
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=Ih6VN015+WYHQvZjBYH1YalgZrYe2EPJmAewqLTkhZE=; b=zD8YKSbXUITx7YnX4cwH1Twegz
	Q5skEgEQb0wZ6/jg2qqynInNjqed7qPtYLPrI8oJNYu3dq4c1qoB0PIBL9g5OF7hghHgjjCnGJlng
	gRDBSlXny3z3nTB1ZpmT8ejG50U7glMq8O2GZ661/Wr9sJQdrWxcPbkv2QMIjb/EtDOA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] VT-d: don't leak domid mapping on error path
Message-Id: <E1n5dXE-0000wp-FB@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:55:12 +0000

commit 84977e8b53935de9a1123f677213f1b146843a0e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:11:23 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:11:23 2022 +0100

    VT-d: don't leak domid mapping on error path
    
    While domain_context_mapping() invokes domain_context_unmap() in a sub-
    case of handling DEV_TYPE_PCI when encountering an error, thus avoiding
    a leak, individual calls to domain_context_mapping_one() aren't
    similarly covered. Such a leak might persist until domain destruction.
    Leverage that these cases can be recognized by pdev being non-NULL.
    
    Fixes: dec403cc668f ("VT-d: fix iommu_domid for PCI/PCIx devices assignment")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: e6252a51faf42c892eb5fc71f8a2617580832196
    master date: 2021-11-24 11:07:11 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index de11c258ca..3b37bad25e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1517,7 +1517,12 @@ int domain_context_mapping_one(
         rc = me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
 
     if ( rc )
-        domain_context_unmap_one(domain, iommu, bus, devfn);
+    {
+        ret = domain_context_unmap_one(domain, iommu, bus, devfn);
+
+        if ( !ret && pdev && pdev->devfn == devfn )
+            check_cleanup_domid_map(domain, pdev, iommu);
+    }
 
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:55:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254237.435863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dXQ-0006v4-HQ; Fri, 07 Jan 2022 00:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254237.435863; Fri, 07 Jan 2022 00: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 1n5dXQ-0006uv-EV; Fri, 07 Jan 2022 00:55:24 +0000
Received: by outflank-mailman (input) for mailman id 254237;
 Fri, 07 Jan 2022 00: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 1n5dXO-0006uT-KO
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dXO-0001EC-Je
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dXO-0000xe-Ic
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=eaV8OdsdRnMJ7mriyvrBFNLCypteoBsjNJUxswOt24s=; b=T0iSZvt3k97W4CjQgJ80bUO7LB
	R4pVklzCrDnDndjWVoQxaOlaTrdDZu252/i4Vn4erBfdXvddoEi4sMkkdeF/gE0SPXZznVVurxfAB
	OcAfUzkKzH2AiDiLc+tozghwdsg1bBDgSHzGFd3aWel+tlqxs7LhYAWU/mQCXN7qZYRY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/Viridian: fix error code use
Message-Id: <E1n5dXO-0000xe-Ic@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:55:22 +0000

commit 481b8bb3311d3a962c795127b7d968d743466654
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:11:58 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:11:58 2022 +0100

    x86/Viridian: fix error code use
    
    Both the wrong use of HV_STATUS_* and the return type of
    hv_vpset_to_vpmask() can lead to viridian_hypercall()'s
    ASSERT_UNREACHABLE() triggering when translating error codes from Xen
    to Viridian representation.
    
    Fixes: b4124682db6e ("viridian: add ExProcessorMasks variants of the flush hypercalls")
    Fixes: 9afa867d42ba ("viridian: add ExProcessorMasks variant of the IPI hypercall")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: 857fee77845be0c5c35fd51bac64455369d32a6f
    master date: 2021-11-24 11:09:56 +0100
---
 xen/arch/x86/hvm/viridian/viridian.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index b906f7b86a..7d1cfc530b 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -628,8 +628,8 @@ static unsigned int hv_vpset_nr_banks(struct hv_vpset *vpset)
     return hweight64(vpset->valid_bank_mask);
 }
 
-static uint16_t hv_vpset_to_vpmask(const struct hv_vpset *set,
-                                   struct hypercall_vpmask *vpmask)
+static int hv_vpset_to_vpmask(const struct hv_vpset *set,
+                              struct hypercall_vpmask *vpmask)
 {
 #define NR_VPS_PER_BANK (HV_VPSET_BANK_SIZE * 8)
 
@@ -919,10 +919,10 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
          input_params.reserved_zero[0] ||
          input_params.reserved_zero[1] ||
          input_params.reserved_zero[2] )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     if ( input_params.vector < 0x10 || input_params.vector > 0xff )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     *set = input_params.set;
     if ( set->format == HV_GENERIC_SET_SPARSE_4K )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:55:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254238.435867 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dXa-0006y3-J0; Fri, 07 Jan 2022 00:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254238.435867; Fri, 07 Jan 2022 00: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 1n5dXa-0006xv-Fw; Fri, 07 Jan 2022 00:55:34 +0000
Received: by outflank-mailman (input) for mailman id 254238;
 Fri, 07 Jan 2022 00: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 1n5dXY-0006xd-Nh
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dXY-0001ES-Mw
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dXY-0000ym-Lw
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=JAB2UmrvbHRVvHhs2/1YuwLm7XM8Qvq3iJ5JYQXPwR8=; b=UJ7kjP66JFb2DEjHVxwZxcftZU
	lHugrVujw8l6Ds/SXQNrGA3V5xJAfahRIm2ZCXtzK8lorChK2IBPP+wX+d//qeF7+sdfHdIwIxU89
	9uYy5C6PnqEg9JbrqzZvi+6xN0gAVj5BZqF3JyFWJpU0vJgFqYv0EhC24w6OdDOJvNRA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
Message-Id: <E1n5dXY-0000ym-Lw@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:55:32 +0000

commit 7bbeff438dfa61e532116d9fbd65bffb896857c5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:12:26 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:12:26 2022 +0100

    x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
    
    Just like (in protected mode) reads may not go to exec-only segments and
    writes may not go to non-writable ones, insn fetches may not access data
    segments.
    
    Fixes: 623e83716791 ("hvm: Support hardware task switching")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 311297f4216a4387bdae6df6cfbb1f5edb06618a
    master date: 2021-12-06 14:15:05 +0100
---
 xen/arch/x86/hvm/hvm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index eee365711d..b680f62892 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2551,6 +2551,9 @@ bool hvm_vcpu_virtual_to_linear(
      */
     ASSERT(seg < x86_seg_none);
 
+    /* However, check that insn fetches only ever specify CS. */
+    ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
+
     if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_PE) )
     {
         /*
@@ -2615,10 +2618,17 @@ bool hvm_vcpu_virtual_to_linear(
                 if ( (reg->type & 0xa) == 0x8 )
                     goto out; /* execute-only code segment */
                 break;
+
             case hvm_access_write:
                 if ( (reg->type & 0xa) != 0x2 )
                     goto out; /* not a writable data segment */
                 break;
+
+            case hvm_access_insn_fetch:
+                if ( !(reg->type & 0x8) )
+                    goto out; /* not a code segment */
+                break;
+
             default:
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:55:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254239.435871 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dXk-00070o-KY; Fri, 07 Jan 2022 00:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254239.435871; Fri, 07 Jan 2022 00: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 1n5dXk-00070h-HT; Fri, 07 Jan 2022 00:55:44 +0000
Received: by outflank-mailman (input) for mailman id 254239;
 Fri, 07 Jan 2022 00: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 1n5dXi-00070I-Qq
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dXi-0001Ed-Q6
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dXi-0000zV-P9
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=qTlZ28YC/EJlPbfoKJoWY7L8lIjoWsDbspu/ENznjFY=; b=yXY7BKLIsxFvQgOE7xlXVTDK5e
	04eAmQOAu9srqjtcGcX/j9C858iG4uN+cIdmB865uouSzKHoWdI/EJo90AVpcuImOaHESfjmNWSv+
	fq4FYF+b4COtEl/J3QSPW62/flMd2hEdisfkSCnrAUUtNGJUxbc7eHpQNawNlAXRiCaw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86: avoid wrong use of all-but-self IPI shorthand
Message-Id: <E1n5dXi-0000zV-P9@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:55:42 +0000

commit 64a35ee749ec3d019929bd5b51f0ed7dae0f7516
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:12:53 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:12:53 2022 +0100

    x86: avoid wrong use of all-but-self IPI shorthand
    
    With "nosmp" I did observe a flood of "APIC error on CPU0: 04(04), Send
    accept error" log messages on an AMD system. And rightly so - nothing
    excludes the use of the shorthand in send_IPI_mask() in this case. Set
    "unaccounted_cpus" to "true" also when command line restrictions are the
    cause.
    
    Note that PV-shim mode is unaffected by this change, first and foremost
    because "nosmp" and "maxcpus=" are ignored in this case.
    
    Fixes: 5500d265a2a8 ("x86/smp: use APIC ALLBUT destination shorthand when possible")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 7621880de0bb40bae6436a5b106babc0e4718f4d
    master date: 2021-12-10 10:26:52 +0100
---
 xen/arch/x86/mpparse.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index dff02b142b..91fa580831 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -85,9 +85,14 @@ void __init set_nr_cpu_ids(unsigned int max_cpus)
 	if (!park_offline_cpus)
 		tot_cpus = max_cpus;
 	nr_cpu_ids = min(tot_cpus, NR_CPUS + 0u);
-	if (park_offline_cpus && nr_cpu_ids < num_processors)
-		printk(XENLOG_WARNING "SMP: Cannot bring up %u further CPUs\n",
-		       num_processors - nr_cpu_ids);
+	if (nr_cpu_ids < num_processors)
+	{
+		unaccounted_cpus = true;
+		if (park_offline_cpus)
+			printk(XENLOG_WARNING
+			       "SMP: Cannot bring up %u further CPUs\n",
+			       num_processors - nr_cpu_ids);
+	}
 
 #ifndef nr_cpumask_bits
 	nr_cpumask_bits = ROUNDUP(nr_cpu_ids, BITS_PER_LONG);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:55:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254240.435875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dXu-00073e-MD; Fri, 07 Jan 2022 00:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254240.435875; Fri, 07 Jan 2022 00: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 1n5dXu-00073W-J7; Fri, 07 Jan 2022 00:55:54 +0000
Received: by outflank-mailman (input) for mailman id 254240;
 Fri, 07 Jan 2022 00: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 1n5dXs-00073D-U5
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dXs-0001En-TQ
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dXs-00010A-SS
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=J/o+ova5OzsPdddONMQlBcpJWdycrULTksA9kwAGYfk=; b=WJ50XVNKMxl8vYgQM43JmYjxY+
	drCXuMR/Sl+8atuKNXaH3bONtwJ2vuow8BgO1wBh8mkZ5ymFtPxIOJb/sbUkg/XAW9VOKAy+z3Cy6
	q0cECV0SU7Q/bkRJdUNdQIVGMNzQRCjMatNS2fofnm01RplHpmNd0aOF3kyD4CstgfBM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
Message-Id: <E1n5dXs-00010A-SS@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:55:52 +0000

commit 98ea29cd71e8e177b5fde83e8016c384581897e9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:13:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:13:38 2022 +0100

    x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
    
    Both SDM and PM explicitly permit this.
    
    Fixes: 52dba7bd0b36 ("x86emul: generalize wbinvd() hook")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Paul Durrant <paul@xen.org>
    master commit: df3e1a5efe700a9f59eced801cac73f9fd02a0e2
    master date: 2021-12-10 14:03:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 425c8ddd97..76a2ccfafe 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2310,7 +2310,9 @@ static int hvmemul_cache_op(
         ASSERT(!is_x86_system_segment(seg));
 
         rc = hvmemul_virtual_to_linear(seg, offset, 0, NULL,
-                                       hvm_access_read, hvmemul_ctxt, &addr);
+                                       op != x86emul_clwb ? hvm_access_none
+                                                          : hvm_access_read,
+                                       hvmemul_ctxt, &addr);
         if ( rc != X86EMUL_OKAY )
             break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:56:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:56:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254241.435879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dY4-00076F-Nb; Fri, 07 Jan 2022 00:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254241.435879; Fri, 07 Jan 2022 00: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 1n5dY4-000765-Kf; Fri, 07 Jan 2022 00:56:04 +0000
Received: by outflank-mailman (input) for mailman id 254241;
 Fri, 07 Jan 2022 00: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 1n5dY3-00075g-2w
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dY3-0001FC-0T
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dY2-00012j-Vi
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=IaCXrzwoejkQVfEsGgCiT0gjkbUxpbUbKclQjd1Rnzo=; b=OSKrVf0HEXrm/0UXqqA+5WgYLm
	tofhHD1Nx2fC26LZeFm03k6LjdOdCuHY2wOzSkR5d/0UJuw+y6Hfs3DPOzL7LspN/zzofAyAL5PRk
	DNItRbYK38yk8+FYu1W85vYYoreoa2KW5UdRWx/7jxrnr2UG3L4GC9eQL95pPE2iKVTI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
Message-Id: <E1n5dY2-00012j-Vi@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:56:02 +0000

commit 1bba0ce1d94e685762827051f722efc96cb180a1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 14:14:19 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:14:19 2022 +0100

    revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
    
    This reverts commit c22bd567ce22f6ad9bd93318ad0d7fd1c2eadb0d.
    
    While its description is correct from an abstract or real hardware pov,
    the range is special inside HVM guests. The range being UC in particular
    gets in the way of OVMF, which places itself at [FFE00000,FFFFFFFF].
    While this is benign to epte_get_entry_emt() as long as the IOMMU isn't
    enabled for a guest, it becomes a very noticable problem otherwise: It
    takes about half a minute for OVMF to decompress itself into its
    designated address range.
    
    And even beyond OVMF there's no reason to have e.g. the ACPI memory
    range marked UC.
    
    Fixes: c22bd567ce22 ("hvmloader: PA range 0xfc000000-0xffffffff should be UC")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ea187c0b7a73c26258c0e91e4f3656989804555f
    master date: 2021-12-17 08:56:15 +0100
---
 tools/firmware/hvmloader/cacheattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/hvmloader/cacheattr.c b/tools/firmware/hvmloader/cacheattr.c
index 1ac6656c70..1c67819748 100644
--- a/tools/firmware/hvmloader/cacheattr.c
+++ b/tools/firmware/hvmloader/cacheattr.c
@@ -98,12 +98,12 @@ void cacheattr_init(void)
     {
         uint64_t base = pci_mem_start, size;
 
-        for ( i = 0; !(base >> 32) && (i < nr_var_ranges); i++ )
+        for ( i = 0; (base != pci_mem_end) && (i < nr_var_ranges); i++ )
         {
             size = PAGE_SIZE;
             while ( !(base & size) )
                 size <<= 1;
-            while ( ((base + size) < base) || ((base + size - 1) >> 32) )
+            while ( ((base + size) < base) || ((base + size) > pci_mem_end) )
                 size >>= 1;
 
             wrmsr(MSR_MTRRphysBase(i), base);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:56:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254242.435883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dYE-00078z-PA; Fri, 07 Jan 2022 00:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254242.435883; Fri, 07 Jan 2022 00: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 1n5dYE-00078p-ME; Fri, 07 Jan 2022 00:56:14 +0000
Received: by outflank-mailman (input) for mailman id 254242;
 Fri, 07 Jan 2022 00: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 1n5dYD-00078d-52
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dYD-0001FP-4J
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dYD-00013S-3P
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=WXBd7z1hEijKaGoUnRpMMQ6FL2P9lLIJ53ISm+pFLnQ=; b=oIu/FM/FNf/GzRewIPOfy8ghS2
	BZWq9jscy3YJ4XRQI99gpwMMywigWyjiMSiFdG95aTl1zepCowGJgM+argSjJz7lfkGDJNC+fu06i
	7icGcrx8Yl4z7l5C0bnfJzSiRZccyAClbuNPbP2C6PJ2t6imWmLJ5yfbJu1//NZ2eEjA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/cpuid: Fix TSXLDTRK definition
Message-Id: <E1n5dYD-00013S-3P@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:56:13 +0000

commit 1172a4359e976cd28de488412ba656ec116ab7eb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 6 14:14:39 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:14:39 2022 +0100

    x86/cpuid: Fix TSXLDTRK definition
    
    TSXLDTRK lives in CPUID leaf 7[0].edx, not 7[0].ecx.
    
    Bit 16 in ecx is LA57.
    
    Fixes: a6d1b558471f ("x86emul: support X{SUS,RES}LDTRK")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 249e0f1d8f203188ccdcced5a05c2149739e1566
    master date: 2021-12-14 12:30:48 +0000
---
 tools/libs/light/libxl_cpuid.c              | 2 +-
 tools/misc/xen-cpuid.c                      | 3 +--
 xen/arch/x86/x86_emulate/x86_emulate.c      | 2 +-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 815498d4f3..e1acf6648d 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -209,7 +209,6 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-vnni",  0x00000007,  0, CPUID_REG_ECX, 11,  1},
         {"avx512-bitalg",0x00000007,  0, CPUID_REG_ECX, 12,  1},
         {"avx512-vpopcntdq",0x00000007,0,CPUID_REG_ECX, 14,  1},
-        {"tsxldtrk",     0x00000007,  0, CPUID_REG_ECX, 16,  1},
         {"rdpid",        0x00000007,  0, CPUID_REG_ECX, 22,  1},
         {"cldemote",     0x00000007,  0, CPUID_REG_ECX, 25,  1},
 
@@ -220,6 +219,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
+        {"tsxldtrk",     0x00000007,  0, CPUID_REG_EDX, 16,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 37989e4a12..34f31326c0 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -128,7 +128,6 @@ static const char *const str_7c0[32] =
     [10] = "vpclmulqdq",       [11] = "avx512-vnni",
     [12] = "avx512-bitalg",
     [14] = "avx512-vpopcntdq",
-    [16] = "tsxldtrk",
 
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
@@ -171,7 +170,7 @@ static const char *const str_7d0[32] =
     [10] = "md-clear",            [11] = "rtm-always-abort",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
-
+    [16] = "tsxldtrk",
     [18] = "pconfig",
     [20] = "cet-ibt",
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 069acde517..f71015ffa1 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2000,7 +2000,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_vnni() (ctxt->cpuid->feat.avx512_vnni)
 #define vcpu_has_avx512_bitalg() (ctxt->cpuid->feat.avx512_bitalg)
 #define vcpu_has_avx512_vpopcntdq() (ctxt->cpuid->feat.avx512_vpopcntdq)
-#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_rdpid()       (ctxt->cpuid->feat.rdpid)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
@@ -2009,6 +2008,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_avx512_vp2intersect() (ctxt->cpuid->feat.avx512_vp2intersect)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
+#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_avx_vnni()    (ctxt->cpuid->feat.avx_vnni)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index f11d5439ae..f62c775b9d 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -239,7 +239,6 @@ XEN_CPUFEATURE(VPCLMULQDQ,    6*32+10) /*A  Vector Carry-less Multiplication Ins
 XEN_CPUFEATURE(AVX512_VNNI,   6*32+11) /*A  Vector Neural Network Instrs */
 XEN_CPUFEATURE(AVX512_BITALG, 6*32+12) /*A  Support for VPOPCNT[B,W] and VPSHUFBITQMB */
 XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
-XEN_CPUFEATURE(TSXLDTRK,      6*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
@@ -278,6 +277,7 @@ XEN_CPUFEATURE(MD_CLEAR,      9*32+10) /*A  VERW clears microarchitectural buffe
 XEN_CPUFEATURE(RTM_ALWAYS_ABORT, 9*32+11) /*! June 2021 TSX defeaturing in microcode. */
 XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*a  SERIALIZE insn */
+XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 00:56:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 00:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254243.435888 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dYO-0007Bt-Ru; Fri, 07 Jan 2022 00:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254243.435888; Fri, 07 Jan 2022 00:56:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5dYO-0007Bd-Nm; Fri, 07 Jan 2022 00:56:24 +0000
Received: by outflank-mailman (input) for mailman id 254243;
 Fri, 07 Jan 2022 00: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 1n5dYN-0007BP-7z
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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 1n5dYN-0001Ft-7N
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5dYN-00014K-6V
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 00: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=qYRV906Vjw7W7O3cSO+vmHRPth1E5ett/qs/3T5to5Y=; b=ZVAUVmPQGjXCvwHtl2Ttkra2vO
	FFGRdDKqKKpEZJlCYqVQsm+01jcXg5ugymdtqvPE0ydKvsNutvLCucytPznW+SzGjMXSd64E9Pu+X
	yH3TADi8FsTm2OhBzVRkj999ErI6J1IQ2wqyAQ4kZo3Mrb1Fsl6gfgj4UWWVTtleCM+s=;
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: Fix default calculation of opt_srb_lock
Message-Id: <E1n5dYN-00014K-6V@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 00:56:23 +0000

commit 243026a2c5ad64c05281dc8ed2f1f57c0ee5988c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 6 14:15:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 14:15:14 2022 +0100

    x86/spec-ctrl: Fix default calculation of opt_srb_lock
    
    Since this logic was introduced, opt_tsx has become more complicated and
    shouldn't be compared to 0 directly.  While there are no buggy logic paths,
    the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
    easier and clearer to use.
    
    Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31f3bc97f4508687215e459a5e35676eecf1772b
    master date: 2022-01-05 09:44:26 +0000
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a5569c7f2b..c18cc8aa49 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1245,7 +1245,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:22:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254262.435927 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jZg-0004Sn-AO; Fri, 07 Jan 2022 07:22:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254262.435927; Fri, 07 Jan 2022 07:22: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 1n5jZg-0004Sg-7R; Fri, 07 Jan 2022 07:22:08 +0000
Received: by outflank-mailman (input) for mailman id 254262;
 Fri, 07 Jan 2022 07:22: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 1n5jZe-0004Sa-TF
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22: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 1n5jZe-0002Ik-RD
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jZe-00061c-PL
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22: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=GRSkVphed2DIgfT1u+hNAaAZGKVBuXFBWugjqO5stGI=; b=Tg9mCPMydH39CRqVnFW1XzjQh8
	OaJbIIIGz5Dklaamg4LhhDHC6x79XGSu5dxFpV915Hins3onew92bvxfmOiXby9+DHd1np9UYtU+D
	wR2yfqFNQgfNZ5zKxFiTgzAGgyWWPL0IphH85x0ZKxs22tghjbdf3uAQqRF4y8Gw2FsY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] efi: fix alignment of function parameters in compat mode
Message-Id: <E1n5jZe-00061c-PL@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:22:06 +0000

commit 71dfb814b51daf2abe7926a3e512bb071939521f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Jan 7 08:11:01 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:11:01 2022 +0100

    efi: fix alignment of function parameters in compat mode
    
    Currently the max_store_size, remain_store_size and max_size in
    compat_pf_efi_runtime_call are 4 byte aligned, which makes clang
    13.0.0 complain with:
    
    In file included from compat.c:30:
    ./runtime.c:646:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 2 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.max_store_size,
                ^
    ./runtime.c:647:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 3 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.remain_store_size,
                ^
    ./runtime.c:648:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 4 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.max_size);
                ^
    Fix this by bouncing the variables on the stack in order for them to
    be 8 byte aligned.
    
    Note this could be done in a more selective manner to only apply to
    compat code calls, but given the overhead of making an EFI call doing
    an extra copy of 3 variables doesn't seem to warrant the special
    casing.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: be12fcca8b784e456df3adedbffe657d753c5ff9
    master date: 2021-11-19 17:01:24 +0000
---
 xen/common/efi/runtime.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 95367694b5..bbcc756f57 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -607,6 +607,9 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
     break;
 
     case XEN_EFI_query_variable_info:
+    {
+        uint64_t max_store_size, remain_store_size, max_size;
+
         if ( op->misc & ~XEN_EFI_VARINFO_BOOT_SNAPSHOT )
             return -EINVAL;
 
@@ -638,16 +641,36 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
 
         if ( !efi_enabled(EFI_RS) || (efi_rs->Hdr.Revision >> 16) < 2 )
             return -EOPNOTSUPP;
+
+        /*
+         * Bounce the variables onto the stack to make them 8 byte aligned when
+         * called from the compat handler, as their placement in
+         * compat_pf_efi_runtime_call will make them 4 byte aligned instead and
+         * and compilers may validly complain.
+         *
+         * Note that while the function parameters are OUT only, copy the
+         * values here anyway just in case. This is done regardless of whether
+         * called from the compat handler or not, as it's not worth the extra
+         * logic to differentiate.
+         */
+        max_store_size = op->u.query_variable_info.max_store_size;
+        remain_store_size = op->u.query_variable_info.remain_store_size;
+        max_size = op->u.query_variable_info.max_size;
+
         state = efi_rs_enter();
         if ( !state.cr3 )
             return -EOPNOTSUPP;
         status = efi_rs->QueryVariableInfo(
-            op->u.query_variable_info.attr,
-            &op->u.query_variable_info.max_store_size,
-            &op->u.query_variable_info.remain_store_size,
-            &op->u.query_variable_info.max_size);
+            op->u.query_variable_info.attr, &max_store_size, &remain_store_size,
+            &max_size);
         efi_rs_leave(&state);
+
+        op->u.query_variable_info.max_store_size = max_store_size;
+        op->u.query_variable_info.remain_store_size = remain_store_size;
+        op->u.query_variable_info.max_size = max_size;
+
         break;
+    }
 
     case XEN_EFI_query_capsule_capabilities:
     case XEN_EFI_update_capsule:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:22:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:22:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254263.435931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jZq-0004UV-Bt; Fri, 07 Jan 2022 07:22:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254263.435931; Fri, 07 Jan 2022 07:22: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 1n5jZq-0004UN-90; Fri, 07 Jan 2022 07:22:18 +0000
Received: by outflank-mailman (input) for mailman id 254263;
 Fri, 07 Jan 2022 07:22: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 1n5jZp-0004UB-07
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22: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 1n5jZo-0002Io-Va
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jZo-00062d-UQ
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22: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=h924Qa06kvNAXF7arwPjGAii2Va+SWLBgpS4WXyYu5s=; b=mY6nIbb4PRx2WLNr8BEfHdmVdp
	J7c5TZq87gKbwO27mVT3CxbpaSIj/+eMIBHhzB84+DwqcioVkCEBPhWK4V9tc5LaZEPDc3hIdRAe6
	YJz4Sz7iLE7GG+vpHpSfWFqlHmzKW7eVWcsD6hzvypIRg71/9KeqiqyGFRyu9MIzkw10=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] VT-d: split domid map cleanup check into a function
Message-Id: <E1n5jZo-00062d-UQ@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:22:16 +0000

commit e3de2e89751149eef28efa8692c6ec238e42bc7e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:12:28 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:12:28 2022 +0100

    VT-d: split domid map cleanup check into a function
    
    This logic will want invoking from elsewhere.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9fdc10abe9457e4c9879a266f82372cb08e88ffb
    master date: 2021-11-24 11:06:20 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 89 ++++++++++++++++++++-----------------
 1 file changed, 47 insertions(+), 42 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index abe7ea5ac9..6e4829465a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -154,6 +154,51 @@ static void cleanup_domid_map(struct domain *domain, struct vtd_iommu *iommu)
     }
 }
 
+static bool any_pdev_behind_iommu(const struct domain *d,
+                                  const struct pci_dev *exclude,
+                                  const struct vtd_iommu *iommu)
+{
+    const struct pci_dev *pdev;
+
+    for_each_pdev ( d, pdev )
+    {
+        const struct acpi_drhd_unit *drhd;
+
+        if ( pdev == exclude )
+            continue;
+
+        drhd = acpi_find_matched_drhd_unit(pdev);
+        if ( drhd && drhd->iommu == iommu )
+            return true;
+    }
+
+    return false;
+}
+
+/*
+ * If no other devices under the same iommu owned by this domain,
+ * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
+ */
+static void check_cleanup_domid_map(struct domain *d,
+                                    const struct pci_dev *exclude,
+                                    struct vtd_iommu *iommu)
+{
+    bool found = any_pdev_behind_iommu(d, exclude, iommu);
+
+    /*
+     * Hidden devices are associated with DomXEN but usable by the hardware
+     * domain. Hence they need considering here as well.
+     */
+    if ( !found && is_hardware_domain(d) )
+        found = any_pdev_behind_iommu(dom_xen, exclude, iommu);
+
+    if ( !found )
+    {
+        clear_bit(iommu->index, &dom_iommu(d)->arch.vtd.iommu_bitmap);
+        cleanup_domid_map(d, iommu);
+    }
+}
+
 static void sync_cache(const void *addr, unsigned int size)
 {
     static unsigned long clflush_size = 0;
@@ -1657,27 +1702,6 @@ int domain_context_unmap_one(
     return rc;
 }
 
-static bool any_pdev_behind_iommu(const struct domain *d,
-                                  const struct pci_dev *exclude,
-                                  const struct vtd_iommu *iommu)
-{
-    const struct pci_dev *pdev;
-
-    for_each_pdev ( d, pdev )
-    {
-        const struct acpi_drhd_unit *drhd;
-
-        if ( pdev == exclude )
-            continue;
-
-        drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd && drhd->iommu == iommu )
-            return true;
-    }
-
-    return false;
-}
-
 static int domain_context_unmap(struct domain *domain, u8 devfn,
                                 struct pci_dev *pdev)
 {
@@ -1686,7 +1710,6 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
     int ret = 0;
     uint16_t seg = pdev->seg;
     uint8_t bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
-    bool found;
 
     drhd = acpi_find_matched_drhd_unit(pdev);
     if ( !drhd )
@@ -1764,26 +1787,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
         goto out;
     }
 
-    if ( ret )
-        goto out;
-
-    /*
-     * If no other devices under the same iommu owned by this domain,
-     * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
-     */
-    found = any_pdev_behind_iommu(domain, pdev, iommu);
-    /*
-     * Hidden devices are associated with DomXEN but usable by the hardware
-     * domain. Hence they need considering here as well.
-     */
-    if ( !found && is_hardware_domain(domain) )
-        found = any_pdev_behind_iommu(dom_xen, pdev, iommu);
-
-    if ( !found )
-    {
-        clear_bit(iommu->index, &dom_iommu(domain)->arch.vtd.iommu_bitmap);
-        cleanup_domid_map(domain, iommu);
-    }
+    if ( !ret )
+        check_cleanup_domid_map(domain, pdev, iommu);
 
 out:
     return ret;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:22:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:22:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254264.435936 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5ja0-0004XT-Dd; Fri, 07 Jan 2022 07:22:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254264.435936; Fri, 07 Jan 2022 07:22: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 1n5ja0-0004XK-AS; Fri, 07 Jan 2022 07:22:28 +0000
Received: by outflank-mailman (input) for mailman id 254264;
 Fri, 07 Jan 2022 07:22: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 1n5jZz-0004X3-3O
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22: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 1n5jZz-0002JQ-2b
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jZz-00063P-1Z
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22: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=D97RZFxVtKRVmMP2wbL/WjWEXZMIzfkzjunOr2mJ6nY=; b=NX1r4yS1Z0r0GT9zvAQHP24/nH
	w/3Od5rRhIysyXjCVZ+T43WI97VN+oSIaD2w9IezpwH9fTTsnB/N6qPPcNO/fN2rkVwAz5ejxvmMM
	nXFjC7nVOnlzbw7TwBB6KO2BTgVkrJ9pHXbM6eqUS89QWjo7pf5A2rl/hTqtBGzOp8Es=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] VT-d: don't leak domid mapping on error path
Message-Id: <E1n5jZz-00063P-1Z@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:22:27 +0000

commit c84755bb6cf1c416f15d3e16bbaa515a188dc7c6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:12:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:12:59 2022 +0100

    VT-d: don't leak domid mapping on error path
    
    While domain_context_mapping() invokes domain_context_unmap() in a sub-
    case of handling DEV_TYPE_PCI when encountering an error, thus avoiding
    a leak, individual calls to domain_context_mapping_one() aren't
    similarly covered. Such a leak might persist until domain destruction.
    Leverage that these cases can be recognized by pdev being non-NULL.
    
    Fixes: dec403cc668f ("VT-d: fix iommu_domid for PCI/PCIx devices assignment")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: e6252a51faf42c892eb5fc71f8a2617580832196
    master date: 2021-11-24 11:07:11 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 6e4829465a..8e20d032bc 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1505,7 +1505,12 @@ int domain_context_mapping_one(
         rc = me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
 
     if ( rc )
-        domain_context_unmap_one(domain, iommu, bus, devfn);
+    {
+        ret = domain_context_unmap_one(domain, iommu, bus, devfn);
+
+        if ( !ret && pdev && pdev->devfn == devfn )
+            check_cleanup_domid_map(domain, pdev, iommu);
+    }
 
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:22:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:22:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254265.435939 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jaA-0004bB-Ex; Fri, 07 Jan 2022 07:22:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254265.435939; Fri, 07 Jan 2022 07:22:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jaA-0004b3-Bz; Fri, 07 Jan 2022 07:22:38 +0000
Received: by outflank-mailman (input) for mailman id 254265;
 Fri, 07 Jan 2022 07:22:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5ja9-0004ak-6f
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5ja9-0002L7-5o
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5ja9-00064N-4u
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wbLKvzZ5xVOsKwh2v54s6iSCcaSLb2NEqT9ZL9KV7f8=; b=yfiovIk/rnB9WIsXXzgCoiCmna
	dg1ttzS1cC2OS6rvfrCC4a0hkk99yCdk4VLtvyM6df1nG3g5wFiU/a/SiazVoqr1US+6E2HHBzQPK
	tIgKC4LY5hK6yGNk6pidJk6NK8LsU42jThTZr+Wszt/fHa9elE72fq+q5gHdYBrr8xBQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/Viridian: fix error code use
Message-Id: <E1n5ja9-00064N-4u@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:22:37 +0000

commit bf3beeeb5a3cdfe0733fc71e848f404f09914a3c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:13:25 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:13:25 2022 +0100

    x86/Viridian: fix error code use
    
    Both the wrong use of HV_STATUS_* and the return type of
    hv_vpset_to_vpmask() can lead to viridian_hypercall()'s
    ASSERT_UNREACHABLE() triggering when translating error codes from Xen
    to Viridian representation.
    
    Fixes: b4124682db6e ("viridian: add ExProcessorMasks variants of the flush hypercalls")
    Fixes: 9afa867d42ba ("viridian: add ExProcessorMasks variant of the IPI hypercall")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: 857fee77845be0c5c35fd51bac64455369d32a6f
    master date: 2021-11-24 11:09:56 +0100
---
 xen/arch/x86/hvm/viridian/viridian.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index b906f7b86a..7d1cfc530b 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -628,8 +628,8 @@ static unsigned int hv_vpset_nr_banks(struct hv_vpset *vpset)
     return hweight64(vpset->valid_bank_mask);
 }
 
-static uint16_t hv_vpset_to_vpmask(const struct hv_vpset *set,
-                                   struct hypercall_vpmask *vpmask)
+static int hv_vpset_to_vpmask(const struct hv_vpset *set,
+                              struct hypercall_vpmask *vpmask)
 {
 #define NR_VPS_PER_BANK (HV_VPSET_BANK_SIZE * 8)
 
@@ -919,10 +919,10 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
          input_params.reserved_zero[0] ||
          input_params.reserved_zero[1] ||
          input_params.reserved_zero[2] )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     if ( input_params.vector < 0x10 || input_params.vector > 0xff )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     *set = input_params.set;
     if ( set->format == HV_GENERIC_SET_SPARSE_4K )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:22:49 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:22:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254266.435944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jaL-0004dz-GT; Fri, 07 Jan 2022 07:22:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254266.435944; Fri, 07 Jan 2022 07:22:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jaL-0004ds-DM; Fri, 07 Jan 2022 07:22:49 +0000
Received: by outflank-mailman (input) for mailman id 254266;
 Fri, 07 Jan 2022 07:22:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jaJ-0004de-9o
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jaJ-0002LH-93
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jaJ-000653-8F
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fTT6N/iQNUZZ90tLdrwhIuzBJc0W6xnYU0ZPf9F0ALs=; b=4bYyRIJlw8ILNsFN+LnHBTgXIF
	tB8ZT808RrpBTOZBaloL0sh8EytOa5At90tRZWHMcIoL56cdYMsnvo4ok2sxSAFpfuwgetcpO8eSC
	0ZU0o5Ps+ayh8ID+QsqUHBHRcAKZzDvXt6kvBho6t+1lG8rm5azA638fS1DflZ1IDIXk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
Message-Id: <E1n5jaJ-000653-8F@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:22:47 +0000

commit 78b382748015dbad7fea1c8f06c9d62fce585904
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:13:47 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:13:47 2022 +0100

    x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
    
    Just like (in protected mode) reads may not go to exec-only segments and
    writes may not go to non-writable ones, insn fetches may not access data
    segments.
    
    Fixes: 623e83716791 ("hvm: Support hardware task switching")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 311297f4216a4387bdae6df6cfbb1f5edb06618a
    master date: 2021-12-06 14:15:05 +0100
---
 xen/arch/x86/hvm/hvm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index f336ffa393..5be8aee4bb 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2530,6 +2530,9 @@ bool_t hvm_virtual_to_linear_addr(
      */
     ASSERT(seg < x86_seg_none);
 
+    /* However, check that insn fetches only ever specify CS. */
+    ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
+
     if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_PE) )
     {
         /*
@@ -2594,10 +2597,17 @@ bool_t hvm_virtual_to_linear_addr(
                 if ( (reg->type & 0xa) == 0x8 )
                     goto out; /* execute-only code segment */
                 break;
+
             case hvm_access_write:
                 if ( (reg->type & 0xa) != 0x2 )
                     goto out; /* not a writable data segment */
                 break;
+
+            case hvm_access_insn_fetch:
+                if ( !(reg->type & 0x8) )
+                    goto out; /* not a code segment */
+                break;
+
             default:
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:22:59 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:22:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254267.435947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jaV-0004gc-Hm; Fri, 07 Jan 2022 07:22:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254267.435947; Fri, 07 Jan 2022 07:22:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jaV-0004gV-Ey; Fri, 07 Jan 2022 07:22:59 +0000
Received: by outflank-mailman (input) for mailman id 254267;
 Fri, 07 Jan 2022 07:22:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jaT-0004gD-Cq
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jaT-0002LU-C5
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jaT-000666-BD
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:22:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ioezRTNnHS2R867TfLYwzv7ZB8zIjwGQn/n5gqWpjrA=; b=E/krXa0FLRu7OXQnpTeSTKx0HB
	tzNIziyXVuZ5Tlt1Mmg54Ur/c2o989G2+pkN9Jx1UMvGwWu62DoRaSifokuxlKozW0kVf749crBU/
	hi7W2Ck44B6PSHN2edpMeydqSKCnLkgtfox8B3lq6fri6nfV3QCS3DdCXVJ9CTPC2n0g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86: avoid wrong use of all-but-self IPI shorthand
Message-Id: <E1n5jaT-000666-BD@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:22:57 +0000

commit 12c6ce12a1996df1e53ee1f35e1b6132771256f3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:14:13 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:14:13 2022 +0100

    x86: avoid wrong use of all-but-self IPI shorthand
    
    With "nosmp" I did observe a flood of "APIC error on CPU0: 04(04), Send
    accept error" log messages on an AMD system. And rightly so - nothing
    excludes the use of the shorthand in send_IPI_mask() in this case. Set
    "unaccounted_cpus" to "true" also when command line restrictions are the
    cause.
    
    Note that PV-shim mode is unaffected by this change, first and foremost
    because "nosmp" and "maxcpus=" are ignored in this case.
    
    Fixes: 5500d265a2a8 ("x86/smp: use APIC ALLBUT destination shorthand when possible")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 7621880de0bb40bae6436a5b106babc0e4718f4d
    master date: 2021-12-10 10:26:52 +0100
---
 xen/arch/x86/mpparse.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index dff02b142b..91fa580831 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -85,9 +85,14 @@ void __init set_nr_cpu_ids(unsigned int max_cpus)
 	if (!park_offline_cpus)
 		tot_cpus = max_cpus;
 	nr_cpu_ids = min(tot_cpus, NR_CPUS + 0u);
-	if (park_offline_cpus && nr_cpu_ids < num_processors)
-		printk(XENLOG_WARNING "SMP: Cannot bring up %u further CPUs\n",
-		       num_processors - nr_cpu_ids);
+	if (nr_cpu_ids < num_processors)
+	{
+		unaccounted_cpus = true;
+		if (park_offline_cpus)
+			printk(XENLOG_WARNING
+			       "SMP: Cannot bring up %u further CPUs\n",
+			       num_processors - nr_cpu_ids);
+	}
 
 #ifndef nr_cpumask_bits
 	nr_cpumask_bits = ROUNDUP(nr_cpu_ids, BITS_PER_LONG);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:23:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:23:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254268.435952 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jae-0004j3-JQ; Fri, 07 Jan 2022 07:23:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254268.435952; Fri, 07 Jan 2022 07:23: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 1n5jae-0004iv-GV; Fri, 07 Jan 2022 07:23:08 +0000
Received: by outflank-mailman (input) for mailman id 254268;
 Fri, 07 Jan 2022 07:23: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 1n5jad-0004in-G2
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jad-0002Lu-FH
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jad-00067I-EK
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/+d6SwpQJG4IW3K/RVpTwfbCTHbzj3h3E5vDWUWGNwk=; b=KF/wyShFCkiSBDvD3F0K5dTZPO
	kJK1X2wh0/5MydijHxXQo8zJ3az/LyV4pcnzuD6a80lPSN/0wv02vMOxqf2zVEE4OH9ztnK2AXgEP
	R5UmKKhrCuDXhCgPqMMFBRLIJbN1hUCLki6Fy3zFQBPXzPNBcNes0Pyes6QoldSDoyyk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
Message-Id: <E1n5jad-00067I-EK@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:23:07 +0000

commit 2204d51e3140d3261675c44c548056a7dd209467
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:14:41 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:14:41 2022 +0100

    x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
    
    Both SDM and PM explicitly permit this.
    
    Fixes: 52dba7bd0b36 ("x86emul: generalize wbinvd() hook")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Paul Durrant <paul@xen.org>
    master commit: df3e1a5efe700a9f59eced801cac73f9fd02a0e2
    master date: 2021-12-10 14:03:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 425c8ddd97..76a2ccfafe 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2310,7 +2310,9 @@ static int hvmemul_cache_op(
         ASSERT(!is_x86_system_segment(seg));
 
         rc = hvmemul_virtual_to_linear(seg, offset, 0, NULL,
-                                       hvm_access_read, hvmemul_ctxt, &addr);
+                                       op != x86emul_clwb ? hvm_access_none
+                                                          : hvm_access_read,
+                                       hvmemul_ctxt, &addr);
         if ( rc != X86EMUL_OKAY )
             break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:23:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:23:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254269.435956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jao-0004ma-MY; Fri, 07 Jan 2022 07:23:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254269.435956; Fri, 07 Jan 2022 07:23: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 1n5jao-0004mS-Jc; Fri, 07 Jan 2022 07:23:18 +0000
Received: by outflank-mailman (input) for mailman id 254269;
 Fri, 07 Jan 2022 07:23: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 1n5jan-0004mJ-Jb
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23: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 1n5jan-0002M7-Ip
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jan-00068S-Hw
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23: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=ibgxp/YwH+YQ+YdKWV9rgyL3hANxC5dtDcMP38RdIoo=; b=QKlctsjSOrAAd1+SIlodsMe+XA
	8K/rfencGbR1m4TD16LPb2bOqalCLi9g3KvHuCxAFRdK8bp7zn288CfJZunhy+qLvshFtlul0QRui
	yC6rUay2kvMIOmPOVty6i+Fk2vfWOT7FH8ozK8uC5uBW8Xzu0yZ4cQzw28qFZSjdotmk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/cpuid: Fix TSXLDTRK definition
Message-Id: <E1n5jan-00068S-Hw@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:23:17 +0000

commit c8260b3d3811983916c332d5d51b67807d77a8dc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 7 08:15:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:15:05 2022 +0100

    x86/cpuid: Fix TSXLDTRK definition
    
    TSXLDTRK lives in CPUID leaf 7[0].edx, not 7[0].ecx.
    
    Bit 16 in ecx is LA57.
    
    Fixes: a6d1b558471f ("x86emul: support X{SUS,RES}LDTRK")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 249e0f1d8f203188ccdcced5a05c2149739e1566
    master date: 2021-12-14 12:30:48 +0000
---
 tools/libs/light/libxl_cpuid.c              | 2 +-
 tools/misc/xen-cpuid.c                      | 3 +--
 xen/arch/x86/x86_emulate/x86_emulate.c      | 2 +-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index aa6a6a5f4b..6e094dfacc 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -209,7 +209,6 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-vnni",  0x00000007,  0, CPUID_REG_ECX, 11,  1},
         {"avx512-bitalg",0x00000007,  0, CPUID_REG_ECX, 12,  1},
         {"avx512-vpopcntdq",0x00000007,0,CPUID_REG_ECX, 14,  1},
-        {"tsxldtrk",     0x00000007,  0, CPUID_REG_ECX, 16,  1},
         {"rdpid",        0x00000007,  0, CPUID_REG_ECX, 22,  1},
         {"cldemote",     0x00000007,  0, CPUID_REG_ECX, 25,  1},
 
@@ -219,6 +218,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
+        {"tsxldtrk",     0x00000007,  0, CPUID_REG_EDX, 16,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 47c75031d1..b9fb918cdd 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -128,7 +128,6 @@ static const char *const str_7c0[32] =
     [10] = "vpclmulqdq",       [11] = "avx512-vnni",
     [12] = "avx512-bitalg",
     [14] = "avx512-vpopcntdq",
-    [16] = "tsxldtrk",
 
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
@@ -170,7 +169,7 @@ static const char *const str_7d0[32] =
     [10] = "md-clear",            [11] = "rtm-always-abort",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
-
+    [16] = "tsxldtrk",
     [18] = "pconfig",
     [20] = "cet-ibt",
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index dc281971ee..0f7f97cd1c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2000,7 +2000,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_vnni() (ctxt->cpuid->feat.avx512_vnni)
 #define vcpu_has_avx512_bitalg() (ctxt->cpuid->feat.avx512_bitalg)
 #define vcpu_has_avx512_vpopcntdq() (ctxt->cpuid->feat.avx512_vpopcntdq)
-#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_rdpid()       (ctxt->cpuid->feat.rdpid)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
@@ -2009,6 +2008,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_avx512_vp2intersect() (ctxt->cpuid->feat.avx512_vp2intersect)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
+#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_avx_vnni()    (ctxt->cpuid->feat.avx_vnni)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index ec2706fe2e..496582feff 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -239,7 +239,6 @@ XEN_CPUFEATURE(VPCLMULQDQ,    6*32+10) /*A  Vector Carry-less Multiplication Ins
 XEN_CPUFEATURE(AVX512_VNNI,   6*32+11) /*A  Vector Neural Network Instrs */
 XEN_CPUFEATURE(AVX512_BITALG, 6*32+12) /*A  Support for VPOPCNT[B,W] and VPSHUFBITQMB */
 XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
-XEN_CPUFEATURE(TSXLDTRK,      6*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
@@ -276,6 +275,7 @@ XEN_CPUFEATURE(MD_CLEAR,      9*32+10) /*A  VERW clears microarchitectural buffe
 XEN_CPUFEATURE(RTM_ALWAYS_ABORT, 9*32+11) /*! June 2021 TSX defeaturing in microcode. */
 XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*a  SERIALIZE insn */
+XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:23:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:23:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254270.435960 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jay-0004ox-O3; Fri, 07 Jan 2022 07:23:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254270.435960; Fri, 07 Jan 2022 07:23: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 1n5jay-0004op-L8; Fri, 07 Jan 2022 07:23:28 +0000
Received: by outflank-mailman (input) for mailman id 254270;
 Fri, 07 Jan 2022 07:23: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 1n5jax-0004of-MO
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23: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 1n5jax-0002MU-Lg
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jax-00069Q-Kr
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23: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=3OTPHqM12Bdo1C2oFHngey/ytPlAJ4St3t3jyfvq2gU=; b=vz59+4wYi6pGCrStwsp/3uOHUL
	f5zf26dBiNAvyw8h0PrAN5rHMqlALgHwh4H/6um29zwM7+K4P+1z8eIkh0GfMnn2PFLk67dEoQ8CO
	lgDl9BW2PMGwru1ZeZ837+C9+dMOkHAHBWc6f5uLuPDDRhWyFVpX6tsVa2QxA54pdZ0Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
Message-Id: <E1n5jax-00069Q-Kr@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:23:27 +0000

commit 467f98a0e0733495ffe0d18bb4ac8e1dee65d19b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:15:40 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:15:40 2022 +0100

    revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
    
    This reverts commit c22bd567ce22f6ad9bd93318ad0d7fd1c2eadb0d.
    
    While its description is correct from an abstract or real hardware pov,
    the range is special inside HVM guests. The range being UC in particular
    gets in the way of OVMF, which places itself at [FFE00000,FFFFFFFF].
    While this is benign to epte_get_entry_emt() as long as the IOMMU isn't
    enabled for a guest, it becomes a very noticable problem otherwise: It
    takes about half a minute for OVMF to decompress itself into its
    designated address range.
    
    And even beyond OVMF there's no reason to have e.g. the ACPI memory
    range marked UC.
    
    Fixes: c22bd567ce22 ("hvmloader: PA range 0xfc000000-0xffffffff should be UC")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ea187c0b7a73c26258c0e91e4f3656989804555f
    master date: 2021-12-17 08:56:15 +0100
---
 tools/firmware/hvmloader/cacheattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/hvmloader/cacheattr.c b/tools/firmware/hvmloader/cacheattr.c
index 1ac6656c70..1c67819748 100644
--- a/tools/firmware/hvmloader/cacheattr.c
+++ b/tools/firmware/hvmloader/cacheattr.c
@@ -98,12 +98,12 @@ void cacheattr_init(void)
     {
         uint64_t base = pci_mem_start, size;
 
-        for ( i = 0; !(base >> 32) && (i < nr_var_ranges); i++ )
+        for ( i = 0; (base != pci_mem_end) && (i < nr_var_ranges); i++ )
         {
             size = PAGE_SIZE;
             while ( !(base & size) )
                 size <<= 1;
-            while ( ((base + size) < base) || ((base + size - 1) >> 32) )
+            while ( ((base + size) < base) || ((base + size) > pci_mem_end) )
                 size >>= 1;
 
             wrmsr(MSR_MTRRphysBase(i), base);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:23:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:23:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254271.435964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jb8-0004sI-Pb; Fri, 07 Jan 2022 07:23:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254271.435964; Fri, 07 Jan 2022 07:23:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5jb8-0004sA-Me; Fri, 07 Jan 2022 07:23:38 +0000
Received: by outflank-mailman (input) for mailman id 254271;
 Fri, 07 Jan 2022 07:23:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jb7-0004s0-Pc
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jb7-0002MY-Oq
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5jb7-0006AG-Nu
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:23:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mjeP4Sxv2OGY5GFNhFMqWvxJZPsvXcLd4fyW8UkZevA=; b=QY1dYur7b6mnYr8/pMASmu6StQ
	uHbaxGDAli3hZhGyy5si7m2dHPCq5r5SfQSBB4QcUwm1ANjaSYpcFtYGzzmLrtBBWz7K3+ZZ0vYjb
	Hj8iKtq0smajMdp2AEpeA5X5uyEwEAmTOslm0h7IgqS9aGE1Qvft7QX5kDWqR5C3lIDM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/spec-ctrl: Fix default calculation of opt_srb_lock
Message-Id: <E1n5jb7-0006AG-Nu@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:23:37 +0000

commit a763f8f158e81158bdf2470dbc3d98353f2322e2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 7 08:16:03 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:16:03 2022 +0100

    x86/spec-ctrl: Fix default calculation of opt_srb_lock
    
    Since this logic was introduced, opt_tsx has become more complicated and
    shouldn't be compared to 0 directly.  While there are no buggy logic paths,
    the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
    easier and clearer to use.
    
    Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31f3bc97f4508687215e459a5e35676eecf1772b
    master date: 2022-01-05 09:44:26 +0000
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 7e0c171dc8..f70535b6e7 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1197,7 +1197,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:55:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254273.435968 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k5a-0007b9-2g; Fri, 07 Jan 2022 07:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254273.435968; Fri, 07 Jan 2022 07:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k5Z-0007b1-Vx; Fri, 07 Jan 2022 07:55:05 +0000
Received: by outflank-mailman (input) for mailman id 254273;
 Fri, 07 Jan 2022 07:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5Y-0007au-Sd
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5Y-0002uh-MT
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5Y-0008SZ-LU
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pigGRJONuyf8lKsVHjtMfL6SQC1iR63NGtSqKerr7qc=; b=J5ZSydkcqsioC+uCgbMTdJ91OC
	Pax2igZJdV3nKGK2BITaGs9DKiz411jXQ/4GwaTihkLypM7PvdIlJbi0iFzVBic8Uug6pY0Odo0xE
	7o8uvsAuAki1cSRjWRO2fmw44R7EglRrKz0c8/7MhPv1o8YyXU2AKaH6f0lqsDv5uKbw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] efi: fix alignment of function parameters in compat mode
Message-Id: <E1n5k5Y-0008SZ-LU@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:55:04 +0000

commit a51f2df5dc4db6e839817a373ce956b880cdf4ce
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Jan 7 08:50:22 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:50:22 2022 +0100

    efi: fix alignment of function parameters in compat mode
    
    Currently the max_store_size, remain_store_size and max_size in
    compat_pf_efi_runtime_call are 4 byte aligned, which makes clang
    13.0.0 complain with:
    
    In file included from compat.c:30:
    ./runtime.c:646:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 2 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.max_store_size,
                ^
    ./runtime.c:647:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 3 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.remain_store_size,
                ^
    ./runtime.c:648:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 4 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.max_size);
                ^
    Fix this by bouncing the variables on the stack in order for them to
    be 8 byte aligned.
    
    Note this could be done in a more selective manner to only apply to
    compat code calls, but given the overhead of making an EFI call doing
    an extra copy of 3 variables doesn't seem to warrant the special
    casing.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: be12fcca8b784e456df3adedbffe657d753c5ff9
    master date: 2021-11-19 17:01:24 +0000
---
 xen/common/efi/runtime.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 95367694b5..bbcc756f57 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -607,6 +607,9 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
     break;
 
     case XEN_EFI_query_variable_info:
+    {
+        uint64_t max_store_size, remain_store_size, max_size;
+
         if ( op->misc & ~XEN_EFI_VARINFO_BOOT_SNAPSHOT )
             return -EINVAL;
 
@@ -638,16 +641,36 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
 
         if ( !efi_enabled(EFI_RS) || (efi_rs->Hdr.Revision >> 16) < 2 )
             return -EOPNOTSUPP;
+
+        /*
+         * Bounce the variables onto the stack to make them 8 byte aligned when
+         * called from the compat handler, as their placement in
+         * compat_pf_efi_runtime_call will make them 4 byte aligned instead and
+         * and compilers may validly complain.
+         *
+         * Note that while the function parameters are OUT only, copy the
+         * values here anyway just in case. This is done regardless of whether
+         * called from the compat handler or not, as it's not worth the extra
+         * logic to differentiate.
+         */
+        max_store_size = op->u.query_variable_info.max_store_size;
+        remain_store_size = op->u.query_variable_info.remain_store_size;
+        max_size = op->u.query_variable_info.max_size;
+
         state = efi_rs_enter();
         if ( !state.cr3 )
             return -EOPNOTSUPP;
         status = efi_rs->QueryVariableInfo(
-            op->u.query_variable_info.attr,
-            &op->u.query_variable_info.max_store_size,
-            &op->u.query_variable_info.remain_store_size,
-            &op->u.query_variable_info.max_size);
+            op->u.query_variable_info.attr, &max_store_size, &remain_store_size,
+            &max_size);
         efi_rs_leave(&state);
+
+        op->u.query_variable_info.max_store_size = max_store_size;
+        op->u.query_variable_info.remain_store_size = remain_store_size;
+        op->u.query_variable_info.max_size = max_size;
+
         break;
+    }
 
     case XEN_EFI_query_capsule_capabilities:
     case XEN_EFI_update_capsule:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254274.435972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k5k-0007dK-4H; Fri, 07 Jan 2022 07:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254274.435972; Fri, 07 Jan 2022 07:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k5k-0007dC-1A; Fri, 07 Jan 2022 07:55:16 +0000
Received: by outflank-mailman (input) for mailman id 254274;
 Fri, 07 Jan 2022 07:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5i-0007cu-RN
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5i-0002uo-Qa
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5i-0008TI-Oq
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kfI35aAKhyD/nagC3iRGzbwbrjis4bPpeaCNv8NJLz0=; b=e7Q3Oj+QVfWA0tdn1XfF2txnL9
	YjtVFpY72XU9KpGQGIoi9M+Ayhggvo5Fh8FsCJJamY2c1SypwG+WqDUJsxZKPoWH0555y0pmZl9HN
	XfuT3s2h2BoUEmEAO8TKmCrjLdP1jo8hr9dCqkeVySfKrHblcKf7yURSDpLBDx/JCI2U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] VT-d: split domid map cleanup check into a function
Message-Id: <E1n5k5i-0008TI-Oq@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:55:14 +0000

commit 992ba6df206d2f22f71fd5f7fbf834729ec05726
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:51:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:51:05 2022 +0100

    VT-d: split domid map cleanup check into a function
    
    This logic will want invoking from elsewhere.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9fdc10abe9457e4c9879a266f82372cb08e88ffb
    master date: 2021-11-24 11:06:20 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 89 ++++++++++++++++++++-----------------
 1 file changed, 47 insertions(+), 42 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 870996abdb..59809bba7f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -153,6 +153,51 @@ static void cleanup_domid_map(struct domain *domain, struct vtd_iommu *iommu)
     }
 }
 
+static bool any_pdev_behind_iommu(const struct domain *d,
+                                  const struct pci_dev *exclude,
+                                  const struct vtd_iommu *iommu)
+{
+    const struct pci_dev *pdev;
+
+    for_each_pdev ( d, pdev )
+    {
+        const struct acpi_drhd_unit *drhd;
+
+        if ( pdev == exclude )
+            continue;
+
+        drhd = acpi_find_matched_drhd_unit(pdev);
+        if ( drhd && drhd->iommu == iommu )
+            return true;
+    }
+
+    return false;
+}
+
+/*
+ * If no other devices under the same iommu owned by this domain,
+ * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
+ */
+static void check_cleanup_domid_map(struct domain *d,
+                                    const struct pci_dev *exclude,
+                                    struct vtd_iommu *iommu)
+{
+    bool found = any_pdev_behind_iommu(d, exclude, iommu);
+
+    /*
+     * Hidden devices are associated with DomXEN but usable by the hardware
+     * domain. Hence they need considering here as well.
+     */
+    if ( !found && is_hardware_domain(d) )
+        found = any_pdev_behind_iommu(dom_xen, exclude, iommu);
+
+    if ( !found )
+    {
+        clear_bit(iommu->index, &dom_iommu(d)->arch.iommu_bitmap);
+        cleanup_domid_map(d, iommu);
+    }
+}
+
 static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
@@ -1674,27 +1719,6 @@ int domain_context_unmap_one(
     return rc;
 }
 
-static bool any_pdev_behind_iommu(const struct domain *d,
-                                  const struct pci_dev *exclude,
-                                  const struct vtd_iommu *iommu)
-{
-    const struct pci_dev *pdev;
-
-    for_each_pdev ( d, pdev )
-    {
-        const struct acpi_drhd_unit *drhd;
-
-        if ( pdev == exclude )
-            continue;
-
-        drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd && drhd->iommu == iommu )
-            return true;
-    }
-
-    return false;
-}
-
 static int domain_context_unmap(struct domain *domain, u8 devfn,
                                 struct pci_dev *pdev)
 {
@@ -1703,7 +1727,6 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
     int ret = 0;
     uint16_t seg = pdev->seg;
     uint8_t bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
-    bool found;
 
     drhd = acpi_find_matched_drhd_unit(pdev);
     if ( !drhd )
@@ -1784,26 +1807,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
         goto out;
     }
 
-    if ( ret )
-        goto out;
-
-    /*
-     * If no other devices under the same iommu owned by this domain,
-     * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
-     */
-    found = any_pdev_behind_iommu(domain, pdev, iommu);
-    /*
-     * Hidden devices are associated with DomXEN but usable by the hardware
-     * domain. Hence they need considering here as well.
-     */
-    if ( !found && is_hardware_domain(domain) )
-        found = any_pdev_behind_iommu(dom_xen, pdev, iommu);
-
-    if ( !found )
-    {
-        clear_bit(iommu->index, &dom_iommu(domain)->arch.iommu_bitmap);
-        cleanup_domid_map(domain, iommu);
-    }
+    if ( !ret )
+        check_cleanup_domid_map(domain, pdev, iommu);
 
 out:
     return ret;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254275.435975 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k5u-0007gQ-5t; Fri, 07 Jan 2022 07:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254275.435975; Fri, 07 Jan 2022 07:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k5u-0007gI-2i; Fri, 07 Jan 2022 07:55:26 +0000
Received: by outflank-mailman (input) for mailman id 254275;
 Fri, 07 Jan 2022 07:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5s-0007g2-Uk
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5s-0002vM-Tt
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k5s-0008U6-Sx
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sGl9jbUgxu4ZJx+m1RLzyf6fSIJrO2tvMfAxXTcUitE=; b=iJDL8IJbdOltkuMkVBWAveoUBn
	+eN+5HR5EPeWjU96CFmTr/N59me3/oKQlm6npgD8PvbthASdGjKL1Q5QJ41kvvuhUkTKIRLeu+stV
	Tlu0Ye+/JkMpBChY706O/l+OOZyCw/F4gYHGsUHnzUV8aRaAQHYjJFCf0ObpArupMKCc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] VT-d: don't leak domid mapping on error path
Message-Id: <E1n5k5s-0008U6-Sx@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:55:24 +0000

commit fb9177385357bd0856692a6aa9c1513468281ae1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:51:27 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:51:27 2022 +0100

    VT-d: don't leak domid mapping on error path
    
    While domain_context_mapping() invokes domain_context_unmap() in a sub-
    case of handling DEV_TYPE_PCI when encountering an error, thus avoiding
    a leak, individual calls to domain_context_mapping_one() aren't
    similarly covered. Such a leak might persist until domain destruction.
    Leverage that these cases can be recognized by pdev being non-NULL.
    
    Fixes: dec403cc668f ("VT-d: fix iommu_domid for PCI/PCIx devices assignment")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: e6252a51faf42c892eb5fc71f8a2617580832196
    master date: 2021-11-24 11:07:11 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 59809bba7f..ce3e511ef7 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1518,7 +1518,12 @@ int domain_context_mapping_one(
         rc = me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
 
     if ( rc )
-        domain_context_unmap_one(domain, iommu, bus, devfn);
+    {
+        ret = domain_context_unmap_one(domain, iommu, bus, devfn);
+
+        if ( !ret && pdev && pdev->devfn == devfn )
+            check_cleanup_domid_map(domain, pdev, iommu);
+    }
 
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:55:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254276.435980 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k64-0007jk-9M; Fri, 07 Jan 2022 07:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254276.435980; Fri, 07 Jan 2022 07:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k64-0007jc-6O; Fri, 07 Jan 2022 07:55:36 +0000
Received: by outflank-mailman (input) for mailman id 254276;
 Fri, 07 Jan 2022 07:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k63-0007jP-23
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k63-0002vd-1G
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k63-0008Us-0J
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NzdlD3sm01YkRuimtjfOG00dpzNG+sAbZ3cf+v7YC60=; b=GmoH4gY6fR2PGEu2zGfopdqqUH
	vQ5gpdyGRMVaFBzppmVO9rX4pAmDlwfmbLYDToV3o7OejBwNdzDfuP9Eq3iWWyccQ5SsRJgm4bMci
	JVlPdbr7IdwLgt0WdqovfNZYSJ6Y9nQmRUrGSMioRmg9Zgr3A2y24Jqf0QmvfaQ8brdE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
Message-Id: <E1n5k63-0008Us-0J@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:55:35 +0000

commit d8cf50574bd307f5f8a82ab3ee8e0fdab14cd09f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:51:51 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:51:51 2022 +0100

    x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
    
    Just like (in protected mode) reads may not go to exec-only segments and
    writes may not go to non-writable ones, insn fetches may not access data
    segments.
    
    Fixes: 623e83716791 ("hvm: Support hardware task switching")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 311297f4216a4387bdae6df6cfbb1f5edb06618a
    master date: 2021-12-06 14:15:05 +0100
---
 xen/arch/x86/hvm/hvm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5b7e494ca3..89926a5bf6 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2530,6 +2530,9 @@ bool_t hvm_virtual_to_linear_addr(
      */
     ASSERT(seg < x86_seg_none);
 
+    /* However, check that insn fetches only ever specify CS. */
+    ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
+
     if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_PE) )
     {
         /*
@@ -2594,10 +2597,17 @@ bool_t hvm_virtual_to_linear_addr(
                 if ( (reg->type & 0xa) == 0x8 )
                     goto out; /* execute-only code segment */
                 break;
+
             case hvm_access_write:
                 if ( (reg->type & 0xa) != 0x2 )
                     goto out; /* not a writable data segment */
                 break;
+
+            case hvm_access_insn_fetch:
+                if ( !(reg->type & 0x8) )
+                    goto out; /* not a code segment */
+                break;
+
             default:
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:55:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254277.435984 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6E-0007mm-Az; Fri, 07 Jan 2022 07:55:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254277.435984; Fri, 07 Jan 2022 07:55: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 1n5k6E-0007md-7w; Fri, 07 Jan 2022 07:55:46 +0000
Received: by outflank-mailman (input) for mailman id 254277;
 Fri, 07 Jan 2022 07:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6D-0007mS-5A
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6D-0002vn-4O
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6D-0008Vb-3Q
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oSeVokAzmASBgauOSwPTJ0kSQva+pJkzi27nCOASkN4=; b=CHKXoqaYCSBzwVH3UF3PgZU/4G
	IrsUA+zF+mktyJUZ00AFxksliQbLZNuOto0wIZJt4XP8SkTq2XyMz+pyg4E9BSqopErmC16PUdamN
	DI9dGZYnzVjFBuRZkwSFdylqJNW0ngzs+t4ZJjj1kSkoHXjxA1WM/Qxb2zDtCD3O4CCE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86: avoid wrong use of all-but-self IPI shorthand
Message-Id: <E1n5k6D-0008Vb-3Q@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:55:45 +0000

commit 160bddfafbc7c1ca1954ae377c5d18da6b2b3a43
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:52:18 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:52:18 2022 +0100

    x86: avoid wrong use of all-but-self IPI shorthand
    
    With "nosmp" I did observe a flood of "APIC error on CPU0: 04(04), Send
    accept error" log messages on an AMD system. And rightly so - nothing
    excludes the use of the shorthand in send_IPI_mask() in this case. Set
    "unaccounted_cpus" to "true" also when command line restrictions are the
    cause.
    
    Note that PV-shim mode is unaffected by this change, first and foremost
    because "nosmp" and "maxcpus=" are ignored in this case.
    
    Fixes: 5500d265a2a8 ("x86/smp: use APIC ALLBUT destination shorthand when possible")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 7621880de0bb40bae6436a5b106babc0e4718f4d
    master date: 2021-12-10 10:26:52 +0100
---
 xen/arch/x86/mpparse.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index d532575fee..3e0ec3c61e 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -85,9 +85,14 @@ void __init set_nr_cpu_ids(unsigned int max_cpus)
 	if (!park_offline_cpus)
 		tot_cpus = max_cpus;
 	nr_cpu_ids = min(tot_cpus, NR_CPUS + 0u);
-	if (park_offline_cpus && nr_cpu_ids < num_processors)
-		printk(XENLOG_WARNING "SMP: Cannot bring up %u further CPUs\n",
-		       num_processors - nr_cpu_ids);
+	if (nr_cpu_ids < num_processors)
+	{
+		unaccounted_cpus = true;
+		if (park_offline_cpus)
+			printk(XENLOG_WARNING
+			       "SMP: Cannot bring up %u further CPUs\n",
+			       num_processors - nr_cpu_ids);
+	}
 
 #ifndef nr_cpumask_bits
 	nr_cpumask_bits = ROUNDUP(nr_cpu_ids, BITS_PER_LONG);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:55:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:55:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254278.435988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6O-0007pV-CH; Fri, 07 Jan 2022 07:55:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254278.435988; Fri, 07 Jan 2022 07:55:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6O-0007pN-9P; Fri, 07 Jan 2022 07:55:56 +0000
Received: by outflank-mailman (input) for mailman id 254278;
 Fri, 07 Jan 2022 07:55:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6N-0007pC-8Q
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6N-0002vx-7e
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6N-0008WD-6g
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=64KFTmKldW2XdJCN22u/iYj0WW+B5HtLlKEUvlCNkwA=; b=pDgG4NDG9rjJMuHepfwTVDqg1z
	o6sNk3YWO5u5Q9iwDJFqNYEySUpnIcrqmTRyFGGGjRodmP6B2UqG1ROGgSuW+Hx/Dhwqyu/bHzxlZ
	L9AV6gKYPToZlCMM/bk88dTh+fDwQYedfeOF9cwdWgrvWzJeYoIsIcSsNMxZevdU5Iyw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
Message-Id: <E1n5k6N-0008WD-6g@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:55:55 +0000

commit 4ebd423a528b3e85aa10b701f8326e16f1e7c352
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:52:48 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:52:48 2022 +0100

    x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
    
    Both SDM and PM explicitly permit this.
    
    Fixes: 52dba7bd0b36 ("x86emul: generalize wbinvd() hook")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Paul Durrant <paul@xen.org>
    master commit: df3e1a5efe700a9f59eced801cac73f9fd02a0e2
    master date: 2021-12-10 14:03:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 24cf85fb4f..ee940c33ca 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2310,7 +2310,9 @@ static int hvmemul_cache_op(
         ASSERT(!is_x86_system_segment(seg));
 
         rc = hvmemul_virtual_to_linear(seg, offset, 0, NULL,
-                                       hvm_access_read, hvmemul_ctxt, &addr);
+                                       op != x86emul_clwb ? hvm_access_none
+                                                          : hvm_access_read,
+                                       hvmemul_ctxt, &addr);
         if ( rc != X86EMUL_OKAY )
             break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:56:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:56:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254279.435992 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6Y-0007sL-De; Fri, 07 Jan 2022 07:56:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254279.435992; Fri, 07 Jan 2022 07:56:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6Y-0007sD-Am; Fri, 07 Jan 2022 07:56:06 +0000
Received: by outflank-mailman (input) for mailman id 254279;
 Fri, 07 Jan 2022 07:56:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6X-0007s5-C6
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6X-0002wP-BK
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6X-00007A-AR
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OS7HE39Of9/lhxtt4Vrs79H70sqYd0j5T4s8FumAG5Y=; b=rmy0Ez+EMrEGKAp0AjP217n/Ap
	JPbPZ3b0xzLQqH4G9I+uw2EcJNLdRQl74EOgw12QNaxEFoSdarzY02vumcUZ0+k7Af3uPtvn5z+6R
	ZsCp11feLev/Q7X/SyNbIurQdJcZspCMLcpFR/RGKzNJh4ncsr3uRlPvIIPE9vloC/Yc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/cpuid: Fix TSXLDTRK definition
Message-Id: <E1n5k6X-00007A-AR@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:56:05 +0000

commit cc645375f69ce99c834025ca1a7387899c9d6e9e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 7 08:53:12 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:53:12 2022 +0100

    x86/cpuid: Fix TSXLDTRK definition
    
    TSXLDTRK lives in CPUID leaf 7[0].edx, not 7[0].ecx.
    
    Bit 16 in ecx is LA57.
    
    Fixes: a6d1b558471f ("x86emul: support X{SUS,RES}LDTRK")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 249e0f1d8f203188ccdcced5a05c2149739e1566
    master date: 2021-12-14 12:30:48 +0000
---
 tools/libxl/libxl_cpuid.c                   | 2 +-
 tools/misc/xen-cpuid.c                      | 3 +--
 xen/arch/x86/x86_emulate/x86_emulate.c      | 2 +-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index fd63f606c8..ce93c5a796 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -208,7 +208,6 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-vnni",  0x00000007,  0, CPUID_REG_ECX, 11,  1},
         {"avx512-bitalg",0x00000007,  0, CPUID_REG_ECX, 12,  1},
         {"avx512-vpopcntdq",0x00000007,0,CPUID_REG_ECX, 14,  1},
-        {"tsxldtrk",     0x00000007,  0, CPUID_REG_ECX, 16,  1},
         {"rdpid",        0x00000007,  0, CPUID_REG_ECX, 22,  1},
         {"cldemote",     0x00000007,  0, CPUID_REG_ECX, 25,  1},
 
@@ -217,6 +216,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
+        {"tsxldtrk",     0x00000007,  0, CPUID_REG_EDX, 16,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index a1d675da0f..0056baf666 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -128,7 +128,6 @@ static const char *const str_7c0[32] =
     [10] = "vpclmulqdq",       [11] = "avx512_vnni",
     [12] = "avx512_bitalg",
     [14] = "avx512_vpopcntdq",
-    [16] = "tsxldtrk",
 
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
@@ -170,7 +169,7 @@ static const char *const str_7d0[32] =
     [10] = "md-clear",      [11] = "rtm-always-abort",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
-
+    [16] = "tsxldtrk",
     [18] = "pconfig",
     [20] = "cet-ibt",
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index de46ec1b44..e9216c40ff 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1999,7 +1999,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_vnni() (ctxt->cpuid->feat.avx512_vnni)
 #define vcpu_has_avx512_bitalg() (ctxt->cpuid->feat.avx512_bitalg)
 #define vcpu_has_avx512_vpopcntdq() (ctxt->cpuid->feat.avx512_vpopcntdq)
-#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_rdpid()       (ctxt->cpuid->feat.rdpid)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
@@ -2007,6 +2006,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_4vnniw() (ctxt->cpuid->feat.avx512_4vnniw)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
+#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
 #define vcpu_must_have(feat) \
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 25a3fa03a4..c1b61385b1 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -238,7 +238,6 @@ XEN_CPUFEATURE(VPCLMULQDQ,    6*32+10) /*A  Vector Carry-less Multiplication Ins
 XEN_CPUFEATURE(AVX512_VNNI,   6*32+11) /*A  Vector Neural Network Instrs */
 XEN_CPUFEATURE(AVX512_BITALG, 6*32+12) /*A  Support for VPOPCNT[B,W] and VPSHUFBITQMB */
 XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
-XEN_CPUFEATURE(TSXLDTRK,      6*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
@@ -274,6 +273,7 @@ XEN_CPUFEATURE(MD_CLEAR,      9*32+10) /*A  VERW clears microarchitectural buffe
 XEN_CPUFEATURE(RTM_ALWAYS_ABORT, 9*32+11) /*! June 2021 TSX defeaturing in microcode. */
 XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*a  SERIALIZE insn */
+XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:56:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:56:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254280.435996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6i-0007uy-F6; Fri, 07 Jan 2022 07:56:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254280.435996; Fri, 07 Jan 2022 07:56:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6i-0007uq-CG; Fri, 07 Jan 2022 07:56:16 +0000
Received: by outflank-mailman (input) for mailman id 254280;
 Fri, 07 Jan 2022 07:56:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6h-0007uh-F0
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6h-0002wZ-EJ
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6h-00007v-DR
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZhTjw8YftLBrr/wNxl6lq562IkzZ1E+yZhj5oWgGLGo=; b=ioz/9kXG8Lojoa2HEZUlakb3cq
	G7ZwPzSvLXAhNurLhz0U+imIL7QALsqh8496aRdusgrT/2TJqKgDgS3euJrJsxGkRklEVEDanpA1L
	8ZGC1grTbazLlqC4hFxRWq56lL4+hVVnZbhP1+eUr/p3hcl4jW0XUBtmsAwDOs1Yg9Wo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
Message-Id: <E1n5k6h-00007v-DR@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:56:15 +0000

commit 1c30c97bd89b85b8cf723d4c255b0da9ca8d1bb7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:54:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:54:21 2022 +0100

    revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
    
    This reverts commit c22bd567ce22f6ad9bd93318ad0d7fd1c2eadb0d.
    
    While its description is correct from an abstract or real hardware pov,
    the range is special inside HVM guests. The range being UC in particular
    gets in the way of OVMF, which places itself at [FFE00000,FFFFFFFF].
    While this is benign to epte_get_entry_emt() as long as the IOMMU isn't
    enabled for a guest, it becomes a very noticable problem otherwise: It
    takes about half a minute for OVMF to decompress itself into its
    designated address range.
    
    And even beyond OVMF there's no reason to have e.g. the ACPI memory
    range marked UC.
    
    Fixes: c22bd567ce22 ("hvmloader: PA range 0xfc000000-0xffffffff should be UC")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ea187c0b7a73c26258c0e91e4f3656989804555f
    master date: 2021-12-17 08:56:15 +0100
---
 tools/firmware/hvmloader/cacheattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/hvmloader/cacheattr.c b/tools/firmware/hvmloader/cacheattr.c
index 1ac6656c70..1c67819748 100644
--- a/tools/firmware/hvmloader/cacheattr.c
+++ b/tools/firmware/hvmloader/cacheattr.c
@@ -98,12 +98,12 @@ void cacheattr_init(void)
     {
         uint64_t base = pci_mem_start, size;
 
-        for ( i = 0; !(base >> 32) && (i < nr_var_ranges); i++ )
+        for ( i = 0; (base != pci_mem_end) && (i < nr_var_ranges); i++ )
         {
             size = PAGE_SIZE;
             while ( !(base & size) )
                 size <<= 1;
-            while ( ((base + size) < base) || ((base + size - 1) >> 32) )
+            while ( ((base + size) < base) || ((base + size) > pci_mem_end) )
                 size >>= 1;
 
             wrmsr(MSR_MTRRphysBase(i), base);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 07:56:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 07:56:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254281.435999 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6s-0007xh-Gg; Fri, 07 Jan 2022 07:56:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254281.435999; Fri, 07 Jan 2022 07:56:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5k6s-0007xa-De; Fri, 07 Jan 2022 07:56:26 +0000
Received: by outflank-mailman (input) for mailman id 254281;
 Fri, 07 Jan 2022 07:56:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6r-0007xM-Hw
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6r-0002x3-HH
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5k6r-00008d-GV
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 07:56:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JIDwk6x6V9ckd3GkbpwFIUqF4VtA2oJlB75g2BTkfck=; b=miwwlcaHz9NIYJD6kbh5XcxiWi
	A1eF8ezi8KPn+aHF6h6atHsqMFmbfmh2qCb+cx6v+IK19UuiWmIBo6gwxz0gr/0r9yapyjbcEiYLm
	/kkFpijLDGSbi+HYHw3iLvkKXtwxF0+dXdt771sLzQW66r+T7Macil6lO0OvLGEZbAU0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/spec-ctrl: Fix default calculation of opt_srb_lock
Message-Id: <E1n5k6r-00008d-GV@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 07:56:25 +0000

commit 45299b3cc83d3d19c24d74f7e28dcc83e8fa0c2e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 7 08:54:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:54:38 2022 +0100

    x86/spec-ctrl: Fix default calculation of opt_srb_lock
    
    Since this logic was introduced, opt_tsx has become more complicated and
    shouldn't be compared to 0 directly.  While there are no buggy logic paths,
    the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
    easier and clearer to use.
    
    Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31f3bc97f4508687215e459a5e35676eecf1772b
    master date: 2022-01-05 09:44:26 +0000
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 7e0c171dc8..f70535b6e7 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1197,7 +1197,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 08:11:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 08:11:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254308.436037 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5kL0-0003gK-Oh; Fri, 07 Jan 2022 08:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254308.436037; Fri, 07 Jan 2022 08: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 1n5kL0-0003gA-LZ; Fri, 07 Jan 2022 08:11:02 +0000
Received: by outflank-mailman (input) for mailman id 254308;
 Fri, 07 Jan 2022 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 1n5kKz-0003g3-H1
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5kKz-0003o9-GH
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 08:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5kKz-0001OL-FE
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=+X9gmnB3ZD6Ma/KDqi7OGe7dud1AEf3lJGI9TYllsCc=; b=Wv7GZtaB9COKSEQoQmzjsWUbcn
	S2tejY4L9YvQct39JSGGspXPIXRz7FYjJhX/7RAMvqt4V5pQCKYizEZ/UYPjcZBKxgfytTYO2Pulv
	7TgALkae9BROY/m0zYF/JFYhZhYX5RGliDbq2usCs1MIi1zrInOvIQCOYKreTLonkyiM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xen-detect: avoid possible pitfall with cpuid()
Message-Id: <E1n5kKz-0001OL-FE@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 08:11:01 +0000

commit 6330e328ba157ed5df417f463ba8621fee731e63
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 16:12:15 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 16:12:15 2022 +0100

    tools/xen-detect: avoid possible pitfall with cpuid()
    
    The 64-bit form forces %ecx to 0 while the 32-bit one so far didn't - it
    only ended up that way when "pv_context" is zero. While presently no
    leaf queried by callers has separate subleaves, let's avoid chancing it.
    
    While there
    - replace references to operands by number,
    - relax constraints where possible,
    - limit PUSH/POP to just the registers not also used as input,
    all where applicable also for the 64-bit variant.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/misc/xen-detect.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tools/misc/xen-detect.c b/tools/misc/xen-detect.c
index 18b28dabf3..4f74c41557 100644
--- a/tools/misc/xen-detect.c
+++ b/tools/misc/xen-detect.c
@@ -52,17 +52,19 @@ static void cpuid(uint32_t idx, uint32_t *regs, int pv_context)
 #ifdef __i386__
     /* Use the stack to avoid reg constraint failures with some gcc flags */
     asm volatile (
-        "push %%eax; push %%ebx; push %%ecx; push %%edx\n\t"
-        "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
-        "mov %%eax,(%2); mov %%ebx,4(%2)\n\t"
-        "mov %%ecx,8(%2); mov %%edx,12(%2)\n\t"
-        "pop %%edx; pop %%ecx; pop %%ebx; pop %%eax\n\t"
-        : : "a" (idx), "c" (pv_context), "S" (regs) : "memory" );
+        "push %%ebx; push %%edx\n\t"
+        "test %[pv],%[pv] ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
+        "mov %%eax,(%[regs]); mov %%ebx,4(%[regs])\n\t"
+        "mov %%ecx,8(%[regs]); mov %%edx,12(%[regs])\n\t"
+        "pop %%edx; pop %%ebx\n\t"
+        : "+a" (idx), "=c" (idx /* dummy */)
+        : "c" (0), [pv] "r" (pv_context), [regs] "SD" (regs)
+        : "memory" );
 #else
     asm volatile (
-        "test %5,%5 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
+        "test %[pv],%[pv] ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid\n\t"
         : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
-        : "0" (idx), "1" (pv_context), "2" (0) );
+        : "0" (idx), "2" (0), [pv] "r" (pv_context) );
 #endif
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 08:11:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 08:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254309.436041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5kLA-0003j1-RY; Fri, 07 Jan 2022 08:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254309.436041; Fri, 07 Jan 2022 08:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5kLA-0003it-Oe; Fri, 07 Jan 2022 08:11:12 +0000
Received: by outflank-mailman (input) for mailman id 254309;
 Fri, 07 Jan 2022 08: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 1n5kL9-0003ie-KP
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5kL9-0003ob-Jg
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 08:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5kL9-0001P9-Ir
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=fR+Q/lIna1dBh86nLtjTmLudfDKUdZkiysBGZ6qhgzw=; b=1jn5Hu59J+oJq9SSUvG2CoQ7vv
	tUqwq4kY2gjkit4N/6rWy3O5RVTBSAeIV6dV0LURgR9actq8nV0GDKryrggZMtrbNxLOalauMkXMM
	vblsVBUzFJm6mzIgS2SK6cuH4zlJ/oOypksb8POO3BbYTMnRklChAKtbhsBy70j+NGo0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/altp2m: p2m_altp2m_get_or_propagate() should honor present page order
Message-Id: <E1n5kL9-0001P9-Ir@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 08:11:11 +0000

commit ced5685208f4525edc3aa86f41eeaee5ccc9fe31
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 6 16:12:39 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 6 16:12:39 2022 +0100

    x86/altp2m: p2m_altp2m_get_or_propagate() should honor present page order
    
    Prior to XSA-304 the only caller merely happened to not use any further
    the order value that it passes into the function. Already then this was
    a latent issue: The function really should, in the "get" case, hand back
    the order the underlying mapping actually uses (or actually the smaller
    of the two), such that (going forward) there wouldn't be any action on
    unrelated mappings (in particular ones which did already diverge from
    the host P2M).
    
    Similarly in the "propagate" case only the smaller of the two orders
    should actually get used for creating the new entry, again to avoid
    altering mappings which did already diverge from the host P2M.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/hvm/hvm.c         |  2 +-
 xen/arch/x86/include/asm/p2m.h |  2 +-
 xen/arch/x86/mm/p2m.c          | 14 ++++++++++----
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 350dc396e3..d233550ae4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1832,7 +1832,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
          * altp2m.
          */
         if ( p2m_altp2m_get_or_propagate(p2m, gfn, &mfn, &p2mt,
-                                         &p2ma, page_order) )
+                                         &p2ma, &page_order) )
         {
             /* Entry was copied from host -- retry fault */
             rc = 1;
diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index 357a808748..6e2206874d 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -852,7 +852,7 @@ void p2m_flush_altp2m(struct domain *d);
 /* Alternate p2m paging */
 bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
                                  mfn_t *mfn, p2m_type_t *p2mt,
-                                 p2m_access_t *p2ma, unsigned int page_order);
+                                 p2m_access_t *p2ma, unsigned int *page_order);
 
 /* Make a specific alternate p2m valid */
 int p2m_init_altp2m_by_id(struct domain *d, unsigned int idx);
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1d5a87a969..98c8201f92 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2198,10 +2198,11 @@ bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx)
  */
 bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
                                  mfn_t *mfn, p2m_type_t *p2mt,
-                                 p2m_access_t *p2ma, unsigned int page_order)
+                                 p2m_access_t *p2ma, unsigned int *page_order)
 {
     p2m_type_t ap2mt;
     p2m_access_t ap2ma;
+    unsigned int cur_order;
     unsigned long mask;
     gfn_t gfn;
     mfn_t amfn;
@@ -2214,7 +2215,10 @@ bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
      */
     p2m_lock(ap2m);
 
-    amfn = get_gfn_type_access(ap2m, gfn_l, &ap2mt, &ap2ma, 0, NULL);
+    amfn = get_gfn_type_access(ap2m, gfn_l, &ap2mt, &ap2ma, 0, &cur_order);
+
+    if ( cur_order > *page_order )
+        cur_order = *page_order;
 
     if ( !mfn_eq(amfn, INVALID_MFN) )
     {
@@ -2222,6 +2226,7 @@ bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
         *mfn  = amfn;
         *p2mt = ap2mt;
         *p2ma = ap2ma;
+        *page_order = cur_order;
         return false;
     }
 
@@ -2229,6 +2234,7 @@ bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
     if ( mfn_eq(*mfn, INVALID_MFN) )
     {
         p2m_unlock(ap2m);
+        *page_order = cur_order;
         return false;
     }
 
@@ -2237,11 +2243,11 @@ bool p2m_altp2m_get_or_propagate(struct p2m_domain *ap2m, unsigned long gfn_l,
      * to the start of the superpage.  NB that we repupose `amfn`
      * here.
      */
-    mask = ~((1UL << page_order) - 1);
+    mask = ~((1UL << cur_order) - 1);
     amfn = _mfn(mfn_x(*mfn) & mask);
     gfn = _gfn(gfn_l & mask);
 
-    rc = p2m_set_entry(ap2m, gfn, amfn, page_order, *p2mt, *p2ma);
+    rc = p2m_set_entry(ap2m, gfn, amfn, cur_order, *p2mt, *p2ma);
     p2m_unlock(ap2m);
 
     if ( rc )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254499.436380 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swE-0004Jn-3f; Fri, 07 Jan 2022 17:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254499.436380; Fri, 07 Jan 2022 17:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swE-0004Jf-0n; Fri, 07 Jan 2022 17:22:02 +0000
Received: by outflank-mailman (input) for mailman id 254499;
 Fri, 07 Jan 2022 17: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 1n5swD-0004JX-Lx
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17: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 1n5swD-0005kH-Kz
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swD-00067M-Jw
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xqeARXqOi1Zn1RfYTNyXsntwS/N5PsiVYwMFoM94UMI=; b=Chrtkf6GpDqLXLhEn3uw0TrmBK
	mbio7sEHsX7u7nUvcafOxlB3dIOIISxlt3RU18t83iKj5fCFaGwHUmddKrK/4FDsGtvC7VH5Q2Ep5
	pMEtHKE9mKbSDDqGihdjFEUIEG0EXT5cLY7QjmJoVre3KzlTtmYszJWKDsi63uHMN3D0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] efi: fix alignment of function parameters in compat mode
Message-Id: <E1n5swD-00067M-Jw@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:22:01 +0000

commit 71dfb814b51daf2abe7926a3e512bb071939521f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Jan 7 08:11:01 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:11:01 2022 +0100

    efi: fix alignment of function parameters in compat mode
    
    Currently the max_store_size, remain_store_size and max_size in
    compat_pf_efi_runtime_call are 4 byte aligned, which makes clang
    13.0.0 complain with:
    
    In file included from compat.c:30:
    ./runtime.c:646:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 2 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.max_store_size,
                ^
    ./runtime.c:647:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 3 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.remain_store_size,
                ^
    ./runtime.c:648:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 4 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.max_size);
                ^
    Fix this by bouncing the variables on the stack in order for them to
    be 8 byte aligned.
    
    Note this could be done in a more selective manner to only apply to
    compat code calls, but given the overhead of making an EFI call doing
    an extra copy of 3 variables doesn't seem to warrant the special
    casing.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: be12fcca8b784e456df3adedbffe657d753c5ff9
    master date: 2021-11-19 17:01:24 +0000
---
 xen/common/efi/runtime.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 95367694b5..bbcc756f57 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -607,6 +607,9 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
     break;
 
     case XEN_EFI_query_variable_info:
+    {
+        uint64_t max_store_size, remain_store_size, max_size;
+
         if ( op->misc & ~XEN_EFI_VARINFO_BOOT_SNAPSHOT )
             return -EINVAL;
 
@@ -638,16 +641,36 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
 
         if ( !efi_enabled(EFI_RS) || (efi_rs->Hdr.Revision >> 16) < 2 )
             return -EOPNOTSUPP;
+
+        /*
+         * Bounce the variables onto the stack to make them 8 byte aligned when
+         * called from the compat handler, as their placement in
+         * compat_pf_efi_runtime_call will make them 4 byte aligned instead and
+         * and compilers may validly complain.
+         *
+         * Note that while the function parameters are OUT only, copy the
+         * values here anyway just in case. This is done regardless of whether
+         * called from the compat handler or not, as it's not worth the extra
+         * logic to differentiate.
+         */
+        max_store_size = op->u.query_variable_info.max_store_size;
+        remain_store_size = op->u.query_variable_info.remain_store_size;
+        max_size = op->u.query_variable_info.max_size;
+
         state = efi_rs_enter();
         if ( !state.cr3 )
             return -EOPNOTSUPP;
         status = efi_rs->QueryVariableInfo(
-            op->u.query_variable_info.attr,
-            &op->u.query_variable_info.max_store_size,
-            &op->u.query_variable_info.remain_store_size,
-            &op->u.query_variable_info.max_size);
+            op->u.query_variable_info.attr, &max_store_size, &remain_store_size,
+            &max_size);
         efi_rs_leave(&state);
+
+        op->u.query_variable_info.max_store_size = max_store_size;
+        op->u.query_variable_info.remain_store_size = remain_store_size;
+        op->u.query_variable_info.max_size = max_size;
+
         break;
+    }
 
     case XEN_EFI_query_capsule_capabilities:
     case XEN_EFI_update_capsule:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254500.436384 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swP-0004Lo-5j; Fri, 07 Jan 2022 17:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254500.436384; Fri, 07 Jan 2022 17:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swP-0004La-2G; Fri, 07 Jan 2022 17:22:13 +0000
Received: by outflank-mailman (input) for mailman id 254500;
 Fri, 07 Jan 2022 17:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swN-0004LO-P6
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swN-0005kL-OG
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swN-000681-NG
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k8/EkXDlsRuoK7E1462TS1WyCWCtgssxJUvmxfr77Z4=; b=IhsGe9hG9ubDPFI7Yj/AEdSS4h
	Gievbs02L849cRYrToxZKinAoT1sbIZsH48wBB1DIYLeP63/HusaMIUdb6hCpOASCZWMOQTn8jdnR
	WjS7NZYPVKMaNLFoD//sKWyQeuDRnz/RMfWFVa9Uq/GJEfKHQ5rVEHqDkDt/na+IM0lI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] VT-d: split domid map cleanup check into a function
Message-Id: <E1n5swN-000681-NG@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:22:11 +0000

commit e3de2e89751149eef28efa8692c6ec238e42bc7e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:12:28 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:12:28 2022 +0100

    VT-d: split domid map cleanup check into a function
    
    This logic will want invoking from elsewhere.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9fdc10abe9457e4c9879a266f82372cb08e88ffb
    master date: 2021-11-24 11:06:20 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 89 ++++++++++++++++++++-----------------
 1 file changed, 47 insertions(+), 42 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index abe7ea5ac9..6e4829465a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -154,6 +154,51 @@ static void cleanup_domid_map(struct domain *domain, struct vtd_iommu *iommu)
     }
 }
 
+static bool any_pdev_behind_iommu(const struct domain *d,
+                                  const struct pci_dev *exclude,
+                                  const struct vtd_iommu *iommu)
+{
+    const struct pci_dev *pdev;
+
+    for_each_pdev ( d, pdev )
+    {
+        const struct acpi_drhd_unit *drhd;
+
+        if ( pdev == exclude )
+            continue;
+
+        drhd = acpi_find_matched_drhd_unit(pdev);
+        if ( drhd && drhd->iommu == iommu )
+            return true;
+    }
+
+    return false;
+}
+
+/*
+ * If no other devices under the same iommu owned by this domain,
+ * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
+ */
+static void check_cleanup_domid_map(struct domain *d,
+                                    const struct pci_dev *exclude,
+                                    struct vtd_iommu *iommu)
+{
+    bool found = any_pdev_behind_iommu(d, exclude, iommu);
+
+    /*
+     * Hidden devices are associated with DomXEN but usable by the hardware
+     * domain. Hence they need considering here as well.
+     */
+    if ( !found && is_hardware_domain(d) )
+        found = any_pdev_behind_iommu(dom_xen, exclude, iommu);
+
+    if ( !found )
+    {
+        clear_bit(iommu->index, &dom_iommu(d)->arch.vtd.iommu_bitmap);
+        cleanup_domid_map(d, iommu);
+    }
+}
+
 static void sync_cache(const void *addr, unsigned int size)
 {
     static unsigned long clflush_size = 0;
@@ -1657,27 +1702,6 @@ int domain_context_unmap_one(
     return rc;
 }
 
-static bool any_pdev_behind_iommu(const struct domain *d,
-                                  const struct pci_dev *exclude,
-                                  const struct vtd_iommu *iommu)
-{
-    const struct pci_dev *pdev;
-
-    for_each_pdev ( d, pdev )
-    {
-        const struct acpi_drhd_unit *drhd;
-
-        if ( pdev == exclude )
-            continue;
-
-        drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd && drhd->iommu == iommu )
-            return true;
-    }
-
-    return false;
-}
-
 static int domain_context_unmap(struct domain *domain, u8 devfn,
                                 struct pci_dev *pdev)
 {
@@ -1686,7 +1710,6 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
     int ret = 0;
     uint16_t seg = pdev->seg;
     uint8_t bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
-    bool found;
 
     drhd = acpi_find_matched_drhd_unit(pdev);
     if ( !drhd )
@@ -1764,26 +1787,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
         goto out;
     }
 
-    if ( ret )
-        goto out;
-
-    /*
-     * If no other devices under the same iommu owned by this domain,
-     * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
-     */
-    found = any_pdev_behind_iommu(domain, pdev, iommu);
-    /*
-     * Hidden devices are associated with DomXEN but usable by the hardware
-     * domain. Hence they need considering here as well.
-     */
-    if ( !found && is_hardware_domain(domain) )
-        found = any_pdev_behind_iommu(dom_xen, pdev, iommu);
-
-    if ( !found )
-    {
-        clear_bit(iommu->index, &dom_iommu(domain)->arch.vtd.iommu_bitmap);
-        cleanup_domid_map(domain, iommu);
-    }
+    if ( !ret )
+        check_cleanup_domid_map(domain, pdev, iommu);
 
 out:
     return ret;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:22:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254501.436388 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swZ-0004P4-6u; Fri, 07 Jan 2022 17:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254501.436388; Fri, 07 Jan 2022 17:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swZ-0004Ou-3h; Fri, 07 Jan 2022 17:22:23 +0000
Received: by outflank-mailman (input) for mailman id 254501;
 Fri, 07 Jan 2022 17:22:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swX-0004Ob-SA
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swX-0005kc-RP
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swX-00068r-QV
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y8lpXZGeX39WbWA1FiRF6+6Gh3w/7yQlqYN7541cLIY=; b=F7T7KttnqpTdg/rJN2HAN7EP5x
	fAcKy25vojEIj4zGGYdeQO7+euzWTPK5c0vAQ7pO+mOoB7d1jwu0yYhNCqoDmP0/4N+fhpgEPH2Lh
	2kBe7XXtYVPzyBSFhODnKHWscvf0WMSBfYhHdWWpLYJvyM5/1mknKxqI6tPOIWxhA8vs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] VT-d: don't leak domid mapping on error path
Message-Id: <E1n5swX-00068r-QV@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:22:21 +0000

commit c84755bb6cf1c416f15d3e16bbaa515a188dc7c6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:12:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:12:59 2022 +0100

    VT-d: don't leak domid mapping on error path
    
    While domain_context_mapping() invokes domain_context_unmap() in a sub-
    case of handling DEV_TYPE_PCI when encountering an error, thus avoiding
    a leak, individual calls to domain_context_mapping_one() aren't
    similarly covered. Such a leak might persist until domain destruction.
    Leverage that these cases can be recognized by pdev being non-NULL.
    
    Fixes: dec403cc668f ("VT-d: fix iommu_domid for PCI/PCIx devices assignment")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: e6252a51faf42c892eb5fc71f8a2617580832196
    master date: 2021-11-24 11:07:11 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 6e4829465a..8e20d032bc 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1505,7 +1505,12 @@ int domain_context_mapping_one(
         rc = me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
 
     if ( rc )
-        domain_context_unmap_one(domain, iommu, bus, devfn);
+    {
+        ret = domain_context_unmap_one(domain, iommu, bus, devfn);
+
+        if ( !ret && pdev && pdev->devfn == devfn )
+            check_cleanup_domid_map(domain, pdev, iommu);
+    }
 
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:22:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254502.436392 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swj-0004S3-7x; Fri, 07 Jan 2022 17:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254502.436392; Fri, 07 Jan 2022 17:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swj-0004Rv-54; Fri, 07 Jan 2022 17:22:33 +0000
Received: by outflank-mailman (input) for mailman id 254502;
 Fri, 07 Jan 2022 17:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swh-0004Rj-VR
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swh-0005l5-Ud
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5swh-00069W-Te
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Yp5LiVueYVxf4SBmveG9mGzh6g6R/dkRXIK0YRYB5x4=; b=BrbqPLPzJLLeLlH632EXFmSoZ8
	fIKRJtaBncdUTImjyKCBHS0VQe8qRrVfCHh+LwLQjMc2ld9+WOEKua2NzuGKxBjDKuvmtKZRyI6+A
	s7evK/GIFtUZOpRjf/RIUGFeNImxMsLryHgT8a9v4PKpHnPQpMueq+uAQjCTDe5mh+C0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/Viridian: fix error code use
Message-Id: <E1n5swh-00069W-Te@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:22:31 +0000

commit bf3beeeb5a3cdfe0733fc71e848f404f09914a3c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:13:25 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:13:25 2022 +0100

    x86/Viridian: fix error code use
    
    Both the wrong use of HV_STATUS_* and the return type of
    hv_vpset_to_vpmask() can lead to viridian_hypercall()'s
    ASSERT_UNREACHABLE() triggering when translating error codes from Xen
    to Viridian representation.
    
    Fixes: b4124682db6e ("viridian: add ExProcessorMasks variants of the flush hypercalls")
    Fixes: 9afa867d42ba ("viridian: add ExProcessorMasks variant of the IPI hypercall")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: 857fee77845be0c5c35fd51bac64455369d32a6f
    master date: 2021-11-24 11:09:56 +0100
---
 xen/arch/x86/hvm/viridian/viridian.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index b906f7b86a..7d1cfc530b 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -628,8 +628,8 @@ static unsigned int hv_vpset_nr_banks(struct hv_vpset *vpset)
     return hweight64(vpset->valid_bank_mask);
 }
 
-static uint16_t hv_vpset_to_vpmask(const struct hv_vpset *set,
-                                   struct hypercall_vpmask *vpmask)
+static int hv_vpset_to_vpmask(const struct hv_vpset *set,
+                              struct hypercall_vpmask *vpmask)
 {
 #define NR_VPS_PER_BANK (HV_VPSET_BANK_SIZE * 8)
 
@@ -919,10 +919,10 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
          input_params.reserved_zero[0] ||
          input_params.reserved_zero[1] ||
          input_params.reserved_zero[2] )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     if ( input_params.vector < 0x10 || input_params.vector > 0xff )
-        return HV_STATUS_INVALID_PARAMETER;
+        return -EINVAL;
 
     *set = input_params.set;
     if ( set->format == HV_GENERIC_SET_SPARSE_4K )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:22:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254503.436396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swt-0004Uy-9T; Fri, 07 Jan 2022 17:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254503.436396; Fri, 07 Jan 2022 17:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5swt-0004Uq-6T; Fri, 07 Jan 2022 17:22:43 +0000
Received: by outflank-mailman (input) for mailman id 254503;
 Fri, 07 Jan 2022 17:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sws-0004UP-32
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sws-0005mn-2G
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sws-0006AH-1A
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M/uJutsrdWbiiN27my5e6b3n7dRf8dtYDKdyilRq4Go=; b=yCsiPilWx6hlV+W2RCy6om42Nl
	peNvgnuv7uksowF1TETZ+3ssxLSN/e6UYQnvQEOsbkfLA++ei/GWJc56Y2ZqsFfAKOEIY9TCVA8nx
	X7gA7dtXHWsGAzWI/yqNzP75V4hSbhDi5K+t1gvBmRdVCtXD8PCPfB1lGiSaaXeJF6ew=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
Message-Id: <E1n5sws-0006AH-1A@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:22:42 +0000

commit 78b382748015dbad7fea1c8f06c9d62fce585904
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:13:47 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:13:47 2022 +0100

    x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
    
    Just like (in protected mode) reads may not go to exec-only segments and
    writes may not go to non-writable ones, insn fetches may not access data
    segments.
    
    Fixes: 623e83716791 ("hvm: Support hardware task switching")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 311297f4216a4387bdae6df6cfbb1f5edb06618a
    master date: 2021-12-06 14:15:05 +0100
---
 xen/arch/x86/hvm/hvm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index f336ffa393..5be8aee4bb 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2530,6 +2530,9 @@ bool_t hvm_virtual_to_linear_addr(
      */
     ASSERT(seg < x86_seg_none);
 
+    /* However, check that insn fetches only ever specify CS. */
+    ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
+
     if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_PE) )
     {
         /*
@@ -2594,10 +2597,17 @@ bool_t hvm_virtual_to_linear_addr(
                 if ( (reg->type & 0xa) == 0x8 )
                     goto out; /* execute-only code segment */
                 break;
+
             case hvm_access_write:
                 if ( (reg->type & 0xa) != 0x2 )
                     goto out; /* not a writable data segment */
                 break;
+
+            case hvm_access_insn_fetch:
+                if ( !(reg->type & 0x8) )
+                    goto out; /* not a code segment */
+                break;
+
             default:
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:22:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254504.436400 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sx3-0004Y2-Ak; Fri, 07 Jan 2022 17:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254504.436400; Fri, 07 Jan 2022 17:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sx3-0004Xu-7r; Fri, 07 Jan 2022 17:22:53 +0000
Received: by outflank-mailman (input) for mailman id 254504;
 Fri, 07 Jan 2022 17:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sx2-0004Xh-60
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sx2-0005mx-5J
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sx2-0006BE-4T
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=irEll9I2ZjcuVUS/QUNXR3sjLuWzyJZJzRjNRJ1Co6Y=; b=LuIGOSiXvS2TNf20xRMJ+cjpuT
	aH3Q/vNOayJHFC5pD4DQ3n9B4c2yZ7FW4Ec0fOK7AUN2h+L3iAxu0Yr6rqKEX2GuRghNCH2PHsrHj
	C9jNNaBiQoV0KM9GYyUKIS9uHOQH+cnnjYBVkNMtdUVnskbFiNKosxGixqYkM1N5BQpE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86: avoid wrong use of all-but-self IPI shorthand
Message-Id: <E1n5sx2-0006BE-4T@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:22:52 +0000

commit 12c6ce12a1996df1e53ee1f35e1b6132771256f3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:14:13 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:14:13 2022 +0100

    x86: avoid wrong use of all-but-self IPI shorthand
    
    With "nosmp" I did observe a flood of "APIC error on CPU0: 04(04), Send
    accept error" log messages on an AMD system. And rightly so - nothing
    excludes the use of the shorthand in send_IPI_mask() in this case. Set
    "unaccounted_cpus" to "true" also when command line restrictions are the
    cause.
    
    Note that PV-shim mode is unaffected by this change, first and foremost
    because "nosmp" and "maxcpus=" are ignored in this case.
    
    Fixes: 5500d265a2a8 ("x86/smp: use APIC ALLBUT destination shorthand when possible")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 7621880de0bb40bae6436a5b106babc0e4718f4d
    master date: 2021-12-10 10:26:52 +0100
---
 xen/arch/x86/mpparse.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index dff02b142b..91fa580831 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -85,9 +85,14 @@ void __init set_nr_cpu_ids(unsigned int max_cpus)
 	if (!park_offline_cpus)
 		tot_cpus = max_cpus;
 	nr_cpu_ids = min(tot_cpus, NR_CPUS + 0u);
-	if (park_offline_cpus && nr_cpu_ids < num_processors)
-		printk(XENLOG_WARNING "SMP: Cannot bring up %u further CPUs\n",
-		       num_processors - nr_cpu_ids);
+	if (nr_cpu_ids < num_processors)
+	{
+		unaccounted_cpus = true;
+		if (park_offline_cpus)
+			printk(XENLOG_WARNING
+			       "SMP: Cannot bring up %u further CPUs\n",
+			       num_processors - nr_cpu_ids);
+	}
 
 #ifndef nr_cpumask_bits
 	nr_cpumask_bits = ROUNDUP(nr_cpu_ids, BITS_PER_LONG);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:23:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254505.436404 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sxD-0004ae-CR; Fri, 07 Jan 2022 17:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254505.436404; Fri, 07 Jan 2022 17:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sxD-0004aW-9T; Fri, 07 Jan 2022 17:23:03 +0000
Received: by outflank-mailman (input) for mailman id 254505;
 Fri, 07 Jan 2022 17:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxC-0004aQ-9U
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxC-0005nN-8k
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxC-0006CN-7q
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oiD+JVjYp1VF4LEjAqL2LM35vfcCJ8f3RcHmOMWyeLM=; b=FxXi7t4LCjYumZ22Ve8bN3TG2O
	jRsh0z6g8pnJ3vgb6T37g1LDq0bhCeUsiigKcAxphS6yW7vNs6a9yCWHd/xbFIMuzHKBKb7NQnu2H
	oVvSjW3hufimCN96YshNnxbWl4l53eXqPQijjmnH+fAuRifLFRmo3IZPoGD6HBGVw49k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
Message-Id: <E1n5sxC-0006CN-7q@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:23:02 +0000

commit 2204d51e3140d3261675c44c548056a7dd209467
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:14:41 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:14:41 2022 +0100

    x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
    
    Both SDM and PM explicitly permit this.
    
    Fixes: 52dba7bd0b36 ("x86emul: generalize wbinvd() hook")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Paul Durrant <paul@xen.org>
    master commit: df3e1a5efe700a9f59eced801cac73f9fd02a0e2
    master date: 2021-12-10 14:03:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 425c8ddd97..76a2ccfafe 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2310,7 +2310,9 @@ static int hvmemul_cache_op(
         ASSERT(!is_x86_system_segment(seg));
 
         rc = hvmemul_virtual_to_linear(seg, offset, 0, NULL,
-                                       hvm_access_read, hvmemul_ctxt, &addr);
+                                       op != x86emul_clwb ? hvm_access_none
+                                                          : hvm_access_read,
+                                       hvmemul_ctxt, &addr);
         if ( rc != X86EMUL_OKAY )
             break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:23:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254506.436407 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sxN-0004e6-FP; Fri, 07 Jan 2022 17:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254506.436407; Fri, 07 Jan 2022 17:23:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sxN-0004dy-CO; Fri, 07 Jan 2022 17:23:13 +0000
Received: by outflank-mailman (input) for mailman id 254506;
 Fri, 07 Jan 2022 17:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxM-0004dn-DN
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxM-0005nX-Cb
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxM-0006Dk-Bf
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4RT8akWFitmJoQJYE91AwTeK1ajmyLcHrg1Icjb+0FE=; b=PQ8+s0ruaHHbty2xTk3WohXA3q
	WQAHkhBTHEeBh9rBXl73ZQsctRBTVrmX/lpHK1HguaT/ojLX+R3ULubYi4Wv2R8olUE5jsdSr4AVK
	SfO32Fmn4RiVUCMvE8rj78WcFomLdfK+RXNekJ8W6vWUlkcJFfxT+qUSEKga1XUekdpY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/cpuid: Fix TSXLDTRK definition
Message-Id: <E1n5sxM-0006Dk-Bf@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:23:12 +0000

commit c8260b3d3811983916c332d5d51b67807d77a8dc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 7 08:15:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:15:05 2022 +0100

    x86/cpuid: Fix TSXLDTRK definition
    
    TSXLDTRK lives in CPUID leaf 7[0].edx, not 7[0].ecx.
    
    Bit 16 in ecx is LA57.
    
    Fixes: a6d1b558471f ("x86emul: support X{SUS,RES}LDTRK")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 249e0f1d8f203188ccdcced5a05c2149739e1566
    master date: 2021-12-14 12:30:48 +0000
---
 tools/libs/light/libxl_cpuid.c              | 2 +-
 tools/misc/xen-cpuid.c                      | 3 +--
 xen/arch/x86/x86_emulate/x86_emulate.c      | 2 +-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index aa6a6a5f4b..6e094dfacc 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -209,7 +209,6 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-vnni",  0x00000007,  0, CPUID_REG_ECX, 11,  1},
         {"avx512-bitalg",0x00000007,  0, CPUID_REG_ECX, 12,  1},
         {"avx512-vpopcntdq",0x00000007,0,CPUID_REG_ECX, 14,  1},
-        {"tsxldtrk",     0x00000007,  0, CPUID_REG_ECX, 16,  1},
         {"rdpid",        0x00000007,  0, CPUID_REG_ECX, 22,  1},
         {"cldemote",     0x00000007,  0, CPUID_REG_ECX, 25,  1},
 
@@ -219,6 +218,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
+        {"tsxldtrk",     0x00000007,  0, CPUID_REG_EDX, 16,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 47c75031d1..b9fb918cdd 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -128,7 +128,6 @@ static const char *const str_7c0[32] =
     [10] = "vpclmulqdq",       [11] = "avx512-vnni",
     [12] = "avx512-bitalg",
     [14] = "avx512-vpopcntdq",
-    [16] = "tsxldtrk",
 
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
@@ -170,7 +169,7 @@ static const char *const str_7d0[32] =
     [10] = "md-clear",            [11] = "rtm-always-abort",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
-
+    [16] = "tsxldtrk",
     [18] = "pconfig",
     [20] = "cet-ibt",
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index dc281971ee..0f7f97cd1c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2000,7 +2000,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_vnni() (ctxt->cpuid->feat.avx512_vnni)
 #define vcpu_has_avx512_bitalg() (ctxt->cpuid->feat.avx512_bitalg)
 #define vcpu_has_avx512_vpopcntdq() (ctxt->cpuid->feat.avx512_vpopcntdq)
-#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_rdpid()       (ctxt->cpuid->feat.rdpid)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
@@ -2009,6 +2008,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_avx512_vp2intersect() (ctxt->cpuid->feat.avx512_vp2intersect)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
+#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_avx_vnni()    (ctxt->cpuid->feat.avx_vnni)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index ec2706fe2e..496582feff 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -239,7 +239,6 @@ XEN_CPUFEATURE(VPCLMULQDQ,    6*32+10) /*A  Vector Carry-less Multiplication Ins
 XEN_CPUFEATURE(AVX512_VNNI,   6*32+11) /*A  Vector Neural Network Instrs */
 XEN_CPUFEATURE(AVX512_BITALG, 6*32+12) /*A  Support for VPOPCNT[B,W] and VPSHUFBITQMB */
 XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
-XEN_CPUFEATURE(TSXLDTRK,      6*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
@@ -276,6 +275,7 @@ XEN_CPUFEATURE(MD_CLEAR,      9*32+10) /*A  VERW clears microarchitectural buffe
 XEN_CPUFEATURE(RTM_ALWAYS_ABORT, 9*32+11) /*! June 2021 TSX defeaturing in microcode. */
 XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*a  SERIALIZE insn */
+XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:23:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254507.436411 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sxX-0004gf-Gt; Fri, 07 Jan 2022 17:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254507.436411; Fri, 07 Jan 2022 17:23:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sxX-0004gZ-Dw; Fri, 07 Jan 2022 17:23:23 +0000
Received: by outflank-mailman (input) for mailman id 254507;
 Fri, 07 Jan 2022 17:23:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxW-0004gG-GL
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxW-0005nf-FZ
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxW-0006Ed-Ej
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S7xaUfLflBkIgc6DQ5cquIfSNQX9CTFwKCKTiL2WnY4=; b=hxEkeTgtHQnuNvP7P6Ra/36eKq
	BBvOA8bbRz/bYqmNmAr3Q4oD1V0DoB4cjwufabDoIOilWG0RL2c0OUkM89c1K3a1hX52d+tTEmx29
	w22laQr21lsE1QenhRKKDGCv7Kxw/S7GhCJ2ML4VoGWiGGeJpFBt5u8DcT233ySWR1KY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
Message-Id: <E1n5sxW-0006Ed-Ej@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:23:22 +0000

commit 467f98a0e0733495ffe0d18bb4ac8e1dee65d19b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:15:40 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:15:40 2022 +0100

    revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
    
    This reverts commit c22bd567ce22f6ad9bd93318ad0d7fd1c2eadb0d.
    
    While its description is correct from an abstract or real hardware pov,
    the range is special inside HVM guests. The range being UC in particular
    gets in the way of OVMF, which places itself at [FFE00000,FFFFFFFF].
    While this is benign to epte_get_entry_emt() as long as the IOMMU isn't
    enabled for a guest, it becomes a very noticable problem otherwise: It
    takes about half a minute for OVMF to decompress itself into its
    designated address range.
    
    And even beyond OVMF there's no reason to have e.g. the ACPI memory
    range marked UC.
    
    Fixes: c22bd567ce22 ("hvmloader: PA range 0xfc000000-0xffffffff should be UC")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ea187c0b7a73c26258c0e91e4f3656989804555f
    master date: 2021-12-17 08:56:15 +0100
---
 tools/firmware/hvmloader/cacheattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/hvmloader/cacheattr.c b/tools/firmware/hvmloader/cacheattr.c
index 1ac6656c70..1c67819748 100644
--- a/tools/firmware/hvmloader/cacheattr.c
+++ b/tools/firmware/hvmloader/cacheattr.c
@@ -98,12 +98,12 @@ void cacheattr_init(void)
     {
         uint64_t base = pci_mem_start, size;
 
-        for ( i = 0; !(base >> 32) && (i < nr_var_ranges); i++ )
+        for ( i = 0; (base != pci_mem_end) && (i < nr_var_ranges); i++ )
         {
             size = PAGE_SIZE;
             while ( !(base & size) )
                 size <<= 1;
-            while ( ((base + size) < base) || ((base + size - 1) >> 32) )
+            while ( ((base + size) < base) || ((base + size) > pci_mem_end) )
                 size >>= 1;
 
             wrmsr(MSR_MTRRphysBase(i), base);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 17:23:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 17:23:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254508.436416 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sxh-0004jc-Ie; Fri, 07 Jan 2022 17:23:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254508.436416; Fri, 07 Jan 2022 17:23:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5sxh-0004jU-FX; Fri, 07 Jan 2022 17:23:33 +0000
Received: by outflank-mailman (input) for mailman id 254508;
 Fri, 07 Jan 2022 17:23:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxg-0004jN-JL
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxg-0005o3-Ic
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5sxg-0006Fg-Hh
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 17:23:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y3IlINTGQuuMPPHrCwPI4Lil+JXj93AoI7nCeqymLK8=; b=Znx8jWfzf9bctL1Vt/YFO4j1py
	ASAQsP0QaeiX63HrqNzshbOsD7qiCZ+CKKp8ibleXf2uJZphpW4AD77fO2j6dp0DMtgSNiGMI/Fh/
	S1hFXmw9votqz0XCTJXe8wtbv6tyfPECU3DTIRxQbrmdA8Oeij7/mN9NaETzy64QmiIs=;
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: Fix default calculation of opt_srb_lock
Message-Id: <E1n5sxg-0006Fg-Hh@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 17:23:32 +0000

commit a763f8f158e81158bdf2470dbc3d98353f2322e2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 7 08:16:03 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:16:03 2022 +0100

    x86/spec-ctrl: Fix default calculation of opt_srb_lock
    
    Since this logic was introduced, opt_tsx has become more complicated and
    shouldn't be compared to 0 directly.  While there are no buggy logic paths,
    the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
    easier and clearer to use.
    
    Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31f3bc97f4508687215e459a5e35676eecf1772b
    master date: 2022-01-05 09:44:26 +0000
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 7e0c171dc8..f70535b6e7 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1197,7 +1197,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:33:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254544.436449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5wr9-0004bs-Rh; Fri, 07 Jan 2022 21:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254544.436449; Fri, 07 Jan 2022 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 1n5wr9-0004bk-OL; Fri, 07 Jan 2022 21:33:03 +0000
Received: by outflank-mailman (input) for mailman id 254544;
 Fri, 07 Jan 2022 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 1n5wr7-0004be-QK
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5wr7-0001xP-Nx
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5wr7-0008Oz-Mj
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=q52xxhZFRjVgdVTE64wiYq5bny/Jvfgzr0cuPoEbvkE=; b=Me3mq4C0w1tdPXBYEl2OrZJyBP
	LsrmKcEfM3hLmcxL6jvQaEAJRcpMfkxQh462o9r0DNtIo5gNhu/YLEPpfdaboLkZWmcLwfH82I8nJ
	5K46Yqn/L/+RpAVnYIMpV4GvcgcTJozoEh+ldZ2pMZNUBiGPzQUzSf6j9c0o6XzVGMpc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] efi: fix alignment of function parameters in compat mode
Message-Id: <E1n5wr7-0008Oz-Mj@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:33:01 +0000

commit a51f2df5dc4db6e839817a373ce956b880cdf4ce
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Jan 7 08:50:22 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:50:22 2022 +0100

    efi: fix alignment of function parameters in compat mode
    
    Currently the max_store_size, remain_store_size and max_size in
    compat_pf_efi_runtime_call are 4 byte aligned, which makes clang
    13.0.0 complain with:
    
    In file included from compat.c:30:
    ./runtime.c:646:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 2 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.max_store_size,
                ^
    ./runtime.c:647:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 3 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.remain_store_size,
                ^
    ./runtime.c:648:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 4 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
                &op->u.query_variable_info.max_size);
                ^
    Fix this by bouncing the variables on the stack in order for them to
    be 8 byte aligned.
    
    Note this could be done in a more selective manner to only apply to
    compat code calls, but given the overhead of making an EFI call doing
    an extra copy of 3 variables doesn't seem to warrant the special
    casing.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: be12fcca8b784e456df3adedbffe657d753c5ff9
    master date: 2021-11-19 17:01:24 +0000
---
 xen/common/efi/runtime.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 95367694b5..bbcc756f57 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -607,6 +607,9 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
     break;
 
     case XEN_EFI_query_variable_info:
+    {
+        uint64_t max_store_size, remain_store_size, max_size;
+
         if ( op->misc & ~XEN_EFI_VARINFO_BOOT_SNAPSHOT )
             return -EINVAL;
 
@@ -638,16 +641,36 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
 
         if ( !efi_enabled(EFI_RS) || (efi_rs->Hdr.Revision >> 16) < 2 )
             return -EOPNOTSUPP;
+
+        /*
+         * Bounce the variables onto the stack to make them 8 byte aligned when
+         * called from the compat handler, as their placement in
+         * compat_pf_efi_runtime_call will make them 4 byte aligned instead and
+         * and compilers may validly complain.
+         *
+         * Note that while the function parameters are OUT only, copy the
+         * values here anyway just in case. This is done regardless of whether
+         * called from the compat handler or not, as it's not worth the extra
+         * logic to differentiate.
+         */
+        max_store_size = op->u.query_variable_info.max_store_size;
+        remain_store_size = op->u.query_variable_info.remain_store_size;
+        max_size = op->u.query_variable_info.max_size;
+
         state = efi_rs_enter();
         if ( !state.cr3 )
             return -EOPNOTSUPP;
         status = efi_rs->QueryVariableInfo(
-            op->u.query_variable_info.attr,
-            &op->u.query_variable_info.max_store_size,
-            &op->u.query_variable_info.remain_store_size,
-            &op->u.query_variable_info.max_size);
+            op->u.query_variable_info.attr, &max_store_size, &remain_store_size,
+            &max_size);
         efi_rs_leave(&state);
+
+        op->u.query_variable_info.max_store_size = max_store_size;
+        op->u.query_variable_info.remain_store_size = remain_store_size;
+        op->u.query_variable_info.max_size = max_size;
+
         break;
+    }
 
     case XEN_EFI_query_capsule_capabilities:
     case XEN_EFI_update_capsule:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254545.436453 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5wrJ-0004dV-Sh; Fri, 07 Jan 2022 21:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254545.436453; Fri, 07 Jan 2022 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 1n5wrJ-0004dN-Pp; Fri, 07 Jan 2022 21:33:13 +0000
Received: by outflank-mailman (input) for mailman id 254545;
 Fri, 07 Jan 2022 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 1n5wrH-0004dB-SJ
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5wrH-0001xV-RY
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5wrH-0008Pl-QN
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=dMYcZGvQYTZedA4c53bHfhKlFm2cLvOoFjwObpXr3WI=; b=IsbsVOnHDuPj7sqrQDHnWV28I8
	pCv/bRhYIvVKrYFRDkw6M1rd+pNFgTKiMdDue2dqopuKyBniEAgjQbSoXa1s65ym32c5UWYFtxGqK
	V7kOL+rUUnjaOrDBFHjYcD8Dj/8LnTs9aCeG2AF5/YbLN2vd6znZ3aYB9cxpoRRiRGJM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] VT-d: split domid map cleanup check into a function
Message-Id: <E1n5wrH-0008Pl-QN@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:33:11 +0000

commit 992ba6df206d2f22f71fd5f7fbf834729ec05726
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:51:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:51:05 2022 +0100

    VT-d: split domid map cleanup check into a function
    
    This logic will want invoking from elsewhere.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9fdc10abe9457e4c9879a266f82372cb08e88ffb
    master date: 2021-11-24 11:06:20 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 89 ++++++++++++++++++++-----------------
 1 file changed, 47 insertions(+), 42 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 870996abdb..59809bba7f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -153,6 +153,51 @@ static void cleanup_domid_map(struct domain *domain, struct vtd_iommu *iommu)
     }
 }
 
+static bool any_pdev_behind_iommu(const struct domain *d,
+                                  const struct pci_dev *exclude,
+                                  const struct vtd_iommu *iommu)
+{
+    const struct pci_dev *pdev;
+
+    for_each_pdev ( d, pdev )
+    {
+        const struct acpi_drhd_unit *drhd;
+
+        if ( pdev == exclude )
+            continue;
+
+        drhd = acpi_find_matched_drhd_unit(pdev);
+        if ( drhd && drhd->iommu == iommu )
+            return true;
+    }
+
+    return false;
+}
+
+/*
+ * If no other devices under the same iommu owned by this domain,
+ * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
+ */
+static void check_cleanup_domid_map(struct domain *d,
+                                    const struct pci_dev *exclude,
+                                    struct vtd_iommu *iommu)
+{
+    bool found = any_pdev_behind_iommu(d, exclude, iommu);
+
+    /*
+     * Hidden devices are associated with DomXEN but usable by the hardware
+     * domain. Hence they need considering here as well.
+     */
+    if ( !found && is_hardware_domain(d) )
+        found = any_pdev_behind_iommu(dom_xen, exclude, iommu);
+
+    if ( !found )
+    {
+        clear_bit(iommu->index, &dom_iommu(d)->arch.iommu_bitmap);
+        cleanup_domid_map(d, iommu);
+    }
+}
+
 static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
@@ -1674,27 +1719,6 @@ int domain_context_unmap_one(
     return rc;
 }
 
-static bool any_pdev_behind_iommu(const struct domain *d,
-                                  const struct pci_dev *exclude,
-                                  const struct vtd_iommu *iommu)
-{
-    const struct pci_dev *pdev;
-
-    for_each_pdev ( d, pdev )
-    {
-        const struct acpi_drhd_unit *drhd;
-
-        if ( pdev == exclude )
-            continue;
-
-        drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd && drhd->iommu == iommu )
-            return true;
-    }
-
-    return false;
-}
-
 static int domain_context_unmap(struct domain *domain, u8 devfn,
                                 struct pci_dev *pdev)
 {
@@ -1703,7 +1727,6 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
     int ret = 0;
     uint16_t seg = pdev->seg;
     uint8_t bus = pdev->bus, tmp_bus, tmp_devfn, secbus;
-    bool found;
 
     drhd = acpi_find_matched_drhd_unit(pdev);
     if ( !drhd )
@@ -1784,26 +1807,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
         goto out;
     }
 
-    if ( ret )
-        goto out;
-
-    /*
-     * If no other devices under the same iommu owned by this domain,
-     * clear iommu in iommu_bitmap and clear domain_id in domid_bitmap.
-     */
-    found = any_pdev_behind_iommu(domain, pdev, iommu);
-    /*
-     * Hidden devices are associated with DomXEN but usable by the hardware
-     * domain. Hence they need considering here as well.
-     */
-    if ( !found && is_hardware_domain(domain) )
-        found = any_pdev_behind_iommu(dom_xen, pdev, iommu);
-
-    if ( !found )
-    {
-        clear_bit(iommu->index, &dom_iommu(domain)->arch.iommu_bitmap);
-        cleanup_domid_map(domain, iommu);
-    }
+    if ( !ret )
+        check_cleanup_domid_map(domain, pdev, iommu);
 
 out:
     return ret;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:33:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254546.436459 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5wrT-0004gR-Ua; Fri, 07 Jan 2022 21:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254546.436459; Fri, 07 Jan 2022 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 1n5wrT-0004gJ-RI; Fri, 07 Jan 2022 21:33:23 +0000
Received: by outflank-mailman (input) for mailman id 254546;
 Fri, 07 Jan 2022 21: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 1n5wrR-0004g0-VR
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5wrR-0001xr-Ug
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5wrR-0008QR-Tl
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=Q8QjL0bHyZISnpMWmVp953ibSJ85KEc2zjSyiV5pc5I=; b=hsavTvwxZHJUSXYPFwqj7hDneT
	whYv6WfW74kbWM1tq+yp0yoLgaDcYSZJ6JR4zZqmI2Cnuw0yI2Jyv19XWxw5YON/vB3sRzD+7jzpD
	Yl9HZTVJZghwiKNOu68X6a4cyW8Y4mlKv7BnJSc46r/FmT5RwfXIBj34G2CX5wvQZPQI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] VT-d: don't leak domid mapping on error path
Message-Id: <E1n5wrR-0008QR-Tl@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:33:21 +0000

commit fb9177385357bd0856692a6aa9c1513468281ae1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:51:27 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:51:27 2022 +0100

    VT-d: don't leak domid mapping on error path
    
    While domain_context_mapping() invokes domain_context_unmap() in a sub-
    case of handling DEV_TYPE_PCI when encountering an error, thus avoiding
    a leak, individual calls to domain_context_mapping_one() aren't
    similarly covered. Such a leak might persist until domain destruction.
    Leverage that these cases can be recognized by pdev being non-NULL.
    
    Fixes: dec403cc668f ("VT-d: fix iommu_domid for PCI/PCIx devices assignment")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: e6252a51faf42c892eb5fc71f8a2617580832196
    master date: 2021-11-24 11:07:11 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 59809bba7f..ce3e511ef7 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1518,7 +1518,12 @@ int domain_context_mapping_one(
         rc = me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
 
     if ( rc )
-        domain_context_unmap_one(domain, iommu, bus, devfn);
+    {
+        ret = domain_context_unmap_one(domain, iommu, bus, devfn);
+
+        if ( !ret && pdev && pdev->devfn == devfn )
+            check_cleanup_domid_map(domain, pdev, iommu);
+    }
 
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:33:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254547.436460 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5wre-0004k3-1B; Fri, 07 Jan 2022 21:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254547.436460; Fri, 07 Jan 2022 21: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 1n5wrd-0004jv-UL; Fri, 07 Jan 2022 21:33:33 +0000
Received: by outflank-mailman (input) for mailman id 254547;
 Fri, 07 Jan 2022 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 1n5wrc-0004ja-2V
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5wrc-0001yJ-1m
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5wrc-0008RE-0q
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21: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=J5CS7YdClS+gMSTLJi6doVrM1iwyLHOMwhvqxS4dj+w=; b=rWqnbpjJ3A+kR0rmjxEi1IB4+j
	VaQpZoS202ZrEqNr+tR6tny5pvOIFW91C0Y1O+jT0mGf/v1EmSIJsbdSArscf7vZPwkhknVmMuogl
	0zzqe1lQtV8Z+6VKNv9eU22V3xIoaAZjilQGwFDIBESa5XEwnRgl4Qm8WvWKY6YWkkhg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
Message-Id: <E1n5wrc-0008RE-0q@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:33:32 +0000

commit d8cf50574bd307f5f8a82ab3ee8e0fdab14cd09f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:51:51 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:51:51 2022 +0100

    x86/HVM: fail virt-to-linear conversion for insn fetches from non-code segments
    
    Just like (in protected mode) reads may not go to exec-only segments and
    writes may not go to non-writable ones, insn fetches may not access data
    segments.
    
    Fixes: 623e83716791 ("hvm: Support hardware task switching")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 311297f4216a4387bdae6df6cfbb1f5edb06618a
    master date: 2021-12-06 14:15:05 +0100
---
 xen/arch/x86/hvm/hvm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5b7e494ca3..89926a5bf6 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2530,6 +2530,9 @@ bool_t hvm_virtual_to_linear_addr(
      */
     ASSERT(seg < x86_seg_none);
 
+    /* However, check that insn fetches only ever specify CS. */
+    ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
+
     if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_PE) )
     {
         /*
@@ -2594,10 +2597,17 @@ bool_t hvm_virtual_to_linear_addr(
                 if ( (reg->type & 0xa) == 0x8 )
                     goto out; /* execute-only code segment */
                 break;
+
             case hvm_access_write:
                 if ( (reg->type & 0xa) != 0x2 )
                     goto out; /* not a writable data segment */
                 break;
+
+            case hvm_access_insn_fetch:
+                if ( !(reg->type & 0x8) )
+                    goto out; /* not a code segment */
+                break;
+
             default:
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:33:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254548.436465 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5wro-0004n6-35; Fri, 07 Jan 2022 21:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254548.436465; Fri, 07 Jan 2022 21: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 1n5wrn-0004my-Vs; Fri, 07 Jan 2022 21:33:43 +0000
Received: by outflank-mailman (input) for mailman id 254548;
 Fri, 07 Jan 2022 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 1n5wrm-0004mh-5d
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5wrm-0001yT-4u
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5wrm-0008S8-40
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=U2uRQpsub7noEQ/tEG3MnQDgwanJ+aNLYq46zReJbk8=; b=Rg35p56EnJ2POOaWkRk+UjPl8z
	KmPaexhDCZiSev/PPLrl/5KbP5/rpdG+450QGZwaXnJXqP8UVWn7WDjfJbl6TJ02ujP1xLyiAM8Qt
	BW5E5ooljAWmAdCpgopBAiT6vULYvplapbDb4KRfUELSGCSQF5dKCxZVs5Dq3cBGyahU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86: avoid wrong use of all-but-self IPI shorthand
Message-Id: <E1n5wrm-0008S8-40@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:33:42 +0000

commit 160bddfafbc7c1ca1954ae377c5d18da6b2b3a43
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:52:18 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:52:18 2022 +0100

    x86: avoid wrong use of all-but-self IPI shorthand
    
    With "nosmp" I did observe a flood of "APIC error on CPU0: 04(04), Send
    accept error" log messages on an AMD system. And rightly so - nothing
    excludes the use of the shorthand in send_IPI_mask() in this case. Set
    "unaccounted_cpus" to "true" also when command line restrictions are the
    cause.
    
    Note that PV-shim mode is unaffected by this change, first and foremost
    because "nosmp" and "maxcpus=" are ignored in this case.
    
    Fixes: 5500d265a2a8 ("x86/smp: use APIC ALLBUT destination shorthand when possible")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 7621880de0bb40bae6436a5b106babc0e4718f4d
    master date: 2021-12-10 10:26:52 +0100
---
 xen/arch/x86/mpparse.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index d532575fee..3e0ec3c61e 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -85,9 +85,14 @@ void __init set_nr_cpu_ids(unsigned int max_cpus)
 	if (!park_offline_cpus)
 		tot_cpus = max_cpus;
 	nr_cpu_ids = min(tot_cpus, NR_CPUS + 0u);
-	if (park_offline_cpus && nr_cpu_ids < num_processors)
-		printk(XENLOG_WARNING "SMP: Cannot bring up %u further CPUs\n",
-		       num_processors - nr_cpu_ids);
+	if (nr_cpu_ids < num_processors)
+	{
+		unaccounted_cpus = true;
+		if (park_offline_cpus)
+			printk(XENLOG_WARNING
+			       "SMP: Cannot bring up %u further CPUs\n",
+			       num_processors - nr_cpu_ids);
+	}
 
 #ifndef nr_cpumask_bits
 	nr_cpumask_bits = ROUNDUP(nr_cpu_ids, BITS_PER_LONG);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:33:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254549.436469 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5wry-0004qD-4K; Fri, 07 Jan 2022 21:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254549.436469; Fri, 07 Jan 2022 21: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 1n5wry-0004q5-1I; Fri, 07 Jan 2022 21:33:54 +0000
Received: by outflank-mailman (input) for mailman id 254549;
 Fri, 07 Jan 2022 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 1n5wrw-0004pm-94
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5wrw-0001yf-87
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5wrw-0008Sy-7B
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=Fjc/aT4bq7GTCXLpt9AWih6qUJ0piAIqhqcddK7lEb0=; b=XF43t89VrRPlX/KH6aRSrzi81L
	SXG2tDv0FasZy2yJ+/S7ZwHPZJLp0YkR4mgdvZ14BGvZ6+6ndRNHObzMXVazyMehAZdxCqyytrK45
	NXlQmzR0rfw75u5Rc1YCeSxiTMUeuDVvkORMOvUBd2veAco28KF4i7fxxuI9+46GOMtk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
Message-Id: <E1n5wrw-0008Sy-7B@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:33:52 +0000

commit 4ebd423a528b3e85aa10b701f8326e16f1e7c352
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:52:48 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:52:48 2022 +0100

    x86/HVM: permit CLFLUSH{,OPT} on execute-only code segments
    
    Both SDM and PM explicitly permit this.
    
    Fixes: 52dba7bd0b36 ("x86emul: generalize wbinvd() hook")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Paul Durrant <paul@xen.org>
    master commit: df3e1a5efe700a9f59eced801cac73f9fd02a0e2
    master date: 2021-12-10 14:03:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 24cf85fb4f..ee940c33ca 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2310,7 +2310,9 @@ static int hvmemul_cache_op(
         ASSERT(!is_x86_system_segment(seg));
 
         rc = hvmemul_virtual_to_linear(seg, offset, 0, NULL,
-                                       hvm_access_read, hvmemul_ctxt, &addr);
+                                       op != x86emul_clwb ? hvm_access_none
+                                                          : hvm_access_read,
+                                       hvmemul_ctxt, &addr);
         if ( rc != X86EMUL_OKAY )
             break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:34:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254550.436473 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5ws8-0004st-67; Fri, 07 Jan 2022 21:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254550.436473; Fri, 07 Jan 2022 21: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 1n5ws8-0004sl-2l; Fri, 07 Jan 2022 21:34:04 +0000
Received: by outflank-mailman (input) for mailman id 254550;
 Fri, 07 Jan 2022 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 1n5ws6-0004sZ-Cs
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5ws6-0001z2-C6
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5ws6-0008UA-BL
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=r48AT70qUZB/g5fuOkHkyaIVxKOOE97VvIDbKoCPkNI=; b=6/AAoSfEzkVmFlUY0g1W17zMjF
	Uj1qDIvFAJmi0zHOLIady79tea2Qm4Itqh0HBrPd7eSi5wuICA5K31AX8Cst+vwStLiwVu8bFqd9+
	KxZMXCJCgASzL/mao7XRGUfxrtliE9pWoPDzyeIgHx4j3Bgh3C0mi8rcfeUAEWgD+CzI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/cpuid: Fix TSXLDTRK definition
Message-Id: <E1n5ws6-0008UA-BL@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:34:02 +0000

commit cc645375f69ce99c834025ca1a7387899c9d6e9e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 7 08:53:12 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:53:12 2022 +0100

    x86/cpuid: Fix TSXLDTRK definition
    
    TSXLDTRK lives in CPUID leaf 7[0].edx, not 7[0].ecx.
    
    Bit 16 in ecx is LA57.
    
    Fixes: a6d1b558471f ("x86emul: support X{SUS,RES}LDTRK")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 249e0f1d8f203188ccdcced5a05c2149739e1566
    master date: 2021-12-14 12:30:48 +0000
---
 tools/libxl/libxl_cpuid.c                   | 2 +-
 tools/misc/xen-cpuid.c                      | 3 +--
 xen/arch/x86/x86_emulate/x86_emulate.c      | 2 +-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index fd63f606c8..ce93c5a796 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -208,7 +208,6 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-vnni",  0x00000007,  0, CPUID_REG_ECX, 11,  1},
         {"avx512-bitalg",0x00000007,  0, CPUID_REG_ECX, 12,  1},
         {"avx512-vpopcntdq",0x00000007,0,CPUID_REG_ECX, 14,  1},
-        {"tsxldtrk",     0x00000007,  0, CPUID_REG_ECX, 16,  1},
         {"rdpid",        0x00000007,  0, CPUID_REG_ECX, 22,  1},
         {"cldemote",     0x00000007,  0, CPUID_REG_ECX, 25,  1},
 
@@ -217,6 +216,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
+        {"tsxldtrk",     0x00000007,  0, CPUID_REG_EDX, 16,  1},
         {"cet-ibt",      0x00000007,  0, CPUID_REG_EDX, 20,  1},
         {"ibrsb",        0x00000007,  0, CPUID_REG_EDX, 26,  1},
         {"stibp",        0x00000007,  0, CPUID_REG_EDX, 27,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index a1d675da0f..0056baf666 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -128,7 +128,6 @@ static const char *const str_7c0[32] =
     [10] = "vpclmulqdq",       [11] = "avx512_vnni",
     [12] = "avx512_bitalg",
     [14] = "avx512_vpopcntdq",
-    [16] = "tsxldtrk",
 
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
@@ -170,7 +169,7 @@ static const char *const str_7d0[32] =
     [10] = "md-clear",      [11] = "rtm-always-abort",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
-
+    [16] = "tsxldtrk",
     [18] = "pconfig",
     [20] = "cet-ibt",
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index de46ec1b44..e9216c40ff 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1999,7 +1999,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_vnni() (ctxt->cpuid->feat.avx512_vnni)
 #define vcpu_has_avx512_bitalg() (ctxt->cpuid->feat.avx512_bitalg)
 #define vcpu_has_avx512_vpopcntdq() (ctxt->cpuid->feat.avx512_vpopcntdq)
-#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_rdpid()       (ctxt->cpuid->feat.rdpid)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
@@ -2007,6 +2006,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_4vnniw() (ctxt->cpuid->feat.avx512_4vnniw)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
+#define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
 #define vcpu_must_have(feat) \
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 25a3fa03a4..c1b61385b1 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -238,7 +238,6 @@ XEN_CPUFEATURE(VPCLMULQDQ,    6*32+10) /*A  Vector Carry-less Multiplication Ins
 XEN_CPUFEATURE(AVX512_VNNI,   6*32+11) /*A  Vector Neural Network Instrs */
 XEN_CPUFEATURE(AVX512_BITALG, 6*32+12) /*A  Support for VPOPCNT[B,W] and VPSHUFBITQMB */
 XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
-XEN_CPUFEATURE(TSXLDTRK,      6*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
@@ -274,6 +273,7 @@ XEN_CPUFEATURE(MD_CLEAR,      9*32+10) /*A  VERW clears microarchitectural buffe
 XEN_CPUFEATURE(RTM_ALWAYS_ABORT, 9*32+11) /*! June 2021 TSX defeaturing in microcode. */
 XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*a  SERIALIZE insn */
+XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:34:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254551.436477 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5wsI-0004vc-7K; Fri, 07 Jan 2022 21:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254551.436477; Fri, 07 Jan 2022 21: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 1n5wsI-0004vU-4E; Fri, 07 Jan 2022 21:34:14 +0000
Received: by outflank-mailman (input) for mailman id 254551;
 Fri, 07 Jan 2022 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 1n5wsG-0004vE-G1
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5wsG-0001zE-FJ
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5wsG-0008V4-EK
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=3okBwjfHhlZGDdwUPVm8XfbELZw8Fj+46nD0Z5y6f18=; b=PUMzRJzbqLijihuPLK/cRsf+M7
	KLtcPiTeOVmkX91VN8HqFpVcwmNlMrWwk1Qe8PBsTi6z+Q4meb5Sr7EJbRmNSpRDMNvJPLL+2c5TR
	wKiCXA7mpc/R4yDgEwWN7+gLzyrBj2uWpoa+HvcbDLx54/SpLZM9CNCGS2erPvXmGHWg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
Message-Id: <E1n5wsG-0008V4-EK@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:34:12 +0000

commit 1c30c97bd89b85b8cf723d4c255b0da9ca8d1bb7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 7 08:54:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:54:21 2022 +0100

    revert "hvmloader: PA range 0xfc000000-0xffffffff should be UC"
    
    This reverts commit c22bd567ce22f6ad9bd93318ad0d7fd1c2eadb0d.
    
    While its description is correct from an abstract or real hardware pov,
    the range is special inside HVM guests. The range being UC in particular
    gets in the way of OVMF, which places itself at [FFE00000,FFFFFFFF].
    While this is benign to epte_get_entry_emt() as long as the IOMMU isn't
    enabled for a guest, it becomes a very noticable problem otherwise: It
    takes about half a minute for OVMF to decompress itself into its
    designated address range.
    
    And even beyond OVMF there's no reason to have e.g. the ACPI memory
    range marked UC.
    
    Fixes: c22bd567ce22 ("hvmloader: PA range 0xfc000000-0xffffffff should be UC")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ea187c0b7a73c26258c0e91e4f3656989804555f
    master date: 2021-12-17 08:56:15 +0100
---
 tools/firmware/hvmloader/cacheattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/hvmloader/cacheattr.c b/tools/firmware/hvmloader/cacheattr.c
index 1ac6656c70..1c67819748 100644
--- a/tools/firmware/hvmloader/cacheattr.c
+++ b/tools/firmware/hvmloader/cacheattr.c
@@ -98,12 +98,12 @@ void cacheattr_init(void)
     {
         uint64_t base = pci_mem_start, size;
 
-        for ( i = 0; !(base >> 32) && (i < nr_var_ranges); i++ )
+        for ( i = 0; (base != pci_mem_end) && (i < nr_var_ranges); i++ )
         {
             size = PAGE_SIZE;
             while ( !(base & size) )
                 size <<= 1;
-            while ( ((base + size) < base) || ((base + size - 1) >> 32) )
+            while ( ((base + size) < base) || ((base + size) > pci_mem_end) )
                 size >>= 1;
 
             wrmsr(MSR_MTRRphysBase(i), base);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jan 07 21:34:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Jan 2022 21:34:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.254552.436481 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n5wsR-0004y8-8p; Fri, 07 Jan 2022 21:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 254552.436481; Fri, 07 Jan 2022 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 1n5wsR-0004xy-5r; Fri, 07 Jan 2022 21:34:23 +0000
Received: by outflank-mailman (input) for mailman id 254552;
 Fri, 07 Jan 2022 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 1n5wsQ-0004xd-Iz
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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 1n5wsQ-0001zX-IJ
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 21:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n5wsQ-0008WJ-Ha
 for xen-changelog@lists.xenproject.org; Fri, 07 Jan 2022 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=mUgJKXm2ssq13lXSoSvY/UdSjUhcyqbeWBBtoRRg8TU=; b=VArc+6qEMI0BH85ZUH0w9Ap59t
	uj/Y70+sKpi5uLUEmpoe1gSgP3UGqilexquD8wtdDL/ftv+i+a3qpJmu7Z6hX4+PyubIBZnlmM6bf
	JC/2vFBSx0x+LwlkVLPRwV3m6ljgFR+PUmtXKiLjPNNgEAZLIu36m691TzL9TY5oFnTo=;
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: Fix default calculation of opt_srb_lock
Message-Id: <E1n5wsQ-0008WJ-Ha@xenbits.xenproject.org>
Date: Fri, 07 Jan 2022 21:34:22 +0000

commit 45299b3cc83d3d19c24d74f7e28dcc83e8fa0c2e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 7 08:54:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 7 08:54:38 2022 +0100

    x86/spec-ctrl: Fix default calculation of opt_srb_lock
    
    Since this logic was introduced, opt_tsx has become more complicated and
    shouldn't be compared to 0 directly.  While there are no buggy logic paths,
    the correct expression is !(opt_tsx & 1) but the rtm_disabled boolean is
    easier and clearer to use.
    
    Fixes: 8fe24090d940 ("x86/cpuid: Rework HLE and RTM handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 31f3bc97f4508687215e459a5e35676eecf1772b
    master date: 2022-01-05 09:44:26 +0000
---
 xen/arch/x86/spec_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 7e0c171dc8..f70535b6e7 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1197,7 +1197,7 @@ void __init init_speculation_mitigations(void)
          */
         if ( opt_srb_lock == -1 &&
              (caps & (ARCH_CAPS_MDS_NO|ARCH_CAPS_TAA_NO)) == ARCH_CAPS_MDS_NO &&
-             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && opt_tsx == 0)) )
+             (!cpu_has_hle || ((caps & ARCH_CAPS_TSX_CTRL) && rtm_disabled)) )
             opt_srb_lock = 0;
 
         val &= ~MCU_OPT_CTRL_RNGDS_MITG_DIS;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 11 10:44:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Jan 2022 10:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.255679.438165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7EdJ-0003Ee-Uy; Tue, 11 Jan 2022 10:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 255679.438165; Tue, 11 Jan 2022 10:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7EdJ-0003EV-S1; Tue, 11 Jan 2022 10:44:05 +0000
Received: by outflank-mailman (input) for mailman id 255679;
 Tue, 11 Jan 2022 10:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7EdI-0003EP-MY
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 10:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7EdI-0006dK-K6
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 10:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7EdI-0000rP-Iu
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 10:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=16rT00aRZnTOzF3V3StKzvroWdhPCarJt1WnhBoc/Uc=; b=5fTvcQ0AgnYN+63ieicu8ERDtQ
	mAsjwEySdf+yvpI2L+Mn/ieZ+I6RY5kYswIxwOh1Dre4ajir+YOH4CyBRRpGttlS74Wt8bq7nugk6
	cjqULTrcKRY4v1IEuLpWiJ4LDQnWwBl6oN2gS9kp4oNxeDnF2VHCwsrZFIq9Z1b13Cvg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/viridian: EOI MSR should always happen in affected vCPU context
Message-Id: <E1n7EdI-0000rP-Iu@xenbits.xenproject.org>
Date: Tue, 11 Jan 2022 10:44:04 +0000

commit b8428a858aba2200abe83afa1eb7c8115979c509
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jan 11 11:42:49 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 11 11:42:49 2022 +0100

    x86/viridian: EOI MSR should always happen in affected vCPU context
    
    The HV_X64_MSR_EOI wrmsr should always happen with the target vCPU
    as current, as there's no support for EOI'ing interrupts on a remote
    vCPU.
    
    While there also turn the unconditional assert at the top of the
    function into an error on non-debug builds.
    
    No functional change intended.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/viridian/synic.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 22e2df27e5..e18538c60a 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -79,11 +79,20 @@ int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
     struct viridian_vcpu *vv = v->arch.hvm.viridian;
     struct domain *d = v->domain;
 
-    ASSERT(v == current || !v->is_running);
+    if ( v != current && v->is_running )
+    {
+        ASSERT_UNREACHABLE();
+        return X86EMUL_EXCEPTION;
+    }
 
     switch ( idx )
     {
     case HV_X64_MSR_EOI:
+        if ( v != current )
+        {
+            ASSERT_UNREACHABLE();
+            return X86EMUL_EXCEPTION;
+        }
         vlapic_EOI_set(vcpu_vlapic(v));
         break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 11 10:44:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Jan 2022 10:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.255680.438170 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7EdU-0003Gv-0l; Tue, 11 Jan 2022 10:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 255680.438170; Tue, 11 Jan 2022 10:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7EdT-0003Gk-TT; Tue, 11 Jan 2022 10:44:15 +0000
Received: by outflank-mailman (input) for mailman id 255680;
 Tue, 11 Jan 2022 10:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7EdS-0003Gd-OF
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 10:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7EdS-0006dQ-NT
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 10:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7EdS-0000sQ-MP
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 10:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1E05ahMfnBO5YPazTTnysNrneNvrMjgjBHKOcK+0eOQ=; b=lWn/xJbxyLKENxXcvjPxkgq0Cg
	I7N2+px93pU/H7gtq4WOTZzXwhiARk35IObrL/iyo9GSSBxVXpK0WfFVrIFOr4CZKSp6jeN8Xw+cD
	OEoN6K+oCvED3K62MApg6f53yEv7Evhj121TqodRlyRbOVnr0IXqoLN16ydKJkr0wjxA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: limit support statement for Linux and Windows frontends
Message-Id: <E1n7EdS-0000sQ-MP@xenbits.xenproject.org>
Date: Tue, 11 Jan 2022 10:44:14 +0000

commit 22891e12a45f9bb2e1dbb5daf2ba39cbe002e4f4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 11:43:48 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 11 11:43:48 2022 +0100

    SUPPORT.md: limit support statement for Linux and Windows frontends
    
    Change the support state of Linux and Windows pv frontends from
    "supported" to "supported with caveats" in order to reflect that the
    frontends can probably be harmed by their respective backends.
    
    Some of the Linux frontends have been hardened already.
    
    This is XSA-376
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 48 insertions(+), 9 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 3a1fd1ba39..32fb0aa8de 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -417,7 +417,11 @@ Guest-side driver capable of speaking the Xen PV block protocol
     Status, FreeBSD: Supported, Security support external
     Status, NetBSD: Supported, Security support external
     Status, OpenBSD: Supported, Security support external
-    Status, Windows: Supported
+    Status, Windows: Supported, with caveats
+
+Windows frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### Netfront
 
@@ -427,20 +431,32 @@ Guest-side driver capable of speaking the Xen PV networking protocol
     Status, FreeBSD: Supported, Security support external
     Status, NetBSD: Supported, Security support external
     Status, OpenBSD: Supported, Security support external
-    Status, Windows: Supported
+    Status, Windows: Supported, with caveats
+
+Windows frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV Framebuffer (frontend)
 
 Guest-side driver capable of speaking the Xen PV Framebuffer protocol
 
-    Status, Linux (xen-fbfront): Supported
+    Status, Linux (xen-fbfront): Supported, with caveats
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV display (frontend)
 
 Guest-side driver capable of speaking the Xen PV display protocol
 
-    Status, Linux: Supported (outside of "backend allocation" mode)
-    Status, Linux: Experimental (in "backend allocation" mode)
+    Status, Linux, outside of "backend allocation" mode: Supported, with caveats
+    Status, Linux, "backend allocation" mode: Experimental
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV Console (frontend)
 
@@ -449,7 +465,11 @@ Guest-side driver capable of speaking the Xen PV console protocol
     Status, Linux (hvc_xen): Supported
     Status, FreeBSD: Supported, Security support external
     Status, NetBSD: Supported, Security support external
-    Status, Windows: Supported
+    Status, Windows: Supported, with caveats
+
+Windows frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV keyboard (frontend)
 
@@ -457,11 +477,19 @@ Guest-side driver capable of speaking the Xen PV keyboard protocol.
 Note that the "keyboard protocol" includes mouse / pointer /
 multi-touch support as well.
 
-    Status, Linux (xen-kbdfront): Supported
+    Status, Linux (xen-kbdfront): Supported, with caveats
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV USB (frontend)
 
-    Status, Linux: Supported
+    Status, Linux: Supported, with caveats
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV SCSI protocol (frontend)
 
@@ -470,6 +498,10 @@ multi-touch support as well.
 NB that while the PV SCSI frontend is in Linux and tested regularly,
 there is currently no xl support.
 
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
+
 ### PV TPM (frontend)
 
 Guest-side driver capable of speaking the Xen PV TPM protocol
@@ -492,7 +524,11 @@ Guest-side driver capable of making pv system calls
 
 Guest-side driver capable of speaking the Xen PV sound protocol
 
-    Status, Linux: Supported
+    Status, Linux: Supported, with caveats
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ## Virtual device support, host side
 
@@ -993,6 +1029,9 @@ are given the following labels:
 
     This feature is security supported
     by a different organization (not the XenProject).
+    The extent of support is defined by that organization.
+    It might be limited, e.g. like described in **Supported, with caveats**
+    below.
     See **External security support** below.
 
   * **Supported, with caveats**
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 11 23:33:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Jan 2022 23:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256187.439531 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7QdT-0002Rj-Rw; Tue, 11 Jan 2022 23:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256187.439531; Tue, 11 Jan 2022 23: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 1n7QdT-0002RY-Ot; Tue, 11 Jan 2022 23:33:03 +0000
Received: by outflank-mailman (input) for mailman id 256187;
 Tue, 11 Jan 2022 23: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 1n7QdS-0002Qx-Fv
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 23: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 1n7QdS-0004ol-F3
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 23:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7QdS-0002P3-Du
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 23: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=xQFkVAivK4AAnoTXFkOPx+EgBWIQd3GVgL8qew5K5qg=; b=Yuci+Tq3ol8d41M7G52M9niX7t
	X9gY/bJ/cBIpdFJUgQFK4mRpGljz6lXVn/kID6COHD5pE5P0bc+StALD9iG7fsA6s3krzSnCRwanr
	2evs482Vksr/fBD69wiKGERbmzVavHEgjao7ONlAQdpcW6WFA4YzW3LHxvXDJILsgl34=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/viridian: EOI MSR should always happen in affected vCPU context
Message-Id: <E1n7QdS-0002P3-Du@xenbits.xenproject.org>
Date: Tue, 11 Jan 2022 23:33:02 +0000

commit b8428a858aba2200abe83afa1eb7c8115979c509
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Jan 11 11:42:49 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 11 11:42:49 2022 +0100

    x86/viridian: EOI MSR should always happen in affected vCPU context
    
    The HV_X64_MSR_EOI wrmsr should always happen with the target vCPU
    as current, as there's no support for EOI'ing interrupts on a remote
    vCPU.
    
    While there also turn the unconditional assert at the top of the
    function into an error on non-debug builds.
    
    No functional change intended.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/viridian/synic.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 22e2df27e5..e18538c60a 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -79,11 +79,20 @@ int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val)
     struct viridian_vcpu *vv = v->arch.hvm.viridian;
     struct domain *d = v->domain;
 
-    ASSERT(v == current || !v->is_running);
+    if ( v != current && v->is_running )
+    {
+        ASSERT_UNREACHABLE();
+        return X86EMUL_EXCEPTION;
+    }
 
     switch ( idx )
     {
     case HV_X64_MSR_EOI:
+        if ( v != current )
+        {
+            ASSERT_UNREACHABLE();
+            return X86EMUL_EXCEPTION;
+        }
         vlapic_EOI_set(vcpu_vlapic(v));
         break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 11 23:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Jan 2022 23:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256191.439536 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7Qdd-0002au-UA; Tue, 11 Jan 2022 23:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256191.439536; Tue, 11 Jan 2022 23: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 1n7Qdd-0002am-R3; Tue, 11 Jan 2022 23:33:13 +0000
Received: by outflank-mailman (input) for mailman id 256191;
 Tue, 11 Jan 2022 23: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 1n7Qdc-0002aP-It
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 23: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 1n7Qdc-0004or-IC
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 23:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7Qdc-0002Pj-HG
 for xen-changelog@lists.xenproject.org; Tue, 11 Jan 2022 23: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=CXDTvR8Knv6iBlvBEmv1dC6OaTorIlvjtnXovnAZKxk=; b=i2rrmK8v3mIKTk+QXhqjcaZe5x
	ZdlIvYVEdaTSYUQisIkniMmWFsCr8qCPsOLm/PrIzjy+yMXTD+lhcwpYseALOoSjrPxhO+z83vRY2
	LakqQzC1dADdw/HWPntR/9mDWEK01fS3q59U7+keetuO5WRU5pWKDctkkjiZicrUMV1M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: limit support statement for Linux and Windows frontends
Message-Id: <E1n7Qdc-0002Pj-HG@xenbits.xenproject.org>
Date: Tue, 11 Jan 2022 23:33:12 +0000

commit 22891e12a45f9bb2e1dbb5daf2ba39cbe002e4f4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 11:43:48 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 11 11:43:48 2022 +0100

    SUPPORT.md: limit support statement for Linux and Windows frontends
    
    Change the support state of Linux and Windows pv frontends from
    "supported" to "supported with caveats" in order to reflect that the
    frontends can probably be harmed by their respective backends.
    
    Some of the Linux frontends have been hardened already.
    
    This is XSA-376
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 48 insertions(+), 9 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 3a1fd1ba39..32fb0aa8de 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -417,7 +417,11 @@ Guest-side driver capable of speaking the Xen PV block protocol
     Status, FreeBSD: Supported, Security support external
     Status, NetBSD: Supported, Security support external
     Status, OpenBSD: Supported, Security support external
-    Status, Windows: Supported
+    Status, Windows: Supported, with caveats
+
+Windows frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### Netfront
 
@@ -427,20 +431,32 @@ Guest-side driver capable of speaking the Xen PV networking protocol
     Status, FreeBSD: Supported, Security support external
     Status, NetBSD: Supported, Security support external
     Status, OpenBSD: Supported, Security support external
-    Status, Windows: Supported
+    Status, Windows: Supported, with caveats
+
+Windows frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV Framebuffer (frontend)
 
 Guest-side driver capable of speaking the Xen PV Framebuffer protocol
 
-    Status, Linux (xen-fbfront): Supported
+    Status, Linux (xen-fbfront): Supported, with caveats
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV display (frontend)
 
 Guest-side driver capable of speaking the Xen PV display protocol
 
-    Status, Linux: Supported (outside of "backend allocation" mode)
-    Status, Linux: Experimental (in "backend allocation" mode)
+    Status, Linux, outside of "backend allocation" mode: Supported, with caveats
+    Status, Linux, "backend allocation" mode: Experimental
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV Console (frontend)
 
@@ -449,7 +465,11 @@ Guest-side driver capable of speaking the Xen PV console protocol
     Status, Linux (hvc_xen): Supported
     Status, FreeBSD: Supported, Security support external
     Status, NetBSD: Supported, Security support external
-    Status, Windows: Supported
+    Status, Windows: Supported, with caveats
+
+Windows frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV keyboard (frontend)
 
@@ -457,11 +477,19 @@ Guest-side driver capable of speaking the Xen PV keyboard protocol.
 Note that the "keyboard protocol" includes mouse / pointer /
 multi-touch support as well.
 
-    Status, Linux (xen-kbdfront): Supported
+    Status, Linux (xen-kbdfront): Supported, with caveats
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV USB (frontend)
 
-    Status, Linux: Supported
+    Status, Linux: Supported, with caveats
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ### PV SCSI protocol (frontend)
 
@@ -470,6 +498,10 @@ multi-touch support as well.
 NB that while the PV SCSI frontend is in Linux and tested regularly,
 there is currently no xl support.
 
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
+
 ### PV TPM (frontend)
 
 Guest-side driver capable of speaking the Xen PV TPM protocol
@@ -492,7 +524,11 @@ Guest-side driver capable of making pv system calls
 
 Guest-side driver capable of speaking the Xen PV sound protocol
 
-    Status, Linux: Supported
+    Status, Linux: Supported, with caveats
+
+Linux frontend currently trusts the backend;
+bugs in the frontend which allow backend to cause mischief will not be
+considered security vulnerabilities.
 
 ## Virtual device support, host side
 
@@ -993,6 +1029,9 @@ are given the following labels:
 
     This feature is security supported
     by a different organization (not the XenProject).
+    The extent of support is defined by that organization.
+    It might be limited, e.g. like described in **Supported, with caveats**
+    below.
     See **External security support** below.
 
   * **Supported, with caveats**
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 08:00:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 08:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256347.439833 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7YY9-0006Yq-Pd; Wed, 12 Jan 2022 08:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256347.439833; Wed, 12 Jan 2022 08:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7YY9-0006YN-M5; Wed, 12 Jan 2022 08:00:05 +0000
Received: by outflank-mailman (input) for mailman id 256347;
 Wed, 12 Jan 2022 08:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YY8-0006Ne-QM
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YY8-0000TN-OO
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YY8-0007DB-N5
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JwKRooqbViUvVOYb1Jncgef74k9yFUu0SBS/yigLtqU=; b=PYa/eyTkZ97vMx/ZQDzWbC9QWh
	wq1UZOhox1UH7bs+gAXyUpImPiaUwO5eFVvNB4fsSxc5q4HavecrbPmDkLiseHqaONgcCX4lZxxjg
	o4pUWBfNKmuhX6OEZd93bFaWrqRKe/YYZ2ZmQajMwV54+gjcNp0rlHI0qQrKHNNHzgHs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/paging: tidy paging_mfn_is_dirty()
Message-Id: <E1n7YY8-0007DB-N5@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 08:00:04 +0000

commit dc773e0e8997f10c4d369f9b60bc529a05de0b79
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jan 12 08:53:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 12 08:53:05 2022 +0100

    x86/paging: tidy paging_mfn_is_dirty()
    
    The function returning a boolean indicator, make it return bool. Also
    constify its struct domain parameter, albeit requiring to also adjust
    mm_locked_by_me(). Furthermore the function is used by shadow code only.
    
    Since mm_locked_by_me() needs touching anyway, also switch its return
    type to bool.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/paging.h |  2 +-
 xen/arch/x86/mm/mm-locks.h        |  2 +-
 xen/arch/x86/mm/paging.c          | 23 ++++++++++++-----------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index 308f1115dd..2ddcfb022c 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -173,7 +173,7 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn);
 
 /* is this guest page dirty? 
  * This is called from inside paging code, with the paging lock held. */
-int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn);
+bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn);
 
 /*
  * Log-dirty radix tree indexing:
diff --git a/xen/arch/x86/mm/mm-locks.h b/xen/arch/x86/mm/mm-locks.h
index d6c073dc5c..fcfd4706ba 100644
--- a/xen/arch/x86/mm/mm-locks.h
+++ b/xen/arch/x86/mm/mm-locks.h
@@ -40,7 +40,7 @@ static inline void mm_lock_init(mm_lock_t *l)
     l->unlock_level = 0;
 }
 
-static inline int mm_locked_by_me(mm_lock_t *l)
+static inline bool mm_locked_by_me(const mm_lock_t *l)
 {
     return (l->lock.recurse_cpu == current->processor);
 }
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index dd6b2bdf6f..c8fd50822a 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -351,14 +351,14 @@ void paging_mark_dirty(struct domain *d, mfn_t gmfn)
     paging_mark_pfn_dirty(d, pfn);
 }
 
-
+#ifdef CONFIG_SHADOW_PAGING
 /* Is this guest page dirty? */
-int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn)
+bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn)
 {
     pfn_t pfn;
     mfn_t mfn, *l4, *l3, *l2;
     unsigned long *l1;
-    int rv;
+    bool dirty;
 
     ASSERT(paging_locked_by_me(d));
     ASSERT(paging_mode_log_dirty(d));
@@ -367,36 +367,37 @@ int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn)
     pfn = _pfn(get_gpfn_from_mfn(mfn_x(gmfn)));
     /* Invalid pages can't be dirty. */
     if ( unlikely(!VALID_M2P(pfn_x(pfn))) )
-        return 0;
+        return false;
 
     mfn = d->arch.paging.log_dirty.top;
     if ( !mfn_valid(mfn) )
-        return 0;
+        return false;
 
     l4 = map_domain_page(mfn);
     mfn = l4[L4_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l4);
     if ( !mfn_valid(mfn) )
-        return 0;
+        return false;
 
     l3 = map_domain_page(mfn);
     mfn = l3[L3_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l3);
     if ( !mfn_valid(mfn) )
-        return 0;
+        return false;
 
     l2 = map_domain_page(mfn);
     mfn = l2[L2_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l2);
     if ( !mfn_valid(mfn) )
-        return 0;
+        return false;
 
     l1 = map_domain_page(mfn);
-    rv = test_bit(L1_LOGDIRTY_IDX(pfn), l1);
+    dirty = test_bit(L1_LOGDIRTY_IDX(pfn), l1);
     unmap_domain_page(l1);
-    return rv;
-}
 
+    return dirty;
+}
+#endif
 
 /* Read a domain's log-dirty bitmap and stats.  If the operation is a CLEAN,
  * clear the bitmap and stats as well. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 08:00:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 08:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256348.439836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7YYJ-0006kR-Rc; Wed, 12 Jan 2022 08:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256348.439836; Wed, 12 Jan 2022 08:00:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7YYJ-0006kK-Ny; Wed, 12 Jan 2022 08:00:15 +0000
Received: by outflank-mailman (input) for mailman id 256348;
 Wed, 12 Jan 2022 08:00:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YYI-0006k2-SX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YYI-0000Yf-Rh
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YYI-0007Ek-Qj
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EFCzqmramD/Y1ckC9Lg8+HGSIhRLLBXIgooZ5NLKGQo=; b=XXzwBA4Kqk4NK7ywwDHStFExYV
	GfjyPRhekmTZ9n5CdVJ8Hkb3qPW6Bbvpcr8hJ3nXHYSnZh+Pc+fDRSZfFEYdyRidIZPbWxng34yrJ
	QVbdMxbmYmrQ0alzo8lbukFRA8fwQnpGr9Tnp8NL4BJclKt6k6OvBgdREOD2PUubZlJg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/paging: replace most mfn_valid() in log-dirty handling
Message-Id: <E1n7YYI-0007Ek-Qj@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 08:00:14 +0000

commit 77a69c2dc72f0ab2cbd84f4e6e3a9420ec92b997
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jan 12 08:54:20 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 12 08:54:20 2022 +0100

    x86/paging: replace most mfn_valid() in log-dirty handling
    
    Top level table and intermediate table entries get explicitly set to
    INVALID_MFN when un-allocated. There's therefore no need to use the more
    expensive mfn_valid() when checking for that sentinel.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/paging.c | 46 ++++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index c8fd50822a..dc3a4a0b4b 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -74,7 +74,7 @@ static mfn_t paging_new_log_dirty_leaf(struct domain *d)
 {
     mfn_t mfn = paging_new_log_dirty_page(d);
 
-    if ( mfn_valid(mfn) )
+    if ( !mfn_eq(mfn, INVALID_MFN) )
         clear_domain_page(mfn);
 
     return mfn;
@@ -84,7 +84,8 @@ static mfn_t paging_new_log_dirty_leaf(struct domain *d)
 static mfn_t paging_new_log_dirty_node(struct domain *d)
 {
     mfn_t mfn = paging_new_log_dirty_page(d);
-    if ( mfn_valid(mfn) )
+
+    if ( !mfn_eq(mfn, INVALID_MFN) )
     {
         int i;
         mfn_t *node = map_domain_page(mfn);
@@ -98,7 +99,7 @@ static mfn_t paging_new_log_dirty_node(struct domain *d)
 /* get the top of the log-dirty bitmap trie */
 static mfn_t *paging_map_log_dirty_bitmap(struct domain *d)
 {
-    if ( likely(mfn_valid(d->arch.paging.log_dirty.top)) )
+    if ( likely(!mfn_eq(d->arch.paging.log_dirty.top, INVALID_MFN)) )
         return map_domain_page(d->arch.paging.log_dirty.top);
     return NULL;
 }
@@ -116,7 +117,7 @@ static int paging_free_log_dirty_bitmap(struct domain *d, int rc)
 
     paging_lock(d);
 
-    if ( !mfn_valid(d->arch.paging.log_dirty.top) )
+    if ( mfn_eq(d->arch.paging.log_dirty.top, INVALID_MFN) )
     {
         paging_unlock(d);
         return 0;
@@ -143,20 +144,20 @@ static int paging_free_log_dirty_bitmap(struct domain *d, int rc)
 
     for ( ; i4 < LOGDIRTY_NODE_ENTRIES; i4++, i3 = 0 )
     {
-        if ( !mfn_valid(l4[i4]) )
+        if ( mfn_eq(l4[i4], INVALID_MFN) )
             continue;
 
         l3 = map_domain_page(l4[i4]);
 
         for ( ; i3 < LOGDIRTY_NODE_ENTRIES; i3++ )
         {
-            if ( !mfn_valid(l3[i3]) )
+            if ( mfn_eq(l3[i3], INVALID_MFN) )
                 continue;
 
             l2 = map_domain_page(l3[i3]);
 
             for ( i2 = 0; i2 < LOGDIRTY_NODE_ENTRIES; i2++ )
-                if ( mfn_valid(l2[i2]) )
+                if ( !mfn_eq(l2[i2], INVALID_MFN) )
                     paging_free_log_dirty_page(d, l2[i2]);
 
             unmap_domain_page(l2);
@@ -288,35 +289,35 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn)
     /* Recursive: this is called from inside the shadow code */
     paging_lock_recursive(d);
 
-    if ( unlikely(!mfn_valid(d->arch.paging.log_dirty.top)) ) 
+    if ( unlikely(mfn_eq(d->arch.paging.log_dirty.top, INVALID_MFN)) )
     {
          d->arch.paging.log_dirty.top = paging_new_log_dirty_node(d);
-         if ( unlikely(!mfn_valid(d->arch.paging.log_dirty.top)) )
+         if ( unlikely(mfn_eq(d->arch.paging.log_dirty.top, INVALID_MFN)) )
              goto out;
     }
 
     l4 = paging_map_log_dirty_bitmap(d);
     mfn = l4[i4];
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         l4[i4] = mfn = paging_new_log_dirty_node(d);
     unmap_domain_page(l4);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         goto out;
 
     l3 = map_domain_page(mfn);
     mfn = l3[i3];
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         l3[i3] = mfn = paging_new_log_dirty_node(d);
     unmap_domain_page(l3);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         goto out;
 
     l2 = map_domain_page(mfn);
     mfn = l2[i2];
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         l2[i2] = mfn = paging_new_log_dirty_leaf(d);
     unmap_domain_page(l2);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         goto out;
 
     l1 = map_domain_page(mfn);
@@ -370,25 +371,25 @@ bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn)
         return false;
 
     mfn = d->arch.paging.log_dirty.top;
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         return false;
 
     l4 = map_domain_page(mfn);
     mfn = l4[L4_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l4);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         return false;
 
     l3 = map_domain_page(mfn);
     mfn = l3[L3_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l3);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         return false;
 
     l2 = map_domain_page(mfn);
     mfn = l2[L2_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l2);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         return false;
 
     l1 = map_domain_page(mfn);
@@ -477,17 +478,18 @@ static int paging_log_dirty_op(struct domain *d,
 
     for ( ; (pages < sc->pages) && (i4 < LOGDIRTY_NODE_ENTRIES); i4++, i3 = 0 )
     {
-        l3 = (l4 && mfn_valid(l4[i4])) ? map_domain_page(l4[i4]) : NULL;
+        l3 = ((l4 && !mfn_eq(l4[i4], INVALID_MFN)) ?
+              map_domain_page(l4[i4]) : NULL);
         for ( ; (pages < sc->pages) && (i3 < LOGDIRTY_NODE_ENTRIES); i3++ )
         {
-            l2 = ((l3 && mfn_valid(l3[i3])) ?
+            l2 = ((l3 && !mfn_eq(l3[i3], INVALID_MFN)) ?
                   map_domain_page(l3[i3]) : NULL);
             for ( i2 = 0;
                   (pages < sc->pages) && (i2 < LOGDIRTY_NODE_ENTRIES);
                   i2++ )
             {
                 unsigned int bytes = PAGE_SIZE;
-                l1 = ((l2 && mfn_valid(l2[i2])) ?
+                l1 = ((l2 && !mfn_eq(l2[i2], INVALID_MFN)) ?
                       map_domain_page(l2[i2]) : NULL);
                 if ( unlikely(((sc->pages - pages + 7) >> 3) < bytes) )
                     bytes = (unsigned int)((sc->pages - pages + 7) >> 3);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 08:00:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 08:00:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256351.439841 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7YYT-0006qw-U6; Wed, 12 Jan 2022 08:00:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256351.439841; Wed, 12 Jan 2022 08:00:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7YYT-0006qn-Qd; Wed, 12 Jan 2022 08:00:25 +0000
Received: by outflank-mailman (input) for mailman id 256351;
 Wed, 12 Jan 2022 08:00: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 1n7YYS-0006qc-VD
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YYS-0000Yp-UN
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YYS-0007FY-Tr
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zJiTMsmMV8VySukhKaQXce5Vck+CdjOpPz3rZnbsWbk=; b=kulk9NY+ApQub4dW7B7MDR61sp
	UmQSjnzVPbl2VNJWSiuWlBaV6D4Hy1sWd0eS7J8dTKhIcFhf5ojNECtlqjgitCFgnACX1On8HQ/XM
	pWPOxyHvK0VWrCG76e/p2isHsIAPEoUCAnpCA1jYOAg8cxFVl6p4ikpV8U4tKnl3zY4Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/debugger: fix make distclean
Message-Id: <E1n7YYS-0007FY-Tr@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 08:00:24 +0000

commit 35d15b27c968a555f10fa9c4fd5560b79d8d36eb
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 12 08:54:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 12 08:54:59 2022 +0100

    tools/debugger: fix make distclean
    
    "make distclean" will complain that "-c" is no supported flag for make.
    
    Fix that by using "-C".
    
    The error has been present for a long time, but it was uncovered only
    recently.
    
    Fixes: 2400a9a365c5619 ("tools/debugger: Allow make to recurse into debugger/")
    Fixes: f9c9b127753e9ed ("tools: fix make distclean")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/debugger/gdbsx/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/debugger/gdbsx/Makefile b/tools/debugger/gdbsx/Makefile
index 8d7cd94a31..5571450a89 100644
--- a/tools/debugger/gdbsx/Makefile
+++ b/tools/debugger/gdbsx/Makefile
@@ -14,7 +14,7 @@ clean:
 
 .PHONY: distclean
 distclean: clean
-	set -e; for d in xg gx; do $(MAKE) -c $$d distclean; done
+	set -e; for d in xg gx; do $(MAKE) -C $$d distclean; done
 
 .PHONY: install
 install: all
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 08:00:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 08:00:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256352.439846 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7YYd-0006ys-Vy; Wed, 12 Jan 2022 08:00:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256352.439846; Wed, 12 Jan 2022 08:00:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7YYd-0006yk-SA; Wed, 12 Jan 2022 08:00:35 +0000
Received: by outflank-mailman (input) for mailman id 256352;
 Wed, 12 Jan 2022 08:00: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 1n7YYd-0006yc-1q
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00: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 1n7YYd-0000Z0-15
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7YYd-0007GH-0G
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 08:00: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=4HIBhSIRoncaPDeq51KjQ945jwZU/bhESG/Kb3Dgkd8=; b=MM/uhDrFAM8A+aU2Zd+kXY79Vg
	sbmeciRtRANDIGKfsZLzj1q2VTZILD0OZrH/z8eaZE5d6d90/na3xS5omLcVfZsV53mEUt24T65Go
	CcXFrtiU2PSbbgsEaY2VsV+vv6XrklpcKMdAr/RRM3PnlCU9Xz3r5kLHWzpAteDvMtrQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: requesting to be TXT reviewer
Message-Id: <E1n7YYd-0007GH-0G@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 08:00:35 +0000

commit 0cf6521ea95dd78accf1e5c13cbfe8156b3611d0
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Jan 12 08:55:20 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 12 08:55:20 2022 +0100

    MAINTAINERS: requesting to be TXT reviewer
    
    I would like to submit myself, Daniel P. Smith, as a reviewer of TXT support in
    Xen.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6e84a05760..4a2884dfa7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -317,6 +317,7 @@ F:	xen/include/xen/hypfs.h
 
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
 R:	Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
+R:	Daniel P. Smith <dpsmith@apertussolutions.com>
 S:	Odd Fixes
 F:	xen/arch/x86/include/asm/tboot.h
 F:	xen/arch/x86/tboot.c
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:33:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256456.440086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7awE-0007RH-Ll; Wed, 12 Jan 2022 10:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256456.440086; Wed, 12 Jan 2022 10:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7awE-0007R7-I9; Wed, 12 Jan 2022 10:33:06 +0000
Received: by outflank-mailman (input) for mailman id 256456;
 Wed, 12 Jan 2022 10:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awD-0007R1-Fi
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33: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 1n7awD-0003Qc-Eu
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awD-0001XV-DH
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KO7+uo5U2q9zIaVdBmEXUzi597g5btvEpLNpLQrW5VQ=; b=x3rvOiPUrIzWtm8odR3ZoY90H4
	ng6UoLhBtS+68nTaelt1bfjq9sOv6/p9KvuzsRtnSq43AbO62tA5nesWBVJl5jZbW5/C/AEgCrZBo
	iHHb7zDaAL4szeTwvG73fHk/aa94wEvfKv8vg80kV0Ng88O0C10QMQ0stH4kTHb6dy2I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] virtio-balloon: don't start free page hinting if postcopy is possible
Message-Id: <E1n7awD-0001XV-DH@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:33:05 +0000

commit aa77e375a5b1b91d7646d8b5f8683778f53fbbd3
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Thu Jul 8 11:53:38 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:18 2021 -0600

    virtio-balloon: don't start free page hinting if postcopy is possible
    
    Postcopy never worked properly with 'free-page-hint=on', as there are
    at least two issues:
    
    1) With postcopy, the guest will never receive a VIRTIO_BALLOON_CMD_ID_DONE
       and consequently won't release free pages back to the OS once
       migration finishes.
    
       The issue is that for postcopy, we won't do a final bitmap sync while
       the guest is stopped on the source and
       virtio_balloon_free_page_hint_notify() will only call
       virtio_balloon_free_page_done() on the source during
       PRECOPY_NOTIFY_CLEANUP, after the VM state was already migrated to
       the destination.
    
    2) Once the VM touches a page on the destination that has been excluded
       from migration on the source via qemu_guest_free_page_hint() while
       postcopy is active, that thread will stall until postcopy finishes
       and all threads are woken up. (with older Linux kernels that won't
       retry faults when woken up via userfaultfd, we might actually get a
       SEGFAULT)
    
       The issue is that the source will refuse to migrate any pages that
       are not marked as dirty in the dirty bmap -- for example, because the
       page might just have been sent. Consequently, the faulting thread will
       stall, waiting for the page to be migrated -- which could take quite
       a while and result in guest OS issues.
    
    While we could fix 1) comparatively easily, 2) is harder to get right and
    might require more involved RAM migration changes on source and destination
    [1].
    
    As it never worked properly, let's not start free page hinting in the
    precopy notifier if the postcopy migration capability was enabled to fix
    it easily. Capabilities cannot be enabled once migration is already
    running.
    
    Note 1: in the future we might either adjust migration code on the source
            to track pages that have actually been sent or adjust
            migration code on source and destination  to eventually send
            pages multiple times from the source and and deal with pages
            that are sent multiple times on the destination.
    
    Note 2: virtio-mem has similar issues, however, access to "unplugged"
            memory by the guest is very rare and we would have to be very
            lucky for it to happen during migration. The spec states
            "The driver SHOULD NOT read from unplugged memory blocks ..."
            and "The driver MUST NOT write to unplugged memory blocks".
            virtio-mem will move away from virtio_balloon_free_page_done()
            soon and handle this case explicitly on the destination.
    
    [1] https://lkml.kernel.org/r/e79fd18c-aa62-c1d8-c7f3-ba3fc2c25fc8@redhat.com
    
    Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
    Cc: qemu-stable@nongnu.org
    Cc: Wei Wang <wei.w.wang@intel.com>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Cc: Alexander Duyck <alexander.duyck@gmail.com>
    Cc: Juan Quintela <quintela@redhat.com>
    Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
    Cc: Peter Xu <peterx@redhat.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20210708095339.20274-2-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Peter Xu <peterx@redhat.com>
    (cherry picked from commit fd51e54fa10221e5a8add894c38cc1cf199f4bc4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio-balloon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 4b5d9e5e50..ae7867a8db 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -30,6 +30,7 @@
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "migration/misc.h"
+#include "migration/migration.h"
 
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
@@ -662,6 +663,18 @@ virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data)
         return 0;
     }
 
+    /*
+     * Pages hinted via qemu_guest_free_page_hint() are cleared from the dirty
+     * bitmap and will not get migrated, especially also not when the postcopy
+     * destination starts using them and requests migration from the source; the
+     * faulting thread will stall until postcopy migration finishes and
+     * all threads are woken up. Let's not start free page hinting if postcopy
+     * is possible.
+     */
+    if (migrate_postcopy_ram()) {
+        return 0;
+    }
+
     switch (pnd->reason) {
     case PRECOPY_NOTIFY_BEFORE_BITMAP_SYNC:
         virtio_balloon_free_page_stop(dev);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:33:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256457.440088 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7awO-0007TG-Mo; Wed, 12 Jan 2022 10:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256457.440088; Wed, 12 Jan 2022 10:33: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 1n7awO-0007T8-Jj; Wed, 12 Jan 2022 10:33:16 +0000
Received: by outflank-mailman (input) for mailman id 256457;
 Wed, 12 Jan 2022 10:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awN-0007Sy-JL
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33: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 1n7awN-0003Ql-IW
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awN-0001YR-HN
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=24fJbXHS/qcrL/ngig1fQIMFbdLZyzPoIqzkIaEQ9dQ=; b=psHubZ8NDU3oM+VyZiaZ5TPfLl
	wa0SZLu5qmLqZywVuveeLR7TL6UqkG/Ev7p8PIiV+uhZkIr0G7Gzd20M50VIU3lKIOyIUMEMzPW7e
	boFNwIYtx+z+SzEqrbPJR9GvOGZe6l3N/KfmkwHJJ3/cUx3MaL/Kc4iYaQ6c47phd8E4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] target/arm: Don't skip M-profile reset entirely in user mode
Message-Id: <E1n7awN-0001YR-HN@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:33:15 +0000

commit 3054f772de9c2e97e7c196d4f3e70d58aca1e807
Author:     Peter Maydell <peter.maydell@linaro.org>
AuthorDate: Mon Sep 20 09:54:33 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:25 2021 -0600

    target/arm: Don't skip M-profile reset entirely in user mode
    
    Currently all of the M-profile specific code in arm_cpu_reset() is
    inside a !defined(CONFIG_USER_ONLY) ifdef block.  This is
    unintentional: it happened because originally the only
    M-profile-specific handling was the setup of the initial SP and PC
    from the vector table, which is system-emulation only.  But then we
    added a lot of other M-profile setup to the same "if (ARM_FEATURE_M)"
    code block without noticing that it was all inside a not-user-mode
    ifdef.  This has generally been harmless, but with the addition of
    v8.1M low-overhead-loop support we ran into a problem: the reset of
    FPSCR.LTPSIZE to 4 was only being done for system emulation mode, so
    if a user-mode guest tried to execute the LE instruction it would
    incorrectly take a UsageFault.
    
    Adjust the ifdefs so only the really system-emulation specific parts
    are covered.  Because this means we now run some reset code that sets
    up initial values in the FPCCR and similar FPU related registers,
    explicitly set up the registers controlling FPU context handling in
    user-emulation mode so that the FPU works by design and not by
    chance.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/613
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-id: 20210914120725.24992-2-peter.maydell@linaro.org
    (cherry picked from commit b62ceeaf8096fdbbbfdc6087da0028bc4a4dd77e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/arm/cpu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 2866dd7658..af60c07ca1 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -265,12 +265,15 @@ static void arm_cpu_reset(DeviceState *dev)
         env->uncached_cpsr = ARM_CPU_MODE_SVC;
     }
     env->daif = PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F;
+#endif
 
     if (arm_feature(env, ARM_FEATURE_M)) {
+#ifndef CONFIG_USER_ONLY
         uint32_t initial_msp; /* Loaded from 0x0 */
         uint32_t initial_pc; /* Loaded from 0x4 */
         uint8_t *rom;
         uint32_t vecbase;
+#endif
 
         if (cpu_isar_feature(aa32_lob, cpu)) {
             /*
@@ -324,6 +327,8 @@ static void arm_cpu_reset(DeviceState *dev)
             env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK |
                 R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK;
         }
+
+#ifndef CONFIG_USER_ONLY
         /* Unlike A/R profile, M profile defines the reset LR value */
         env->regs[14] = 0xffffffff;
 
@@ -352,8 +357,22 @@ static void arm_cpu_reset(DeviceState *dev)
         env->regs[13] = initial_msp & 0xFFFFFFFC;
         env->regs[15] = initial_pc & ~1;
         env->thumb = initial_pc & 1;
+#else
+        /*
+         * For user mode we run non-secure and with access to the FPU.
+         * The FPU context is active (ie does not need further setup)
+         * and is owned by non-secure.
+         */
+        env->v7m.secure = false;
+        env->v7m.nsacr = 0xcff;
+        env->v7m.cpacr[M_REG_NS] = 0xf0ffff;
+        env->v7m.fpccr[M_REG_S] &=
+            ~(R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK);
+        env->v7m.control[M_REG_S] |= R_V7M_CONTROL_FPCA_MASK;
+#endif
     }
 
+#ifndef CONFIG_USER_ONLY
     /* AArch32 has a hard highvec setting of 0xFFFF0000.  If we are currently
      * executing as AArch32 then check if highvecs are enabled and
      * adjust the PC accordingly.
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:33:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256458.440093 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7awY-0007X1-OQ; Wed, 12 Jan 2022 10:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256458.440093; Wed, 12 Jan 2022 10:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7awY-0007Wt-LP; Wed, 12 Jan 2022 10:33:26 +0000
Received: by outflank-mailman (input) for mailman id 256458;
 Wed, 12 Jan 2022 10:33:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awX-0007Wi-Ms
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33: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 1n7awX-0003R4-M5
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awX-0001ZA-L9
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QzhO6aBl3nvkcyRpMz6FDqumZUZ7PwU3aPLolLMLp3Y=; b=pwhZeW8+unfZrq8rE45jTJgO6f
	ycH0/qMLa7TbRve+Td0PwTjscTCWwIcTCdwx49SED07VhLyGgVjxYjkRAaopvXqfAlC5ophD/iBI5
	I9a8sPCCFiF7dX24ykSnDX0F92dE802FK6DSR0G/7rj7xImjiUUyx55Nbi65GRwhL8/8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] virtio-net: fix use after unmap/free for sg
Message-Id: <E1n7awX-0001ZA-L9@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:33:25 +0000

commit 9e41f16fca436a666ee79f5219797a2c58b6cf19
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Sep 2 13:44:12 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:31 2021 -0600

    virtio-net: fix use after unmap/free for sg
    
    When mergeable buffer is enabled, we try to set the num_buffers after
    the virtqueue elem has been unmapped. This will lead several issues,
    E.g a use after free when the descriptor has an address which belongs
    to the non direct access region. In this case we use bounce buffer
    that is allocated during address_space_map() and freed during
    address_space_unmap().
    
    Fixing this by storing the elems temporarily in an array and delay the
    unmap after we set the the num_buffers.
    
    This addresses CVE-2021-3748.
    
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Fixes: fbe78f4f55c6 ("virtio-net support")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit bedd7e93d01961fcb16a97ae45d93acf357e11f6)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/virtio-net.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 16d20cdee5..f205331dcf 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1746,10 +1746,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
     VirtIONet *n = qemu_get_nic_opaque(nc);
     VirtIONetQueue *q = virtio_net_get_subqueue(nc);
     VirtIODevice *vdev = VIRTIO_DEVICE(n);
+    VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE];
+    size_t lens[VIRTQUEUE_MAX_SIZE];
     struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
     struct virtio_net_hdr_mrg_rxbuf mhdr;
     unsigned mhdr_cnt = 0;
-    size_t offset, i, guest_offset;
+    size_t offset, i, guest_offset, j;
+    ssize_t err;
 
     if (!virtio_net_can_receive(nc)) {
         return -1;
@@ -1780,6 +1783,12 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
 
         total = 0;
 
+        if (i == VIRTQUEUE_MAX_SIZE) {
+            virtio_error(vdev, "virtio-net unexpected long buffer chain");
+            err = size;
+            goto err;
+        }
+
         elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement));
         if (!elem) {
             if (i) {
@@ -1791,7 +1800,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                              n->guest_hdr_len, n->host_hdr_len,
                              vdev->guest_features);
             }
-            return -1;
+            err = -1;
+            goto err;
         }
 
         if (elem->in_num < 1) {
@@ -1799,7 +1809,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                          "virtio-net receive queue contains no in buffers");
             virtqueue_detach_element(q->rx_vq, elem, 0);
             g_free(elem);
-            return -1;
+            err = -1;
+            goto err;
         }
 
         sg = elem->in_sg;
@@ -1836,12 +1847,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
         if (!n->mergeable_rx_bufs && offset < size) {
             virtqueue_unpop(q->rx_vq, elem, total);
             g_free(elem);
-            return size;
+            err = size;
+            goto err;
         }
 
-        /* signal other side */
-        virtqueue_fill(q->rx_vq, elem, total, i++);
-        g_free(elem);
+        elems[i] = elem;
+        lens[i] = total;
+        i++;
     }
 
     if (mhdr_cnt) {
@@ -1851,10 +1863,23 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                      &mhdr.num_buffers, sizeof mhdr.num_buffers);
     }
 
+    for (j = 0; j < i; j++) {
+        /* signal other side */
+        virtqueue_fill(q->rx_vq, elems[j], lens[j], j);
+        g_free(elems[j]);
+    }
+
     virtqueue_flush(q->rx_vq, i);
     virtio_notify(vdev, q->rx_vq);
 
     return size;
+
+err:
+    for (j = 0; j < i; j++) {
+        g_free(elems[j]);
+    }
+
+    return err;
 }
 
 static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:33:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:33:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256459.440096 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7awi-0007Zw-Q2; Wed, 12 Jan 2022 10:33:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256459.440096; Wed, 12 Jan 2022 10:33: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 1n7awi-0007Zo-N8; Wed, 12 Jan 2022 10:33:36 +0000
Received: by outflank-mailman (input) for mailman id 256459;
 Wed, 12 Jan 2022 10:33:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awh-0007Zc-QC
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33: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 1n7awh-0003RG-PX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awh-0001Zv-OV
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z8qQMWPodz8Zt4pKsE6e5z0UN6kbqskzg3wPUEz94Mk=; b=fLlgmP82ysK+PeXAyef0zo+I61
	45+mXpqdPjwI38P3OlYnDZ81ggKpJfqDFsKIP8caXJ1DVe8NRXnuYDDNhLytyU1tz8JWZgC/LFnYP
	5uoMVlT2SsuVHj/7GtN4z6yoFF7xvjkkUPoQj8+srgEb2WPqqlIoaIKEeRU0C7RiKEsw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] qemu-nbd: Change default cache mode to writeback
Message-Id: <E1n7awh-0001Zv-OV@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:33:35 +0000

commit 4c34ef3d341deff67bed735efca91d2ce0f9368c
Author:     Nir Soffer <nirsof@gmail.com>
AuthorDate: Fri Aug 13 23:55:19 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:36 2021 -0600

    qemu-nbd: Change default cache mode to writeback
    
    Both qemu and qemu-img use writeback cache mode by default, which is
    already documented in qemu(1). qemu-nbd uses writethrough cache mode by
    default, and the default cache mode is not documented.
    
    According to the qemu-nbd(8):
    
       --cache=CACHE
              The  cache  mode  to be used with the file.  See the
              documentation of the emulator's -drive cache=... option for
              allowed values.
    
    qemu(1) says:
    
        The default mode is cache=writeback.
    
    So users have no reason to assume that qemu-nbd is using writethough
    cache mode. The only hint is the painfully slow writing when using the
    defaults.
    
    Looking in git history, it seems that qemu used writethrough in the past
    to support broken guests that did not flush data properly, or could not
    flush due to limitations in qemu. But qemu-nbd clients can use
    NBD_CMD_FLUSH to flush data, so using writethrough does not help anyone.
    
    Change the default cache mode to writback, and document the default and
    available values properly in the online help and manual.
    
    With this change converting image via qemu-nbd is 3.5 times faster.
    
        $ qemu-img create dst.img 50g
        $ qemu-nbd -t -f raw -k /tmp/nbd.sock dst.img
    
    Before this change:
    
        $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
        Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
          Time (mean ± σ):     83.639 s ±  5.970 s    [User: 2.733 s, System: 6.112 s]
          Range (min … max):   76.749 s … 87.245 s    3 runs
    
    After this change:
    
        $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
        Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
          Time (mean ± σ):     23.522 s ±  0.433 s    [User: 2.083 s, System: 5.475 s]
          Range (min … max):   23.234 s … 24.019 s    3 runs
    
    Users can avoid the issue by using --cache=writeback[1] but the defaults
    should give good performance for the common use case.
    
    [1] https://bugzilla.redhat.com/1990656
    
    Signed-off-by: Nir Soffer <nsoffer@redhat.com>
    Message-Id: <20210813205519.50518-1-nsoffer@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    CC: qemu-stable@nongnu.org
    Signed-off-by: Eric Blake <eblake@redhat.com>
    (cherry picked from commit 09615257058a0ae87b837bb041f56f7312d9ead8)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 docs/tools/qemu-nbd.rst | 6 ++++--
 qemu-nbd.c              | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst
index ee862fa0bc..5643da26e9 100644
--- a/docs/tools/qemu-nbd.rst
+++ b/docs/tools/qemu-nbd.rst
@@ -98,8 +98,10 @@ driver options if ``--image-opts`` is specified.
 
 .. option:: --cache=CACHE
 
-  The cache mode to be used with the file.  See the documentation of
-  the emulator's ``-drive cache=...`` option for allowed values.
+  The cache mode to be used with the file. Valid values are:
+  ``none``, ``writeback`` (the default), ``writethrough``,
+  ``directsync`` and ``unsafe``. See the documentation of
+  the emulator's ``-drive cache=...`` option for more info.
 
 .. option:: -n, --nocache
 
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 26ffbf15af..6c18fcd19a 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -135,7 +135,9 @@ static void usage(const char *name)
 "                            'snapshot.id=[ID],snapshot.name=[NAME]', or\n"
 "                            '[ID_OR_NAME]'\n"
 "  -n, --nocache             disable host cache\n"
-"      --cache=MODE          set cache mode (none, writeback, ...)\n"
+"      --cache=MODE          set cache mode used to access the disk image, the\n"
+"                            valid options are: 'none', 'writeback' (default),\n"
+"                            'writethrough', 'directsync' and 'unsafe'\n"
 "      --aio=MODE            set AIO mode (native, io_uring or threads)\n"
 "      --discard=MODE        set discard mode (ignore, unmap)\n"
 "      --detect-zeroes=MODE  set detect-zeroes mode (off, on, unmap)\n"
@@ -552,7 +554,7 @@ int main(int argc, char **argv)
     bool alloc_depth = false;
     const char *tlscredsid = NULL;
     bool imageOpts = false;
-    bool writethrough = true;
+    bool writethrough = false; /* Client will flush as needed. */
     bool fork_process = false;
     bool list = false;
     int old_stderr = -1;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:33:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:33:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256460.440101 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7aws-0007ca-SL; Wed, 12 Jan 2022 10:33:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256460.440101; Wed, 12 Jan 2022 10:33: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 1n7aws-0007cS-Oh; Wed, 12 Jan 2022 10:33:46 +0000
Received: by outflank-mailman (input) for mailman id 256460;
 Wed, 12 Jan 2022 10:33:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awr-0007cA-TL
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33: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 1n7awr-0003RQ-Si
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7awr-0001aY-Rs
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9KyY3gn4y4BuKDK0Cwi0rs5yWWxfGhNLDVj3OP2a+5E=; b=p4FcYsfPkhi9ytWajpmirlsmWE
	q++OdC6xLF8pvyrMvvhYxFXDFl3wPZ/uijpQ4w1w+WWRAx67AHtb2EQFVH6mTbVcrs+WYuCo84l2V
	rXLJgtLTPMyUWbW8Jw80crvFEg1pisCy4MfIRYvIlYTQVFRsHzJeQc0sFLEcsM0l5bWY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hmp: Unbreak "change vnc"
Message-Id: <E1n7awr-0001aY-Rs@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:33:45 +0000

commit 7637373b23f32fb88e100df455addc4107a054dc
Author:     Markus Armbruster <armbru@redhat.com>
AuthorDate: Thu Sep 9 10:12:18 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:41 2021 -0600

    hmp: Unbreak "change vnc"
    
    HMP command "change vnc" can take the password as argument, or prompt
    for it:
    
        (qemu) change vnc password 123
        (qemu) change vnc password
        Password: ***
        (qemu)
    
    This regressed in commit cfb5387a1d "hmp: remove "change vnc TARGET"
    command", v6.0.0.
    
        (qemu) change vnc passwd 123
        Password: ***
        (qemu) change vnc passwd
        (qemu)
    
    The latter passes NULL to qmp_change_vnc_password(), which is a no-no.
    Looks like it puts the display into "password required, but none set"
    state.
    
    The logic error is easy to miss in review, but testing should've
    caught it.
    
    Fix the obvious way.
    
    Fixes: cfb5387a1de2acda23fb5c97d2378b9e7ddf8025
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
    Message-Id: <20210909081219.308065-2-armbru@redhat.com>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 6193344f9337f8b76cd44ce94a32c9900d907d35)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index e00255f7ee..a7e197a90b 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1496,7 +1496,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
         }
         if (strcmp(target, "passwd") == 0 ||
             strcmp(target, "password") == 0) {
-            if (arg) {
+            if (!arg) {
                 MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
                 monitor_read_password(hmp_mon, hmp_change_read_arg, NULL);
                 return;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:33:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:33:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256461.440105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ax2-0007g8-Vx; Wed, 12 Jan 2022 10:33:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256461.440105; Wed, 12 Jan 2022 10:33: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 1n7ax2-0007fy-Sa; Wed, 12 Jan 2022 10:33:56 +0000
Received: by outflank-mailman (input) for mailman id 256461;
 Wed, 12 Jan 2022 10:33:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ax2-0007fk-0J
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33: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 1n7ax1-0003Rt-W0
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ax1-0001bX-Uz
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:33:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aa0o3MTX3fyNh4YJFpwT9SFajzCJEJgBTYrfnqbccPc=; b=abGMfRg21mNAC8AelXiUOGisco
	Tr1Bob5uGc4MusMoRpHROyqyHxb6ctSxaIvh/Len0E+0ma9mPgRqEumjANDIJKgWn+3fHccsYcJ7E
	/zQsT10AOJvhX8G+mDQL6ccGW9GeXXDJ4I6aKRswfD3jBfSZb0Ii6gCPd5g35HXqXgM0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
Message-Id: <E1n7ax1-0001bX-Uz@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:33:55 +0000

commit f0dee5a40d27ad8ce2d180141bb5953fce44a146
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Wed Sep 29 18:24:43 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:49 2021 -0600

    virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
    
    Apparently, we don't have to duplicate the string.
    
    Fixes: 722a3c783ef4 ("virtio-pci: Send qapi events when the virtio-mem size changes")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Markus Armbruster <armbru@redhat.com>
    Message-Id: <20210929162445.64060-2-david@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 75b98cb9f6456ccf194211beffcbf93b0a995fa4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio-mem-pci.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c
index fa5395cd88..7e384b7397 100644
--- a/hw/virtio/virtio-mem-pci.c
+++ b/hw/virtio/virtio-mem-pci.c
@@ -88,13 +88,8 @@ static void virtio_mem_pci_size_change_notify(Notifier *notifier, void *data)
                                          size_change_notifier);
     DeviceState *dev = DEVICE(pci_mem);
     const uint64_t * const size_p = data;
-    const char *id = NULL;
 
-    if (dev->id) {
-        id = g_strdup(dev->id);
-    }
-
-    qapi_event_send_memory_device_size_change(!!id, id, *size_p);
+    qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p);
 }
 
 static void virtio_mem_pci_class_init(ObjectClass *klass, void *data)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:34:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256462.440109 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7axD-0007is-0s; Wed, 12 Jan 2022 10:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256462.440109; Wed, 12 Jan 2022 10:34: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 1n7axC-0007ik-UH; Wed, 12 Jan 2022 10:34:06 +0000
Received: by outflank-mailman (input) for mailman id 256462;
 Wed, 12 Jan 2022 10:34:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axC-0007ic-45
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34: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 1n7axC-0003SG-3S
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axC-0001cR-2B
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+2WcocWlsKZDR2Ev4zWywenxWffXTKe1VdNcfsvEi7I=; b=Z+yFtah5maAmMq6iDaZ2BH/pFU
	SD7s2bFtLU3XNbvTeH9ObqVq92rwnsp61VdT23FwcH+FHmFFKxmIXEJFwv6j3i6E8vozX4yN0z1H9
	YoK7H5QPLuui26grLot7XV1vqn+uIsplhdszHQWJ2uUUDmEHQmph6vVVwM3vR4zWrRSU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] uas: add stream number sanity checks.
Message-Id: <E1n7axC-0001cR-2B@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:34:06 +0000

commit 23ba9f170feca6ae0d8442aab2c89656f9b01288
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Wed Aug 18 14:05:05 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:53 2021 -0600

    uas: add stream number sanity checks.
    
    The device uses the guest-supplied stream number unchecked, which can
    lead to guest-triggered out-of-band access to the UASDevice->data3 and
    UASDevice->status3 fields.  Add the missing checks.
    
    Fixes: CVE-2021-3713
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reported-by: Chen Zhe <chenzhe@huawei.com>
    Reported-by: Tan Jingguo <tanjingguo@huawei.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20210818120505.1258262-2-kraxel@redhat.com>
    (cherry picked from commit 13b250b12ad3c59114a6a17d59caf073ce45b33a)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/usb/dev-uas.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 263056231c..f6309a5ebf 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -840,6 +840,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         }
         break;
     case UAS_PIPE_ID_STATUS:
+        if (p->stream > UAS_MAX_STREAMS) {
+            goto err_stream;
+        }
         if (p->stream) {
             QTAILQ_FOREACH(st, &uas->results, next) {
                 if (st->stream == p->stream) {
@@ -867,6 +870,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         break;
     case UAS_PIPE_ID_DATA_IN:
     case UAS_PIPE_ID_DATA_OUT:
+        if (p->stream > UAS_MAX_STREAMS) {
+            goto err_stream;
+        }
         if (p->stream) {
             req = usb_uas_find_request(uas, p->stream);
         } else {
@@ -902,6 +908,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         p->status = USB_RET_STALL;
         break;
     }
+
+err_stream:
+    error_report("%s: invalid stream %d", __func__, p->stream);
+    p->status = USB_RET_STALL;
+    return;
 }
 
 static void usb_uas_unrealize(USBDevice *dev)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:34:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:34:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256463.440113 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7axO-0007lg-2r; Wed, 12 Jan 2022 10:34:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256463.440113; Wed, 12 Jan 2022 10:34: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 1n7axN-0007lX-Vo; Wed, 12 Jan 2022 10:34:17 +0000
Received: by outflank-mailman (input) for mailman id 256463;
 Wed, 12 Jan 2022 10:34:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axM-0007lP-7R
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34: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 1n7axM-0003SM-6i
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axM-0001eC-5u
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xY8EKblo2bny3uFUTjnc124wA2htJUHaUGmQmPz8Z+A=; b=H96tp99k+4wrA/0OUIYZqB7DgL
	eRRH1WMM5ECaVveIA//XEcpBub6TzYgcBqPbobAUFQv4sZvNC6WaYcBPBpLS93DHDf383onDjscvx
	VAv081r6X5QizWZYkRcMQbOv1alzGCWzW1KpV4zqIUCwRPuA3Jt/FcQst+1WAi8oe3M0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] vhost-user: fix duplicated notifier MR init
Message-Id: <E1n7axM-0001eC-5u@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:34:16 +0000

commit 695c25e167e217aab74f964afe9b93a8a52b4d41
Author:     Xueming Li <xuemingl@nvidia.com>
AuthorDate: Fri Oct 8 16:02:15 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:02 2021 -0600

    vhost-user: fix duplicated notifier MR init
    
    In case of device resume after suspend, VQ notifier MR still valid.
    Duplicated registrations explode memory block list and slow down device
    resume.
    
    Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers")
    Cc: tiwei.bie@intel.com
    Cc: qemu-stable@nongnu.org
    Cc: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
    
    Signed-off-by: Xueming Li <xuemingl@nvidia.com>
    Message-Id: <20211008080215.590292-1-xuemingl@nvidia.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit a1ed9ef1de87c3e86ff68589604298ec90875a14)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/vhost-user.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index aec6cc1990..7b35c5d71d 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1469,8 +1469,9 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
 
     name = g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]",
                            user, queue_idx);
-    memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
-                                      page_size, addr);
+    if (!n->mr.ram) /* Don't init again after suspend. */
+        memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
+                                          page_size, addr);
     g_free(name);
 
     if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:34:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:34:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256465.440117 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7axY-0007of-42; Wed, 12 Jan 2022 10:34:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256465.440117; Wed, 12 Jan 2022 10:34: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 1n7axY-0007oX-0y; Wed, 12 Jan 2022 10:34:28 +0000
Received: by outflank-mailman (input) for mailman id 256465;
 Wed, 12 Jan 2022 10:34:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axW-0007o6-B0
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34: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 1n7axW-0003SX-AP
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axW-0001fb-95
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Uu6NbPaB1HEpm/eaQYBNcky6q8ou0ZfUFGl7XGkeFv8=; b=X3JyqAZqodhZLZ6QQQ1+UX4+F6
	McnsD99PO6O22mt5rHUQ6swTXKECTokEhLG9v4FftP5nMq9WJJY/JMTQ4pX5gJTqXsV980JOrXPSf
	qH3OKNs/IqfqARVH6K3ocGI/YPPj2MF/LtNVI56bLWuA7tTDAyeNiogWs7cGKcRuHDRE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
Message-Id: <E1n7axW-0001fb-95@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:34:26 +0000

commit 3c6e5df1f6badec09cdbbff29b16668a92816b68
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Mon Oct 11 22:10:47 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:07 2021 -0600

    libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
    
    We end up not copying the mmap_addr of all existing regions, resulting
    in a SEGFAULT once we actually try to map/access anything within our
    memory regions.
    
    Fixes: 875b9fd97b34 ("Support individual region unmap in libvhost-user")
    Cc: qemu-stable@nongnu.org
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
    Cc: Stefan Hajnoczi <stefanha@redhat.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Coiby Xu <coiby.xu@gmail.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20211011201047.62587-1-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 6889eb2d431ae962e3e083b57bff47cd573cb1c4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 subprojects/libvhost-user/libvhost-user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index bf09693255..787f4d2d4f 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -816,6 +816,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
             shadow_regions[j].gpa = dev->regions[i].gpa;
             shadow_regions[j].size = dev->regions[i].size;
             shadow_regions[j].qva = dev->regions[i].qva;
+            shadow_regions[j].mmap_addr = dev->regions[i].mmap_addr;
             shadow_regions[j].mmap_offset = dev->regions[i].mmap_offset;
             j++;
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:34:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:34:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256467.440121 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7axi-0007ra-5c; Wed, 12 Jan 2022 10:34:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256467.440121; Wed, 12 Jan 2022 10:34:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7axi-0007rS-2b; Wed, 12 Jan 2022 10:34:38 +0000
Received: by outflank-mailman (input) for mailman id 256467;
 Wed, 12 Jan 2022 10:34:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axg-0007rE-EU
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34: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 1n7axg-0003Sb-Dv
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axg-0001gg-Cp
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nqA3RhTrbhx6JGxwL+NfoUeTYLDnBtDnKDmTxLCfl0Y=; b=j85bsjjBWxE44zjxGzkquLS1rm
	pWmso66k/68FyrcYk5wVA1DRuTK5riQZdecuCdRDsimRuKALF8Hfb7SPWtSNG12aBLjJ5jctxbHN2
	F0rR06HiGl+OZHYPPsOlYjWiod3cBzGpZM7PkDagDiLp2h3bZkhQnBk3t+uDvJrszLmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()
Message-Id: <E1n7axg-0001gg-Cp@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:34:36 +0000

commit b19de1137bc158cc2782750f1a94be153a5fd54d
Author:     Helge Deller <deller@gmx.de>
AuthorDate: Tue May 25 22:12:45 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:12 2021 -0600

    hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()
    
    The CDE desktop on HP-UX 10 shows wrongly rendered pixels when the local screen
    menu is closed. This bug was introduced by commit c7050f3f167b
    ("hw/display/artist: Refactor x/y coordination extraction") which converted the
    coordinate extraction in artist_vram_read() and artist_vram_write() to use the
    ADDR_TO_X and ADDR_TO_Y macros, but forgot to right-shift the address by 2 as
    it was done before.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Fixes: c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction")
    Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Cc: Richard Henderson <richard.henderson@linaro.org>
    Cc: Sven Schnelle <svens@stackframe.org>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Message-Id: <YK1aPb8keur9W7h2@ls3530>
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    (cherry picked from commit 01f750f5fef1afd8f6abc0548910f87d473e26d5)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/display/artist.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/display/artist.c b/hw/display/artist.c
index aa7bd594aa..21b7fd1b44 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -1170,8 +1170,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,
     }
 
     buf = vram_write_buffer(s);
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (!buf->size) {
         return;
@@ -1232,8 +1232,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)
         return 0;
     }
 
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (posy > buf->height || posx > buf->width) {
         return 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:34:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:34:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256468.440125 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7axs-0007uN-7O; Wed, 12 Jan 2022 10:34:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256468.440125; Wed, 12 Jan 2022 10:34:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7axs-0007uF-4G; Wed, 12 Jan 2022 10:34:48 +0000
Received: by outflank-mailman (input) for mailman id 256468;
 Wed, 12 Jan 2022 10:34:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axq-0007u6-IO
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34: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 1n7axq-0003Si-Hl
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7axq-0001hT-Gh
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v4PJec5Mubeb5b8+OHMsflM6HuYb3URsoTrdIL8DS4U=; b=aDe9kcoY/AqWHOi/krnGKBoIZd
	HuJOQSJNtloWQ0OmmVLWck+AxuvVJLpkdwToidj5MO1bbc6LKyclT9yj8yuV5LAK/L7BMh3SIpdB+
	yfWuh2CuiPLOjtTzmiF/Twnq3IlMV2AZUBoRu/9H1Zvr3VtwYIR8t1VczKURDGNfkTbg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model
Message-Id: <E1n7axq-0001hT-Gh@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:34:46 +0000

commit ff6d391e10d04a457994be8c032c6c38c0118ebc
Author:     Yang Zhong <yang.zhong@intel.com>
AuthorDate: Fri Aug 20 13:46:11 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:43:09 2021 -0600

    i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model
    
    The AVX_VNNI feature is not in Cooperlake platform, remove it
    from cpu model.
    
    Signed-off-by: Yang Zhong <yang.zhong@intel.com>
    Message-Id: <20210820054611.84303-1-yang.zhong@intel.com>
    Fixes: c1826ea6a052 ("i386/cpu: Expose AVX_VNNI instruction to guest")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    (cherry picked from commit f429dbf8fc526a9cacf531176b28d0c65701475a)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 34a7ce865b..24ddc5b926 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3102,7 +3102,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
             MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO |
             MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO,
         .features[FEAT_7_1_EAX] =
-            CPUID_7_1_EAX_AVX_VNNI | CPUID_7_1_EAX_AVX512_BF16,
+            CPUID_7_1_EAX_AVX512_BF16,
         /* XSAVES is added in version 2 */
         .features[FEAT_XSAVE] =
             CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:34:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:34:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256469.440129 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ay2-0007xG-8k; Wed, 12 Jan 2022 10:34:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256469.440129; Wed, 12 Jan 2022 10:34:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ay2-0007x9-5p; Wed, 12 Jan 2022 10:34:58 +0000
Received: by outflank-mailman (input) for mailman id 256469;
 Wed, 12 Jan 2022 10:34:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ay0-0007wy-LR
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34: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 1n7ay0-0003T4-Ks
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ay0-0001iQ-K4
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:34:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y5R8rGCTzzWn8+c3NhdisTB2Tkij16RvBZHAW8+HtXc=; b=z+3haDI5xb7rJbBBUACx8usmlM
	19a/ntQF7Btjou70Xp9Z5OkS9w63W/o4VQlW55n+WWJkWadZR64iuT0ddUxP2GbNqoRnLncGjlO/o
	RHfhgvU8iwAjOBpUBeLGs6ZItodUWjWd49zjgivywhO/Epj1bQvRo8eGRCmureGoE7Xs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] 9pfs: fix crash in v9fs_walk()
Message-Id: <E1n7ay0-0001iQ-K4@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:34:56 +0000

commit abeee2a470f549b2730365f350416cc932340324
Author:     Christian Schoenebeck <qemu_oss@crudebyte.com>
AuthorDate: Wed Sep 1 18:15:10 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:46:48 2021 -0600

    9pfs: fix crash in v9fs_walk()
    
    v9fs_walk() utilizes the v9fs_co_run_in_worker({...}) macro to run the
    supplied fs driver code block on a background worker thread.
    
    When either the 'Twalk' client request was interrupted or if the client
    requested fid for that 'Twalk' request caused a stat error then that
    fs driver code block was left by 'break' keyword, with the intention to
    return from worker thread back to main thread as well:
    
        v9fs_co_run_in_worker({
            if (v9fs_request_cancelled(pdu)) {
                err = -EINTR;
                break;
            }
            err = s->ops->lstat(&s->ctx, &dpath, &fidst);
            if (err < 0) {
                err = -errno;
                break;
            }
            ...
        });
    
    However that 'break;' statement also skipped the v9fs_co_run_in_worker()
    macro's final and mandatory
    
        /* re-enter back to qemu thread */
        qemu_coroutine_yield();
    
    call and thus caused the rest of v9fs_walk() to be continued being
    executed on the worker thread instead of main thread, eventually
    leading to a crash in the transport virtio transport driver.
    
    To fix this issue and to prevent the same error from happening again by
    other users of v9fs_co_run_in_worker() in future, auto wrap the supplied
    code block into its own
    
        do { } while (0);
    
    loop inside the 'v9fs_co_run_in_worker' macro definition.
    
    Full discussion and backtrace:
    https://lists.gnu.org/archive/html/qemu-devel/2021-08/msg05209.html
    https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg00174.html
    
    Fixes: 8d6cb100731c4d28535adbf2a3c2d1f29be3fef4
    Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Greg Kurz <groug@kaod.org>
    Message-Id: <E1mLTBg-0002Bh-2D@lizzy.crudebyte.com>
    (cherry picked from commit f83df00900816476cca41bb536e4d532b297d76e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/9pfs/coth.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h
index c51289903d..f83c7dda7b 100644
--- a/hw/9pfs/coth.h
+++ b/hw/9pfs/coth.h
@@ -51,7 +51,9 @@
          */                                                             \
         qemu_coroutine_yield();                                         \
         qemu_bh_delete(co_bh);                                          \
-        code_block;                                                     \
+        do {                                                            \
+            code_block;                                                 \
+        } while (0);                                                    \
         /* re-enter back to qemu thread */                              \
         qemu_coroutine_yield();                                         \
     } while (0)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:35:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:35:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256470.440133 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ayC-0007zy-As; Wed, 12 Jan 2022 10:35:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256470.440133; Wed, 12 Jan 2022 10:35:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ayC-0007zq-7X; Wed, 12 Jan 2022 10:35:08 +0000
Received: by outflank-mailman (input) for mailman id 256470;
 Wed, 12 Jan 2022 10:35:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayA-0007zb-Oc
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35: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 1n7ayA-0003TX-Ny
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayA-0001jU-N7
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I4KMJusEo8VLSdPYmgtRZBjy1gl7boc1k6ZNL38aiuk=; b=49+8w37Sbonk47Bt+2iFPcVlVQ
	ZBRBUmY0jNFG2CFAIZYwdVOzkjQtgEd5oAEAByhBpPgVgzm7Vy2G9TaJdbRh97B69/NF8DNe8sUVb
	SF6kK/mLN+1KVdtd3i4QslxEuDPBQCRTpZUr08+AAPfGdY75O2MGOx2jYJ7OrqlUvp6g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] plugins/execlog: removed unintended "s" at the end of log lines.
Message-Id: <E1n7ayA-0001jU-N7@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:35:06 +0000

commit f97853c8cb849cc4773005183c974dec641d8493
Author:     Mahmoud Mandour <ma.mandourr@gmail.com>
AuthorDate: Fri Aug 6 15:10:12 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:48:25 2021 -0600

    plugins/execlog: removed unintended "s" at the end of log lines.
    
    Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20210803151428.125323-1-ma.mandourr@gmail.com>
    Message-Id: <20210806141015.2487502-2-alex.bennee@linaro.org>
    Cc: qemu-stable@nongnu.org
    (cherry picked from commit b40310616d2bd550279dd22b05483c3c613a00ff)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 contrib/plugins/execlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index 2de9f0d7d4..a5275dcc15 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -67,7 +67,7 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *udata)
     /* Print previous instruction in cache */
     if (s->len) {
         qemu_plugin_outs(s->str);
-        qemu_plugin_outs("s\n");
+        qemu_plugin_outs("\n");
     }
 
     /* Store new instruction in cache */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:35:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:35:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256471.440137 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ayM-00083R-Dd; Wed, 12 Jan 2022 10:35:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256471.440137; Wed, 12 Jan 2022 10:35:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ayM-00083J-AX; Wed, 12 Jan 2022 10:35:18 +0000
Received: by outflank-mailman (input) for mailman id 256471;
 Wed, 12 Jan 2022 10:35:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayK-00083A-S0
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35: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 1n7ayK-0003Tc-RQ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayK-0001kj-Qb
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4gMljg2w+Mcz3EqtQ6ztJp7qQ7Jv6Ij2v4uEkjdy1+Y=; b=7HxhL0AmR7ZndU+uafuB/dxWEy
	wdTMPSesJl9JSLeEC+ocMVtFq6x3pWQ9hFl4iKQCJ9inp2j639TB7uWkqnpmpSkq/GDDBWlk6GtnB
	aufObYY8QMAzjWxwKublTGCH3wsTT0UWHDarE5ml0pXitEpcKnxAtL4Y2Uam7KbMbxik=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] plugins: do not limit exported symbols if modules are active
Message-Id: <E1n7ayK-0001kj-Qb@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:35:16 +0000

commit ec0803510289fcb15d8b4f8699169ac35f842bfe
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Wed Aug 11 12:05:50 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:49:09 2021 -0600

    plugins: do not limit exported symbols if modules are active
    
    On Mac --enable-modules and --enable-plugins are currently incompatible, because the
    Apple -Wl,-exported_symbols_list command line options prevents the export of any
    symbols needed by the modules.  On x86 -Wl,--dynamic-list does not have this effect,
    but only because the -Wl,--export-dynamic option provided by gmodule-2.0.pc overrides
    it.  On Apple there is no -Wl,--export-dynamic, because it is the default, and thus
    no override.
    
    Either way, when modules are active there is no reason to include the plugin_ldflags.
    While at it, avoid the useless -Wl,--export-dynamic when --enable-plugins is
    specified but --enable-modules is not; this way, the GNU and Apple configurations
    are more similar.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/516
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    [AJB: fix noexport to no-export]
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20210811100550.54714-1-pbonzini@redhat.com>
    Cc: qemu-stable@nongnu.org
    (cherry picked from commit b906acace2d4f68b6ff8de73739a773cc4851436)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 configure           |  5 ++---
 plugins/meson.build | 14 ++++++++------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 9a79a004d7..7659870810 100755
--- a/configure
+++ b/configure
@@ -3187,9 +3187,8 @@ glib_req_ver=2.56
 glib_modules=gthread-2.0
 if test "$modules" = yes; then
     glib_modules="$glib_modules gmodule-export-2.0"
-fi
-if test "$plugins" = "yes"; then
-    glib_modules="$glib_modules gmodule-2.0"
+elif test "$plugins" = "yes"; then
+    glib_modules="$glib_modules gmodule-no-export-2.0"
 fi
 
 for i in $glib_modules; do
diff --git a/plugins/meson.build b/plugins/meson.build
index e77723010e..bfd5c9822a 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -1,9 +1,11 @@
-if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
-  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
-elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
-  plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
-else
-  plugin_ldflags = []
+plugin_ldflags = []
+# Modules need more symbols than just those in plugins/qemu-plugins.symbols
+if not enable_modules
+  if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
+    plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
+  elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
+    plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
+  endif
 endif
 
 specific_ss.add(when: 'CONFIG_PLUGIN', if_true: [files(
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:35:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:35:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256472.440141 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ayW-00086Y-F5; Wed, 12 Jan 2022 10:35:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256472.440141; Wed, 12 Jan 2022 10:35: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 1n7ayW-00086P-C4; Wed, 12 Jan 2022 10:35:28 +0000
Received: by outflank-mailman (input) for mailman id 256472;
 Wed, 12 Jan 2022 10:35: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 1n7ayU-000868-VJ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35: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 1n7ayU-0003Tm-Ui
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayU-0001ly-Tn
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35: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=ih77XKGJUYB5v5HE6IULkrsba8JBkTq0VRr6wddTgLg=; b=gxUG/nBeGZdwi8+ksxGLuzoPo6
	e3oewdE7DImqO0QJYQ/Xd3OtYHJvm6xn2kvtw2lUGzzzuA4DdIuWwXxgrlhWoFw/KZXIO5R822AiB
	xngTD6PIfsaNMYnFNKx9sRwDpIIaKb12RJ8jdiwFBV3AnctCy7YbLjEPd4ofKfLiL+tQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] qemu-sockets: fix unix socket path copy (again)
Message-Id: <E1n7ayU-0001ly-Tn@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:35:26 +0000

commit 3ee93e456d08415cc1abe4110f6e0c9b0ead0bbc
Author:     Michael Tokarev <mjt@tls.msk.ru>
AuthorDate: Wed Sep 1 16:16:24 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:55:36 2021 -0600

    qemu-sockets: fix unix socket path copy (again)
    
    Commit 4cfd970ec188558daa6214f26203fe553fb1e01f added an
    assert which ensures the path within an address of a unix
    socket returned from the kernel is at least one byte and
    does not exceed sun_path buffer. Both of this constraints
    are wrong:
    
    A unix socket can be unnamed, in this case the path is
    completely empty (not even \0)
    
    And some implementations (notable linux) can add extra
    trailing byte (\0) _after_ the sun_path buffer if we
    passed buffer larger than it (and we do).
    
    So remove the assertion (since it causes real-life breakage)
    but at the same time fix the usage of sun_path. Namely,
    we should not access sun_path[0] if kernel did not return
    it at all (this is the case for unnamed sockets),
    and use the returned salen when copyig actual path as an
    upper constraint for the amount of bytes to copy - this
    will ensure we wont exceed the information provided by
    the kernel, regardless whenever there is a trailing \0
    or not. This also helps with unnamed sockets.
    
    Note the case of abstract socket, the sun_path is actually
    a blob and can contain \0 characters, - it should not be
    passed to g_strndup and the like, it should be accessed by
    memcpy-like functions.
    
    Fixes: 4cfd970ec188558daa6214f26203fe553fb1e01f
    Fixes: http://bugs.debian.org/993145
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    CC: qemu-stable@nongnu.org
    (cherry picked from commit 118d527f2e4baec5fe8060b22a6212468b8e4d3f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 util/qemu-sockets.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index f2f3676d1f..c5043999e9 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1345,25 +1345,22 @@ socket_sockaddr_to_address_unix(struct sockaddr_storage *sa,
     SocketAddress *addr;
     struct sockaddr_un *su = (struct sockaddr_un *)sa;
 
-    assert(salen >= sizeof(su->sun_family) + 1 &&
-           salen <= sizeof(struct sockaddr_un));
-
     addr = g_new0(SocketAddress, 1);
     addr->type = SOCKET_ADDRESS_TYPE_UNIX;
+    salen -= offsetof(struct sockaddr_un, sun_path);
 #ifdef CONFIG_LINUX
-    if (!su->sun_path[0]) {
+    if (salen > 0 && !su->sun_path[0]) {
         /* Linux abstract socket */
-        addr->u.q_unix.path = g_strndup(su->sun_path + 1,
-                                        salen - sizeof(su->sun_family) - 1);
+        addr->u.q_unix.path = g_strndup(su->sun_path + 1, salen - 1);
         addr->u.q_unix.has_abstract = true;
         addr->u.q_unix.abstract = true;
         addr->u.q_unix.has_tight = true;
-        addr->u.q_unix.tight = salen < sizeof(*su);
+        addr->u.q_unix.tight = salen < sizeof(su->sun_path);
         return addr;
     }
 #endif
 
-    addr->u.q_unix.path = g_strndup(su->sun_path, sizeof(su->sun_path));
+    addr->u.q_unix.path = g_strndup(su->sun_path, salen);
     return addr;
 }
 #endif /* WIN32 */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:35:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:35:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256473.440145 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ayg-00089E-Ge; Wed, 12 Jan 2022 10:35:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256473.440145; Wed, 12 Jan 2022 10:35:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ayg-000896-DX; Wed, 12 Jan 2022 10:35:38 +0000
Received: by outflank-mailman (input) for mailman id 256473;
 Wed, 12 Jan 2022 10:35:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayf-00088w-2Q
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayf-0003Tr-1n
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayf-0001mw-0t
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CTrRdak2KI6j5SsqPL2r4mHa1jMyl61V0VKq3S0AM1s=; b=V8ZXO0V71IJtBHEVyUP2UgMu3M
	ksKH8H7ZHDwfxcRtE5dW5n5uiqBGUOBTbDTB3tZ1Wb1EcO2OMuO/Z2FHZiwCtp2jctXw6yXkX1lvI
	QV8V8gcSImYTzgSgqCc7uYX5p07HaLzqlQjaia35UBhASMej8NzPdGl+sQjm0ljVS9Jc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] vhost-vsock: fix migration issue when seqpacket is supported
Message-Id: <E1n7ayf-0001mw-0t@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:35:37 +0000

commit 246ccfbf44a0ff5967393adb7b7a79dc7c353eb6
Author:     Stefano Garzarella <sgarzare@redhat.com>
AuthorDate: Tue Sep 21 18:16:41 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:04:13 2021 -0600

    vhost-vsock: fix migration issue when seqpacket is supported
    
    Commit 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support")
    enabled the SEQPACKET feature bit.
    This commit is released with QEMU 6.1, so if we try to migrate a VM where
    the host kernel supports SEQPACKET but machine type version is less than
    6.1, we get the following errors:
    
        Features 0x130000002 unsupported. Allowed features: 0x179000000
        Failed to load virtio-vhost_vsock:virtio
        error while loading state for instance 0x0 of device '0000:00:05.0/virtio-vhost_vsock'
        load of migration failed: Operation not permitted
    
    Let's disable the feature bit for machine types < 6.1.
    We add a new OnOffAuto property for this, called `seqpacket`.
    When it is `auto` (default), QEMU behaves as before, trying to enable the
    feature, when it is `on` QEMU will fail if the backend (vhost-vsock
    kernel module) doesn't support it.
    
    Fixes: 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support")
    Cc: qemu-stable@nongnu.org
    Reported-by: Jiang Wang <jiang.wang@bytedance.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20210921161642.206461-2-sgarzare@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d6a9378f47515c6d70dbff4912c5740c98709880)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/core/machine.c               |  1 +
 hw/virtio/vhost-vsock.c         | 19 ++++++++++++++++---
 include/hw/virtio/vhost-vsock.h |  3 +++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 54e040587d..2cf2f321f9 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -43,6 +43,7 @@ GlobalProperty hw_compat_6_0[] = {
     { "nvme-ns", "eui64-default", "off"},
     { "e1000", "init-vet", "off" },
     { "e1000e", "init-vet", "off" },
+    { "vhost-vsock-device", "seqpacket", "off" },
 };
 const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0);
 
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 1b1a5c70ed..dade0da031 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -114,10 +114,21 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          Error **errp)
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+
+    if (vsock->seqpacket != ON_OFF_AUTO_OFF) {
+        virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
+    }
+
+    requested_features = vhost_get_features(&vvc->vhost_dev, feature_bits,
+                                            requested_features);
+
+    if (vsock->seqpacket == ON_OFF_AUTO_ON &&
+        !virtio_has_feature(requested_features, VIRTIO_VSOCK_F_SEQPACKET)) {
+        error_setg(errp, "vhost-vsock backend doesn't support seqpacket");
+    }
 
-    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
-    return vhost_get_features(&vvc->vhost_dev, feature_bits,
-                                requested_features);
+    return requested_features;
 }
 
 static const VMStateDescription vmstate_virtio_vhost_vsock = {
@@ -218,6 +229,8 @@ static void vhost_vsock_device_unrealize(DeviceState *dev)
 static Property vhost_vsock_properties[] = {
     DEFINE_PROP_UINT64("guest-cid", VHostVSock, conf.guest_cid, 0),
     DEFINE_PROP_STRING("vhostfd", VHostVSock, conf.vhostfd),
+    DEFINE_PROP_ON_OFF_AUTO("seqpacket", VHostVSock, seqpacket,
+                            ON_OFF_AUTO_AUTO),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsock.h
index 84f4e727c7..3f121a624f 100644
--- a/include/hw/virtio/vhost-vsock.h
+++ b/include/hw/virtio/vhost-vsock.h
@@ -30,6 +30,9 @@ struct VHostVSock {
     VHostVSockCommon parent;
     VHostVSockConf conf;
 
+    /* features */
+    OnOffAuto seqpacket;
+
     /*< public >*/
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:35:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:35:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256474.440149 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ayq-0008C5-I0; Wed, 12 Jan 2022 10:35:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256474.440149; Wed, 12 Jan 2022 10:35: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 1n7ayq-0008Bw-F2; Wed, 12 Jan 2022 10:35:48 +0000
Received: by outflank-mailman (input) for mailman id 256474;
 Wed, 12 Jan 2022 10:35:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayp-0008Bi-61
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayp-0003U1-5T
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayp-0001nh-4O
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rEVFfF2Lu+CKkJGNNGBrxIovCSnyazC9XbUc3ZzVaA8=; b=DLsydO1uVk8+yOrGm4qNy7BENu
	VjLjFne0x50BxNWpgXdDoSq3fd8XUaBte82ScM118dTqMCACmkz0tiqG/XfudNSiSPQe85rQZXyZu
	b01yV/bTfpKnrl6ebCmxKUc0UwNwSCo+zgKt0P271GcT6/78GP3HNCP3/VzXR/UGYgwo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw/arm/virt: Rename default_bus_bypass_iommu
Message-Id: <E1n7ayp-0001nh-4O@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:35:47 +0000

commit 36cfd11a867ebcf015db24b666ec28deb05c101f
Author:     Jean-Philippe Brucker <jean-philippe@linaro.org>
AuthorDate: Tue Oct 26 10:37:34 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:07:27 2021 -0600

    hw/arm/virt: Rename default_bus_bypass_iommu
    
    Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine
    parameter definitions cannot use underscores, because keyval_dashify()
    transforms them to dashes and the parser doesn't find the parameter.
    
    This affects option default_bus_bypass_iommu which was introduced in the
    same release:
    
    $ qemu-system-aarch64 -M virt,default_bus_bypass_iommu=on
    qemu-system-aarch64: Property 'virt-6.1-machine.default-bus-bypass-iommu' not found
    
    Rename the parameter to "default-bus-bypass-iommu". Passing
    "default_bus_bypass_iommu" is still valid since the underscore are
    transformed automatically.
    
    Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option")
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Tested-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20211026093733.2144161-1-jean-philippe@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit 9dad363a223df8269175d218413aa8cd265e078e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/arm/virt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 81eda46b0b..106be60fd4 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2677,10 +2677,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
                                           "Set the IOMMU type. "
                                           "Valid values are none and smmuv3");
 
-    object_class_property_add_bool(oc, "default_bus_bypass_iommu",
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
                                    virt_get_default_bus_bypass_iommu,
                                    virt_set_default_bus_bypass_iommu);
-    object_class_property_set_description(oc, "default_bus_bypass_iommu",
+    object_class_property_set_description(oc, "default-bus-bypass-iommu",
                                           "Set on/off to enable/disable "
                                           "bypass_iommu for default root bus");
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:35:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:35:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256475.440153 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7az0-0008Eq-JX; Wed, 12 Jan 2022 10:35:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256475.440153; Wed, 12 Jan 2022 10:35: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 1n7az0-0008Ei-Gc; Wed, 12 Jan 2022 10:35:58 +0000
Received: by outflank-mailman (input) for mailman id 256475;
 Wed, 12 Jan 2022 10:35:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayz-0008EW-9c
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayz-0003UQ-94
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ayz-0001oT-7w
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:35:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QdPghh8xPrfJPu+4Fzve650+RKK79pLB6x/4P9s04Bo=; b=08atUTfwVS1LuD5iTfXpRstI/c
	QRCLCjGzIPGtqTesmpNgp7xO58q98Hd8JE8DKd1jPDNt3GiCEHOqFElhL7JvpeykseHRVwZdonw7N
	9C7K+YbPAgehJ26wDg6+t6SgwVmY59bG4ANq99RPH3K+mI2d7+lucJUHGUNv2x91U1gQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw/i386: Rename default_bus_bypass_iommu
Message-Id: <E1n7ayz-0001oT-7w@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:35:57 +0000

commit 5cf977a2a18a0f6c92b36e852639f26b993d76e5
Author:     Jean-Philippe Brucker <jean-philippe@linaro.org>
AuthorDate: Mon Oct 25 11:47:38 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:07:48 2021 -0600

    hw/i386: Rename default_bus_bypass_iommu
    
    Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine
    parameter definitions cannot use underscores, because keyval_dashify()
    transforms them to dashes and the parser doesn't find the parameter.
    
    This affects option default_bus_bypass_iommu which was introduced in the
    same release:
    
    $ qemu-system-x86_64 -M q35,default_bus_bypass_iommu=on
    qemu-system-x86_64: Property 'pc-q35-6.1-machine.default-bus-bypass-iommu' not found
    
    Rename the parameter to "default-bus-bypass-iommu". Passing
    "default_bus_bypass_iommu" is still valid since the underscore are
    transformed automatically.
    
    Fixes: c9e96b04fc19 ("hw/i386: Add a default_bus_bypass_iommu pc machine option")
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Tested-by: Eric Auger <eric.auger@redhat.com>
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Message-Id: <20211025104737.1560274-1-jean-philippe@linaro.org>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 739b38630c45585cd9d372d44537f69c0b2b4346)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/i386/pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c2b9d62a35..1d421ae2f8 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1763,7 +1763,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     object_class_property_add_bool(oc, "hpet",
         pc_machine_get_hpet, pc_machine_set_hpet);
 
-    object_class_property_add_bool(oc, "default_bus_bypass_iommu",
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
         pc_machine_get_default_bus_bypass_iommu,
         pc_machine_set_default_bus_bypass_iommu);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:36:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:36:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256476.440157 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7azB-0008Hl-LI; Wed, 12 Jan 2022 10:36:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256476.440157; Wed, 12 Jan 2022 10:36:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7azB-0008Hc-I6; Wed, 12 Jan 2022 10:36:09 +0000
Received: by outflank-mailman (input) for mailman id 256476;
 Wed, 12 Jan 2022 10:36: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 1n7az9-0008HQ-D3
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7az9-0003VS-CK
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7az9-0001ps-BR
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7jkXRo7AelvHVgkV2T9iH6BNxdXiFhXL7ZQACg5vJ88=; b=xRfLpVSXS9a5pw4VSC8KYzGCli
	zcn64ykQYBsMv1KHALQnzTwR8sFXlMjRFB+S5Wuygs2XsV/goMG3zOlLKcdJ/l7cjQMyel4Mi2VH3
	ArV1Idh+lQ/IEu/DPB/P9SyR74nm72gQUR9TUxHZBfC2KEWrDe1nXWMSSbHXLOFfqzeA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] bios-tables-test: allow changes in DSDT ACPI tables for q35
Message-Id: <E1n7az9-0001ps-BR@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:36:07 +0000

commit c66f5dfc127adaadb67a2d95e5e58e6542aaa9eb
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:36 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:12:31 2021 -0600

    bios-tables-test: allow changes in DSDT ACPI tables for q35
    
    We are going to commit a change to fix IO address range allocated for acpi pci
    hotplug in q35. This affects DSDT tables. This change allows DSDT table
    modification so that unit tests are not broken.
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20210916132838.3469580-2-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 9f29e872d5b3973003701401cf659cfb71c95013)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..c06da38af3 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,13 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT",
+"tests/data/acpi/q35/DSDT.tis.tpm12",
+"tests/data/acpi/q35/DSDT.tis.tpm2",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.mmio64",
+"tests/data/acpi/q35/DSDT.ipmibt",
+"tests/data/acpi/q35/DSDT.cphp",
+"tests/data/acpi/q35/DSDT.memhp",
+"tests/data/acpi/q35/DSDT.numamem",
+"tests/data/acpi/q35/DSDT.nohpet",
+"tests/data/acpi/q35/DSDT.dimmpxm",
+"tests/data/acpi/q35/DSDT.acpihmat",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:36:19 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:36:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256477.440160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7azL-0008KP-Mp; Wed, 12 Jan 2022 10:36:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256477.440160; Wed, 12 Jan 2022 10:36:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7azL-0008KH-JW; Wed, 12 Jan 2022 10:36:19 +0000
Received: by outflank-mailman (input) for mailman id 256477;
 Wed, 12 Jan 2022 10:36: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 1n7azJ-0008K2-G2
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36: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 1n7azJ-0003WQ-FM
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azJ-0001r3-EY
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36: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=cBEUdH1Ig5U8OM0+EeL2YHm6Mm02lyWZGmc3zQOomlo=; b=Wid+atrwpVARQ6QI8cu2ITogtS
	znL2XTuFlycnm6KjI8oejTXaBJB0stdZueCKzUsn8RCdXq5v9/nNk817FU3wKSpRIlNHktxZcI7ar
	QOupVf5F7bSQ51xV2ZX5LWYS+tjEsVazVw8euZuHvVFF1DLUir/4LAHLBoVzaFAuMY1Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
Message-Id: <E1n7azJ-0001r3-EY@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:36:17 +0000

commit 9e80a430ed5996734ef35c457d793b8106f16d15
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:37 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:12:38 2021 -0600

    hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
    
    Change caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
    selects an IO address range for acpi based PCI hotplug for q35 arbitrarily. It
    starts at address 0x0cc4 and ends at 0x0cdb. At the time when the patch was
    written but the final version of the patch was not yet pushed upstream, this
    address range was free and did not conflict with any other IO address ranges.
    However, with the following change, this address range was no
    longer conflict free as in this change, the IO address range
    (value of ACPI_PCIHP_SIZE) was incremented by four bytes:
    
    b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
    
    This can be seen from the output of QMP command 'info mtree' :
    
    0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
    0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
    0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
    0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
    0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
    0000000000000cc4-0000000000000cdb (prio 0, i/o): acpi-pci-hotplug
    0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
    
    It shows that there is a region of conflict between IO regions of acpi
    pci hotplug and acpi cpu hotplug.
    
    Unfortunately, the change caf108bc58790 did not update the IO address range
    appropriately before it was pushed upstream to accommodate the increased
    length of the IO address space introduced in change b32bd763a1ca92.
    
    Due to this bug, windows guests complain 'This device cannot find
    enough free resources it can use' in the device manager panel for extended
    IO buses. This issue also breaks the correct functioning of pci hotplug as the
    following shows that the IO space for pci hotplug has been truncated:
    
    (qemu) info mtree -f
    FlatView #0
     AS "I/O", root: io
     Root memory region: io
      0000000000000cc4-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
      0000000000000cd8-0000000000000cf7 (prio 0, i/o): acpi-cpu-hotplug
    
    Therefore, in this fix, we adjust the IO address range for the acpi pci
    hotplug so that it does not conflict with cpu hotplug and there is no
    truncation of IO spaces. The starting IO address of PCI hotplug region
    has been decremented by four bytes in order to accommodate four byte
    increment in the IO address space introduced by change
    b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
    
    After fixing, the following are the corrected IO ranges:
    
    0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
    0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
    0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
    0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
    0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
    0000000000000cc0-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
    0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
    
    This change has been tested using a Windows Server 2019 guest VM. Windows
    no longer complains after this change.
    
    Fixes: caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/561
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Julia Suvorova <jusual@redhat.com>
    Message-Id: <20210916132838.3469580-3-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 0e780da76a6fe283a20283856718bca3986c104f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 include/hw/acpi/ich9.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index a329ce43ab..f04f1791bd 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -29,7 +29,7 @@
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/acpi/tco.h"
 
-#define ACPI_PCIHP_ADDR_ICH9 0x0cc4
+#define ACPI_PCIHP_ADDR_ICH9 0x0cc0
 
 typedef struct ICH9LPCPMRegs {
     /*
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:36:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:36:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256478.440165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7azU-0008Nx-Pt; Wed, 12 Jan 2022 10:36:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256478.440165; Wed, 12 Jan 2022 10:36: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 1n7azU-0008Np-Ms; Wed, 12 Jan 2022 10:36:28 +0000
Received: by outflank-mailman (input) for mailman id 256478;
 Wed, 12 Jan 2022 10:36: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 1n7azT-0008Nb-Jc
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36: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 1n7azT-0003WV-Is
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azT-0001s0-Hw
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36: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=+QFjo+sVQzYoI46EDOpvnx+C9ZOO2oY+iFN+clonYjQ=; b=FPX6R2YNsylTnxCXcA7laMpSr8
	Aw6H1f6NLDoyxTZVjF1PP0vWkP9xH0IPbzAxyjEGPGdcrX5LUXNHvS57z3htsmf5lWKDDruRkM8mW
	PlnaxBTykiFsPokcEkJiJ416i9ize4nH9Wf0j+X/7hGc0XDu85mlJc49ys0wBOhowCuY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] bios-tables-test: Update ACPI DSDT table golden blobs for q35
Message-Id: <E1n7azT-0001s0-Hw@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:36:27 +0000

commit 3aa2c2cd679dcf86e67f8c466c2e3c0bc5e1155f
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:38 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:27:44 2021 -0600

    bios-tables-test: Update ACPI DSDT table golden blobs for q35
    
    We have modified the IO address range for ACPI pci hotplug in q35. See change:
    
    5adcc9e39e6a5 ("hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35")
    
    The ACPI DSDT table golden blobs must be regenrated in order to make the unit tests
    pass. This change updates the golden ACPI DSDT table blobs.
    
    Following is the ASL diff between the blobs:
    
    @@ -1,30 +1,30 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT, Tue Sep 14 09:04:06 2021
    + * Disassembly of /tmp/aml-52DP90, Tue Sep 14 09:04:06 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
      *     Length           0x00002061 (8289)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xE5
    + *     Checksum         0xF9
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
    @@ -226,46 +226,46 @@
                 Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                 {
                     IO (Decode16,
                         0x0070,             // Range Minimum
                         0x0070,             // Range Maximum
                         0x01,               // Alignment
                         0x08,               // Length
                         )
                     IRQNoFlags ()
                         {8}
                 })
             }
         }
    
         Scope (_SB.PCI0)
         {
    -        OperationRegion (PCST, SystemIO, 0x0CC4, 0x08)
    +        OperationRegion (PCST, SystemIO, 0x0CC0, 0x08)
             Field (PCST, DWordAcc, NoLock, WriteAsZeros)
             {
                 PCIU,   32,
                 PCID,   32
             }
    
    -        OperationRegion (SEJ, SystemIO, 0x0CCC, 0x04)
    +        OperationRegion (SEJ, SystemIO, 0x0CC8, 0x04)
             Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
             {
                 B0EJ,   32
             }
    
    -        OperationRegion (BNMR, SystemIO, 0x0CD4, 0x08)
    +        OperationRegion (BNMR, SystemIO, 0x0CD0, 0x08)
             Field (BNMR, DWordAcc, NoLock, WriteAsZeros)
             {
                 BNUM,   32,
                 PIDX,   32
             }
    
             Mutex (BLCK, 0x00)
             Method (PCEJ, 2, NotSerialized)
             {
                 Acquire (BLCK, 0xFFFF)
                 BNUM = Arg0
                 B0EJ = (One << Arg1)
                 Release (BLCK)
                 Return (Zero)
             }
    
    @@ -3185,34 +3185,34 @@
                         0x0620,             // Range Minimum
                         0x0620,             // Range Maximum
                         0x01,               // Alignment
                         0x10,               // Length
                         )
                 })
             }
    
             Device (PHPR)
             {
                 Name (_HID, "PNP0A06" /* Generic Container Device */)  // _HID: Hardware ID
                 Name (_UID, "PCI Hotplug resources")  // _UID: Unique ID
                 Name (_STA, 0x0B)  // _STA: Status
                 Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                 {
                     IO (Decode16,
    -                    0x0CC4,             // Range Minimum
    -                    0x0CC4,             // Range Maximum
    +                    0x0CC0,             // Range Minimum
    +                    0x0CC0,             // Range Maximum
                         0x01,               // Alignment
                         0x18,               // Length
                         )
                 })
             }
         }
    
         Scope (\)
         {
             Name (_S3, Package (0x04)  // _S3_: S3 System State
             {
                 One,
                 One,
                 Zero,
                 Zero
             })
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20210916132838.3469580-4-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 500eb21cff08dfb0478db9b34f2fdba69eb31496)
    *drop dependency on 75539b886a ("tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs")
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT                    | Bin 8289 -> 8289 bytes
 tests/data/acpi/q35/DSDT.acpihmat           | Bin 9614 -> 9614 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 11003 -> 11003 bytes
 tests/data/acpi/q35/DSDT.cphp               | Bin 8753 -> 8753 bytes
 tests/data/acpi/q35/DSDT.dimmpxm            | Bin 9943 -> 9943 bytes
 tests/data/acpi/q35/DSDT.ipmibt             | Bin 8364 -> 8364 bytes
 tests/data/acpi/q35/DSDT.memhp              | Bin 9648 -> 9648 bytes
 tests/data/acpi/q35/DSDT.mmio64             | Bin 9419 -> 9419 bytes
 tests/data/acpi/q35/DSDT.nohpet             | Bin 8147 -> 8147 bytes
 tests/data/acpi/q35/DSDT.numamem            | Bin 8295 -> 8295 bytes
 tests/data/acpi/q35/DSDT.tis                | Bin 8894 -> 8894 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |  12 ------------
 12 files changed, 12 deletions(-)

diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT
index 842533f53e..281fc82c03 100644
Binary files a/tests/data/acpi/q35/DSDT and b/tests/data/acpi/q35/DSDT differ
diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.acpihmat
index 8d00f2ea0d..8c1e05a11a 100644
Binary files a/tests/data/acpi/q35/DSDT.acpihmat and b/tests/data/acpi/q35/DSDT.acpihmat differ
diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge
index 55ad4bd7ab..6f1464b6c7 100644
Binary files a/tests/data/acpi/q35/DSDT.bridge and b/tests/data/acpi/q35/DSDT.bridge differ
diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp
index ccde2add9f..f8337ff519 100644
Binary files a/tests/data/acpi/q35/DSDT.cphp and b/tests/data/acpi/q35/DSDT.cphp differ
diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.dimmpxm
index b062e30117..fe5820d93d 100644
Binary files a/tests/data/acpi/q35/DSDT.dimmpxm and b/tests/data/acpi/q35/DSDT.dimmpxm differ
diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt
index 1c5737692f..6317410658 100644
Binary files a/tests/data/acpi/q35/DSDT.ipmibt and b/tests/data/acpi/q35/DSDT.ipmibt differ
diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp
index 7b6f6487b2..9bc11518fc 100644
Binary files a/tests/data/acpi/q35/DSDT.memhp and b/tests/data/acpi/q35/DSDT.memhp differ
diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/q35/DSDT.mmio64
index 2e0a772a85..713288a12e 100644
Binary files a/tests/data/acpi/q35/DSDT.mmio64 and b/tests/data/acpi/q35/DSDT.mmio64 differ
diff --git a/tests/data/acpi/q35/DSDT.nohpet b/tests/data/acpi/q35/DSDT.nohpet
index ceb61f4115..e8202e6ddf 100644
Binary files a/tests/data/acpi/q35/DSDT.nohpet and b/tests/data/acpi/q35/DSDT.nohpet differ
diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem
index a3f846df54..151e7cf429 100644
Binary files a/tests/data/acpi/q35/DSDT.numamem and b/tests/data/acpi/q35/DSDT.numamem differ
diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis
index d1433e3c14..c92d4d29c7 100644
Binary files a/tests/data/acpi/q35/DSDT.tis and b/tests/data/acpi/q35/DSDT.tis differ
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index c06da38af3..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,13 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT",
-"tests/data/acpi/q35/DSDT.tis.tpm12",
-"tests/data/acpi/q35/DSDT.tis.tpm2",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.mmio64",
-"tests/data/acpi/q35/DSDT.ipmibt",
-"tests/data/acpi/q35/DSDT.cphp",
-"tests/data/acpi/q35/DSDT.memhp",
-"tests/data/acpi/q35/DSDT.numamem",
-"tests/data/acpi/q35/DSDT.nohpet",
-"tests/data/acpi/q35/DSDT.dimmpxm",
-"tests/data/acpi/q35/DSDT.acpihmat",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:36:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:36:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256480.440169 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7aze-0008Qq-RQ; Wed, 12 Jan 2022 10:36:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256480.440169; Wed, 12 Jan 2022 10:36:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7aze-0008Qh-OP; Wed, 12 Jan 2022 10:36:38 +0000
Received: by outflank-mailman (input) for mailman id 256480;
 Wed, 12 Jan 2022 10:36:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azd-0008Qb-N8
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azd-0003Wi-Ma
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azd-0001sr-Lu
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m2qhvS/lh6VpMSSF3criDAM3w6kijlrhEPYqZbrZkZE=; b=t3xJtLRfxCySEkoz1axcp6cQSk
	tXnNqNj3hrRJCa5j/3Mc8yb0H2lMsYh0FOaovuGoocHAR4DZR0VlaylV75yadFFdd7PrMsX/tCDD8
	R/mbteetXxDMKAfaPWa9qyur9/8/HKDYnKhS++0wKukgtIrHLKhbR908QngHY6z33P5k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] block: introduce max_hw_iov for use in scsi-generic
Message-Id: <E1n7azd-0001sr-Lu@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:36:37 +0000

commit a43e057bd6095108fbe99b6a21d4857186aa3df3
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Sep 23 09:04:36 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:53:15 2021 -0600

    block: introduce max_hw_iov for use in scsi-generic
    
    Linux limits the size of iovecs to 1024 (UIO_MAXIOV in the kernel
    sources, IOV_MAX in POSIX).  Because of this, on some host adapters
    requests with many iovecs are rejected with -EINVAL by the
    io_submit() or readv()/writev() system calls.
    
    In fact, the same limit applies to SG_IO as well.  To fix both the
    EINVAL and the possible performance issues from using fewer iovecs
    than allowed by Linux (some HBAs have max_segments as low as 128),
    introduce a separate entry in BlockLimits to hold the max_segments
    value from sysfs.  This new limit is used only for SG_IO and clamped
    to bs->bl.max_iov anyway, just like max_hw_transfer is clamped to
    bs->bl.max_transfer.
    
    Reported-by: Halil Pasic <pasic@linux.ibm.com>
    Cc: Hanna Reitz <hreitz@redhat.com>
    Cc: Kevin Wolf <kwolf@redhat.com>
    Cc: qemu-block@nongnu.org
    Cc: qemu-stable@nongnu.org
    Fixes: 18473467d5 ("file-posix: try BLKSECTGET on block devices too, do not round to power of 2", 2021-06-25)
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210923130436.1187591-1-pbonzini@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit cc071629539dc1f303175a7e2d4ab854c0a8b20f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 block/block-backend.c          | 6 ++++++
 block/file-posix.c             | 2 +-
 block/io.c                     | 1 +
 hw/scsi/scsi-generic.c         | 2 +-
 include/block/block_int.h      | 7 +++++++
 include/sysemu/block-backend.h | 1 +
 6 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index deb55c272e..6320752aa2 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1978,6 +1978,12 @@ uint32_t blk_get_max_transfer(BlockBackend *blk)
     return ROUND_DOWN(max, blk_get_request_alignment(blk));
 }
 
+int blk_get_max_hw_iov(BlockBackend *blk)
+{
+    return MIN_NON_ZERO(blk->root->bs->bl.max_hw_iov,
+                        blk->root->bs->bl.max_iov);
+}
+
 int blk_get_max_iov(BlockBackend *blk)
 {
     return blk->root->bs->bl.max_iov;
diff --git a/block/file-posix.c b/block/file-posix.c
index cb9bffe047..1567edb3d5 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1273,7 +1273,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
 
         ret = hdev_get_max_segments(s->fd, &st);
         if (ret > 0) {
-            bs->bl.max_iov = ret;
+            bs->bl.max_hw_iov = ret;
         }
     }
 }
diff --git a/block/io.c b/block/io.c
index a19942718b..f38e7f81d8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -136,6 +136,7 @@ static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src)
     dst->min_mem_alignment = MAX(dst->min_mem_alignment,
                                  src->min_mem_alignment);
     dst->max_iov = MIN_NON_ZERO(dst->max_iov, src->max_iov);
+    dst->max_hw_iov = MIN_NON_ZERO(dst->max_hw_iov, src->max_hw_iov);
 }
 
 typedef struct BdrvRefreshLimitsState {
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 665baf900e..0306ccc7b1 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -180,7 +180,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
         page = r->req.cmd.buf[2];
         if (page == 0xb0) {
             uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
-            uint32_t max_iov = blk_get_max_iov(s->conf.blk);
+            uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
 
             assert(max_transfer);
             max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index f1a54db0f8..c31cbd034a 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -702,6 +702,13 @@ typedef struct BlockLimits {
      */
     uint64_t max_hw_transfer;
 
+    /* Maximal number of scatter/gather elements allowed by the hardware.
+     * Applies whenever transfers to the device bypass the kernel I/O
+     * scheduler, for example with SG_IO.  If larger than max_iov
+     * or if zero, blk_get_max_hw_iov will fall back to max_iov.
+     */
+    int max_hw_iov;
+
     /* memory alignment, in bytes so that no bounce buffer is needed */
     size_t min_mem_alignment;
 
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 9ac5f7bbd3..5daec61f6e 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -210,6 +210,7 @@ uint32_t blk_get_request_alignment(BlockBackend *blk);
 uint32_t blk_get_max_transfer(BlockBackend *blk);
 uint64_t blk_get_max_hw_transfer(BlockBackend *blk);
 int blk_get_max_iov(BlockBackend *blk);
+int blk_get_max_hw_iov(BlockBackend *blk);
 void blk_set_guest_block_size(BlockBackend *blk, int align);
 void *blk_try_blockalign(BlockBackend *blk, size_t size);
 void *blk_blockalign(BlockBackend *blk, size_t size);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:36:50 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:36:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256481.440173 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7azo-0008Tj-Sy; Wed, 12 Jan 2022 10:36:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256481.440173; Wed, 12 Jan 2022 10:36: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 1n7azo-0008Tb-Pz; Wed, 12 Jan 2022 10:36:48 +0000
Received: by outflank-mailman (input) for mailman id 256481;
 Wed, 12 Jan 2022 10:36:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azn-0008TT-QD
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azn-0003Wp-Pa
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azn-0001th-Oq
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PpSKtc2pzJIzFQEwXyfTR9xPHHolIY/1xwd5Ebh+ZIo=; b=FfXWuHUsJmbGeto2Xw6xfkHAYX
	4RjVWk5dPyGFYpF0I4bGbdQmZf3Ntjh5pmY0V9HHRkF6VxjU8szhV1MarJiB+Ut90IZWYObcua8zC
	zkTgLfq8BRLVdkSnSozMAfbqClkipLOHcoSiVaTRzZeKNFL/3bksYYM1iignGdMguOxU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] pci: fix PCI resource reserve capability on BE
Message-Id: <E1n7azn-0001th-Oq@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:36:47 +0000

commit 24101e36f1c2c782c8c2d055b477e0e0beaf4c68
Author:     Michael S. Tsirkin <mst@redhat.com>
AuthorDate: Wed Oct 20 05:48:54 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:01:41 2021 -0600

    pci: fix PCI resource reserve capability on BE
    
    PCI resource reserve capability should use LE format as all other PCI
    things. If we don't then seabios won't boot:
    
    === PCI new allocation pass #1 ===
    PCI: check devices
    PCI: QEMU resource reserve cap: size 10000000000000 type io
    PCI: secondary bus 1 size 10000000000000 type io
    PCI: secondary bus 1 size 00200000 type mem
    PCI: secondary bus 1 size 00200000 type prefmem
    === PCI new allocation pass #2 ===
    PCI: out of I/O address space
    
    This became more important since we started reserving IO by default,
    previously no one noticed.
    
    Fixes: e2a6290aab ("hw/pcie-root-port: Fix hotplug for PCI devices requiring IO")
    Cc: marcel.apfelbaum@gmail.com
    Fixes: 226263fb5c ("hw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port")
    Cc: zuban32s@gmail.com
    Fixes: 6755e618d0 ("hw/pci: add PCI resource reserve capability to legacy PCI bridge")
    Cc: jing2.liu@linux.intel.com
    Tested-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    (cherry picked from commit 0e464f7d993113119f0fd17b890831440734ce15)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/pci/pci_bridge.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 3789c17edc..6a1e8e433c 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
     PCIBridgeQemuCap cap = {
             .len = cap_len,
             .type = REDHAT_PCI_CAP_RESOURCE_RESERVE,
-            .bus_res = res_reserve.bus,
-            .io = res_reserve.io,
-            .mem = res_reserve.mem_non_pref,
-            .mem_pref_32 = res_reserve.mem_pref_32,
-            .mem_pref_64 = res_reserve.mem_pref_64
+            .bus_res = cpu_to_le32(res_reserve.bus),
+            .io = cpu_to_le64(res_reserve.io),
+            .mem = cpu_to_le32(res_reserve.mem_non_pref),
+            .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32),
+            .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64)
     };
 
     int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:36:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:36:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256482.440177 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7azy-000086-Ug; Wed, 12 Jan 2022 10:36:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256482.440177; Wed, 12 Jan 2022 10:36: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 1n7azy-00007y-RU; Wed, 12 Jan 2022 10:36:58 +0000
Received: by outflank-mailman (input) for mailman id 256482;
 Wed, 12 Jan 2022 10:36:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azx-00007o-TH
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azx-0003XD-Sb
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7azx-0001uw-Rr
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:36:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q2bMy+3+d7fIIt78UwBI1KXV+TQUTjwIaJF4NZ3KJgo=; b=bWPC+qd9rJQruThLJd/SiLNiQ7
	7pIV0itWJrMFfuD2h3cx1da2jBBV5Gh1xzgBmXxixuZ84sEjNPGfnj7YdFV5TSAIOZhLoprk1W1ir
	42GgRGQ8UhpDs+yw2OFsDA8LHGBdjmOz3xJnGeRm4VODorZBRxOoMU52QAAi961e/t9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
Message-Id: <E1n7azx-0001uw-Rr@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:36:57 +0000

commit a759dc19ecf11410593db40e2ce7dba3c06f16ac
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:48 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:15 2021 -0600

    tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
    
    We are adding a new unit test to cover the acpi hotplug support in q35 for
    multi-function bridges. This test uses a new table DSDT.multi-bridge.
    We need to allow changes in DSDT acpi table for addition of this new
    unit test.
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-2-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit 6dcb1cc9512c6b4cd8f85abc537abaf6f6c0738b)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT.multi-bridge       | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 1 +
 2 files changed, 1 insertion(+)

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..dabc024f53 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.multi-bridge",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:37:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:37:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256483.440183 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b09-0000BC-1i; Wed, 12 Jan 2022 10:37:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256483.440183; Wed, 12 Jan 2022 10:37:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b08-0000B3-TF; Wed, 12 Jan 2022 10:37:08 +0000
Received: by outflank-mailman (input) for mailman id 256483;
 Wed, 12 Jan 2022 10:37:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b08-0000Ax-0O
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b07-0003XU-Vk
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b07-0001w2-Ux
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bfq/ILZjICYrCKqyZzhvydzUjzdCWRwp74L299K0QxQ=; b=VPHlABvO/lsgAvmyTv4ngxI5Of
	+3ebrY2zTYbDT12TCjRREOzH6dh2UHPH+to4mJ06wcxPc7AZqc2FkFJcK8hK1LWCRcj/SYv2AjJ+Z
	cP9iUda/QH6rF+nU9Jl+fAhpwuCvw9MXn2zkMnM7JJLimvQoloINL9NYmbzH4LeIhQdE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
Message-Id: <E1n7b07-0001w2-Ux@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:37:07 +0000

commit 8319de607faa33113ec9b47778da77e7ad4d9c8b
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:49 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:20 2021 -0600

    tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
    
    commit d7346e614f4ec ("acpi: x86: pcihp: add support hotplug on multifunction bridges")
    added ACPI hotplug descriptions for cold plugged bridges for functions other
    than 0. For all other devices, the ACPI hotplug descriptions are limited to
    function 0 only. This change adds unit tests for this feature.
    
    This test adds the following devices to qemu and then checks the changes
    introduced in the DSDT table due to the addition of the following devices:
    
    (a) a multifunction bridge device
    (b) a bridge device with function 1
    (c) a non-bridge device with function 2
    
    In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
    For (a) we should find a hotplug AML description for function 0.
    
    The following diff compares the DSDT table AML with the new unit test before
    and after the change d7346e614f4ec is introduced. In other words,
    this diff reflects the changes that occurs in the DSDT table due to the change
    d7346e614f4ec .
    
    @@ -1,60 +1,38 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT.multi-bridge, Thu Oct  7 18:56:05 2021
    + * Disassembly of /tmp/aml-AN0DA1, Thu Oct  7 18:56:05 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
    - *     Length           0x000020FE (8446)
    + *     Length           0x00002187 (8583)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xDE
    + *     Checksum         0x8D
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
    -    /*
    -     * iASL Warning: There was 1 external control method found during
    -     * disassembly, but only 0 were resolved (1 unresolved). Additional
    -     * ACPI tables may be required to properly disassemble the code. This
    -     * resulting disassembler output file may not compile because the
    -     * disassembler did not know how many arguments to assign to the
    -     * unresolved methods. Note: SSDTs can be dynamically loaded at
    -     * runtime and may or may not be available via the host OS.
    -     *
    -     * In addition, the -fe option can be used to specify a file containing
    -     * control method external declarations with the associated method
    -     * argument counts. Each line of the file must be of the form:
    -     *     External (<method pathname>, MethodObj, <argument count>)
    -     * Invocation:
    -     *     iasl -fe refs.txt -d dsdt.aml
    -     *
    -     * The following methods were unresolved and many not compile properly
    -     * because the disassembler had to guess at the number of arguments
    -     * required for each:
    -     */
    -    External (_SB_.PCI0.S19_.PCNT, MethodObj)    // Warning: Unknown method, guessing 1 arguments
    -
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
             Method (DBUG, 1, NotSerialized)
             {
                 ToHexString (Arg0, Local0)
                 ToBuffer (Local0, Local0)
                 Local1 = (SizeOf (Local0) - One)
                 Local2 = Zero
                 While ((Local2 < Local1))
                 {
    @@ -3322,24 +3300,60 @@
                     Method (DVNT, 2, NotSerialized)
                     {
                         If ((Arg0 & One))
                         {
                             Notify (S00, Arg1)
                         }
                     }
    
                     Method (PCNT, 0, NotSerialized)
                     {
                         BNUM = One
                         DVNT (PCIU, One)
                         DVNT (PCID, 0x03)
                     }
                 }
    
    +            Device (S19)
    +            {
    +                Name (_ADR, 0x00030001)  // _ADR: Address
    +                Name (BSEL, Zero)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = Zero
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
                 Method (PCNT, 0, NotSerialized)
                 {
    -                ^S19.PCNT (^S10.PCNT ())
    +                ^S19.PCNT ()
    +                ^S10.PCNT ()
                 }
             }
         }
     }
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-3-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit 04dd78b9e85720226a148eef54b45cb02b463034)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/bios-tables-test.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 51d3a4e239..921f676e4c 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -859,6 +859,23 @@ static void test_acpi_q35_tcg_bridge(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_multif_bridge(void)
+{
+    test_data data = {
+        .machine = MACHINE_Q35,
+        .variant = ".multi-bridge",
+    };
+    test_acpi_one("-device pcie-root-port,id=pcie-root-port-0,"
+                  "multifunction=on,"
+                  "port=0x0,chassis=1,addr=0x2,bus=pcie.0 "
+                  "-device pcie-root-port,id=pcie-root-port-1,"
+                  "port=0x1,chassis=2,addr=0x3.0x1,bus=pcie.0 "
+                  "-device virtio-balloon,id=balloon0,"
+                  "bus=pcie.0,addr=0x4.0x2",
+                  &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_mmio64(void)
 {
     test_data data = {
@@ -1528,6 +1545,7 @@ int main(int argc, char *argv[])
                        test_acpi_piix4_no_acpi_pci_hotplug);
         qtest_add_func("acpi/q35", test_acpi_q35_tcg);
         qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
+        qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge);
         qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
         qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
         qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:37:19 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:37:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256484.440185 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0J-0000EW-3S; Wed, 12 Jan 2022 10:37:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256484.440185; Wed, 12 Jan 2022 10:37:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0J-0000EO-0a; Wed, 12 Jan 2022 10:37:19 +0000
Received: by outflank-mailman (input) for mailman id 256484;
 Wed, 12 Jan 2022 10:37:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0I-0000EG-3K
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0I-0003Xp-2i
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0I-0001x4-1t
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gQ2FglNENKwGQC7sFqF8rCHp/QjeFGkl4yu5N59T6aQ=; b=EubIK9kWfL0G1E2ZuKDvb+tiBE
	Bnm9bG1L1Du8lP1osRqX3UHo4XWESW1qxJJ3WYhM0vDsByFKQmZ0Z/N5UF++N48dxy5OYF8qaUQd+
	A0KtiitHJc7KzN9BLZPBdLLL1TyzAyiXVI+paW6iZs532IoKG79Cw3wGQRkHOBi57bTc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
Message-Id: <E1n7b0I-0001x4-1t@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:37:18 +0000

commit bbbdedb38692dc1005a17b465f6b92474356c1c0
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:50 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:24 2021 -0600

    tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
    
    We added a new unit test for testing acpi hotplug on multifunction bridges in
    q35 machines. Here, we update the DSDT table gloden master blob for this unit
    test.
    
    The test adds the following devices to qemu and then checks the changes
    introduced in the DSDT table due to the addition of the following devices:
    
    (a) a multifunction bridge device
    (b) a bridge device with function 1
    (c) a non-bridge device with function 2
    
    In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
    For (a) we should find a hotplug AML description for function 0.
    
    Following is the ASL diff between the original DSDT table and the modified DSDT
    table due to the unit test. We see that multifunction bridge on bus 2 and single
    function bridge on bus 3 function 1 are described, not the non-bridge balloon
    device on bus 4, function 2.
    
    @@ -1,30 +1,30 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT, Thu Oct  7 18:29:19 2021
    + * Disassembly of /tmp/aml-C7JCA1, Thu Oct  7 18:29:19 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
    - *     Length           0x00002061 (8289)
    + *     Length           0x00002187 (8583)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xF9
    + *     Checksum         0x8D
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
    @@ -3265,23 +3265,95 @@
                     Method (_S1D, 0, NotSerialized)  // _S1D: S1 Device State
                     {
                         Return (Zero)
                     }
    
                     Method (_S2D, 0, NotSerialized)  // _S2D: S2 Device State
                     {
                         Return (Zero)
                     }
    
                     Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
                     {
                         Return (Zero)
                     }
                 }
    
    +            Device (S10)
    +            {
    +                Name (_ADR, 0x00020000)  // _ADR: Address
    +                Name (BSEL, One)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = One
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
    +            Device (S19)
    +            {
    +                Name (_ADR, 0x00030001)  // _ADR: Address
    +                Name (BSEL, Zero)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = Zero
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
                 Method (PCNT, 0, NotSerialized)
                 {
    +                ^S19.PCNT ()
    +                ^S10.PCNT ()
                 }
             }
         }
     }
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-4-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit a8339e07f94a47f99560baef59d65a9e039aaf45)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 0 -> 8583 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   1 -
 2 files changed, 1 deletion(-)

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
index e69de29bb2..a24c713d22 100644
Binary files a/tests/data/acpi/q35/DSDT.multi-bridge and b/tests/data/acpi/q35/DSDT.multi-bridge differ
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dabc024f53..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.multi-bridge",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:37:29 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:37:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256485.440189 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0T-0000I5-58; Wed, 12 Jan 2022 10:37:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256485.440189; Wed, 12 Jan 2022 10:37:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0T-0000Ht-29; Wed, 12 Jan 2022 10:37:29 +0000
Received: by outflank-mailman (input) for mailman id 256485;
 Wed, 12 Jan 2022 10:37:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0S-0000Hh-6G
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0S-0003Xu-5f
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0S-0001xr-52
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iLWeffIAm07bdkQ/PmRjF3z2zfUjVgDN+GRgIliEulU=; b=dfUw778OpYn4fIFw7Zn5IkwBDp
	J32osuegtESZK4D8m96DW0vBgwc3/M8zEdbrL3bGFfN2l0g8LaRzucJ+dJVumnshgO6Jn7O7TpQiq
	EeNG+xVhu0e63Xzkysmps/miN3S86yAH0HMYopjmc8SaTMDgpAyLlJgIR33/XfioGt1k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] block/file-posix: Fix return value translation for AIO discards
Message-Id: <E1n7b0S-0001xr-52@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:37:28 +0000

commit ebf660beb171d40af179f84a967b710199f81511
Author:     Ari Sundholm <ari@tuxera.com>
AuthorDate: Tue Oct 19 14:09:55 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:12:50 2021 -0600

    block/file-posix: Fix return value translation for AIO discards
    
    AIO discards regressed as a result of the following commit:
            0dfc7af2 block/file-posix: Optimize for macOS
    
    When trying to run blkdiscard within a Linux guest, the request would
    fail, with some errors in dmesg:
    
    ---- [ snip ] ----
    [    4.010070] sd 2:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK
    driverbyte=DRIVER_SENSE
    [    4.011061] sd 2:0:0:0: [sda] tag#0 Sense Key : Aborted Command
    [current]
    [    4.011061] sd 2:0:0:0: [sda] tag#0 Add. Sense: I/O process
    terminated
    [    4.011061] sd 2:0:0:0: [sda] tag#0 CDB: Unmap/Read sub-channel 42
    00 00 00 00 00 00 00 18 00
    [    4.011061] blk_update_request: I/O error, dev sda, sector 0
    ---- [ snip ] ----
    
    This turns out to be a result of a flaw in changes to the error value
    translation logic in handle_aiocb_discard(). The default return value
    may be left untranslated in some configurations, and the wrong variable
    is used in one translation.
    
    Fix both issues.
    
    Fixes: 0dfc7af2b28 ("block/file-posix: Optimize for macOS")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Ari Sundholm <ari@tuxera.com>
    Signed-off-by: Emil Karlson <jkarlson@tuxera.com>
    Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-Id: <20211019110954.4170931-1-ari@tuxera.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 13a028336f2c05e7ff47dfdaf30dfac7f4883e80)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 block/file-posix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 1567edb3d5..dd295cfc6d 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1807,7 +1807,7 @@ static int handle_aiocb_copy_range(void *opaque)
 static int handle_aiocb_discard(void *opaque)
 {
     RawPosixAIOData *aiocb = opaque;
-    int ret = -EOPNOTSUPP;
+    int ret = -ENOTSUP;
     BDRVRawState *s = aiocb->bs->opaque;
 
     if (!s->has_discard) {
@@ -1829,7 +1829,7 @@ static int handle_aiocb_discard(void *opaque)
 #ifdef CONFIG_FALLOCATE_PUNCH_HOLE
         ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                            aiocb->aio_offset, aiocb->aio_nbytes);
-        ret = translate_err(-errno);
+        ret = translate_err(ret);
 #elif defined(__APPLE__) && (__MACH__)
         fpunchhole_t fpunchhole;
         fpunchhole.fp_flags = 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:37:39 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:37:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256486.440193 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0d-0000LI-6q; Wed, 12 Jan 2022 10:37:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256486.440193; Wed, 12 Jan 2022 10:37:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0d-0000L8-3f; Wed, 12 Jan 2022 10:37:39 +0000
Received: by outflank-mailman (input) for mailman id 256486;
 Wed, 12 Jan 2022 10:37:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0c-0000Kz-9R
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0c-0003Xy-8n
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0c-0001yk-87
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CglseLTcvuIHczJL5fSDYaUHwY9MytdChzKNMk6gIyE=; b=srJHFmJUV7Pad8FO9ui4p/7lh9
	lsU6XxnnJkeqTSbOruCaBB37biv3FlP2oJDN0lY3MWCbP0Oy3M8KqW8ccdsm4xCKnEI34RoQXvXsn
	1UamAJcmMLIq90UOyKR2zUfPYWAPIfJVXCc1kSYWj0wyeX/kiPzF8ZmOz3sE+jHyTVgI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] Partially revert "build: -no-pie is no functional linker flag"
Message-Id: <E1n7b0c-0001yk-87@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:37:38 +0000

commit 43a457841f8c61dd4677ec018c3da4b0323ffb4b
Author:     Jessica Clarke <jrtc27@jrtc27.com>
AuthorDate: Thu Aug 5 20:25:45 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:13:38 2021 -0600

    Partially revert "build: -no-pie is no functional linker flag"
    
    This partially reverts commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53.
    
    This commit was misguided and broke using --disable-pie on any distro
    that enables PIE by default in their compiler driver, including Debian
    and its derivatives. Whilst -no-pie is not a linker flag, it is a
    compiler driver flag that ensures -pie is not automatically passed by it
    to the linker. Without it, all compile_prog checks will fail as any code
    built with the explicit -fno-pie will fail to link with the implicit
    default -pie due to trying to use position-dependent relocations. The
    only bug that needed fixing was LDFLAGS_NOPIE being used as a flag for
    the linker itself in pc-bios/optionrom/Makefile.
    
    Note this does not reinstate exporting LDFLAGS_NOPIE, as it is unused,
    since the only previous use was the one that should not have existed. I
    have also updated the comment for the -fno-pie and -no-pie checks to
    reflect what they're actually needed for.
    
    Fixes: bbd2d5a8120771ec59b86a80a1f51884e0a26e53
    Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
    Message-Id: <20210805192545.38279-1-jrtc27@jrtc27.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit ffd205ef2901bd65fcfbd09a98c0ff7cfcec5e4d)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 configure | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 7659870810..6e308ed77f 100755
--- a/configure
+++ b/configure
@@ -2246,9 +2246,11 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-# Check we support --no-pie first; we will need this for building ROMs.
+# Check we support -fno-pie and -no-pie first; we will need the former for
+# building ROMs, and both for everything if --disable-pie is passed.
 if compile_prog "-Werror -fno-pie" "-no-pie"; then
   CFLAGS_NOPIE="-fno-pie"
+  LDFLAGS_NOPIE="-no-pie"
 fi
 
 if test "$static" = "yes"; then
@@ -2264,6 +2266,7 @@ if test "$static" = "yes"; then
   fi
 elif test "$pie" = "no"; then
   CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
+  CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
   CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:37:49 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:37:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256487.440196 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0n-0000O8-7y; Wed, 12 Jan 2022 10:37:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256487.440196; Wed, 12 Jan 2022 10:37:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0n-0000O0-58; Wed, 12 Jan 2022 10:37:49 +0000
Received: by outflank-mailman (input) for mailman id 256487;
 Wed, 12 Jan 2022 10:37:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0m-0000Nu-CU
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0m-0003YF-Bp
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0m-0001zk-B0
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xpamEX/28dDCFsZaGuDEAmZRJl7Rm16o9zl5eVGUEX8=; b=K9XEPxFs0M9d5ESlMIA74aUD9d
	hZRgVJC5P4VTCbI5zEkDSreIt0SA8y4eIzI2VaLySnSQEXU+PIFsfWIl9X+aTaSY4QLqfY3RmPHju
	AWJdKySyzjI5/B0U9WX7pxNZKoLSUILPDPltcd73BEGoB6eCAbWpdmyoGdr5tioTEE6o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] target-i386: mmu: use pg_mode instead of HF_LMA_MASK
Message-Id: <E1n7b0m-0001zk-B0@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:37:48 +0000

commit cddfaf96ab2a6772dd87998af699f91ca15facfd
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Nov 4 14:45:20 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:18:25 2021 -0600

    target-i386: mmu: use pg_mode instead of HF_LMA_MASK
    
    Correctly look up the paging mode of the hypervisor when it is using 64-bit
    mode but the guest is not.
    
    Fixes: 68746930ae ("target/i386: use mmu_translate for NPT walk", 2021-05-11)
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 93eae3583256896dd91a4c2ca38dcbb8d4051cff)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index b6d940e04e..2dea4a248e 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -90,7 +90,7 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f
         target_ulong pdpe_addr;
 
 #ifdef TARGET_X86_64
-        if (env->hflags & HF_LMA_MASK) {
+        if (pg_mode & PG_MODE_LMA) {
             bool la57 = pg_mode & PG_MODE_LA57;
             uint64_t pml5e_addr, pml5e;
             uint64_t pml4e_addr, pml4e;
@@ -287,7 +287,7 @@ do_check_protect_pse36:
         *prot |= PAGE_EXEC;
     }
 
-    if (!(env->hflags & HF_LMA_MASK)) {
+    if (!(pg_mode & PG_MODE_LMA)) {
         pkr = 0;
     } else if (ptep & PG_USER_MASK) {
         pkr = pg_mode & PG_MODE_PKE ? env->pkru : 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:37:59 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:37:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256488.440201 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0x-0000RF-9j; Wed, 12 Jan 2022 10:37:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256488.440201; Wed, 12 Jan 2022 10:37:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b0x-0000R7-6a; Wed, 12 Jan 2022 10:37:59 +0000
Received: by outflank-mailman (input) for mailman id 256488;
 Wed, 12 Jan 2022 10:37:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0w-0000Qw-FO
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0w-0003Yd-El
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b0w-00022F-E1
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:37:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+MVkza6AZ7XIK1ILNAqUabKWTMtgs2Gd4O2TcTUvSgk=; b=MU9TAWzrH7LLG6YIM6G+8qAzEF
	39te1ZeRfBZSyYI8D+Pofib6Oa6emQkLAWhQzSl4FKO14q4kPpAtx7HLrguJA6+6aI3vE8qRV4ar3
	YYgcymO/vkEmgW8KLI5el5xu2GrOUPu+FZ1WoReQ1mJIH2vPEPmkNc0UrNUmX8QoIA4s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] target-i386: mmu: fix handling of noncanonical virtual addresses
Message-Id: <E1n7b0w-00022F-E1@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:37:58 +0000

commit 3488bb205de0537ba5364ee1ee09cb07a26a4bb0
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Nov 4 14:47:46 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:19:00 2021 -0600

    target-i386: mmu: fix handling of noncanonical virtual addresses
    
    mmu_translate is supposed to return an error code for page faults; it is
    not able to handle other exceptions.  The #GP case for noncanonical
    virtual addresses is not handled correctly, and incorrectly raised as
    a page fault with error code 1.  Since it cannot happen for nested
    page tables, move it directly to handle_mmu_fault, even before the
    invocation of mmu_translate.
    
    Fixes: #676
    Fixes: 661ff4879e ("target/i386: extract mmu_translate", 2021-05-11)
    Cc: qemu-stable@nongnu.org
    Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b04dc92e013d55c9ac8082caefff45dcfb1310e7)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index 2dea4a248e..9fb59058ef 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -94,15 +94,6 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f
             bool la57 = pg_mode & PG_MODE_LA57;
             uint64_t pml5e_addr, pml5e;
             uint64_t pml4e_addr, pml4e;
-            int32_t sext;
-
-            /* test virtual address sign extension */
-            sext = la57 ? (int64_t)addr >> 56 : (int64_t)addr >> 47;
-            if (get_hphys_func && sext != 0 && sext != -1) {
-                env->error_code = 0;
-                cs->exception_index = EXCP0D_GPF;
-                return 1;
-            }
 
             if (la57) {
                 pml5e_addr = ((cr3 & ~0xfff) +
@@ -423,6 +414,18 @@ static int handle_mmu_fault(CPUState *cs, vaddr addr, int size,
         page_size = 4096;
     } else {
         pg_mode = get_pg_mode(env);
+        if (pg_mode & PG_MODE_LMA) {
+            int32_t sext;
+
+            /* test virtual address sign extension */
+            sext = (int64_t)addr >> (pg_mode & PG_MODE_LA57 ? 56 : 47);
+            if (sext != 0 && sext != -1) {
+                env->error_code = 0;
+                cs->exception_index = EXCP0D_GPF;
+                return 1;
+            }
+        }
+
         error_code = mmu_translate(cs, addr, get_hphys, env->cr[3], is_write1,
                                    mmu_idx, pg_mode,
                                    &paddr, &page_size, &prot);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:38:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:38:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256489.440207 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b17-0000U3-CM; Wed, 12 Jan 2022 10:38:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256489.440207; Wed, 12 Jan 2022 10:38:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b17-0000Tv-84; Wed, 12 Jan 2022 10:38:09 +0000
Received: by outflank-mailman (input) for mailman id 256489;
 Wed, 12 Jan 2022 10:38:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b16-0000Tn-KF
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b16-0003Yu-I6
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b16-00023J-HG
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nOX/R+W57SKEwOjPDJZgpt7MJluhKw44EFIMwRbmMW0=; b=zAQFRTTIJR43dzkBqt631edlud
	q3uRoKRHg+X7xLJjm791/z0A/1IgbaqUHu7w6WSDKRSM0/DL0a/JkzQJ/08ofVAMr9fVGdQJmfS7B
	A0TXouY+FOxJqj79YmczImrE+OEkhK6D4h5Nhra0DvIjEdnkxbi4zY42KNxBwjNbZKMg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands
Message-Id: <E1n7b16-00023J-HG@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:38:08 +0000

commit c2c7f108b8228091d7ad4bd488c3abb9adc632e7
Author:     Mauro Matteo Cascella <mcascell@redhat.com>
AuthorDate: Thu Nov 4 17:31:38 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:22:44 2021 -0600

    hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands
    
    This avoids an off-by-one read of 'mode_sense_valid' buffer in
    hw/scsi/scsi-disk.c:mode_sense_page().
    
    Fixes: CVE-2021-3930
    Cc: qemu-stable@nongnu.org
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Fixes: a8f4bbe2900 ("scsi-disk: store valid mode pages in a table")
    Fixes: #546
    Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
    Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/scsi/scsi-disk.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index e8a547dbb7..d4914178ea 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1087,6 +1087,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
     uint8_t *p = *p_outbuf + 2;
     int length;
 
+    assert(page < ARRAY_SIZE(mode_sense_valid));
     if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) {
         return -1;
     }
@@ -1428,6 +1429,11 @@ static int scsi_disk_check_mode_select(SCSIDiskState *s, int page,
         return -1;
     }
 
+    /* MODE_PAGE_ALLS is only valid for MODE SENSE commands */
+    if (page == MODE_PAGE_ALLS) {
+        return -1;
+    }
+
     p = mode_current;
     memset(mode_current, 0, inlen + 2);
     len = mode_sense_page(s, page, &p, 0);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:38:19 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:38:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256490.440209 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1H-0000XT-EL; Wed, 12 Jan 2022 10:38:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256490.440209; Wed, 12 Jan 2022 10:38:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1H-0000XL-BV; Wed, 12 Jan 2022 10:38:19 +0000
Received: by outflank-mailman (input) for mailman id 256490;
 Wed, 12 Jan 2022 10:38:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1G-0000XD-M0
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1G-0003Yy-LK
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1G-00024P-KR
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cVA2tRAqeUFQRw3vjFig5iHz7a0Hntc2sQJ1vkwviEg=; b=WnwCaXbs7rlt3EMeJqvWPgpGXP
	hJ39xRbbW6dt7+/X4Ht0+M10+ZD5SQ0BJRsClFe5FBJ4Q285yX4GNz4As3TPG00RpxcT+2Ec3Zzug
	fjkeZEhlW+oDlJOmGJHJAgwpBQs1z16+wC33cI2uUjLjX4x3zEW+EQRQb50SqjaG/a7g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw: m68k: virt: Add compat machine for 6.1
Message-Id: <E1n7b1G-00024P-KR@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:38:18 +0000

commit 7d71e6bfb0a2f03bd35165d4fc11da64b7ccc0d7
Author:     Laurent Vivier <laurent@vivier.eu>
AuthorDate: Sat Nov 6 20:41:57 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:23:21 2021 -0600

    hw: m68k: virt: Add compat machine for 6.1
    
    Add the missing machine type for m68k/virt
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    Message-Id: <20211106194158.4068596-2-laurent@vivier.eu>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 6837f299762679429924242a63f16490862578e3)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/m68k/virt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 4e8bce5aa6..0d9e3f83c1 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -304,7 +304,14 @@ type_init(virt_machine_register_types)
     } \
     type_init(machvirt_machine_##major##_##minor##_init);
 
+static void virt_machine_6_1_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE(6, 1, true)
+
 static void virt_machine_6_0_options(MachineClass *mc)
 {
+    virt_machine_6_1_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len);
 }
-DEFINE_VIRT_MACHINE(6, 0, true)
+DEFINE_VIRT_MACHINE(6, 0, false)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:38:30 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:38:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256491.440213 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1S-0000an-Fz; Wed, 12 Jan 2022 10:38:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256491.440213; Wed, 12 Jan 2022 10:38:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1S-0000af-Cx; Wed, 12 Jan 2022 10:38:30 +0000
Received: by outflank-mailman (input) for mailman id 256491;
 Wed, 12 Jan 2022 10:38:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1Q-0000aV-PG
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1Q-0003ZB-OY
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1Q-00025G-Nn
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ruqs226FoR87Ci9/9rK6iz4IRzRRteQHml04UMWfu8E=; b=Gd3k8Z/XwwuLx3Kj+tr6OQKbF3
	GWJMaW7Da74FZCNfJglRLXnIGQVxXRnGXa+UDQN0eUnuGoAwB5vMqvspcv6yeXF09onccqQ47qqP2
	z8JuU320QvxU0XBv9pphtRqD3Pe7T/piru3CaIcOq7owOzYUQJX7ha3Vj55CNnD+8hTg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] rcu: Introduce force_rcu notifier
Message-Id: <E1n7b1Q-00025G-Nn@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:38:28 +0000

commit fceaefb43f059428cbedd81810c57b460cc80a79
Author:     Greg Kurz <groug@kaod.org>
AuthorDate: Tue Nov 9 19:35:22 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:25:55 2021 -0600

    rcu: Introduce force_rcu notifier
    
    The drain_rcu_call() function can be blocked as long as an RCU reader
    stays in a read-side critical section. This is typically what happens
    when a TCG vCPU is executing a busy loop. It can deadlock the QEMU
    monitor as reported in https://gitlab.com/qemu-project/qemu/-/issues/650 .
    
    This can be avoided by allowing drain_rcu_call() to enforce an RCU grace
    period. Since each reader might need to do specific actions to end a
    read-side critical section, do it with notifiers.
    
    Prepare ground for this by adding a notifier list to the RCU reader
    struct and use it in wait_for_readers() if drain_rcu_call() is in
    progress. An API is added for readers to register their notifiers.
    
    This is largely based on a draft from Paolo Bonzini.
    
    Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20211109183523.47726-2-groug@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit ef149763a8fcce70b85dfda27cc1222ecf765750)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 include/qemu/rcu.h | 15 +++++++++++++++
 util/rcu.c         | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index 515d327cf1..e69efbd47f 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -27,6 +27,7 @@
 #include "qemu/thread.h"
 #include "qemu/queue.h"
 #include "qemu/atomic.h"
+#include "qemu/notify.h"
 #include "qemu/sys_membarrier.h"
 
 #ifdef __cplusplus
@@ -66,6 +67,13 @@ struct rcu_reader_data {
 
     /* Data used for registry, protected by rcu_registry_lock */
     QLIST_ENTRY(rcu_reader_data) node;
+
+    /*
+     * NotifierList used to force an RCU grace period.  Accessed under
+     * rcu_registry_lock.  Note that the notifier is called _outside_
+     * the thread!
+     */
+    NotifierList force_rcu;
 };
 
 extern __thread struct rcu_reader_data rcu_reader;
@@ -180,6 +188,13 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(RCUReadAuto, rcu_read_auto_unlock)
 #define RCU_READ_LOCK_GUARD() \
     g_autoptr(RCUReadAuto) _rcu_read_auto __attribute__((unused)) = rcu_read_auto_lock()
 
+/*
+ * Force-RCU notifiers tell readers that they should exit their
+ * read-side critical section.
+ */
+void rcu_add_force_rcu_notifier(Notifier *n);
+void rcu_remove_force_rcu_notifier(Notifier *n);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/util/rcu.c b/util/rcu.c
index 13ac0f75cb..c91da9f137 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -46,6 +46,7 @@
 unsigned long rcu_gp_ctr = RCU_GP_LOCKED;
 
 QemuEvent rcu_gp_event;
+static int in_drain_call_rcu;
 static QemuMutex rcu_registry_lock;
 static QemuMutex rcu_sync_lock;
 
@@ -107,6 +108,8 @@ static void wait_for_readers(void)
                  * get some extra futex wakeups.
                  */
                 qatomic_set(&index->waiting, false);
+            } else if (qatomic_read(&in_drain_call_rcu)) {
+                notifier_list_notify(&index->force_rcu, NULL);
             }
         }
 
@@ -339,8 +342,10 @@ void drain_call_rcu(void)
      * assumed.
      */
 
+    qatomic_inc(&in_drain_call_rcu);
     call_rcu1(&rcu_drain.rcu, drain_rcu_callback);
     qemu_event_wait(&rcu_drain.drain_complete_event);
+    qatomic_dec(&in_drain_call_rcu);
 
     if (locked) {
         qemu_mutex_lock_iothread();
@@ -363,6 +368,20 @@ void rcu_unregister_thread(void)
     qemu_mutex_unlock(&rcu_registry_lock);
 }
 
+void rcu_add_force_rcu_notifier(Notifier *n)
+{
+    qemu_mutex_lock(&rcu_registry_lock);
+    notifier_list_add(&rcu_reader.force_rcu, n);
+    qemu_mutex_unlock(&rcu_registry_lock);
+}
+
+void rcu_remove_force_rcu_notifier(Notifier *n)
+{
+    qemu_mutex_lock(&rcu_registry_lock);
+    notifier_remove(n);
+    qemu_mutex_unlock(&rcu_registry_lock);
+}
+
 static void rcu_init_complete(void)
 {
     QemuThread thread;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:38:40 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:38:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256492.440217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1c-0000de-Hg; Wed, 12 Jan 2022 10:38:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256492.440217; Wed, 12 Jan 2022 10:38:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1c-0000dW-ET; Wed, 12 Jan 2022 10:38:40 +0000
Received: by outflank-mailman (input) for mailman id 256492;
 Wed, 12 Jan 2022 10:38:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1a-0000dN-SJ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1a-0003ZN-Rj
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1a-00026J-Qu
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v6NEKYLLylvVJsbd269pRGX862UFNwexUdIDYhnRjho=; b=vy8308uECdsDzxpM7iWQsf3c8z
	wXkMjTnGdDt+3qHECB7foOFPN4aWqtAS14qrgowQg2MztXqeUADQz6gcvgqLbBWYW/IT9QgoBH3jM
	O/6G7wuibOSuQ07ahz6JiRX/UzwM2j9/WCwP+j+3SDWpg/prY9zqPAyBTEIK57ODnA/w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] accel/tcg: Register a force_rcu notifier
Message-Id: <E1n7b1a-00026J-Qu@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:38:38 +0000

commit 36c651c2264da6984c62173e2e0df77d76f064f5
Author:     Greg Kurz <groug@kaod.org>
AuthorDate: Tue Nov 9 19:35:23 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:26:01 2021 -0600

    accel/tcg: Register a force_rcu notifier
    
    A TCG vCPU doing a busy loop systematicaly hangs the QEMU monitor
    if the user passes 'device_add' without argument. This is because
    drain_cpu_all() which is called from qmp_device_add() cannot return
    if readers don't exit read-side critical sections. That is typically
    what busy-looping TCG vCPUs do:
    
    int cpu_exec(CPUState *cpu)
    {
    [...]
        rcu_read_lock();
    [...]
        while (!cpu_handle_exception(cpu, &ret)) {
            // Busy loop keeps vCPU here
        }
    [...]
        rcu_read_unlock();
    
        return ret;
    }
    
    For MTTCG, have all vCPU threads register a force_rcu notifier that will
    kick them out of the loop using async_run_on_cpu(). The notifier is called
    with the rcu_registry_lock mutex held, using async_run_on_cpu() ensures
    there are no deadlocks.
    
    For RR, a single thread runs all vCPUs. Just register a single notifier
    that kicks the current vCPU to the next one.
    
    For MTTCG:
    Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
    
    For RR:
    Suggested-by: Richard Henderson <richard.henderson@linaro.org>
    
    Fixes: 7bed89958bfb ("device_core: use drain_call_rcu in in qmp_device_add")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/650
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20211109183523.47726-3-groug@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit dd47a8f654d84f666b235ce8891e17ee76f9be8b)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 accel/tcg/tcg-accel-ops-mttcg.c | 26 ++++++++++++++++++++++++++
 accel/tcg/tcg-accel-ops-rr.c    | 10 ++++++++++
 2 files changed, 36 insertions(+)

diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c
index 847d2079d2..29632bd4c0 100644
--- a/accel/tcg/tcg-accel-ops-mttcg.c
+++ b/accel/tcg/tcg-accel-ops-mttcg.c
@@ -28,6 +28,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/replay.h"
 #include "qemu/main-loop.h"
+#include "qemu/notify.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
 #include "hw/boards.h"
@@ -35,6 +36,26 @@
 #include "tcg-accel-ops.h"
 #include "tcg-accel-ops-mttcg.h"
 
+typedef struct MttcgForceRcuNotifier {
+    Notifier notifier;
+    CPUState *cpu;
+} MttcgForceRcuNotifier;
+
+static void do_nothing(CPUState *cpu, run_on_cpu_data d)
+{
+}
+
+static void mttcg_force_rcu(Notifier *notify, void *data)
+{
+    CPUState *cpu = container_of(notify, MttcgForceRcuNotifier, notifier)->cpu;
+
+    /*
+     * Called with rcu_registry_lock held, using async_run_on_cpu() ensures
+     * that there are no deadlocks.
+     */
+    async_run_on_cpu(cpu, do_nothing, RUN_ON_CPU_NULL);
+}
+
 /*
  * In the multi-threaded case each vCPU has its own thread. The TLS
  * variable current_cpu can be used deep in the code to find the
@@ -43,12 +64,16 @@
 
 static void *mttcg_cpu_thread_fn(void *arg)
 {
+    MttcgForceRcuNotifier force_rcu;
     CPUState *cpu = arg;
 
     assert(tcg_enabled());
     g_assert(!icount_enabled());
 
     rcu_register_thread();
+    force_rcu.notifier.notify = mttcg_force_rcu;
+    force_rcu.cpu = cpu;
+    rcu_add_force_rcu_notifier(&force_rcu.notifier);
     tcg_register_thread();
 
     qemu_mutex_lock_iothread();
@@ -100,6 +125,7 @@ static void *mttcg_cpu_thread_fn(void *arg)
 
     tcg_cpus_destroy(cpu);
     qemu_mutex_unlock_iothread();
+    rcu_remove_force_rcu_notifier(&force_rcu.notifier);
     rcu_unregister_thread();
     return NULL;
 }
diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index c02c061ecb..aa5b4ac247 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -28,6 +28,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/replay.h"
 #include "qemu/main-loop.h"
+#include "qemu/notify.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
 
@@ -135,6 +136,11 @@ static void rr_deal_with_unplugged_cpus(void)
     }
 }
 
+static void rr_force_rcu(Notifier *notify, void *data)
+{
+    rr_kick_next_cpu();
+}
+
 /*
  * In the single-threaded case each vCPU is simulated in turn. If
  * there is more than a single vCPU we create a simple timer to kick
@@ -145,10 +151,13 @@ static void rr_deal_with_unplugged_cpus(void)
 
 static void *rr_cpu_thread_fn(void *arg)
 {
+    Notifier force_rcu;
     CPUState *cpu = arg;
 
     assert(tcg_enabled());
     rcu_register_thread();
+    force_rcu.notify = rr_force_rcu;
+    rcu_add_force_rcu_notifier(&force_rcu);
     tcg_register_thread();
 
     qemu_mutex_lock_iothread();
@@ -257,6 +266,7 @@ static void *rr_cpu_thread_fn(void *arg)
         rr_deal_with_unplugged_cpus();
     }
 
+    rcu_remove_force_rcu_notifier(&force_rcu);
     rcu_unregister_thread();
     return NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:38:50 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:38:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256493.440221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1m-0000gm-JL; Wed, 12 Jan 2022 10:38:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256493.440221; Wed, 12 Jan 2022 10:38:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1m-0000ge-GL; Wed, 12 Jan 2022 10:38:50 +0000
Received: by outflank-mailman (input) for mailman id 256493;
 Wed, 12 Jan 2022 10:38:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1k-0000gD-Va
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1k-0003ZR-Ux
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1k-00027E-Tw
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0aqk420tEGLYywsvqjintOHIcs1rrZ94I9qEOmu4KqA=; b=7AwqIy/SOWyucG4GyndQBt1kT0
	WUPimlwaKHYQ7KDWYrQX90x8PfiXDyoFllh/XOhH6+oC8GhBvr6sCI+AW99vxbG0st6GcEFHzMVY8
	RdTmyNrhNzNvV3NQgIrD/DXAu0s+bEf5o4dU4zoNMzM4dK1RppQY39tY+pPGa9C73Ha4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] pcie: rename 'native-hotplug' to 'x-native-hotplug'
Message-Id: <E1n7b1k-00027E-Tw@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:38:48 +0000

commit 7204b8f3c61cb2f0d6f81a4261a2ba7298a007ba
Author:     Igor Mammedov <imammedo@redhat.com>
AuthorDate: Fri Nov 12 06:08:53 2021 -0500
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:38:08 2021 -0600

    pcie: rename 'native-hotplug' to 'x-native-hotplug'
    
    Mark property as experimental/internal adding 'x-' prefix.
    
    Property was introduced in 6.1 and it should have provided
    ability to turn on native PCIE hotplug on port even when
    ACPI PCI hotplug is in use is user explicitly sets property
    on CLI. However that never worked since slot is wired to
    ACPI hotplug controller.
    Another non-intended usecase: disable native hotplug on slot
    when APCI based hotplug is disabled, which works but slot has
    'hotplug' property for this taks.
    
    It should be relatively safe to rename it to experimental
    as no users should exist for it and given that the property
    is broken we don't really want to leave it around for much
    longer lest users start using it.
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211112110857.3116853-2-imammedo@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 2aa1842d6d79dcd1b84c58eeb44591a99a9e56df)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/i386/pc_q35.c   | 2 +-
 hw/pci/pcie_port.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 04b4a4788d..9070544a90 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -243,7 +243,7 @@ static void pc_q35_init(MachineState *machine)
                                           NULL);
 
     if (acpi_pcihp) {
-        object_register_sugar_prop(TYPE_PCIE_SLOT, "native-hotplug",
+        object_register_sugar_prop(TYPE_PCIE_SLOT, "x-native-hotplug",
                                    "false", true);
     }
 
diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c
index da850e8dde..e95c1e5519 100644
--- a/hw/pci/pcie_port.c
+++ b/hw/pci/pcie_port.c
@@ -148,7 +148,7 @@ static Property pcie_slot_props[] = {
     DEFINE_PROP_UINT8("chassis", PCIESlot, chassis, 0),
     DEFINE_PROP_UINT16("slot", PCIESlot, slot, 0),
     DEFINE_PROP_BOOL("hotplug", PCIESlot, hotplug, true),
-    DEFINE_PROP_BOOL("native-hotplug", PCIESlot, native_hotplug, true),
+    DEFINE_PROP_BOOL("x-native-hotplug", PCIESlot, native_hotplug, true),
     DEFINE_PROP_END_OF_LIST()
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:39:00 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:39:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256497.440237 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1w-000131-4z; Wed, 12 Jan 2022 10:39:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256497.440237; Wed, 12 Jan 2022 10:39:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b1w-00012t-1U; Wed, 12 Jan 2022 10:39:00 +0000
Received: by outflank-mailman (input) for mailman id 256497;
 Wed, 12 Jan 2022 10:38:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1v-00012O-2h
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1v-0003Zu-20
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b1v-00028D-1E
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:38:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FskRubpVZA5znKLK182x4tMii+RtdhwK2LSOlzk7DVc=; b=AYbLFN15Uh2aQmMnZeQGBHoa1j
	ssTL+DGeXTceSIE+iqscOYg4/Xquv7/EthK1gibCpXKfUGNMTXXRGsmNtqFtmQH4iJHEx0+4gKx6s
	DcCwo+ZrG0kB+ITS4zLlFSR79yTVlgZAT6LSgizhhuOB/Y5WL++3lk/0k8uKU19qe2F8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] virtio: use virtio accessor to access packed descriptor flags
Message-Id: <E1n7b1v-00028D-1E@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:38:59 +0000

commit df1c9c3039e5ded39ae6b37b62b8d064acfe7dd5
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Nov 11 14:38:53 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:43:18 2021 -0600

    virtio: use virtio accessor to access packed descriptor flags
    
    We used to access packed descriptor flags via
    address_space_{write|read}_cached(). When we hit the cache, memcpy()
    is used which is not an atomic operation which may lead a wrong value
    is read or wrote.
    
    So this patch switches to use virito_{stw|lduw}_phys_cached() to make
    sure the aceess is atomic.
    
    Fixes: 86044b24e865f ("virtio: basic packed virtqueue support")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20211111063854.29060-1-jasowang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit f463e761a41ee71e59892121e1c74d9c25c985d2)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 874377f37a..2dbccb6b3f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -509,11 +509,9 @@ static void vring_packed_desc_read_flags(VirtIODevice *vdev,
                                          MemoryRegionCache *cache,
                                          int i)
 {
-    address_space_read_cached(cache,
-                              i * sizeof(VRingPackedDesc) +
-                              offsetof(VRingPackedDesc, flags),
-                              flags, sizeof(*flags));
-    virtio_tswap16s(vdev, flags);
+    hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags);
+
+    *flags = virtio_lduw_phys_cached(vdev, cache, off);
 }
 
 static void vring_packed_desc_read(VirtIODevice *vdev,
@@ -566,8 +564,7 @@ static void vring_packed_desc_write_flags(VirtIODevice *vdev,
 {
     hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags);
 
-    virtio_tswap16s(vdev, &desc->flags);
-    address_space_write_cached(cache, off, &desc->flags, sizeof(desc->flags));
+    virtio_stw_phys_cached(vdev, cache, off, desc->flags);
     address_space_cache_invalidate(cache, off, sizeof(desc->flags));
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:39:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:39:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256501.440240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b26-0001Cn-7J; Wed, 12 Jan 2022 10:39:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256501.440240; Wed, 12 Jan 2022 10:39:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b26-0001Cf-3i; Wed, 12 Jan 2022 10:39:10 +0000
Received: by outflank-mailman (input) for mailman id 256501;
 Wed, 12 Jan 2022 10:39:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b25-0001CH-5r
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b25-0003aF-5C
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b25-000290-4Q
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cQnzBZdri7/smq8EfbYiamTvf/XxJZ2Atn2GKs0rRC8=; b=s8h0zU8eKT3rgqFkS78d3EPfQG
	NP70rGUfr9YpynlqMHAKBzcnXszRkvIJ6EO8PHBda47A268dfRlrUSi5TgMu35rr9NWvDfXzDUn1t
	l5omOUFyIt9if4yQ4nu7aiUNa38UsCGBWg5YNTKwmPCh4HfnCQB1WmM2seRpcnSDn4n0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] virtio: use virtio accessor to access packed event
Message-Id: <E1n7b25-000290-4Q@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:39:09 +0000

commit 08e46e6d92b979743f4f0fb36e587b5e75a0bde6
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Nov 11 14:38:54 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:43:25 2021 -0600

    virtio: use virtio accessor to access packed event
    
    We used to access packed descriptor event and off_wrap via
    address_space_{write|read}_cached(). When we hit the cache, memcpy()
    is used which is not atomic which may lead a wrong value to be read or
    wrote.
    
    This patch fixes this by switching to use
    virito_{stw|lduw}_phys_cached() to make sure the access is atomic.
    
    Fixes: 683f7665679c1 ("virtio: event suppression support for packed ring")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20211111063854.29060-2-jasowang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d152cdd6f6fad381e804c8185f0ba938030ccac9)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 2dbccb6b3f..c9567f09ed 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -249,13 +249,10 @@ static void vring_packed_event_read(VirtIODevice *vdev,
     hwaddr off_off = offsetof(VRingPackedDescEvent, off_wrap);
     hwaddr off_flags = offsetof(VRingPackedDescEvent, flags);
 
-    address_space_read_cached(cache, off_flags, &e->flags,
-                              sizeof(e->flags));
+    e->flags = virtio_lduw_phys_cached(vdev, cache, off_flags);
     /* Make sure flags is seen before off_wrap */
     smp_rmb();
-    address_space_read_cached(cache, off_off, &e->off_wrap,
-                              sizeof(e->off_wrap));
-    virtio_tswap16s(vdev, &e->off_wrap);
+    e->off_wrap = virtio_lduw_phys_cached(vdev, cache, off_off);
     virtio_tswap16s(vdev, &e->flags);
 }
 
@@ -265,8 +262,7 @@ static void vring_packed_off_wrap_write(VirtIODevice *vdev,
 {
     hwaddr off = offsetof(VRingPackedDescEvent, off_wrap);
 
-    virtio_tswap16s(vdev, &off_wrap);
-    address_space_write_cached(cache, off, &off_wrap, sizeof(off_wrap));
+    virtio_stw_phys_cached(vdev, cache, off, off_wrap);
     address_space_cache_invalidate(cache, off, sizeof(off_wrap));
 }
 
@@ -275,8 +271,7 @@ static void vring_packed_flags_write(VirtIODevice *vdev,
 {
     hwaddr off = offsetof(VRingPackedDescEvent, flags);
 
-    virtio_tswap16s(vdev, &flags);
-    address_space_write_cached(cache, off, &flags, sizeof(flags));
+    virtio_stw_phys_cached(vdev, cache, off, flags);
     address_space_cache_invalidate(cache, off, sizeof(flags));
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:39:20 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:39:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256502.440243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2G-0001OW-9T; Wed, 12 Jan 2022 10:39:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256502.440243; Wed, 12 Jan 2022 10:39:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2G-0001OO-6Z; Wed, 12 Jan 2022 10:39:20 +0000
Received: by outflank-mailman (input) for mailman id 256502;
 Wed, 12 Jan 2022 10:39:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2F-0001Mx-8i
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2F-0003aJ-88
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2F-00029h-7R
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qrsUvFv8iBg1JtnEJk7jWrjife7vX4R9LJ9DqkRRgsU=; b=Xmjl/qbAqrl7uFoFq3BfM+RYml
	n2+RxIiZwBv4rsRBtMceA2t2cz4UMIeadoD8faGUrHihfBLSPwoLMNhAijv1y0gUNgXIvXeoMjeJR
	27+4whjz4Ki4f5sYZx7FuvT8MBA+U8VjhjB170nK+gose7ApvlXt9r3frrSRl1SkMY/w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] vfio: Fix memory leak of hostwin
Message-Id: <E1n7b2F-00029h-7R@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:39:19 +0000

commit 8c2d5911debfd00a7e8b3d8989c23e892c872043
Author:     Peng Liang <liangpeng10@huawei.com>
AuthorDate: Wed Nov 17 09:47:39 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:49:55 2021 -0600

    vfio: Fix memory leak of hostwin
    
    hostwin is allocated and added to hostwin_list in vfio_host_win_add, but
    it is only deleted from hostwin_list in vfio_host_win_del, which causes
    a memory leak.  Also, freeing all elements in hostwin_list is missing in
    vfio_disconnect_container.
    
    Fix: 2e4109de8e58 ("vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2)")
    CC: qemu-stable@nongnu.org
    Signed-off-by: Peng Liang <liangpeng10@huawei.com>
    Link: https://lore.kernel.org/r/20211117014739.1839263-1-liangpeng10@huawei.com
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    (cherry picked from commit f3bc3a73c908df15966e66f88d5a633bd42fd029)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/vfio/common.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 8728d4d5c2..af37346aca 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -551,6 +551,7 @@ static int vfio_host_win_del(VFIOContainer *container, hwaddr min_iova,
     QLIST_FOREACH(hostwin, &container->hostwin_list, hostwin_next) {
         if (hostwin->min_iova == min_iova && hostwin->max_iova == max_iova) {
             QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
             return 0;
         }
     }
@@ -2230,6 +2231,7 @@ static void vfio_disconnect_container(VFIOGroup *group)
     if (QLIST_EMPTY(&container->group_list)) {
         VFIOAddressSpace *space = container->space;
         VFIOGuestIOMMU *giommu, *tmp;
+        VFIOHostDMAWindow *hostwin, *next;
 
         QLIST_REMOVE(container, next);
 
@@ -2240,6 +2242,12 @@ static void vfio_disconnect_container(VFIOGroup *group)
             g_free(giommu);
         }
 
+        QLIST_FOREACH_SAFE(hostwin, &container->hostwin_list, hostwin_next,
+                           next) {
+            QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
+        }
+
         trace_vfio_disconnect_container(container->fd);
         close(container->fd);
         g_free(container);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:39:30 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:39:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256504.440247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2Q-0001U3-Ay; Wed, 12 Jan 2022 10:39:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256504.440247; Wed, 12 Jan 2022 10:39:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2Q-0001Tv-81; Wed, 12 Jan 2022 10:39:30 +0000
Received: by outflank-mailman (input) for mailman id 256504;
 Wed, 12 Jan 2022 10:39:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2P-0001Tf-C8
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2P-0003aP-Ba
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2P-0002AD-AX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q2goNg5J5K5t/hfnfKFGyqF2vnX/hVqqlfF2oOzVUV8=; b=gTWGkx3PRDo+F2hWVmXtoMGXOz
	gGEkDOX9a42w5n/a0ZK/HK2TSI1pH3CztWWUZ/snnyuDsjAq7+MlxYHCj3//5TYLQzPBgGUC57B8N
	Kjr1Svu9FKZ/A2sIZbxgX6gga0XK5tVNijkkysLQFs1QtqOtpQLW111tCvm9wla+DyLc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] nbd/server: Don't complain on certain client disconnects
Message-Id: <E1n7b2P-0002AD-AX@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:39:29 +0000

commit 932333c5f00ef5697ce4e1f81750bb4dcee958a1
Author:     Eric Blake <eblake@redhat.com>
AuthorDate: Wed Nov 17 11:02:29 2021 -0600
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:51:17 2021 -0600

    nbd/server: Don't complain on certain client disconnects
    
    When a client disconnects abruptly, but did not have any pending
    requests (for example, when using nbdsh without calling h.shutdown),
    we used to output the following message:
    
    $ qemu-nbd -f raw file
    $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)'
    qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
    
    Then in commit f148ae7, we refactored nbd_receive_request() to use
    nbd_read_eof(); when this returns 0, we regressed into tracing
    uninitialized memory (if tracing is enabled) and reporting a
    less-specific:
    
    qemu-nbd: Disconnect client, due to: Request handling failed in intermediate state
    
    Note that with Unix sockets, we have yet another error message,
    unchanged by the 6.0 regression:
    
    $ qemu-nbd -k /tmp/sock -f raw file
    $ nbdsh -u 'nbd+unix:///?socket=/tmp/sock' -c 'h.trim(1,0)'
    qemu-nbd: Disconnect client, due to: Failed to send reply: Unable to write to socket: Broken pipe
    
    But in all cases, the error message goes away if the client performs a
    soft shutdown by using NBD_CMD_DISC, rather than a hard shutdown by
    abrupt disconnect:
    
    $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)' -c 'h.shutdown()'
    
    This patch fixes things to avoid uninitialized memory, and in general
    avoids warning about a client that does a hard shutdown when not in
    the middle of a packet.  A client that aborts mid-request, or which
    does not read the full server's reply, can still result in warnings,
    but those are indeed much more unusual situations.
    
    CC: qemu-stable@nongnu.org
    Fixes: f148ae7d36 ("nbd/server: Quiesce coroutines on context switch", v6.0.0)
    Signed-off-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    [eblake: defer unrelated typo fixes to later patch]
    Message-Id: <20211117170230.1128262-2-eblake@redhat.com>
    Signed-off-by: Eric Blake <eblake@redhat.com>
    (cherry picked from commit 1644cccea5c71b02b9cf8f78b780e7069a29b189)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 nbd/server.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nbd/server.c b/nbd/server.c
index 3927f7789d..83aeed51c7 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1413,6 +1413,9 @@ static int nbd_receive_request(NBDClient *client, NBDRequest *request,
     if (ret < 0) {
         return ret;
     }
+    if (ret == 0) {
+        return -EIO;
+    }
 
     /* Request
        [ 0 ..  3]   magic   (NBD_REQUEST_MAGIC)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:39:40 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:39:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256505.440252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2a-0001X9-Ca; Wed, 12 Jan 2022 10:39:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256505.440252; Wed, 12 Jan 2022 10:39:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2a-0001Wz-9U; Wed, 12 Jan 2022 10:39:40 +0000
Received: by outflank-mailman (input) for mailman id 256505;
 Wed, 12 Jan 2022 10:39:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2Z-0001Wj-Fg
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2Z-0003aW-F6
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2Z-0002Ax-EK
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oTzlQkjjfsmb8AzQFtSR43KpKpc9QAG2SAQHcHreYD8=; b=cUaduwYND5CwAXMApGk9mGRsiK
	Mxv1bzvpgHP70aL6h7+H5Arbb7e1UmrpmwZX90yNUtg0iyh7FYuZfRjwRK2GQJgmgKantRxx2zDyR
	Zc6Qcm622KZEnKfCwwqff+WxXvZARgu0wST3HLJ69xmY+a3zw+PjoSqYMTBzopy/1g5U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
Message-Id: <E1n7b2Z-0002Ax-EK@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:39:39 +0000

commit 2b2eb343a01bb84a9d988158f706a65b57604d65
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Wed Nov 17 14:12:56 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:52:50 2021 -0600

    hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
    
    Fix missing offset verification.
    
    Cc: qemu-stable@nongnu.org
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
    Fixes: f432fdfa121 ("support changed namespace asynchronous event")
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit e2c57529c9306e4c9aac75d9879f6e7699584a22)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/nvme/ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 6baf9e0420..27dddb87bd 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4164,6 +4164,11 @@ static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint8_t rae, uint32_t buf_len,
     int i = 0;
     uint32_t nsid;
 
+    if (off >= sizeof(nslist)) {
+        trace_pci_nvme_err_invalid_log_page_offset(off, sizeof(nslist));
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+
     memset(nslist, 0x0, sizeof(nslist));
     trans_len = MIN(sizeof(nslist) - off, buf_len);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:39:50 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:39:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256506.440256 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2k-0001ad-E1; Wed, 12 Jan 2022 10:39:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256506.440256; Wed, 12 Jan 2022 10:39:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2k-0001aV-B0; Wed, 12 Jan 2022 10:39:50 +0000
Received: by outflank-mailman (input) for mailman id 256506;
 Wed, 12 Jan 2022 10:39:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2j-0001aN-It
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2j-0003ah-IC
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2j-0002BX-HM
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4c0sTokv6TjIG8xXUEWOZFqE0jH4/PTXUKyrSUPElz4=; b=yvk9GIBj8YQr3wJBS6n+tkupNT
	5awJ6NrfNGz6+G01IBJ4MSIFi/1nlOrgUDQw61zkT/bA5EEGzCg4pu5gE9sLmtHf70tPpw0cP1NLE
	/tmS+gRuwNAqQRBxd6BAHMyL38VLlLMMSehYNqBPYmIKyRaxhURwFL7ucsRetd5zWCgA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] chardev/wctable: don't free the instance in wctablet_chr_finalize
Message-Id: <E1n7b2j-0002BX-HM@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:39:49 +0000

commit 4658dfcbc09dcc90025604cce64d6fd01952b882
Author:     Daniil Tatianin <d-tatianin@yandex-team.ru>
AuthorDate: Wed Nov 17 17:23:49 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:54:14 2021 -0600

    chardev/wctable: don't free the instance in wctablet_chr_finalize
    
    Object is supposed to be freed by invoking obj->free, and not
    obj->instance_finalize. This would lead to use-after-free followed by
    double free in object_unref/object_finalize.
    
    Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20211117142349.836279-1-d-tatianin@yandex-team.ru>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit fdc6e168181d06391711171b7c409b34f2981ced)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 chardev/wctablet.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/chardev/wctablet.c b/chardev/wctablet.c
index 95e005f5a5..e8b292c43c 100644
--- a/chardev/wctablet.c
+++ b/chardev/wctablet.c
@@ -320,7 +320,6 @@ static void wctablet_chr_finalize(Object *obj)
     TabletChardev *tablet = WCTABLET_CHARDEV(obj);
 
     qemu_input_handler_unregister(tablet->hs);
-    g_free(tablet);
 }
 
 static void wctablet_chr_open(Chardev *chr,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:40:00 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:40:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256507.440260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2u-0001e7-FR; Wed, 12 Jan 2022 10:40:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256507.440260; Wed, 12 Jan 2022 10:40:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b2u-0001dz-CP; Wed, 12 Jan 2022 10:40:00 +0000
Received: by outflank-mailman (input) for mailman id 256507;
 Wed, 12 Jan 2022 10:39:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2t-0001dt-Lr
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2t-0003bE-LF
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b2t-0002CF-KU
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:39:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+N6uqr1n9HGvtLIR3vs0hxe520q7GmLaC1Osdlhz2Oo=; b=XMrq5U9HA3o+ejsoTEHbRtZe9S
	BG3GHn33jLVgC3ntB5bfgjQ/ocZ3IRDboBv0IKXXqePjuoWeNFfqEluZML426cYLvq92Ula0EzVx5
	pcjbxW9uKmwNSNa9Fhxy8+JJXbsLxP1gDrw5EMdxIPRGwqxKQ73YZAcPNq1Wf310SZGQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw/block/fdc: Extract blk_create_empty_drive()
Message-Id: <E1n7b2t-0002CF-KU@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:39:59 +0000

commit 7629818574eb67d2a9eb5db313c935bcf1d4e557
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:34 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:04:59 2021 -0600

    hw/block/fdc: Extract blk_create_empty_drive()
    
    We are going to re-use this code in the next commit,
    so extract it as a new blk_create_empty_drive() function.
    
    Inspired-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-2-philmd@redhat.com
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit b154791e7b6d4ca5cdcd54443484d97360bd7ad2)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/fdc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 9014cd30b3..c3e09973ca 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -61,6 +61,12 @@
     } while (0)
 
 
+/* Anonymous BlockBackend for empty drive */
+static BlockBackend *blk_create_empty_drive(void)
+{
+    return blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
+}
+
 /********************************************************/
 /* qdev floppy bus                                      */
 
@@ -486,8 +492,7 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp)
     }
 
     if (!dev->conf.blk) {
-        /* Anonymous BlockBackend for an empty drive */
-        dev->conf.blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
+        dev->conf.blk = blk_create_empty_drive();
         ret = blk_attach_dev(dev->conf.blk, qdev);
         assert(ret == 0);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:40:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:40:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256508.440264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b34-0002R5-H9; Wed, 12 Jan 2022 10:40:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256508.440264; Wed, 12 Jan 2022 10:40:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b34-0002Qw-E5; Wed, 12 Jan 2022 10:40:10 +0000
Received: by outflank-mailman (input) for mailman id 256508;
 Wed, 12 Jan 2022 10:40:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b33-0002Qk-Oy
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b33-0003bb-OP
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b33-0002Dk-Ne
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c/9AV1oBq4I3p9bZZAW3O4MnJ4yvD/NTdOo1CfcVwHk=; b=ictBjgp6D/+0WlWqEgDIVGuklP
	GpXXrSuuvQOa2ZUiCGbRTho/bWKQZrPDvG1xGJpCGCZWfm6aLH+sU3TSdnNUhuPq1rl16nc7irzXR
	ZO5FBuy3rP2qMSa7Om2BZj7v6e0zQLSIQNnmd2OCrA38rqkC84boY8qeurqGZK0sngX4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196
Message-Id: <E1n7b33-0002Dk-Ne@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:40:09 +0000

commit 71ba2adfeb4ca63015d4a51a665e67c46a06e822
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:35 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:05:05 2021 -0600

    hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196
    
    Guest might select another drive on the bus by setting the
    DRIVE_SEL bit of the DIGITAL OUTPUT REGISTER (DOR).
    The current controller model doesn't expect a BlockBackend
    to be NULL. A simple way to fix CVE-2021-20196 is to create
    an empty BlockBackend when it is missing. All further
    accesses will be safely handled, and the controller state
    machines keep behaving correctly.
    
    Cc: qemu-stable@nongnu.org
    Fixes: CVE-2021-20196
    Reported-by: Gaoning Pan (Ant Security Light-Year Lab) <pgn@zju.edu.cn>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-3-philmd@redhat.com
    BugLink: https://bugs.launchpad.net/qemu/+bug/1912780
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/338
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 1ab95af033a419e7a64e2d58e67dd96b20af5233)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/fdc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index c3e09973ca..af398c1116 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -1166,7 +1166,19 @@ static FDrive *get_drv(FDCtrl *fdctrl, int unit)
 
 static FDrive *get_cur_drv(FDCtrl *fdctrl)
 {
-    return get_drv(fdctrl, fdctrl->cur_drv);
+    FDrive *cur_drv = get_drv(fdctrl, fdctrl->cur_drv);
+
+    if (!cur_drv->blk) {
+        /*
+         * Kludge: empty drive line selected. Create an anonymous
+         * BlockBackend to avoid NULL deref with various BlockBackend
+         * API calls within this model (CVE-2021-20196).
+         * Due to the controller QOM model limitations, we don't
+         * attach the created to the controller device.
+         */
+        cur_drv->blk = blk_create_empty_drive();
+    }
+    return cur_drv;
 }
 
 /* Status A register : 0x00 (read-only) */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:40:21 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:40:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256509.440268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3E-0002UF-IV; Wed, 12 Jan 2022 10:40:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256509.440268; Wed, 12 Jan 2022 10:40:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3E-0002U7-Ff; Wed, 12 Jan 2022 10:40:20 +0000
Received: by outflank-mailman (input) for mailman id 256509;
 Wed, 12 Jan 2022 10:40:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3D-0002Tw-SA
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3D-0003c4-RX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3D-0002En-Qj
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w8tJBwX68WTkCf16sIkZ+M2K2T4giPsd60aIMdtMdKs=; b=WvtIZpBRU/8n7G+Kke6gSgIGm5
	oswGacXIruxi9zRGf9fpDLsPRVS9UN7xZEDyhlI5RPV7MVaTOz0hT6MC4XC80coUe14u8zJ43AEVU
	cTEB8feOjgkGoX9iHWBScvLq0xDPEWDkjLGTUGlcGckvDqBcbxIO+h3M3Omew28+FktE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196
Message-Id: <E1n7b3D-0002En-Qj@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:40:19 +0000

commit ef0cf1887ee9acb21a8d7a06e83bdbbae0fdf9e6
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:36 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:05:11 2021 -0600

    tests/qtest/fdc-test: Add a regression test for CVE-2021-20196
    
    Without the previous commit, when running 'make check-qtest-i386'
    with QEMU configured with '--enable-sanitizers' we get:
    
      AddressSanitizer:DEADLYSIGNAL
      =================================================================
      ==287878==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000344
      ==287878==The signal is caused by a WRITE memory access.
      ==287878==Hint: address points to the zero page.
          #0 0x564b2e5bac27 in blk_inc_in_flight block/block-backend.c:1346:5
          #1 0x564b2e5bb228 in blk_pwritev_part block/block-backend.c:1317:5
          #2 0x564b2e5bcd57 in blk_pwrite block/block-backend.c:1498:11
          #3 0x564b2ca1cdd3 in fdctrl_write_data hw/block/fdc.c:2221:17
          #4 0x564b2ca1b2f7 in fdctrl_write hw/block/fdc.c:829:9
          #5 0x564b2dc49503 in portio_write softmmu/ioport.c:201:9
    
    Add the reproducer for CVE-2021-20196.
    
    Suggested-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-4-philmd@redhat.com
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit cc20926e9b8077bff6813efc8dcdeae90d1a3b10)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/fdc-test.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
index 26b69f7c5c..8f6eee84a4 100644
--- a/tests/qtest/fdc-test.c
+++ b/tests/qtest/fdc-test.c
@@ -32,6 +32,9 @@
 /* TODO actually test the results and get rid of this */
 #define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__))
 
+#define DRIVE_FLOPPY_BLANK \
+    "-drive if=floppy,file=null-co://,file.read-zeroes=on,format=raw,size=1440k"
+
 #define TEST_IMAGE_SIZE 1440 * 1024
 
 #define FLOPPY_BASE 0x3f0
@@ -546,6 +549,40 @@ static void fuzz_registers(void)
     }
 }
 
+static bool qtest_check_clang_sanitizer(void)
+{
+#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
+    return true;
+#else
+    g_test_skip("QEMU not configured using --enable-sanitizers");
+    return false;
+#endif
+}
+static void test_cve_2021_20196(void)
+{
+    QTestState *s;
+
+    if (!qtest_check_clang_sanitizer()) {
+        return;
+    }
+
+    s = qtest_initf("-nographic -m 32M -nodefaults " DRIVE_FLOPPY_BLANK);
+
+    qtest_outw(s, 0x3f4, 0x0500);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outw(s, 0x3f1, 0x0400);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outb(s, 0x3f5, 0x01);
+    qtest_outw(s, 0x3f1, 0x0500);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_quit(s);
+}
+
 int main(int argc, char **argv)
 {
     int fd;
@@ -576,6 +613,7 @@ int main(int argc, char **argv)
     qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18);
     qtest_add_func("/fdc/read_no_dma_19", test_read_no_dma_19);
     qtest_add_func("/fdc/fuzz-registers", fuzz_registers);
+    qtest_add_func("/fdc/fuzz/cve_2021_20196", test_cve_2021_20196);
 
     ret = g_test_run();
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:40:30 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:40:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256511.440272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3O-0002YF-Lo; Wed, 12 Jan 2022 10:40:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256511.440272; Wed, 12 Jan 2022 10:40:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3O-0002Y7-IX; Wed, 12 Jan 2022 10:40:30 +0000
Received: by outflank-mailman (input) for mailman id 256511;
 Wed, 12 Jan 2022 10:40:30 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3N-0002Xw-VY
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3N-0003cE-Ux
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3N-0002GK-Ts
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aIKRJw0RXv130/G5BKktQs87Qhu4KBO9bOCC0bPgyfA=; b=0SImCe59NGeAccrxtYpamOSqfq
	aL6TTht/Z+LhljKLk6PiBDR6ixn83T42xPBNxSPT85fY+txCPWGQy6ClXVk47jK5JiDX/pJrwJRG4
	S7pjqGLg0z0U4ZhqDWgHvXCUUWs82yWhMsjerEXai1Z+IRn/ESndP2fS3lgppzxIV+BI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] virtio-blk: Fix clean up of host notifiers for single MR transaction.
Message-Id: <E1n7b3N-0002GK-Ts@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:40:29 +0000

commit fec12fc8882b7326e820696ef81da3f1deeca11b
Author:     Mark Mielke <mark.mielke@gmail.com>
AuthorDate: Thu Dec 2 11:26:51 2021 -0500
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:10:56 2021 -0600

    virtio-blk: Fix clean up of host notifiers for single MR transaction.
    
    The code that introduced "virtio-blk: Configure all host notifiers in
    a single MR transaction" introduced a second loop variable to perform
    cleanup in second loop, but mistakenly still refers to the first
    loop variable within the second loop body.
    
    Fixes: d0267da61489 ("virtio-blk: Configure all host notifiers in a single MR transaction")
    Signed-off-by: Mark Mielke <mark.mielke@gmail.com>
    Message-id: CALm7yL08qarOu0dnQkTN+pa=BSRC92g31YpQQNDeAiT4yLZWQQ@mail.gmail.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 5b807181c27a940a3a7ad1f221a2e76a132cbdc0)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/dataplane/virtio-blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 252c3a7a23..ee5a5352dc 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -222,7 +222,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
             memory_region_transaction_commit();
 
             while (j--) {
-                virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
+                virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), j);
             }
             goto fail_host_notifiers;
         }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:40:40 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:40:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256512.440276 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3Y-0002bM-Mu; Wed, 12 Jan 2022 10:40:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256512.440276; Wed, 12 Jan 2022 10:40:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3Y-0002bE-K2; Wed, 12 Jan 2022 10:40:40 +0000
Received: by outflank-mailman (input) for mailman id 256512;
 Wed, 12 Jan 2022 10:40:40 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3Y-0002b6-2i
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:40 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3Y-0003cP-22
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3Y-0002He-1B
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:40 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f3yalKaP8A47wT8eFSfzMB21LDzbSNuS6YaH9JR0fb0=; b=cEGjmI/koldc44ed2qfFxyTM7w
	KISz65jsHGWLlU1vsd3W6o8KWSAtqtchm7T/JKi0zVWEcjyEWWOInOyXlsfY6p84iMz4TbdheqFGk
	UuEDlWOnz90pmjRLxzKrzyPlVp5bOIzQDm8oxCHkorWOhoy3iDNiwGJI6dRociazKcaI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
Message-Id: <E1n7b3Y-0002He-1B@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:40:40 +0000

commit 1ce084af083b6958c8287ea742a008a105bc960d
Author:     Prasad J Pandit <pjp@fedoraproject.org>
AuthorDate: Sat Jan 30 18:46:52 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 17:39:20 2021 -0600

    net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
    
    While activating device in vmxnet3_acticate_device(), it does not
    validate guest supplied configuration values against predefined
    minimum - maximum limits. This may lead to integer overflow or
    OOB access issues. Add checks to avoid it.
    
    Fixes: CVE-2021-20203
    Buglink: https://bugs.launchpad.net/qemu/+bug/1913873
    Reported-by: Gaoning Pan <pgn@zju.edu.cn>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit d05dcd94aee88728facafb993c7280547eb4d645)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/vmxnet3.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 41f796a247..f65af4e9ef 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1441,6 +1441,7 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
+    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU);
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
@@ -1486,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* Read rings memory locations for TX queues */
         pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA);
         size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize);
+        if (size > VMXNET3_TX_RING_MAX_SIZE) {
+            size = VMXNET3_TX_RING_MAX_SIZE;
+        }
 
         vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size,
                           sizeof(struct Vmxnet3_TxDesc), false);
@@ -1496,6 +1500,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* TXC ring */
         pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA);
         size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize);
+        if (size > VMXNET3_TC_RING_MAX_SIZE) {
+            size = VMXNET3_TC_RING_MAX_SIZE;
+        }
         vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size,
                           sizeof(struct Vmxnet3_TxCompDesc), true);
         VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring);
@@ -1537,6 +1544,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
             /* RX rings */
             pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]);
             size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]);
+            if (size > VMXNET3_RX_RING_MAX_SIZE) {
+                size = VMXNET3_RX_RING_MAX_SIZE;
+            }
             vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size,
                               sizeof(struct Vmxnet3_RxDesc), false);
             VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d",
@@ -1546,6 +1556,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* RXC ring */
         pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA);
         size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize);
+        if (size > VMXNET3_RC_RING_MAX_SIZE) {
+            size = VMXNET3_RC_RING_MAX_SIZE;
+        }
         vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size,
                           sizeof(struct Vmxnet3_RxCompDesc), true);
         VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:40:51 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:40:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256513.440280 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3j-0002eK-OW; Wed, 12 Jan 2022 10:40:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256513.440280; Wed, 12 Jan 2022 10:40:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3j-0002eC-LY; Wed, 12 Jan 2022 10:40:51 +0000
Received: by outflank-mailman (input) for mailman id 256513;
 Wed, 12 Jan 2022 10:40:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3i-0002e2-5m
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:50 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3i-0003cW-59
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3i-0002It-4I
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:40:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tLIeQkK0fUW42nNGzFDOH5yKm0Hj1ZA1ntr8VCvXqas=; b=AQ4JmPTeF+C4dpOvXZ4DIZtGIC
	256kzVSVZxv8AXPesv7iAN5pXE62p3G7/p4VxmbOCHhfguXv1m7vDhHEtEHEJ00qTU+dfGhddiXzF
	HfZMh61DSViRMQo6CXoT6JB0A9yIZnfXD6dK5mt2ltxRjgtkSxIOwVzKdZTdrFYQBrRM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] e1000: fix tx re-entrancy problem
Message-Id: <E1n7b3i-0002It-4I@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:40:50 +0000

commit 43583f0c079b084ada9214c00125e21bbfc6266a
Author:     Jon Maloy <jmaloy@redhat.com>
AuthorDate: Thu Oct 21 12:10:47 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 17:40:06 2021 -0600

    e1000: fix tx re-entrancy problem
    
    The fact that the MMIO handler is not re-entrant causes an infinite
    loop under certain conditions:
    
    Guest write to TDT ->  Loopback -> RX (DMA to TDT) -> TX
    
    We now eliminate the effect of this problem locally in e1000, by adding
    a boolean in struct E1000State indicating when the TX side is busy. This
    will cause any entering new call to return early instead of interfering
    with the ongoing work, and eliminates any risk of looping.
    
    This is intended to address CVE-2021-20257.
    
    Signed-off-by: Jon Maloy <jmaloy@redhat.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit 25ddb946e6301f42cff3094ea1c25fb78813e7e9)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/e1000.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index a30546c5d5..f5bc81296d 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -107,6 +107,7 @@ struct E1000State_st {
         e1000x_txd_props props;
         e1000x_txd_props tso_props;
         uint16_t tso_frames;
+        bool busy;
     } tx;
 
     struct {
@@ -763,6 +764,11 @@ start_xmit(E1000State *s)
         return;
     }
 
+    if (s->tx.busy) {
+        return;
+    }
+    s->tx.busy = true;
+
     while (s->mac_reg[TDH] != s->mac_reg[TDT]) {
         base = tx_desc_base(s) +
                sizeof(struct e1000_tx_desc) * s->mac_reg[TDH];
@@ -789,6 +795,7 @@ start_xmit(E1000State *s)
             break;
         }
     }
+    s->tx.busy = false;
     set_ics(s, 0, cause);
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:41:01 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:41:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256514.440284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3t-0002hG-Py; Wed, 12 Jan 2022 10:41:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256514.440284; Wed, 12 Jan 2022 10:41:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b3t-0002h8-N0; Wed, 12 Jan 2022 10:41:01 +0000
Received: by outflank-mailman (input) for mailman id 256514;
 Wed, 12 Jan 2022 10:41:00 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3s-0002gt-8n
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:00 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3s-0003cq-8E
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b3s-0002K0-7P
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BxoXo5CrlzLgmxzlAFnzslSF8B/cuozIQDi6epGY8gk=; b=Q2gpDvNNvOyBqjVC5uqmXIszx1
	sSkGwgBFrUIQmzRhj5yatmbDtWNyUIPG+tKQz0dTwk7AW0whwfTH31MwEMpA9K/rsd2Ygp/QcDgt7
	iP1gs+Tm7gWlVMX64wioK6EVnEg4baAInD+Te/YIY6VFI+038mROiiDfcwP3gFV0akmU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] qxl: fix pre-save logic
Message-Id: <E1n7b3s-0002K0-7P@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:41:00 +0000

commit 34833f361b1407ad7b4f02ed5eb852e76ab032e4
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Fri Sep 10 11:42:03 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:12 2021 -0600

    qxl: fix pre-save logic
    
    Oops.  Logic is backwards.
    
    Fixes: 39b8a183e2f3 ("qxl: remove assert in qxl_pre_save.")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/610
    Resolves: https://bugzilla.redhat.com//show_bug.cgi?id=2002907
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20210910094203.3582378-1-kraxel@redhat.com>
    (cherry picked from commit eb94846280df3f1e2a91b6179fc05f9890b7e384)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 43482d4364..29c80b4289 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2252,7 +2252,7 @@ static int qxl_pre_save(void *opaque)
     } else {
         d->last_release_offset = (uint8_t *)d->last_release - ram_start;
     }
-    if (d->last_release_offset < d->vga.vram_size) {
+    if (d->last_release_offset >= d->vga.vram_size) {
         return 1;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:41:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:41:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256515.440288 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b43-0002kK-RU; Wed, 12 Jan 2022 10:41:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256515.440288; Wed, 12 Jan 2022 10:41: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 1n7b43-0002kC-OU; Wed, 12 Jan 2022 10:41:11 +0000
Received: by outflank-mailman (input) for mailman id 256515;
 Wed, 12 Jan 2022 10:41:10 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b42-0002k0-Bo
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:10 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b42-0003el-BE
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:10 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b42-0002L7-AX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:10 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WGVlhcs0/r+s/dmCO1xi3/3pcf/69nQlWwkhTWiyCvw=; b=TIEHnFJVUY/v5oZIvSlWfZfMo6
	fZI045vYO5HK+aenKKhH04wHKBvcIXr32965TovOP4mXoGEFrguQIpUhhzB1wozQCAdudrPG+8tDN
	HVaMQuHmvEgZ0MsR7Quo/kifyHAEgPOMckwHamg7/Gu2nTgrx76yeNR/dkUoC6R6eQfs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] target/i386: add missing bits to CR4_RESERVED_MASK
Message-Id: <E1n7b42-0002L7-AX@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:41:10 +0000

commit e88636b4d46b91e130ae715b8d8b90f62e414428
Author:     Daniel P. Berrangé <berrange@redhat.com>
AuthorDate: Tue Aug 31 18:50:33 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:18 2021 -0600

    target/i386: add missing bits to CR4_RESERVED_MASK
    
    Booting Fedora kernels with -cpu max hangs very early in boot. Disabling
    the la57 CPUID bit fixes the problem. git bisect traced the regression to
    
      commit 213ff024a2f92020290296cb9dc29c2af3d4a221 (HEAD, refs/bisect/bad)
      Author: Lara Lazier <laramglazier@gmail.com>
      Date:   Wed Jul 21 17:26:50 2021 +0200
    
        target/i386: Added consistency checks for CR4
    
        All MBZ bits in CR4 must be zero. (APM2 15.5)
        Added reserved bitmask and added checks in both
        helper_vmrun and helper_write_crN.
    
        Signed-off-by: Lara Lazier <laramglazier@gmail.com>
        Message-Id: <20210721152651.14683-2-laramglazier@gmail.com>
        Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    
    In this commit CR4_RESERVED_MASK is missing CR4_LA57_MASK and
    two others. Adding this lets Fedora kernels boot once again.
    
    Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
    Tested-by: Richard W.M. Jones <rjones@redhat.com>
    Message-Id: <20210831175033.175584-1-berrange@redhat.com>
    [Removed VMXE/SMXE, matching the commit message. - Paolo]
    Fixes: 213ff024a2 ("target/i386: Added consistency checks for CR4", 2021-07-22)
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 69e3895f9d37ca39536775b13ce63e8c291427ba)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/cpu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 6c50d3ab4f..21b33fbe2e 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -257,6 +257,7 @@ typedef enum X86Seg {
                 | CR4_DE_MASK | CR4_PSE_MASK | CR4_PAE_MASK \
                 | CR4_MCE_MASK | CR4_PGE_MASK | CR4_PCE_MASK \
                 | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK |CR4_UMIP_MASK \
+                | CR4_LA57_MASK \
                 | CR4_FSGSBASE_MASK | CR4_PCIDE_MASK | CR4_OSXSAVE_MASK \
                 | CR4_SMEP_MASK | CR4_SMAP_MASK | CR4_PKE_MASK | CR4_PKS_MASK))
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:41:21 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:41:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256516.440292 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b4D-0002n9-Su; Wed, 12 Jan 2022 10:41:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256516.440292; Wed, 12 Jan 2022 10:41:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b4D-0002n1-Py; Wed, 12 Jan 2022 10:41:21 +0000
Received: by outflank-mailman (input) for mailman id 256516;
 Wed, 12 Jan 2022 10:41:20 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4C-0002ml-FJ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:20 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4C-0003eu-Ej
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:20 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4C-0002M6-Dk
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:20 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3aQ2dVqyndeWqO7QaY50QHfjNS8IUCS6E4/A4aKfdok=; b=1amgKqwvDL8ZeZxJJvzMuVNk3p
	NG3crzoRkILUg5II2RfwVcTa9nQzCc1M8GZ+uFJfy4gvCu1wGvthhm+JTXv5ErS+6lNv0UVVpdzgD
	t7KqsTRNtYH/6l+6rzBv5ZKhxueCIB/+zLS5kbA5JGvOxNY9h1Suh6OZubjCHu16k2E0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] tcg/arm: Reduce vector alignment requirement for NEON
Message-Id: <E1n7b4C-0002M6-Dk@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:41:20 +0000

commit 711bd602cc432e4ab0c4c59f19d6611302870248
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sun Sep 12 10:49:25 2021 -0700
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:27 2021 -0600

    tcg/arm: Reduce vector alignment requirement for NEON
    
    With arm32, the ABI gives us 8-byte alignment for the stack.
    While it's possible to realign the stack to provide 16-byte alignment,
    it's far easier to simply not encode 16-byte alignment in the
    VLD1 and VST1 instructions that we emit.
    
    Remove the assertion in temp_allocate_frame, limit natural alignment
    to the provided stack alignment, and add a comment.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1999878
    Reported-by: Richard W.M. Jones <rjones@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20210912174925.200132-1-richard.henderson@linaro.org>
    Message-Id: <20211206191335.230683-2-richard.henderson@linaro.org>
    (cherry picked from commit b9537d5904f6e3df896264a6144883ab07db9608)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tcg/arm/tcg-target.c.inc | 13 +++++++++----
 tcg/tcg.c                |  8 +++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
index 007ceee68e..34acfb522c 100644
--- a/tcg/arm/tcg-target.c.inc
+++ b/tcg/arm/tcg-target.c.inc
@@ -2477,8 +2477,13 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg,
         tcg_out_vldst(s, INSN_VLD1 | 0x7d0, arg, arg1, arg2);
         return;
     case TCG_TYPE_V128:
-        /* regs 2; size 8; align 16 */
-        tcg_out_vldst(s, INSN_VLD1 | 0xae0, arg, arg1, arg2);
+        /*
+         * We have only 8-byte alignment for the stack per the ABI.
+         * Rather than dynamically re-align the stack, it's easier
+         * to simply not request alignment beyond that.  So:
+         * regs 2; size 8; align 8
+         */
+        tcg_out_vldst(s, INSN_VLD1 | 0xad0, arg, arg1, arg2);
         return;
     default:
         g_assert_not_reached();
@@ -2497,8 +2502,8 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg,
         tcg_out_vldst(s, INSN_VST1 | 0x7d0, arg, arg1, arg2);
         return;
     case TCG_TYPE_V128:
-        /* regs 2; size 8; align 16 */
-        tcg_out_vldst(s, INSN_VST1 | 0xae0, arg, arg1, arg2);
+        /* See tcg_out_ld re alignment: regs 2; size 8; align 8 */
+        tcg_out_vldst(s, INSN_VST1 | 0xad0, arg, arg1, arg2);
         return;
     default:
         g_assert_not_reached();
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 4142d42d77..ca5bcc4635 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3060,7 +3060,13 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp *ts)
         g_assert_not_reached();
     }
 
-    assert(align <= TCG_TARGET_STACK_ALIGN);
+    /*
+     * Assume the stack is sufficiently aligned.
+     * This affects e.g. ARM NEON, where we have 8 byte stack alignment
+     * and do not require 16 byte vector alignment.  This seems slightly
+     * easier than fully parameterizing the above switch statement.
+     */
+    align = MIN(TCG_TARGET_STACK_ALIGN, align);
     off = ROUND_UP(s->current_frame_offset, align);
 
     /* If we've exhausted the stack frame, restart with a smaller TB. */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:41:31 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:41:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256517.440296 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b4N-0002qE-UD; Wed, 12 Jan 2022 10:41:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256517.440296; Wed, 12 Jan 2022 10:41:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b4N-0002q6-RO; Wed, 12 Jan 2022 10:41:31 +0000
Received: by outflank-mailman (input) for mailman id 256517;
 Wed, 12 Jan 2022 10:41:30 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4M-0002pw-Ij
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:30 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4M-0003ey-I2
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4M-0002Mh-H4
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:30 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HcQ9EqdsoHfxp8nIPXsRxfCUz0D8edBkVJZxiNygjV4=; b=6TmCqK5X+zDN+mOAIfqrjaNdte
	xx0Ni2xh02Wc7ira/q6hCFuyHkUXF3d1MmqPVFZ2Qhge6/GsRvuV2Zc6YqG8yC0+3BrBjqVZq/GOq
	hLd8LnQy3yaTpByVSOwaVweI8bJCBEjUjUZnMZcr+uNCQdFXIePEq2NQNfu/FruQjyG0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] tests: tcg: Fix PVH test with binutils 2.36+
Message-Id: <E1n7b4M-0002Mh-H4@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:41:30 +0000

commit fddd169de593da46b2ccd316d63c03b416b94437
Author:     Cole Robinson <crobinso@redhat.com>
AuthorDate: Fri Oct 8 12:21:01 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:37 2021 -0600

    tests: tcg: Fix PVH test with binutils 2.36+
    
    binutils started adding a .note.gnu.property ELF section which
    makes the PVH test fail:
    
      TEST    hello on x86_64
    qemu-system-x86_64: Error loading uncompressed kernel without PVH ELF Note
    
    Discard .note.gnu* while keeping the PVH .note bits intact.
    
    This also strips the build-id note, so drop the related comment.
    
    Signed-off-by: Cole Robinson <crobinso@redhat.com>
    Message-Id: <5ab2a54c262c61f64c22dbb49ade3e2db8a740bb.1633708346.git.crobinso@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 8e751e9c38e324737fd3d3aa0562f886313bba3c)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/tcg/x86_64/system/kernel.ld | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/tcg/x86_64/system/kernel.ld b/tests/tcg/x86_64/system/kernel.ld
index 49c12b04ae..ca5d6bd850 100644
--- a/tests/tcg/x86_64/system/kernel.ld
+++ b/tests/tcg/x86_64/system/kernel.ld
@@ -16,7 +16,10 @@ SECTIONS {
 		*(.rodata)
 	} :text
 
-        /* Keep build ID and PVH notes in same section */
+        /DISCARD/ : {
+                *(.note.gnu*)
+        }
+
         .notes :  {
                *(.note.*)
         } :note
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:41:42 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:41:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256518.440299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b4Y-0002tc-0j; Wed, 12 Jan 2022 10:41:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256518.440299; Wed, 12 Jan 2022 10:41:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b4X-0002tU-UB; Wed, 12 Jan 2022 10:41:41 +0000
Received: by outflank-mailman (input) for mailman id 256518;
 Wed, 12 Jan 2022 10:41:40 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4W-0002tJ-LS
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:40 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4W-0003f5-Kv
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4W-0002NE-KF
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:40 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2jUO0joq7YLb3Y+krc4p3k4TOtrE6u8sFvPJ4n/7wbk=; b=SjcFn1KlmFhDiSTJ49FfMWu4z4
	j4R4Q7t9nqQRwiOZDBy74+bxcYS3WAN4HMa8u/eU7bNCrtemCqJLgPrb8kskAgsS86wYErJ2E6QkZ
	J/jqsgTMkf0HAmIxZPJChITabJ+1T2lC3maQeAXZ0kwW/p5ZI1u9s/9xMXcGYB6LO24Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] Update version for v6.1.1 release
Message-Id: <E1n7b4W-0002NE-KF@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:41:40 +0000

commit 54e1f5be86dd11744e45da8be6afad01d01d59e7
Author:     Michael Roth <michael.roth@amd.com>
AuthorDate: Thu Dec 23 09:52:09 2021 -0600
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Thu Dec 23 09:52:09 2021 -0600

    Update version for v6.1.1 release
    
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index dfda3e0b4f..f3b5af39e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-6.1.0
+6.1.1
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:41:52 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:41:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256519.440304 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7b4i-0002xV-2h; Wed, 12 Jan 2022 10:41:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256519.440304; Wed, 12 Jan 2022 10:41: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 1n7b4h-0002xN-Va; Wed, 12 Jan 2022 10:41:51 +0000
Received: by outflank-mailman (input) for mailman id 256519;
 Wed, 12 Jan 2022 10:41:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4g-0002wC-RG
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:50 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4g-0003fG-Qg
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7b4g-0002Nt-Pq
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:41:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KQ14GtbLYj3wBcyL3XqmPkwW6SDXvY5i/Dp60N1WtL4=; b=ilihXNYqMF1L9R7X+qFLZAhXrf
	R/rER1T/W+U/KzWC3FZZpFceqL5NdXlIYbohAFRGZmQGOlmNDEglPD8nA4Cd4zk0y2bS7uFuOzA8Z
	F9oml1EHPyg4eqK4UCMluAqVeqYEvU6kYte67AGmcXR9Jc8YYuqThYfDyARouNSN3ArY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] Merge tag 'v6.1.1' into staging
Message-Id: <E1n7b4g-0002Nt-Pq@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:41:50 +0000

commit a68d6d311c2d1fd9d2fa9a0768ea2353e8a79b42
Merge: b6e539830bf45e2d7a6bd86ddfdf003088b173b0 54e1f5be86dd11744e45da8be6afad01d01d59e7
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Jan 12 10:29:29 2022 +0000
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Jan 12 10:29:29 2022 +0000

    Merge tag 'v6.1.1' into staging
    
    v6.1.1 release

 VERSION                                   |   2 +-
 accel/tcg/tcg-accel-ops-mttcg.c           |  26 ++++++++++++++++++++
 accel/tcg/tcg-accel-ops-rr.c              |  10 ++++++++
 block/block-backend.c                     |   6 +++++
 block/file-posix.c                        |   6 ++---
 block/io.c                                |   1 +
 chardev/wctablet.c                        |   1 -
 configure                                 |  10 +++++---
 contrib/plugins/execlog.c                 |   2 +-
 docs/tools/qemu-nbd.rst                   |   6 +++--
 hw/9pfs/coth.h                            |   4 ++-
 hw/arm/virt.c                             |   4 +--
 hw/block/dataplane/virtio-blk.c           |   2 +-
 hw/block/fdc.c                            |  23 +++++++++++++++---
 hw/core/machine.c                         |   1 +
 hw/display/artist.c                       |   8 +++---
 hw/display/qxl.c                          |   2 +-
 hw/i386/pc.c                              |   2 +-
 hw/i386/pc_q35.c                          |   2 +-
 hw/m68k/virt.c                            |   9 ++++++-
 hw/net/e1000.c                            |   7 ++++++
 hw/net/virtio-net.c                       |  39 ++++++++++++++++++++++++------
 hw/net/vmxnet3.c                          |  13 ++++++++++
 hw/nvme/ctrl.c                            |   5 ++++
 hw/pci/pci_bridge.c                       |  10 ++++----
 hw/pci/pcie_port.c                        |   2 +-
 hw/scsi/scsi-disk.c                       |   6 +++++
 hw/scsi/scsi-generic.c                    |   2 +-
 hw/usb/dev-uas.c                          |  11 +++++++++
 hw/vfio/common.c                          |   8 ++++++
 hw/virtio/vhost-user.c                    |   5 ++--
 hw/virtio/vhost-vsock.c                   |  19 ++++++++++++---
 hw/virtio/virtio-balloon.c                |  13 ++++++++++
 hw/virtio/virtio-mem-pci.c                |   7 +-----
 hw/virtio/virtio.c                        |  24 ++++++------------
 include/block/block_int.h                 |   7 ++++++
 include/hw/acpi/ich9.h                    |   2 +-
 include/hw/virtio/vhost-vsock.h           |   3 +++
 include/qemu/rcu.h                        |  15 ++++++++++++
 include/sysemu/block-backend.h            |   1 +
 monitor/hmp-cmds.c                        |   2 +-
 nbd/server.c                              |   3 +++
 plugins/meson.build                       |  14 ++++++-----
 qemu-nbd.c                                |   6 +++--
 subprojects/libvhost-user/libvhost-user.c |   1 +
 target/arm/cpu.c                          |  19 +++++++++++++++
 target/i386/cpu.c                         |   2 +-
 target/i386/cpu.h                         |   1 +
 target/i386/tcg/sysemu/excp_helper.c      |  25 ++++++++++---------
 tcg/arm/tcg-target.c.inc                  |  13 +++++++---
 tcg/tcg.c                                 |   8 +++++-
 tests/data/acpi/q35/DSDT                  | Bin 8289 -> 8289 bytes
 tests/data/acpi/q35/DSDT.acpihmat         | Bin 9614 -> 9614 bytes
 tests/data/acpi/q35/DSDT.bridge           | Bin 11003 -> 11003 bytes
 tests/data/acpi/q35/DSDT.cphp             | Bin 8753 -> 8753 bytes
 tests/data/acpi/q35/DSDT.dimmpxm          | Bin 9943 -> 9943 bytes
 tests/data/acpi/q35/DSDT.ipmibt           | Bin 8364 -> 8364 bytes
 tests/data/acpi/q35/DSDT.memhp            | Bin 9648 -> 9648 bytes
 tests/data/acpi/q35/DSDT.mmio64           | Bin 9419 -> 9419 bytes
 tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
 tests/data/acpi/q35/DSDT.nohpet           | Bin 8147 -> 8147 bytes
 tests/data/acpi/q35/DSDT.numamem          | Bin 8295 -> 8295 bytes
 tests/data/acpi/q35/DSDT.tis              | Bin 8894 -> 8894 bytes
 tests/qtest/bios-tables-test.c            |  18 ++++++++++++++
 tests/qtest/fdc-test.c                    |  38 +++++++++++++++++++++++++++++
 tests/tcg/x86_64/system/kernel.ld         |   5 +++-
 util/qemu-sockets.c                       |  13 ++++------
 util/rcu.c                                |  19 +++++++++++++++
 68 files changed, 409 insertions(+), 104 deletions(-)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 10:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 10:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256523.440319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7bHW-0004R1-BA; Wed, 12 Jan 2022 10:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256523.440319; Wed, 12 Jan 2022 10:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7bHW-0004Qt-88; Wed, 12 Jan 2022 10:55:06 +0000
Received: by outflank-mailman (input) for mailman id 256523;
 Wed, 12 Jan 2022 10:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7bHU-0004Qh-Af
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7bHU-0003wI-88
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7bHU-0003Jy-75
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 10:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6lx1h1c4qJKyTa5XQ70hm7Hf75lLm1eNGiGDBC4thes=; b=TQEE+ZTtd75X5FjHUPUsmtOKUk
	VA5ahEraCpbIQJG8hl+AWHH486etDko9sXo64mbAWAEASxk1X1OlRq4dGIA4r0AUZR51v7S5I9NZi
	XTRGr0SxSaTkFz+ERF73/eiyb0fX36QF71B6EpaCisv81LHWDoRs7HS/WuIjiXVb8DL4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/evtchn: Deduplicate xenevtchn_fd()
Message-Id: <E1n7bHU-0003Jy-75@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 10:55:04 +0000

commit 2e8aa1663c76a189998bf51b869b9e468c992c89
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 10 12:29:05 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 10:49:05 2022 +0000

    tools/libs/evtchn: Deduplicate xenevtchn_fd()
    
    struct xenevtchn_handle is common in private.h, meaning that xenevtchn_fd()
    has exactly one correct implementation.
    
    Implement it in core.c, rather than identically for each OS.  This matches all
    other libraries (call, gnttab, gntshr) which implement an fd getter.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/evtchn/core.c    | 5 +++++
 tools/libs/evtchn/freebsd.c | 5 -----
 tools/libs/evtchn/linux.c   | 5 -----
 tools/libs/evtchn/minios.c  | 5 -----
 tools/libs/evtchn/netbsd.c  | 5 -----
 tools/libs/evtchn/solaris.c | 5 -----
 6 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/tools/libs/evtchn/core.c b/tools/libs/evtchn/core.c
index c402d9393b..de925fc963 100644
--- a/tools/libs/evtchn/core.c
+++ b/tools/libs/evtchn/core.c
@@ -120,6 +120,11 @@ int xenevtchn_close(xenevtchn_handle *xce)
     return rc;
 }
 
+int xenevtchn_fd(xenevtchn_handle *xce)
+{
+    return xce->fd;
+}
+
 int xenevtchn_restrict(xenevtchn_handle *xce, domid_t domid)
 {
     return osdep_evtchn_restrict(xce, domid);
diff --git a/tools/libs/evtchn/freebsd.c b/tools/libs/evtchn/freebsd.c
index 7427ab2408..c4d075350b 100644
--- a/tools/libs/evtchn/freebsd.c
+++ b/tools/libs/evtchn/freebsd.c
@@ -63,11 +63,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return -1;
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
diff --git a/tools/libs/evtchn/linux.c b/tools/libs/evtchn/linux.c
index f27b6def39..e61b77ca61 100644
--- a/tools/libs/evtchn/linux.c
+++ b/tools/libs/evtchn/linux.c
@@ -66,11 +66,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return ioctl(xce->fd, IOCTL_EVTCHN_RESTRICT_DOMID, &restrict_domid);
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index e5dfdc5ef5..8f84048b11 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
@@ -112,11 +112,6 @@ void minios_evtchn_close_fd(int fd)
     files[fd].type = FTYPE_NONE;
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int ret;
diff --git a/tools/libs/evtchn/netbsd.c b/tools/libs/evtchn/netbsd.c
index 1cebc21ffc..0b223c4beb 100644
--- a/tools/libs/evtchn/netbsd.c
+++ b/tools/libs/evtchn/netbsd.c
@@ -58,11 +58,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return -1;
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
diff --git a/tools/libs/evtchn/solaris.c b/tools/libs/evtchn/solaris.c
index df9579df17..7fef88a73e 100644
--- a/tools/libs/evtchn/solaris.c
+++ b/tools/libs/evtchn/solaris.c
@@ -57,11 +57,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return -1;
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:33:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256604.440478 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7coJ-0004k8-Fd; Wed, 12 Jan 2022 12:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256604.440478; Wed, 12 Jan 2022 12:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7coJ-0004k0-Cg; Wed, 12 Jan 2022 12:33:03 +0000
Received: by outflank-mailman (input) for mailman id 256604;
 Wed, 12 Jan 2022 12:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coI-0004ju-9g
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coI-0005kT-7x
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coI-0001r8-6U
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+XjFvQoL60MxiNZfgHFQwN7piuJwRkc69KXkfaswgJk=; b=L+qAJ1R5HQCdxTvPAKe/POclxW
	ezcaTbqXkeFt2o/w+4kNToXFuoLjR00YthiZW1vvAupRu8q41sgVGunPl4TNHdmH9dFoB3gq2Wf/X
	p96d4tT2pApO3f1A0ju6f9jn36iswMMQLcEPpm16Sb9SqoCcslekb8f6DFd4MVrMz0Po=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Split struct file definition from its usage
Message-Id: <E1n7coI-0001r8-6U@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:33:02 +0000

commit 35cbce04ddc18a94b51a47ed3fbeef4a008dc298
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:00 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:34:50 2022 +0000

    Split struct file definition from its usage
    
    Make the struct file definition standalone and use it for the
    declaration of the files array.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 39d6a18..a638bc9 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -181,7 +181,7 @@ struct evtchn_port_info {
         int bound;
 };
 
-extern struct file {
+struct file {
     enum fd_type type;
     union {
 	struct {
@@ -236,7 +236,9 @@ extern struct file {
 #endif
     };
     int read;	/* maybe available for read */
-} files[];
+};
+
+extern struct file files[];
 
 int alloc_fd(enum fd_type type);
 void close_all_files(void);
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:33:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256605.440482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7coT-0004lw-Gu; Wed, 12 Jan 2022 12:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256605.440482; Wed, 12 Jan 2022 12:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7coT-0004lo-E6; Wed, 12 Jan 2022 12:33:13 +0000
Received: by outflank-mailman (input) for mailman id 256605;
 Wed, 12 Jan 2022 12:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coS-0004lb-CF
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coS-0005kX-BQ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coS-0001rm-AQ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jHoWzesawZNnZ4l18m97+1Axzr002MxUpRyKerVpnGo=; b=gC/wf6lyCP//Nx0ptO+ipfVCBI
	vHuVJrV5nieMPd8/BXvT2R1WtIBq6gtmcPESGyRVnqp2xU0YnU9FcQdw6vjtEJKUvEOK6ZAAEhoUV
	3v5ibwT8h94O3HNIrDDOukkxBWatLbQqduJr6KFRmuzG4X/kTQhnjT/OLTo1B0e5Eibw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Make file.read bool and move it ahead of device specific part
Message-Id: <E1n7coS-0001rm-AQ@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:33:12 +0000

commit c9fe334979f60c0078d7166f8211db24780af538
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:01 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:34:56 2022 +0000

    Make file.read bool and move it ahead of device specific part
    
    The read member of struct file should be bool.
    
    In order to have the device specific part at the end of the structure
    move "read" ahead of that.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 blkfront.c             |  4 ++--
 console/xencons_ring.c |  2 +-
 fbfront.c              | 12 ++++++------
 include/lib.h          |  3 ++-
 netfront.c             |  4 ++--
 tpm_tis.c              |  2 +-
 tpmfront.c             |  6 +++---
 7 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/blkfront.c b/blkfront.c
index 834a978..7c8eb74 100644
--- a/blkfront.c
+++ b/blkfront.c
@@ -62,7 +62,7 @@ void blkfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
     int fd = dev->fd;
 
     if (fd != -1)
-        files[fd].read = 1;
+        files[fd].read = true;
 #endif
     wake_up(&blkfront_queue);
 }
@@ -484,7 +484,7 @@ int blkfront_aio_poll(struct blkfront_dev *dev)
 moretodo:
 #ifdef HAVE_LIBC
     if (dev->fd != -1) {
-        files[dev->fd].read = 0;
+        files[dev->fd].read = false;
         mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
     }
 #endif
diff --git a/console/xencons_ring.c b/console/xencons_ring.c
index b6db74e..c348f3c 100644
--- a/console/xencons_ring.c
+++ b/console/xencons_ring.c
@@ -102,7 +102,7 @@ void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
         int fd = dev ? dev->fd : -1;
 
         if (fd != -1)
-            files[fd].read = 1;
+            files[fd].read = true;
 
         wake_up(&console_queue);
 #else
diff --git a/fbfront.c b/fbfront.c
index d3b3848..6725da1 100644
--- a/fbfront.c
+++ b/fbfront.c
@@ -45,7 +45,7 @@ void kbdfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
     int fd = dev->fd;
 
     if (fd != -1)
-        files[fd].read = 1;
+        files[fd].read = true;
 #endif
     wake_up(&kbdfront_queue);
 }
@@ -207,7 +207,7 @@ int kbdfront_receive(struct kbdfront_dev *dev, union xenkbd_in_event *buf, int n
 
 #ifdef HAVE_LIBC
     if (dev->fd != -1) {
-        files[dev->fd].read = 0;
+        files[dev->fd].read = false;
         mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
     }
 #endif
@@ -229,7 +229,7 @@ int kbdfront_receive(struct kbdfront_dev *dev, union xenkbd_in_event *buf, int n
 #ifdef HAVE_LIBC
     if (cons != prod && dev->fd != -1)
         /* still some events to read */
-        files[dev->fd].read = 1;
+        files[dev->fd].read = true;
 #endif
 
     return i;
@@ -349,7 +349,7 @@ void fbfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
     int fd = dev->fd;
 
     if (fd != -1)
-        files[fd].read = 1;
+        files[fd].read = true;
 #endif
     wake_up(&fbfront_queue);
 }
@@ -376,7 +376,7 @@ int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n)
 
 #ifdef HAVE_LIBC
     if (dev->fd != -1) {
-        files[dev->fd].read = 0;
+        files[dev->fd].read = false;
         mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
     }
 #endif
@@ -398,7 +398,7 @@ int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n)
 #ifdef HAVE_LIBC
     if (cons != prod && dev->fd != -1)
         /* still some events to read */
-        files[dev->fd].read = 1;
+        files[dev->fd].read = true;
 #endif
 
     return i;
diff --git a/include/lib.h b/include/lib.h
index a638bc9..df2de9e 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -49,6 +49,7 @@
 #define _LIB_H_
 
 #include <stdarg.h>
+#include <stdbool.h>
 #include <stddef.h>
 #include <xen/xen.h>
 #include <xen/event_channel.h>
@@ -183,6 +184,7 @@ struct evtchn_port_info {
 
 struct file {
     enum fd_type type;
+    bool read;	/* maybe available for read */
     union {
 	struct {
             /* lwIP fd */
@@ -235,7 +237,6 @@ struct file {
         } xenbus;
 #endif
     };
-    int read;	/* maybe available for read */
 };
 
 extern struct file files[];
diff --git a/netfront.c b/netfront.c
index dfe065b..a566e34 100644
--- a/netfront.c
+++ b/netfront.c
@@ -255,7 +255,7 @@ void netfront_select_handler(evtchn_port_t port, struct pt_regs *regs, void *dat
     local_irq_restore(flags);
 
     if (fd != -1)
-        files[fd].read = 1;
+        files[fd].read = true;
     wake_up(&netfront_queue);
 }
 #endif
@@ -783,7 +783,7 @@ ssize_t netfront_receive(struct netfront_dev *dev, unsigned char *data, size_t l
     network_rx(dev);
     if (!dev->rlen && fd != -1)
         /* No data for us, make select stop returning */
-        files[fd].read = 0;
+        files[fd].read = false;
     /* Before re-enabling the interrupts, in case a packet just arrived in the
      * meanwhile. */
     local_irq_restore(flags);
diff --git a/tpm_tis.c b/tpm_tis.c
index 475ac5d..4a51027 100644
--- a/tpm_tis.c
+++ b/tpm_tis.c
@@ -845,7 +845,7 @@ int tpm_tis_send(struct tpm_chip* tpm, uint8_t* buf, size_t len) {
    }
 #ifdef HAVE_LIBC
    if(tpm->fd >= 0) {
-      files[tpm->fd].read = 0;
+      files[tpm->fd].read = false;
       files[tpm->fd].tpm_tis.respgot = 0;
       files[tpm->fd].tpm_tis.offset = 0;
    }
diff --git a/tpmfront.c b/tpmfront.c
index 6049244..d825b49 100644
--- a/tpmfront.c
+++ b/tpmfront.c
@@ -66,7 +66,7 @@ void tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) {
    dev->waiting = 0;
 #ifdef HAVE_LIBC
    if(dev->fd >= 0) {
-      files[dev->fd].read = 1;
+      files[dev->fd].read = true;
    }
 #endif
    wake_up(&dev->waitq);
@@ -438,7 +438,7 @@ int tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length)
    dev->resplen = 0;
 #ifdef HAVE_LIBC
    if(dev->fd >= 0) {
-      files[dev->fd].read = 0;
+      files[dev->fd].read = false;
       files[dev->fd].tpmfront.respgot = 0;
       files[dev->fd].tpmfront.offset = 0;
    }
@@ -611,7 +611,7 @@ int tpmfront_posix_fstat(int fd, struct stat* buf)
 
    /* If we have a response waiting, then read it now from the backend
     * so we can get its length*/
-   if(dev->waiting || (files[dev->fd].read == 1 && !files[dev->fd].tpmfront.respgot)) {
+   if(dev->waiting || (files[dev->fd].read && !files[dev->fd].tpmfront.respgot)) {
       if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
 	 errno = EIO;
 	 return -1;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:33:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256606.440487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cod-0004pB-J4; Wed, 12 Jan 2022 12:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256606.440487; Wed, 12 Jan 2022 12:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cod-0004p3-Fa; Wed, 12 Jan 2022 12:33:23 +0000
Received: by outflank-mailman (input) for mailman id 256606;
 Wed, 12 Jan 2022 12:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coc-0004om-Fa
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coc-0005kq-Ee
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7coc-0001sR-Dl
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N26TSEuq3vH8hAtebVfZeQvr+t3/3TkqlOyq3cA9LuA=; b=2u3odC9uhiNUsRgAfHRvXdcMOv
	J96RhMSV/OVziO62mNzEYnnv7YoFRZ4PhucJ+H64cNjWA1sNyR6ndN2qE8fZrmsN0oDXqWz6KpGZT
	1YECHhTJsZhFPZPz+58UPjkNXB4Twi1+Et1ukiTsws9JsfTozx0t31bYSTBfexVmcd3I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Make offset a common struct file member for all types
Message-Id: <E1n7coc-0001sR-Dl@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:33:22 +0000

commit 09020f309cb003d15ddc96952784b60d3a6b4d44
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:02 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:10 2022 +0000

    Make offset a common struct file member for all types
    
    Currently 4 file types have an offset member in their private struct
    file part. Make offset a common struct member shared by all file types.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 blkfront.c    |  5 ++---
 include/lib.h |  5 +----
 lib/sys.c     | 14 +++++---------
 tpm_tis.c     | 11 +++++------
 tpmfront.c    | 11 +++++------
 5 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/blkfront.c b/blkfront.c
index 7c8eb74..8137106 100644
--- a/blkfront.c
+++ b/blkfront.c
@@ -563,14 +563,13 @@ int blkfront_open(struct blkfront_dev *dev)
     dev->fd = alloc_fd(FTYPE_BLK);
     printk("blk_open(%s) -> %d\n", dev->nodename, dev->fd);
     files[dev->fd].blk.dev = dev;
-    files[dev->fd].blk.offset = 0;
     return dev->fd;
 }
 
 int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write)
 {
    struct blkfront_dev* dev = files[fd].blk.dev;
-   off_t offset = files[fd].blk.offset;
+   off_t offset = files[fd].offset;
    struct blkfront_aiocb aiocb;
    unsigned long long disksize = dev->info.sectors * dev->info.sector_size;
    unsigned int blocksize = dev->info.sector_size;
@@ -712,7 +711,7 @@ int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write)
    }
 
    free(copybuf);
-   files[fd].blk.offset += rc;
+   files[fd].offset += rc;
    return rc;
 
 }
diff --git a/include/lib.h b/include/lib.h
index df2de9e..4d9b14b 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -185,6 +185,7 @@ struct evtchn_port_info {
 struct file {
     enum fd_type type;
     bool read;	/* maybe available for read */
+    off_t offset;
     union {
 	struct {
             /* lwIP fd */
@@ -193,7 +194,6 @@ struct file {
 	struct {
             /* FS import fd */
 	    int fd;
-	    off_t offset;
 	} file;
 	struct {
 	    struct evtchn_port_list ports;
@@ -204,7 +204,6 @@ struct file {
 	} tap;
 	struct {
 	    struct blkfront_dev *dev;
-            off_t offset;
 	} blk;
 	struct {
 	    struct kbdfront_dev *dev;
@@ -219,14 +218,12 @@ struct file {
 	struct {
 	   struct tpmfront_dev *dev;
 	   int respgot;
-	   off_t offset;
 	} tpmfront;
 #endif
 #ifdef CONFIG_TPM_TIS
 	struct {
 	   struct tpm_chip *dev;
 	   int respgot;
-	   off_t offset;
 	} tpm_tis;
 #endif
 #ifdef CONFIG_XENBUS
diff --git a/lib/sys.c b/lib/sys.c
index e8d5eb2..e1cea70 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -107,6 +107,7 @@ int alloc_fd(enum fd_type type)
     for (i=0; i<NOFILE; i++) {
 	if (files[i].type == FTYPE_NONE) {
 	    files[i].type = type;
+            files[i].offset = 0;
 	    pthread_mutex_unlock(&fd_lock);
 	    return i;
 	}
@@ -363,25 +364,20 @@ int write(int fd, const void *buf, size_t nbytes)
 
 off_t lseek(int fd, off_t offset, int whence)
 {
-    off_t* target = NULL;
     switch(files[fd].type) {
 #ifdef CONFIG_BLKFRONT
        case FTYPE_BLK:
-          target = &files[fd].blk.offset;
           break;
 #endif
 #ifdef CONFIG_TPMFRONT
        case FTYPE_TPMFRONT:
-          target = &files[fd].tpmfront.offset;
           break;
 #endif
 #ifdef CONFIG_TPM_TIS
        case FTYPE_TPM_TIS:
-          target = &files[fd].tpm_tis.offset;
           break;
 #endif
        case FTYPE_FILE:
-          target = &files[fd].file.offset;
           break;
        default:
           /* Not implemented for this filetype */
@@ -391,10 +387,10 @@ off_t lseek(int fd, off_t offset, int whence)
 
     switch (whence) {
        case SEEK_SET:
-          *target = offset;
+          files[fd].offset = offset;
           break;
        case SEEK_CUR:
-          *target += offset;
+          files[fd].offset += offset;
           break;
        case SEEK_END:
           {
@@ -403,14 +399,14 @@ off_t lseek(int fd, off_t offset, int whence)
              ret = fstat(fd, &st);
              if (ret)
                 return -1;
-             *target = st.st_size + offset;
+             files[fd].offset = st.st_size + offset;
              break;
           }
        default:
           errno = EINVAL;
           return -1;
     }
-    return *target;
+    return files[fd].offset;
 }
 
 int fsync(int fd) {
diff --git a/tpm_tis.c b/tpm_tis.c
index 4a51027..8a632b1 100644
--- a/tpm_tis.c
+++ b/tpm_tis.c
@@ -847,7 +847,7 @@ int tpm_tis_send(struct tpm_chip* tpm, uint8_t* buf, size_t len) {
    if(tpm->fd >= 0) {
       files[tpm->fd].read = false;
       files[tpm->fd].tpm_tis.respgot = 0;
-      files[tpm->fd].tpm_tis.offset = 0;
+      files[tpm->fd].offset = 0;
    }
 #endif
    return len;
@@ -1290,7 +1290,6 @@ int tpm_tis_open(struct tpm_chip* tpm)
    tpm->fd = alloc_fd(FTYPE_TPM_TIS);
    printk("tpm_tis_open() -> %d\n", tpm->fd);
    files[tpm->fd].tpm_tis.dev = tpm;
-   files[tpm->fd].tpm_tis.offset = 0;
    files[tpm->fd].tpm_tis.respgot = 0;
    return tpm->fd;
 }
@@ -1340,13 +1339,13 @@ int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
 
 
    /* Handle EOF case */
-   if(files[fd].tpm_tis.offset >= tpm->data_len) {
+   if(files[fd].offset >= tpm->data_len) {
       rc = 0;
    } else {
-      rc = min(tpm->data_len - files[fd].tpm_tis.offset, count);
-      memcpy(buf, tpm->data_buffer + files[fd].tpm_tis.offset, rc);
+      rc = min(tpm->data_len - files[fd].offset, count);
+      memcpy(buf, tpm->data_buffer + files[fd].offset, rc);
    }
-   files[fd].tpm_tis.offset += rc;
+   files[fd].offset += rc;
    /* Reset the data pending flag */
    return rc;
 }
diff --git a/tpmfront.c b/tpmfront.c
index d825b49..8b2a910 100644
--- a/tpmfront.c
+++ b/tpmfront.c
@@ -440,7 +440,7 @@ int tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length)
    if(dev->fd >= 0) {
       files[dev->fd].read = false;
       files[dev->fd].tpmfront.respgot = 0;
-      files[dev->fd].tpmfront.offset = 0;
+      files[dev->fd].offset = 0;
    }
 #endif
    wmb();
@@ -539,7 +539,6 @@ int tpmfront_open(struct tpmfront_dev* dev)
    dev->fd = alloc_fd(FTYPE_TPMFRONT);
    printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd);
    files[dev->fd].tpmfront.dev = dev;
-   files[dev->fd].tpmfront.offset = 0;
    files[dev->fd].tpmfront.respgot = 0;
    return dev->fd;
 }
@@ -589,14 +588,14 @@ int tpmfront_posix_read(int fd, uint8_t* buf, size_t count)
    }
 
    /* handle EOF case */
-   if(files[dev->fd].tpmfront.offset >= dev->resplen) {
+   if(files[dev->fd].offset >= dev->resplen) {
       return 0;
    }
 
    /* Compute the number of bytes and do the copy operation */
-   if((rc = min(count, dev->resplen - files[dev->fd].tpmfront.offset)) != 0) {
-      memcpy(buf, dev->respbuf + files[dev->fd].tpmfront.offset, rc);
-      files[dev->fd].tpmfront.offset += rc;
+   if((rc = min(count, dev->resplen - files[dev->fd].offset)) != 0) {
+      memcpy(buf, dev->respbuf + files[dev->fd].offset, rc);
+      files[dev->fd].offset += rc;
    }
 
    return rc;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:33:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256607.440490 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7con-0004sh-KG; Wed, 12 Jan 2022 12:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256607.440490; Wed, 12 Jan 2022 12:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7con-0004sZ-H9; Wed, 12 Jan 2022 12:33:33 +0000
Received: by outflank-mailman (input) for mailman id 256607;
 Wed, 12 Jan 2022 12: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 1n7com-0004sK-Is
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7com-0005l3-I4
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7com-0001t0-H5
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4Rfs9a5Phgv6vlw+6hftz66ncvxJAP01GfPWQRNAPEw=; b=n9qUbd4MclKSiR6RKsW95aUKrM
	0V1lnI95qo4fimv5fygVkOf9VwGANnhIsdOKSvoQ9Np2O+V0mm9bYPQmmpKPGziPMJZlRr6E27vAS
	xJornPieiU8zCU6X61MUuZeGjyTelRbPCMwhg97No58kk9te8uMxPAE9ulmxSO+Zh3X4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Replace multiple fd elements in struct file by common one
Message-Id: <E1n7com-0001t0-H5@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:33:32 +0000

commit f27adfcb42219e1d49ef4f1c8db85c0d31aab04f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:03 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:18 2022 +0000

    Replace multiple fd elements in struct file by common one
    
    The type specific union in struct files contains two instances of
    "int fd". Replace them by a common one.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h |  9 +--------
 lib/sys.c     | 28 ++++++++++++++--------------
 2 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 4d9b14b..dc56f52 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -187,14 +187,7 @@ struct file {
     bool read;	/* maybe available for read */
     off_t offset;
     union {
-	struct {
-            /* lwIP fd */
-	    int fd;
-	} socket;
-	struct {
-            /* FS import fd */
-	    int fd;
-	} file;
+        int fd; /* Any fd from an upper layer. */
 	struct {
 	    struct evtchn_port_list ports;
 	} evtchn;
diff --git a/lib/sys.c b/lib/sys.c
index e1cea70..1da7401 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -258,7 +258,7 @@ int read(int fd, void *buf, size_t nbytes)
         }
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
-	    return lwip_read(files[fd].socket.fd, buf, nbytes);
+	    return lwip_read(files[fd].fd, buf, nbytes);
 #endif
 #ifdef CONFIG_NETFRONT
 	case FTYPE_TAP: {
@@ -335,7 +335,7 @@ int write(int fd, const void *buf, size_t nbytes)
 	    return nbytes;
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
-	    return lwip_write(files[fd].socket.fd, (void*) buf, nbytes);
+	    return lwip_write(files[fd].fd, (void*) buf, nbytes);
 #endif
 #ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
@@ -428,7 +428,7 @@ int close(int fd)
 #endif
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET: {
-	    int res = lwip_close(files[fd].socket.fd);
+	    int res = lwip_close(files[fd].fd);
 	    files[fd].type = FTYPE_NONE;
 	    return res;
 	}
@@ -594,7 +594,7 @@ int fcntl(int fd, int cmd, ...)
 	    if (files[fd].type == FTYPE_SOCKET && !(arg & ~O_NONBLOCK)) {
 		/* Only flag supported: non-blocking mode */
 		uint32_t nblock = !!(arg & O_NONBLOCK);
-		return lwip_ioctl(files[fd].socket.fd, FIONBIO, &nblock);
+		return lwip_ioctl(files[fd].fd, FIONBIO, &nblock);
 	    }
 	    /* Fallthrough */
 #endif
@@ -732,15 +732,15 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
     for (i = 0; i < nfds; i++) {
 	if (files[i].type == FTYPE_SOCKET) {
 	    if (FD_ISSET(i, readfds)) {
-		FD_SET(files[i].socket.fd, &sock_readfds);
+		FD_SET(files[i].fd, &sock_readfds);
 		sock_nfds = i+1;
 	    }
 	    if (FD_ISSET(i, writefds)) {
-		FD_SET(files[i].socket.fd, &sock_writefds);
+		FD_SET(files[i].fd, &sock_writefds);
 		sock_nfds = i+1;
 	    }
 	    if (FD_ISSET(i, exceptfds)) {
-		FD_SET(files[i].socket.fd, &sock_exceptfds);
+		FD_SET(files[i].fd, &sock_exceptfds);
 		sock_nfds = i+1;
 	    }
 	}
@@ -803,19 +803,19 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
 	case FTYPE_SOCKET:
 	    if (FD_ISSET(i, readfds)) {
 	        /* Optimize no-network-packet case.  */
-		if (sock_n && FD_ISSET(files[i].socket.fd, &sock_readfds))
+		if (sock_n && FD_ISSET(files[i].fd, &sock_readfds))
 		    n++;
 		else
 		    FD_CLR(i, readfds);
 	    }
             if (FD_ISSET(i, writefds)) {
-		if (sock_n && FD_ISSET(files[i].socket.fd, &sock_writefds))
+		if (sock_n && FD_ISSET(files[i].fd, &sock_writefds))
 		    n++;
 		else
 		    FD_CLR(i, writefds);
             }
             if (FD_ISSET(i, exceptfds)) {
-		if (sock_n && FD_ISSET(files[i].socket.fd, &sock_exceptfds))
+		if (sock_n && FD_ISSET(files[i].fd, &sock_exceptfds))
 		    n++;
 		else
 		    FD_CLR(i, exceptfds);
@@ -1112,7 +1112,7 @@ int socket(int domain, int type, int protocol)
 	return -1;
     res = alloc_fd(FTYPE_SOCKET);
     printk("socket -> %d\n", res);
-    files[res].socket.fd = fd;
+    files[res].fd = fd;
     return res;
 }
 
@@ -1124,11 +1124,11 @@ int accept(int s, struct sockaddr *addr, socklen_t *addrlen)
 	errno = EBADF;
 	return -1;
     }
-    fd = lwip_accept(files[s].socket.fd, addr, addrlen);
+    fd = lwip_accept(files[s].fd, addr, addrlen);
     if (fd < 0)
 	return -1;
     res = alloc_fd(FTYPE_SOCKET);
-    files[res].socket.fd = fd;
+    files[res].fd = fd;
     printk("accepted on %d -> %d\n", s, res);
     return res;
 }
@@ -1141,7 +1141,7 @@ ret name proto \
 	errno = EBADF; \
 	return -1; \
     } \
-    s = files[s].socket.fd; \
+    s = files[s].fd; \
     return lwip_##name args; \
 }
 
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:33:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256608.440494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cox-0004vg-M4; Wed, 12 Jan 2022 12:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256608.440494; Wed, 12 Jan 2022 12:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cox-0004vY-Ij; Wed, 12 Jan 2022 12:33:43 +0000
Received: by outflank-mailman (input) for mailman id 256608;
 Wed, 12 Jan 2022 12: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 1n7cow-0004vN-Lv
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cow-0005lD-LF
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cow-0001tf-KA
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D4iIQ306vu3dKSjzTGDZ0vIugiQJPO1cN33XneoWVeE=; b=vUrd67PSrbm2tO+Hak/L0kVPWv
	tAaANInIQWHI/1JNqX+/XfGJYRJ+aHga07/PDI5eWEWBXbfaQghJaMM4Qd8b6eJUoQkGHV8GRCfWv
	BIituic4N/QSJcHOnJbyQwkGo5A9o+u/e4iTySR9QFnOe5ZyUvD1/5WB2ZKrV8R1Kpg8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Introduce a common dev pointer in struct file
Message-Id: <E1n7cow-0001tf-KA@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:33:42 +0000

commit 2e3bb09a98f2912a045b21dee1cf0216edb8001d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:04 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:25 2022 +0000

    Introduce a common dev pointer in struct file
    
    There are many dev pointers in a union in struct file. Prepare to
    switch to a single one by introducing a new common one.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/lib.h b/include/lib.h
index dc56f52..60aaf1c 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -188,6 +188,7 @@ struct file {
     off_t offset;
     union {
         int fd; /* Any fd from an upper layer. */
+        void *dev;
 	struct {
 	    struct evtchn_port_list ports;
 	} evtchn;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:33:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256609.440498 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cp7-0004z3-Oi; Wed, 12 Jan 2022 12:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256609.440498; Wed, 12 Jan 2022 12: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 1n7cp7-0004yv-Lk; Wed, 12 Jan 2022 12:33:53 +0000
Received: by outflank-mailman (input) for mailman id 256609;
 Wed, 12 Jan 2022 12: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 1n7cp6-0004yj-PL
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cp6-0005lN-OR
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cp6-0001uL-NX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YRVjU7u9V0AbW7Lj4u8n7+SbdIEiYzfeocGYSALVXxw=; b=p66KB7LYJ0otPxCE1HOGOIzAcc
	/cSkvjjaMJNEOTBojrnlLNyITtcAaNuOVm/tMuYvvg0JMs7Q+uWY9bOWVX6Y7Hvuv8vgGNA2JrMls
	/fKsS9u6XVlN+mBmHOXm8/HWmaYQzOeoRGfPt2kgjd25J+cW4VLc50/ZqUGkeDppqGLg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Eliminate blkfront union member in struct file
Message-Id: <E1n7cp6-0001uL-NX@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:33:52 +0000

commit 431147cf8dc8697dc023d353f62017837262063b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:05 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:29 2022 +0000

    Eliminate blkfront union member in struct file
    
    Replace the blkfront specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 blkfront.c    | 6 +++---
 include/lib.h | 3 ---
 lib/sys.c     | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/blkfront.c b/blkfront.c
index 8137106..e3f42be 100644
--- a/blkfront.c
+++ b/blkfront.c
@@ -562,13 +562,13 @@ int blkfront_open(struct blkfront_dev *dev)
     }
     dev->fd = alloc_fd(FTYPE_BLK);
     printk("blk_open(%s) -> %d\n", dev->nodename, dev->fd);
-    files[dev->fd].blk.dev = dev;
+    files[dev->fd].dev = dev;
     return dev->fd;
 }
 
 int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write)
 {
-   struct blkfront_dev* dev = files[fd].blk.dev;
+   struct blkfront_dev* dev = files[fd].dev;
    off_t offset = files[fd].offset;
    struct blkfront_aiocb aiocb;
    unsigned long long disksize = dev->info.sectors * dev->info.sector_size;
@@ -718,7 +718,7 @@ int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write)
 
 int blkfront_posix_fstat(int fd, struct stat* buf)
 {
-   struct blkfront_dev* dev = files[fd].blk.dev;
+   struct blkfront_dev* dev = files[fd].dev;
 
    buf->st_mode = dev->info.mode;
    buf->st_uid = 0;
diff --git a/include/lib.h b/include/lib.h
index 60aaf1c..3a40634 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -196,9 +196,6 @@ struct file {
 	struct {
 	    struct netfront_dev *dev;
 	} tap;
-	struct {
-	    struct blkfront_dev *dev;
-	} blk;
 	struct {
 	    struct kbdfront_dev *dev;
 	} kbd;
diff --git a/lib/sys.c b/lib/sys.c
index 1da7401..f2fdbdf 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -456,7 +456,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_BLKFRONT
 	case FTYPE_BLK:
-            shutdown_blkfront(files[fd].blk.dev);
+            shutdown_blkfront(files[fd].dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
 #endif
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:34:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256610.440502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpH-00051t-QI; Wed, 12 Jan 2022 12:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256610.440502; Wed, 12 Jan 2022 12:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpH-00051l-NF; Wed, 12 Jan 2022 12:34:03 +0000
Received: by outflank-mailman (input) for mailman id 256610;
 Wed, 12 Jan 2022 12: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 1n7cpG-00051a-Sc
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cpG-0005m4-Rq
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cpG-0001vE-Qp
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tu2/QVKT5UD5d5KRhZY1Gfv1zfwXKRtHdWe/0cEvCD8=; b=EH2x3W7EKCQm7jj6inERu2rdwf
	xdeRwtnOZ21uZ8mgm1A9zSaD6GMY2bWoIgLfK3vr8OsC/b0Aw1ObV52FwOwh+9oCvxmbQqmUvn+Ir
	YDckZQeEiqVT1fU4zIGoYXgRAE8Pt/5D3bM1gpstDqKsBoSe8syqL3TQXOFokx2+4WzQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Eliminate consfront union member in struct file
Message-Id: <E1n7cpG-0001vE-Qp@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:34:02 +0000

commit 63f2cbb5f1ff63a70e4302010dbd13ee4bc1a5f2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:06 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:34 2022 +0000

    Eliminate consfront union member in struct file
    
    Replace the consfront specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h |  3 ---
 lib/sys.c     | 31 +++++++++++++++++--------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 3a40634..0cedae6 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -202,9 +202,6 @@ struct file {
 	struct {
 	    struct fbfront_dev *dev;
 	} fb;
-	struct {
-	    struct consfront_dev *dev;
-	} cons;
 #ifdef CONFIG_TPMFRONT
 	struct {
 	   struct tpmfront_dev *dev;
diff --git a/lib/sys.c b/lib/sys.c
index f2fdbdf..62c2020 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -179,7 +179,7 @@ int posix_openpt(int flags)
 
     dev = init_consfront(NULL);
     dev->fd = alloc_fd(FTYPE_CONSOLE);
-    files[dev->fd].cons.dev = dev;
+    files[dev->fd].dev = dev;
 
     printk("fd(%d) = posix_openpt\n", dev->fd);
     return(dev->fd);
@@ -194,7 +194,7 @@ int open_savefile(const char *path, int save)
 
     dev = init_consfront(nodename);
     dev->fd = alloc_fd(FTYPE_SAVEFILE);
-    files[dev->fd].cons.dev = dev;
+    files[dev->fd].dev = dev;
 
     printk("fd(%d) = open_savefile\n", dev->fd);
     return(dev->fd);
@@ -248,7 +248,7 @@ int read(int fd, void *buf, size_t nbytes)
             DEFINE_WAIT(w);
             while(1) {
                 add_waiter(w, console_queue);
-                ret = xencons_ring_recv(files[fd].cons.dev, buf, nbytes);
+                ret = xencons_ring_recv(files[fd].dev, buf, nbytes);
                 if (ret)
                     break;
                 schedule();
@@ -324,14 +324,14 @@ int write(int fd, const void *buf, size_t nbytes)
         case FTYPE_SAVEFILE: {
                 int ret = 0, tot = nbytes;
                 while (nbytes > 0) {
-                    ret = xencons_ring_send(files[fd].cons.dev, (char *)buf, nbytes);
+                    ret = xencons_ring_send(files[fd].dev, (char *)buf, nbytes);
                     nbytes -= ret;
                     buf = (char *)buf + ret;
                 }
                 return tot - nbytes;
             }
 	case FTYPE_CONSOLE:
-	    console_print(files[fd].cons.dev, (char *)buf, nbytes);
+	    console_print(files[fd].dev, (char *)buf, nbytes);
 	    return nbytes;
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
@@ -487,7 +487,7 @@ int close(int fd)
 #ifdef CONFIG_CONSFRONT
         case FTYPE_SAVEFILE:
         case FTYPE_CONSOLE:
-            fini_consfront(files[fd].cons.dev);
+            fini_consfront(files[fd].dev);
             files[fd].type = FTYPE_NONE;
             return 0;
 #endif
@@ -764,7 +764,7 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
 	    /* Fallthrough.  */
 	case FTYPE_CONSOLE:
 	    if (FD_ISSET(i, readfds)) {
-                if (xencons_ring_avail(files[i].cons.dev))
+                if (xencons_ring_avail(files[i].dev))
 		    n++;
 		else
 		    FD_CLR(i, readfds);
@@ -1447,6 +1447,8 @@ const struct termios default_termios = {0,             /* iflag */
 
 int tcsetattr(int fildes, int action, const struct termios *tios)
 {
+    struct consfront_dev *dev;
+
     if (fildes < 0 || fildes >= NOFILE) {
         errno = EBADF;
         return -1;
@@ -1472,21 +1474,21 @@ int tcsetattr(int fildes, int action, const struct termios *tios)
             return -1;
     }
 
-    if (files[fildes].cons.dev == NULL) {
+    dev = files[fildes].dev;
+    if (dev == NULL) {
         errno = ENOSYS;
         return -1;
     }
 
-    if (tios->c_oflag & OPOST)
-        files[fildes].cons.dev->is_raw = false;
-    else
-        files[fildes].cons.dev->is_raw = true;
+    dev->is_raw = !(tios->c_oflag & OPOST);
 
     return 0;
 }
 
 int tcgetattr(int fildes, struct termios *tios)
 {
+    struct consfront_dev *dev;
+
     if (fildes < 0 || fildes >= NOFILE) {
         errno = EBADF;
         return -1;
@@ -1497,7 +1499,8 @@ int tcgetattr(int fildes, struct termios *tios)
         return -1;
     }
 
-    if (files[fildes].cons.dev == NULL) {
+    dev = files[fildes].dev;
+    if (dev == NULL) {
         errno = ENOSYS;
         return 0;
     }
@@ -1509,7 +1512,7 @@ int tcgetattr(int fildes, struct termios *tios)
 
     memcpy(tios, &default_termios, sizeof(struct termios));
 
-    if (files[fildes].cons.dev->is_raw)
+    if (dev->is_raw)
         tios->c_oflag &= ~OPOST;
 
     return 0;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:34:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256611.440506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpS-00054c-SX; Wed, 12 Jan 2022 12:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256611.440506; Wed, 12 Jan 2022 12:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpS-00054U-PE; Wed, 12 Jan 2022 12:34:14 +0000
Received: by outflank-mailman (input) for mailman id 256611;
 Wed, 12 Jan 2022 12: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 1n7cpQ-00054J-Vq
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cpQ-0005mE-V5
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cpQ-0001wH-UF
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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=WIthvcmOG72r7pNmPPTLIC2jrs/T/T1V+BOuRQG9758=; b=O/jEtWbqY+lEv/MFbLOXVEcu6i
	23LmZFUUphZLUW6TL/bq5cmy0nRpqrrV7djFdQH3zi2G+N26ogQD0APWygmGBbadi7hQ+xLWJTYnE
	r78o/LZ74RfEnaSdjicGawGy8yQYKpo05XSDX9aZdCeKtjaaqVHgjn5++2meCuh9hCbc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Eliminate fbfront union member in struct file
Message-Id: <E1n7cpQ-0001wH-UF@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:34:12 +0000

commit 395a27e142acf139bc1a3017abe97aa5635ba904
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:07 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:38 2022 +0000

    Eliminate fbfront union member in struct file
    
    Replace the fbfront specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 fbfront.c     | 2 +-
 include/lib.h | 3 ---
 lib/sys.c     | 4 ++--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fbfront.c b/fbfront.c
index 6725da1..c8410af 100644
--- a/fbfront.c
+++ b/fbfront.c
@@ -703,7 +703,7 @@ int fbfront_open(struct fbfront_dev *dev)
 {
     dev->fd = alloc_fd(FTYPE_FB);
     printk("fb_open(%s) -> %d\n", dev->nodename, dev->fd);
-    files[dev->fd].fb.dev = dev;
+    files[dev->fd].dev = dev;
     return dev->fd;
 }
 #endif
diff --git a/include/lib.h b/include/lib.h
index 0cedae6..2a9a01c 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -199,9 +199,6 @@ struct file {
 	struct {
 	    struct kbdfront_dev *dev;
 	} kbd;
-	struct {
-	    struct fbfront_dev *dev;
-	} fb;
 #ifdef CONFIG_TPMFRONT
 	struct {
 	   struct tpmfront_dev *dev;
diff --git a/lib/sys.c b/lib/sys.c
index 62c2020..2d48657 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -287,7 +287,7 @@ int read(int fd, void *buf, size_t nbytes)
         case FTYPE_FB: {
             int ret, n;
             n = nbytes / sizeof(union xenfb_in_event);
-            ret = fbfront_receive(files[fd].fb.dev, buf, n);
+            ret = fbfront_receive(files[fd].dev, buf, n);
 	    if (ret <= 0) {
 		errno = EAGAIN;
 		return -1;
@@ -480,7 +480,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_FBFRONT
 	case FTYPE_FB:
-            shutdown_fbfront(files[fd].fb.dev);
+            shutdown_fbfront(files[fd].dev);
             files[fd].type = FTYPE_NONE;
             return 0;
 #endif
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:34:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256612.440510 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpc-00057Q-Tg; Wed, 12 Jan 2022 12:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256612.440510; Wed, 12 Jan 2022 12:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpc-00057I-Qq; Wed, 12 Jan 2022 12:34:24 +0000
Received: by outflank-mailman (input) for mailman id 256612;
 Wed, 12 Jan 2022 12: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 1n7cpb-000576-2e
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cpb-0005mQ-22
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cpb-0001xF-1E
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8zQoEa7d8S0giOpTAzr2K/xd4wgIlvG7bcyBTl7pYp4=; b=zxNUXubh27YQqgTt0vA0l9VeK0
	NZJh0rdAxM6tObdn+xGH+BQ9K4M5rvA6nB+0i7Crr9LsE6ivXUp5Z6+Ub0wGgH5gKaadzTd61iObf
	4xRid7dav2nKQ26OsnF53PbMuFaMmcOmP/kb35dJsw1Hd3YOv5MVzTorgMnXgOOLUqPM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Eliminate kbdfront union member in struct file
Message-Id: <E1n7cpb-0001xF-1E@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:34:23 +0000

commit ef3876a527fdd53e9aff4d8cbf9f0741eeb57fa9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:08 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:43 2022 +0000

    Eliminate kbdfront union member in struct file
    
    Replace the kbdfront specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 fbfront.c     | 2 +-
 include/lib.h | 3 ---
 lib/sys.c     | 4 ++--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fbfront.c b/fbfront.c
index c8410af..1e055fb 100644
--- a/fbfront.c
+++ b/fbfront.c
@@ -302,7 +302,7 @@ int kbdfront_open(struct kbdfront_dev *dev)
 {
     dev->fd = alloc_fd(FTYPE_KBD);
     printk("kbd_open(%s) -> %d\n", dev->nodename, dev->fd);
-    files[dev->fd].kbd.dev = dev;
+    files[dev->fd].dev = dev;
     return dev->fd;
 }
 #endif
diff --git a/include/lib.h b/include/lib.h
index 2a9a01c..5201ed7 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -196,9 +196,6 @@ struct file {
 	struct {
 	    struct netfront_dev *dev;
 	} tap;
-	struct {
-	    struct kbdfront_dev *dev;
-	} kbd;
 #ifdef CONFIG_TPMFRONT
 	struct {
 	   struct tpmfront_dev *dev;
diff --git a/lib/sys.c b/lib/sys.c
index 2d48657..8c7ea3c 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -275,7 +275,7 @@ int read(int fd, void *buf, size_t nbytes)
         case FTYPE_KBD: {
             int ret, n;
             n = nbytes / sizeof(union xenkbd_in_event);
-            ret = kbdfront_receive(files[fd].kbd.dev, buf, n);
+            ret = kbdfront_receive(files[fd].dev, buf, n);
 	    if (ret <= 0) {
 		errno = EAGAIN;
 		return -1;
@@ -474,7 +474,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
-            shutdown_kbdfront(files[fd].kbd.dev);
+            shutdown_kbdfront(files[fd].dev);
             files[fd].type = FTYPE_NONE;
             return 0;
 #endif
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:34:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:34:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256613.440515 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpm-0005Ag-Vj; Wed, 12 Jan 2022 12:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256613.440515; Wed, 12 Jan 2022 12:34:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpm-0005AW-SN; Wed, 12 Jan 2022 12:34:34 +0000
Received: by outflank-mailman (input) for mailman id 256613;
 Wed, 12 Jan 2022 12: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 1n7cpl-0005AJ-5p
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cpl-0005ma-50
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cpl-0001yB-4J
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iYBn5eofeBGBOSZtfOOEd8WwYUTT1Z6zy2BX9go3o+c=; b=w6xh+mlxypfcv0eFXb4GsHUfQE
	ftrada/Oa9aTSBzzC7ScUCfWGOjK9ytFBk//XQkQ7MCfRPxQEt6AG3T5bTCi0wQMtjb6/NCcao3t0
	k1+q9TBoIj2BhAmRtBvfq3VaPDO+5K4T749A6iOjfJByJjXmz72+OTABNES1cyPCh2Cs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Eliminate netfront union member in struct file
Message-Id: <E1n7cpl-0001yB-4J@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:34:33 +0000

commit 0e55c583a0f44e6a35345d20bbe3f3c291445751
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:09 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:46 2022 +0000

    Eliminate netfront union member in struct file
    
    Replace the netfront specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h | 3 ---
 lib/sys.c     | 6 +++---
 netfront.c    | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 5201ed7..f2a124e 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -193,9 +193,6 @@ struct file {
 	    struct evtchn_port_list ports;
 	} evtchn;
 	struct gntmap gntmap;
-	struct {
-	    struct netfront_dev *dev;
-	} tap;
 #ifdef CONFIG_TPMFRONT
 	struct {
 	   struct tpmfront_dev *dev;
diff --git a/lib/sys.c b/lib/sys.c
index 8c7ea3c..b35e433 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -263,7 +263,7 @@ int read(int fd, void *buf, size_t nbytes)
 #ifdef CONFIG_NETFRONT
 	case FTYPE_TAP: {
 	    ssize_t ret;
-	    ret = netfront_receive(files[fd].tap.dev, buf, nbytes);
+	    ret = netfront_receive(files[fd].dev, buf, nbytes);
 	    if (ret <= 0) {
 		errno = EAGAIN;
 		return -1;
@@ -339,7 +339,7 @@ int write(int fd, const void *buf, size_t nbytes)
 #endif
 #ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
-	    netfront_xmit(files[fd].tap.dev, (void*) buf, nbytes);
+	    netfront_xmit(files[fd].dev, (void*) buf, nbytes);
 	    return nbytes;
 #endif
 #ifdef CONFIG_BLKFRONT
@@ -450,7 +450,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
-	    shutdown_netfront(files[fd].tap.dev);
+	    shutdown_netfront(files[fd].dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
 #endif
diff --git a/netfront.c b/netfront.c
index a566e34..7696451 100644
--- a/netfront.c
+++ b/netfront.c
@@ -576,7 +576,7 @@ int netfront_tap_open(char *nodename) {
     }
     dev->fd = alloc_fd(FTYPE_TAP);
     printk("tap_open(%s) -> %d\n", nodename, dev->fd);
-    files[dev->fd].tap.dev = dev;
+    files[dev->fd].dev = dev;
     return dev->fd;
 }
 #endif
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:34:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:34:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256614.440518 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpx-0005DI-0S; Wed, 12 Jan 2022 12:34:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256614.440518; Wed, 12 Jan 2022 12:34:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cpw-0005DA-Tr; Wed, 12 Jan 2022 12:34:44 +0000
Received: by outflank-mailman (input) for mailman id 256614;
 Wed, 12 Jan 2022 12: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 1n7cpv-0005Ck-8d
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cpv-0005mo-7w
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cpv-0001z4-7C
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CK+AVSYjsww87jo6PgzS/tFx9CNAtCeBDiA/CpNt2SA=; b=jVlLkmcbskJLXS7FdLlUCMvxhl
	9WNj3VfEahoRYMztEmlmnCyr/cf6EL6gPXC1FrJYAqQ4CCIJBzBILbEbvLNra2MYUyTP62SmarsoU
	ALDIt1unTqnI02CGRQvjmu7+3xWJMr5XTADttdlb7CZge7WecFimmRgmVIDXgGF71jA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Move tpm respgot member of struct file to device specific data
Message-Id: <E1n7cpv-0001z4-7C@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:34:43 +0000

commit 4042863b4fb7c85d4d03e2f3a40b18c91b37313e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:10 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:49 2022 +0000

    Move tpm respgot member of struct file to device specific data
    
    Tpmfront has a "respgot" flag in struct file, which can be moved to the
    device specific data. While at it make it a bool.
    
    The respgot flag of the tpm_tis member of struct file can be removed,
    as it is never read.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h      |  2 --
 include/tpmfront.h |  2 ++
 tpm_tis.c          |  2 --
 tpmfront.c         | 10 +++++-----
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index f2a124e..d740065 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -196,13 +196,11 @@ struct file {
 #ifdef CONFIG_TPMFRONT
 	struct {
 	   struct tpmfront_dev *dev;
-	   int respgot;
 	} tpmfront;
 #endif
 #ifdef CONFIG_TPM_TIS
 	struct {
 	   struct tpm_chip *dev;
-	   int respgot;
 	} tpm_tis;
 #endif
 #ifdef CONFIG_XENBUS
diff --git a/include/tpmfront.h b/include/tpmfront.h
index c489fae..b7da50e 100644
--- a/include/tpmfront.h
+++ b/include/tpmfront.h
@@ -25,6 +25,7 @@
 #ifndef TPMFRONT_H
 #define TPMFRONT_H
 
+#include <stdbool.h>
 #include <mini-os/types.h>
 #include <mini-os/os.h>
 #include <mini-os/events.h>
@@ -53,6 +54,7 @@ struct tpmfront_dev {
 
 #ifdef HAVE_LIBC
    int fd;
+   bool respgot;
 #endif
 
 };
diff --git a/tpm_tis.c b/tpm_tis.c
index 8a632b1..4127118 100644
--- a/tpm_tis.c
+++ b/tpm_tis.c
@@ -846,7 +846,6 @@ int tpm_tis_send(struct tpm_chip* tpm, uint8_t* buf, size_t len) {
 #ifdef HAVE_LIBC
    if(tpm->fd >= 0) {
       files[tpm->fd].read = false;
-      files[tpm->fd].tpm_tis.respgot = 0;
       files[tpm->fd].offset = 0;
    }
 #endif
@@ -1290,7 +1289,6 @@ int tpm_tis_open(struct tpm_chip* tpm)
    tpm->fd = alloc_fd(FTYPE_TPM_TIS);
    printk("tpm_tis_open() -> %d\n", tpm->fd);
    files[tpm->fd].tpm_tis.dev = tpm;
-   files[tpm->fd].tpm_tis.respgot = 0;
    return tpm->fd;
 }
 
diff --git a/tpmfront.c b/tpmfront.c
index 8b2a910..be671c2 100644
--- a/tpmfront.c
+++ b/tpmfront.c
@@ -439,8 +439,8 @@ int tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length)
 #ifdef HAVE_LIBC
    if(dev->fd >= 0) {
       files[dev->fd].read = false;
-      files[dev->fd].tpmfront.respgot = 0;
       files[dev->fd].offset = 0;
+      dev->respgot = false;
    }
 #endif
    wmb();
@@ -499,7 +499,7 @@ int i;
 #endif
 #ifdef HAVE_LIBC
    if(dev->fd >= 0) {
-      files[dev->fd].tpmfront.respgot = 1;
+      dev->respgot = true;
    }
 #endif
 quit:
@@ -539,7 +539,7 @@ int tpmfront_open(struct tpmfront_dev* dev)
    dev->fd = alloc_fd(FTYPE_TPMFRONT);
    printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd);
    files[dev->fd].tpmfront.dev = dev;
-   files[dev->fd].tpmfront.respgot = 0;
+   dev->respgot = false;
    return dev->fd;
 }
 
@@ -580,7 +580,7 @@ int tpmfront_posix_read(int fd, uint8_t* buf, size_t count)
    }
 
    /* get the response if we haven't already */
-   if(files[dev->fd].tpmfront.respgot == 0) {
+   if (!dev->respgot) {
       if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
 	 errno = EIO;
 	 return -1;
@@ -610,7 +610,7 @@ int tpmfront_posix_fstat(int fd, struct stat* buf)
 
    /* If we have a response waiting, then read it now from the backend
     * so we can get its length*/
-   if(dev->waiting || (files[dev->fd].read && !files[dev->fd].tpmfront.respgot)) {
+   if(dev->waiting || (files[dev->fd].read && !dev->respgot)) {
       if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
 	 errno = EIO;
 	 return -1;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:34:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:34:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256615.440521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cq7-0005Ge-2C; Wed, 12 Jan 2022 12:34:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256615.440521; Wed, 12 Jan 2022 12:34:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cq6-0005G4-VG; Wed, 12 Jan 2022 12:34:54 +0000
Received: by outflank-mailman (input) for mailman id 256615;
 Wed, 12 Jan 2022 12: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 1n7cq5-0005Fq-BU
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cq5-0005nJ-As
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cq5-000202-AA
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:34:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IZuHdL4R/qc1Lqo0uwWGF93Ym6f/Dq0PG7qgyogYIZ8=; b=NrN5+tRMhK03v+ImyHjj5NA1HZ
	9aUseAKcG2mtAwRB2SvVuoqoiPu314yzPCZTcqWUh0WX/7JX/Cea4GW5ob0+xVKrd18luzXn2dlYE
	RtOaVs/kEoZr4ZBsTY2BYTWyvD7txnMdvp2iZeQzDHUfsgfKmI1IuLghBxGE9yICaOA4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Eliminate tpmfront union member in struct file
Message-Id: <E1n7cq5-000202-AA@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:34:53 +0000

commit 4673f9aace27c21cc07030a07ed443affeee4f06
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:11 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:55 2022 +0000

    Eliminate tpmfront union member in struct file
    
    Replace the tpmfront specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h | 5 -----
 lib/sys.c     | 2 +-
 tpmfront.c    | 8 ++++----
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index d740065..2ddc076 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -193,11 +193,6 @@ struct file {
 	    struct evtchn_port_list ports;
 	} evtchn;
 	struct gntmap gntmap;
-#ifdef CONFIG_TPMFRONT
-	struct {
-	   struct tpmfront_dev *dev;
-	} tpmfront;
-#endif
 #ifdef CONFIG_TPM_TIS
 	struct {
 	   struct tpm_chip *dev;
diff --git a/lib/sys.c b/lib/sys.c
index b35e433..b042bf5 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -462,7 +462,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_TPMFRONT
 	case FTYPE_TPMFRONT:
-            shutdown_tpmfront(files[fd].tpmfront.dev);
+            shutdown_tpmfront(files[fd].dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
 #endif
diff --git a/tpmfront.c b/tpmfront.c
index be671c2..0a2fefc 100644
--- a/tpmfront.c
+++ b/tpmfront.c
@@ -538,7 +538,7 @@ int tpmfront_open(struct tpmfront_dev* dev)
 
    dev->fd = alloc_fd(FTYPE_TPMFRONT);
    printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd);
-   files[dev->fd].tpmfront.dev = dev;
+   files[dev->fd].dev = dev;
    dev->respgot = false;
    return dev->fd;
 }
@@ -547,7 +547,7 @@ int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count)
 {
    int rc;
    struct tpmfront_dev* dev;
-   dev = files[fd].tpmfront.dev;
+   dev = files[fd].dev;
 
    if(count == 0) {
       return 0;
@@ -573,7 +573,7 @@ int tpmfront_posix_read(int fd, uint8_t* buf, size_t count)
    size_t dummysz;
    struct tpmfront_dev* dev;
 
-   dev = files[fd].tpmfront.dev;
+   dev = files[fd].dev;
 
    if(count == 0) {
       return 0;
@@ -606,7 +606,7 @@ int tpmfront_posix_fstat(int fd, struct stat* buf)
    uint8_t* dummybuf;
    size_t dummysz;
    int rc;
-   struct tpmfront_dev* dev = files[fd].tpmfront.dev;
+   struct tpmfront_dev* dev = files[fd].dev;
 
    /* If we have a response waiting, then read it now from the backend
     * so we can get its length*/
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:35:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:35:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256616.440526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cqH-0005K6-52; Wed, 12 Jan 2022 12:35:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256616.440526; Wed, 12 Jan 2022 12: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 1n7cqH-0005Jy-1y; Wed, 12 Jan 2022 12:35:05 +0000
Received: by outflank-mailman (input) for mailman id 256616;
 Wed, 12 Jan 2022 12: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 1n7cqF-0005Jn-F5
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12: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 1n7cqF-0005ni-EJ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cqF-00021C-DE
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:35:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=amL5CVrQOFkOfanfKBo72crI2NxbESRHWcWB9pAtAeE=; b=wKzv+D7ZYhzk63ruzGCuLq2C0i
	z3uvTQBH8us0Ff5xv5yoLxKPGDr9aevG3sUHdG4pPbk1b07IkBQtXawBPxeGrKEfFOwsn4i50NMnM
	ILibFJY5WYubL5qIEwB9c6www1LVdcR97Z84iy+uoNOJmAIstUbGwKgAZp20t1glfTqA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Eliminate tpmtis union member in struct file
Message-Id: <E1n7cqF-00021C-DE@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:35:03 +0000

commit 91fdefeb25115aadee84bfce4de9399e4f9cf151
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:12 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:35:59 2022 +0000

    Eliminate tpmtis union member in struct file
    
    Replace the tpmtis specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h | 5 -----
 lib/sys.c     | 2 +-
 tpm_tis.c     | 8 ++++----
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 2ddc076..d6a29ba 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -193,11 +193,6 @@ struct file {
 	    struct evtchn_port_list ports;
 	} evtchn;
 	struct gntmap gntmap;
-#ifdef CONFIG_TPM_TIS
-	struct {
-	   struct tpm_chip *dev;
-	} tpm_tis;
-#endif
 #ifdef CONFIG_XENBUS
         struct {
             /* To each xenbus FD is associated a queue of watch events for this
diff --git a/lib/sys.c b/lib/sys.c
index b042bf5..96fc769 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -468,7 +468,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_TPM_TIS
 	case FTYPE_TPM_TIS:
-            shutdown_tpm_tis(files[fd].tpm_tis.dev);
+            shutdown_tpm_tis(files[fd].dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
 #endif
diff --git a/tpm_tis.c b/tpm_tis.c
index 4127118..477f555 100644
--- a/tpm_tis.c
+++ b/tpm_tis.c
@@ -1288,14 +1288,14 @@ int tpm_tis_open(struct tpm_chip* tpm)
 
    tpm->fd = alloc_fd(FTYPE_TPM_TIS);
    printk("tpm_tis_open() -> %d\n", tpm->fd);
-   files[tpm->fd].tpm_tis.dev = tpm;
+   files[tpm->fd].dev = tpm;
    return tpm->fd;
 }
 
 int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count)
 {
    struct tpm_chip* tpm;
-   tpm = files[fd].tpm_tis.dev;
+   tpm = files[fd].dev;
 
    if(tpm->locality < 0) {
       printk("tpm_tis_posix_write() failed! locality not set!\n");
@@ -1323,7 +1323,7 @@ int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
 {
    int rc;
    struct tpm_chip* tpm;
-   tpm = files[fd].tpm_tis.dev;
+   tpm = files[fd].dev;
 
    if(count == 0) {
       return 0;
@@ -1350,7 +1350,7 @@ int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
 int tpm_tis_posix_fstat(int fd, struct stat* buf)
 {
    struct tpm_chip* tpm;
-   tpm = files[fd].tpm_tis.dev;
+   tpm = files[fd].dev;
 
    buf->st_mode = O_RDWR;
    buf->st_uid = 0;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 12:35:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 12:35:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256617.440529 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7cqR-0005Mm-6J; Wed, 12 Jan 2022 12:35:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256617.440529; Wed, 12 Jan 2022 12: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 1n7cqR-0005Me-3V; Wed, 12 Jan 2022 12:35:15 +0000
Received: by outflank-mailman (input) for mailman id 256617;
 Wed, 12 Jan 2022 12:35:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cqP-0005MH-I9
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:35:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cqP-0005nu-HU
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:35:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7cqP-00022D-Gb
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 12:35:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uCRj40o4Z9PPOgpAfmDP17JSiIlwTkOCZnRgE1MMLbU=; b=Ei12H7LUvsPbqIGVQ/IUGs80PF
	EWAdxYY3W9f+qOWGm0tHUwlGD2xxAUOQ+37stMxd7UXOSULeBfBDuaJAMjV7LIRfrVFV8wAtKSjHU
	L6WwR4P2VyfaiClJBdS0tvsmcywTLWwryQGMRblg0m/2rRFEJN+vPyBdUSqyzBE1uvbY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Eliminate xenbus union member in struct file
Message-Id: <E1n7cqP-00022D-Gb@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 12:35:13 +0000

commit 65d6fc6917ea0d9c652181215ea988e8e6dc576a
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 11 15:58:13 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 11:36:04 2022 +0000

    Eliminate xenbus union member in struct file
    
    Replace the xenbus specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h |  7 -------
 lib/sys.c     |  2 +-
 lib/xs.c      | 13 +++++++------
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index d6a29ba..91364ba 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -193,13 +193,6 @@ struct file {
 	    struct evtchn_port_list ports;
 	} evtchn;
 	struct gntmap gntmap;
-#ifdef CONFIG_XENBUS
-        struct {
-            /* To each xenbus FD is associated a queue of watch events for this
-             * FD.  */
-            xenbus_event_queue events;
-        } xenbus;
-#endif
     };
 };
 
diff --git a/lib/sys.c b/lib/sys.c
index 96fc769..6f2b026 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -776,7 +776,7 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
 #ifdef CONFIG_XENBUS
 	case FTYPE_XENBUS:
 	    if (FD_ISSET(i, readfds)) {
-                if (files[i].xenbus.events)
+                if (files[i].dev)
 		    n++;
 		else
 		    FD_CLR(i, readfds);
diff --git a/lib/xs.c b/lib/xs.c
index 324bd05..0459f52 100644
--- a/lib/xs.c
+++ b/lib/xs.c
@@ -21,8 +21,8 @@ static inline int _xs_fileno(struct xs_handle *h) {
 struct xs_handle *xs_daemon_open()
 {
     int fd = alloc_fd(FTYPE_XENBUS);
-    files[fd].xenbus.events = NULL;
-    printk("xs_daemon_open -> %d, %p\n", fd, &files[fd].xenbus.events);
+    files[fd].dev = NULL;
+    printk("xs_daemon_open -> %d, %p\n", fd, &files[fd].dev);
     return (void*)(intptr_t) fd;
 }
 
@@ -30,7 +30,7 @@ void xs_daemon_close(struct xs_handle *h)
 {
     int fd = _xs_fileno(h);
     struct xenbus_event *event, *next;
-    for (event = files[fd].xenbus.events; event; event = next)
+    for (event = files[fd].dev; event; event = next)
     {
         next = event->next;
         free(event);
@@ -172,15 +172,16 @@ bool xs_watch(struct xs_handle *h, const char *path, const char *token)
 {
     int fd = _xs_fileno(h);
     printk("xs_watch(%s, %s)\n", path, token);
-    return xs_bool(xenbus_watch_path_token(XBT_NULL, path, token, &files[fd].xenbus.events));
+    return xs_bool(xenbus_watch_path_token(XBT_NULL, path, token,
+                   (xenbus_event_queue *)&files[fd].dev));
 }
 
 char **xs_read_watch(struct xs_handle *h, unsigned int *num)
 {
     int fd = _xs_fileno(h);
     struct xenbus_event *event;
-    event = files[fd].xenbus.events;
-    files[fd].xenbus.events = event->next;
+    event = files[fd].dev;
+    files[fd].dev = event->next;
     printk("xs_read_watch() -> %s %s\n", event->path, event->token);
     *num = 2;
     return (char **) &event->path;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:11:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256814.440911 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j1T-0003i3-Fe; Wed, 12 Jan 2022 19:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256814.440911; Wed, 12 Jan 2022 19: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 1n7j1T-0003hv-Cg; Wed, 12 Jan 2022 19:11:03 +0000
Received: by outflank-mailman (input) for mailman id 256814;
 Wed, 12 Jan 2022 19: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 1n7j1S-0003hp-C7
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j1S-00054F-8g
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j1S-0001HW-7k
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=cd63LJ5N8Jr8AmzPwikENYukbZhmzHEHzPrebJzp2dQ=; b=H7TGbq7Vur40ep0tLnNOgpqHRY
	AQu7AAcaQ2EjSb7dsLgnhq/lvOSGO4R/tdk8ETLqIeV1cUPaK1GqPVjGWA7TcxGdXA5LL/ffLXd/f
	siM1QA8g+Wz92gHXNvYufREE+d2hsXVSLX7T4dZuug3D4eeOg1lOPIdndbTn0yOFci4I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] virtio-balloon: don't start free page hinting if postcopy is possible
Message-Id: <E1n7j1S-0001HW-7k@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:11:02 +0000

commit aa77e375a5b1b91d7646d8b5f8683778f53fbbd3
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Thu Jul 8 11:53:38 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:18 2021 -0600

    virtio-balloon: don't start free page hinting if postcopy is possible
    
    Postcopy never worked properly with 'free-page-hint=on', as there are
    at least two issues:
    
    1) With postcopy, the guest will never receive a VIRTIO_BALLOON_CMD_ID_DONE
       and consequently won't release free pages back to the OS once
       migration finishes.
    
       The issue is that for postcopy, we won't do a final bitmap sync while
       the guest is stopped on the source and
       virtio_balloon_free_page_hint_notify() will only call
       virtio_balloon_free_page_done() on the source during
       PRECOPY_NOTIFY_CLEANUP, after the VM state was already migrated to
       the destination.
    
    2) Once the VM touches a page on the destination that has been excluded
       from migration on the source via qemu_guest_free_page_hint() while
       postcopy is active, that thread will stall until postcopy finishes
       and all threads are woken up. (with older Linux kernels that won't
       retry faults when woken up via userfaultfd, we might actually get a
       SEGFAULT)
    
       The issue is that the source will refuse to migrate any pages that
       are not marked as dirty in the dirty bmap -- for example, because the
       page might just have been sent. Consequently, the faulting thread will
       stall, waiting for the page to be migrated -- which could take quite
       a while and result in guest OS issues.
    
    While we could fix 1) comparatively easily, 2) is harder to get right and
    might require more involved RAM migration changes on source and destination
    [1].
    
    As it never worked properly, let's not start free page hinting in the
    precopy notifier if the postcopy migration capability was enabled to fix
    it easily. Capabilities cannot be enabled once migration is already
    running.
    
    Note 1: in the future we might either adjust migration code on the source
            to track pages that have actually been sent or adjust
            migration code on source and destination  to eventually send
            pages multiple times from the source and and deal with pages
            that are sent multiple times on the destination.
    
    Note 2: virtio-mem has similar issues, however, access to "unplugged"
            memory by the guest is very rare and we would have to be very
            lucky for it to happen during migration. The spec states
            "The driver SHOULD NOT read from unplugged memory blocks ..."
            and "The driver MUST NOT write to unplugged memory blocks".
            virtio-mem will move away from virtio_balloon_free_page_done()
            soon and handle this case explicitly on the destination.
    
    [1] https://lkml.kernel.org/r/e79fd18c-aa62-c1d8-c7f3-ba3fc2c25fc8@redhat.com
    
    Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
    Cc: qemu-stable@nongnu.org
    Cc: Wei Wang <wei.w.wang@intel.com>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Cc: Alexander Duyck <alexander.duyck@gmail.com>
    Cc: Juan Quintela <quintela@redhat.com>
    Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
    Cc: Peter Xu <peterx@redhat.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20210708095339.20274-2-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Peter Xu <peterx@redhat.com>
    (cherry picked from commit fd51e54fa10221e5a8add894c38cc1cf199f4bc4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio-balloon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 4b5d9e5e50..ae7867a8db 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -30,6 +30,7 @@
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "migration/misc.h"
+#include "migration/migration.h"
 
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
@@ -662,6 +663,18 @@ virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data)
         return 0;
     }
 
+    /*
+     * Pages hinted via qemu_guest_free_page_hint() are cleared from the dirty
+     * bitmap and will not get migrated, especially also not when the postcopy
+     * destination starts using them and requests migration from the source; the
+     * faulting thread will stall until postcopy migration finishes and
+     * all threads are woken up. Let's not start free page hinting if postcopy
+     * is possible.
+     */
+    if (migrate_postcopy_ram()) {
+        return 0;
+    }
+
     switch (pnd->reason) {
     case PRECOPY_NOTIFY_BEFORE_BITMAP_SYNC:
         virtio_balloon_free_page_stop(dev);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:11:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256815.440915 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j1d-0003jq-H8; Wed, 12 Jan 2022 19:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256815.440915; Wed, 12 Jan 2022 19: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 1n7j1d-0003jh-EB; Wed, 12 Jan 2022 19:11:13 +0000
Received: by outflank-mailman (input) for mailman id 256815;
 Wed, 12 Jan 2022 19: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 1n7j1c-0003jT-D0
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j1c-00055q-CE
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j1c-0001IG-BD
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=8v75Vz39IDI3c8E+MLHr2vjWSoiaHI3tu/I3uX3Y/aU=; b=twQfdxRqTgyZM7sLaBEno/kn+W
	HkwlMpqfc4gyPLq5Eo963EprUEvwTba56/rBBH4xzXbMeOMgrpnK5qRl8ZGE7hplrK1vZRYe/qCVH
	Jz8as2IEV7YcvS0n90VuXTvbHlYbYr6EdLyW2ZgHkUnDfux4ieAK6xCiCZCdarUk8cug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] target/arm: Don't skip M-profile reset entirely in user mode
Message-Id: <E1n7j1c-0001IG-BD@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:11:12 +0000

commit 3054f772de9c2e97e7c196d4f3e70d58aca1e807
Author:     Peter Maydell <peter.maydell@linaro.org>
AuthorDate: Mon Sep 20 09:54:33 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:25 2021 -0600

    target/arm: Don't skip M-profile reset entirely in user mode
    
    Currently all of the M-profile specific code in arm_cpu_reset() is
    inside a !defined(CONFIG_USER_ONLY) ifdef block.  This is
    unintentional: it happened because originally the only
    M-profile-specific handling was the setup of the initial SP and PC
    from the vector table, which is system-emulation only.  But then we
    added a lot of other M-profile setup to the same "if (ARM_FEATURE_M)"
    code block without noticing that it was all inside a not-user-mode
    ifdef.  This has generally been harmless, but with the addition of
    v8.1M low-overhead-loop support we ran into a problem: the reset of
    FPSCR.LTPSIZE to 4 was only being done for system emulation mode, so
    if a user-mode guest tried to execute the LE instruction it would
    incorrectly take a UsageFault.
    
    Adjust the ifdefs so only the really system-emulation specific parts
    are covered.  Because this means we now run some reset code that sets
    up initial values in the FPCCR and similar FPU related registers,
    explicitly set up the registers controlling FPU context handling in
    user-emulation mode so that the FPU works by design and not by
    chance.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/613
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-id: 20210914120725.24992-2-peter.maydell@linaro.org
    (cherry picked from commit b62ceeaf8096fdbbbfdc6087da0028bc4a4dd77e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/arm/cpu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 2866dd7658..af60c07ca1 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -265,12 +265,15 @@ static void arm_cpu_reset(DeviceState *dev)
         env->uncached_cpsr = ARM_CPU_MODE_SVC;
     }
     env->daif = PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F;
+#endif
 
     if (arm_feature(env, ARM_FEATURE_M)) {
+#ifndef CONFIG_USER_ONLY
         uint32_t initial_msp; /* Loaded from 0x0 */
         uint32_t initial_pc; /* Loaded from 0x4 */
         uint8_t *rom;
         uint32_t vecbase;
+#endif
 
         if (cpu_isar_feature(aa32_lob, cpu)) {
             /*
@@ -324,6 +327,8 @@ static void arm_cpu_reset(DeviceState *dev)
             env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK |
                 R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK;
         }
+
+#ifndef CONFIG_USER_ONLY
         /* Unlike A/R profile, M profile defines the reset LR value */
         env->regs[14] = 0xffffffff;
 
@@ -352,8 +357,22 @@ static void arm_cpu_reset(DeviceState *dev)
         env->regs[13] = initial_msp & 0xFFFFFFFC;
         env->regs[15] = initial_pc & ~1;
         env->thumb = initial_pc & 1;
+#else
+        /*
+         * For user mode we run non-secure and with access to the FPU.
+         * The FPU context is active (ie does not need further setup)
+         * and is owned by non-secure.
+         */
+        env->v7m.secure = false;
+        env->v7m.nsacr = 0xcff;
+        env->v7m.cpacr[M_REG_NS] = 0xf0ffff;
+        env->v7m.fpccr[M_REG_S] &=
+            ~(R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK);
+        env->v7m.control[M_REG_S] |= R_V7M_CONTROL_FPCA_MASK;
+#endif
     }
 
+#ifndef CONFIG_USER_ONLY
     /* AArch32 has a hard highvec setting of 0xFFFF0000.  If we are currently
      * executing as AArch32 then check if highvecs are enabled and
      * adjust the PC accordingly.
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:11:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256816.440919 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j1o-0003mp-Ie; Wed, 12 Jan 2022 19:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256816.440919; Wed, 12 Jan 2022 19: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 1n7j1o-0003mh-Fc; Wed, 12 Jan 2022 19:11:24 +0000
Received: by outflank-mailman (input) for mailman id 256816;
 Wed, 12 Jan 2022 19: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 1n7j1m-0003mR-GJ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j1m-00056B-Fc
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j1m-0001J2-Ee
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=EDBBBGfw0gezVgNRSKxDGqBYG1Iju2lhjTulN5waSmo=; b=MFF89sjJkPzvcrzm5KwvvTJFGm
	z4KHwxCsPXy17zw15UeY0Bn3UaCjfDahmLiV3Es0VKYWIEYg3Nrx9obkojTxJkJjnUL19YdGlwCbp
	OhdiuJjZKsRb9ql8TMkqV/SFT1w7+tgncDCatngM1rEK8TeVdv9nYRejpYi6mJsFzNS0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] virtio-net: fix use after unmap/free for sg
Message-Id: <E1n7j1m-0001J2-Ee@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:11:22 +0000

commit 9e41f16fca436a666ee79f5219797a2c58b6cf19
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Sep 2 13:44:12 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:31 2021 -0600

    virtio-net: fix use after unmap/free for sg
    
    When mergeable buffer is enabled, we try to set the num_buffers after
    the virtqueue elem has been unmapped. This will lead several issues,
    E.g a use after free when the descriptor has an address which belongs
    to the non direct access region. In this case we use bounce buffer
    that is allocated during address_space_map() and freed during
    address_space_unmap().
    
    Fixing this by storing the elems temporarily in an array and delay the
    unmap after we set the the num_buffers.
    
    This addresses CVE-2021-3748.
    
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Fixes: fbe78f4f55c6 ("virtio-net support")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit bedd7e93d01961fcb16a97ae45d93acf357e11f6)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/virtio-net.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 16d20cdee5..f205331dcf 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1746,10 +1746,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
     VirtIONet *n = qemu_get_nic_opaque(nc);
     VirtIONetQueue *q = virtio_net_get_subqueue(nc);
     VirtIODevice *vdev = VIRTIO_DEVICE(n);
+    VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE];
+    size_t lens[VIRTQUEUE_MAX_SIZE];
     struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
     struct virtio_net_hdr_mrg_rxbuf mhdr;
     unsigned mhdr_cnt = 0;
-    size_t offset, i, guest_offset;
+    size_t offset, i, guest_offset, j;
+    ssize_t err;
 
     if (!virtio_net_can_receive(nc)) {
         return -1;
@@ -1780,6 +1783,12 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
 
         total = 0;
 
+        if (i == VIRTQUEUE_MAX_SIZE) {
+            virtio_error(vdev, "virtio-net unexpected long buffer chain");
+            err = size;
+            goto err;
+        }
+
         elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement));
         if (!elem) {
             if (i) {
@@ -1791,7 +1800,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                              n->guest_hdr_len, n->host_hdr_len,
                              vdev->guest_features);
             }
-            return -1;
+            err = -1;
+            goto err;
         }
 
         if (elem->in_num < 1) {
@@ -1799,7 +1809,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                          "virtio-net receive queue contains no in buffers");
             virtqueue_detach_element(q->rx_vq, elem, 0);
             g_free(elem);
-            return -1;
+            err = -1;
+            goto err;
         }
 
         sg = elem->in_sg;
@@ -1836,12 +1847,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
         if (!n->mergeable_rx_bufs && offset < size) {
             virtqueue_unpop(q->rx_vq, elem, total);
             g_free(elem);
-            return size;
+            err = size;
+            goto err;
         }
 
-        /* signal other side */
-        virtqueue_fill(q->rx_vq, elem, total, i++);
-        g_free(elem);
+        elems[i] = elem;
+        lens[i] = total;
+        i++;
     }
 
     if (mhdr_cnt) {
@@ -1851,10 +1863,23 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                      &mhdr.num_buffers, sizeof mhdr.num_buffers);
     }
 
+    for (j = 0; j < i; j++) {
+        /* signal other side */
+        virtqueue_fill(q->rx_vq, elems[j], lens[j], j);
+        g_free(elems[j]);
+    }
+
     virtqueue_flush(q->rx_vq, i);
     virtio_notify(vdev, q->rx_vq);
 
     return size;
+
+err:
+    for (j = 0; j < i; j++) {
+        g_free(elems[j]);
+    }
+
+    return err;
 }
 
 static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:11:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256817.440922 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j1y-0003qD-KX; Wed, 12 Jan 2022 19:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256817.440922; Wed, 12 Jan 2022 19: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 1n7j1y-0003q5-HE; Wed, 12 Jan 2022 19:11:34 +0000
Received: by outflank-mailman (input) for mailman id 256817;
 Wed, 12 Jan 2022 19: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 1n7j1w-0003pm-Jc
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j1w-00056P-In
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j1w-0001Jn-Hy
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=vOV/7tRI6CD5QDdKkKzxWi+s79kEtrArikcUKLBgB48=; b=7DQ39bbfOC25MmpJMWxuPrsINc
	lMc7nzr1/8RQOaI63FVO8rtpRWUaXnwO22oa6qEyMxpdeLX0fZ0mCTH0gJ76FooSxgyk0PBWp1A6F
	pDXvjmA+2u0Yt45pSHbSsVwYH5Q87Y55o/aLJMrqegUoqhozkbocAd+AY/9w/q4hhH1U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] qemu-nbd: Change default cache mode to writeback
Message-Id: <E1n7j1w-0001Jn-Hy@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:11:32 +0000

commit 4c34ef3d341deff67bed735efca91d2ce0f9368c
Author:     Nir Soffer <nirsof@gmail.com>
AuthorDate: Fri Aug 13 23:55:19 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:36 2021 -0600

    qemu-nbd: Change default cache mode to writeback
    
    Both qemu and qemu-img use writeback cache mode by default, which is
    already documented in qemu(1). qemu-nbd uses writethrough cache mode by
    default, and the default cache mode is not documented.
    
    According to the qemu-nbd(8):
    
       --cache=CACHE
              The  cache  mode  to be used with the file.  See the
              documentation of the emulator's -drive cache=... option for
              allowed values.
    
    qemu(1) says:
    
        The default mode is cache=writeback.
    
    So users have no reason to assume that qemu-nbd is using writethough
    cache mode. The only hint is the painfully slow writing when using the
    defaults.
    
    Looking in git history, it seems that qemu used writethrough in the past
    to support broken guests that did not flush data properly, or could not
    flush due to limitations in qemu. But qemu-nbd clients can use
    NBD_CMD_FLUSH to flush data, so using writethrough does not help anyone.
    
    Change the default cache mode to writback, and document the default and
    available values properly in the online help and manual.
    
    With this change converting image via qemu-nbd is 3.5 times faster.
    
        $ qemu-img create dst.img 50g
        $ qemu-nbd -t -f raw -k /tmp/nbd.sock dst.img
    
    Before this change:
    
        $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
        Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
          Time (mean ± σ):     83.639 s ±  5.970 s    [User: 2.733 s, System: 6.112 s]
          Range (min … max):   76.749 s … 87.245 s    3 runs
    
    After this change:
    
        $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
        Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
          Time (mean ± σ):     23.522 s ±  0.433 s    [User: 2.083 s, System: 5.475 s]
          Range (min … max):   23.234 s … 24.019 s    3 runs
    
    Users can avoid the issue by using --cache=writeback[1] but the defaults
    should give good performance for the common use case.
    
    [1] https://bugzilla.redhat.com/1990656
    
    Signed-off-by: Nir Soffer <nsoffer@redhat.com>
    Message-Id: <20210813205519.50518-1-nsoffer@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    CC: qemu-stable@nongnu.org
    Signed-off-by: Eric Blake <eblake@redhat.com>
    (cherry picked from commit 09615257058a0ae87b837bb041f56f7312d9ead8)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 docs/tools/qemu-nbd.rst | 6 ++++--
 qemu-nbd.c              | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst
index ee862fa0bc..5643da26e9 100644
--- a/docs/tools/qemu-nbd.rst
+++ b/docs/tools/qemu-nbd.rst
@@ -98,8 +98,10 @@ driver options if ``--image-opts`` is specified.
 
 .. option:: --cache=CACHE
 
-  The cache mode to be used with the file.  See the documentation of
-  the emulator's ``-drive cache=...`` option for allowed values.
+  The cache mode to be used with the file. Valid values are:
+  ``none``, ``writeback`` (the default), ``writethrough``,
+  ``directsync`` and ``unsafe``. See the documentation of
+  the emulator's ``-drive cache=...`` option for more info.
 
 .. option:: -n, --nocache
 
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 26ffbf15af..6c18fcd19a 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -135,7 +135,9 @@ static void usage(const char *name)
 "                            'snapshot.id=[ID],snapshot.name=[NAME]', or\n"
 "                            '[ID_OR_NAME]'\n"
 "  -n, --nocache             disable host cache\n"
-"      --cache=MODE          set cache mode (none, writeback, ...)\n"
+"      --cache=MODE          set cache mode used to access the disk image, the\n"
+"                            valid options are: 'none', 'writeback' (default),\n"
+"                            'writethrough', 'directsync' and 'unsafe'\n"
 "      --aio=MODE            set AIO mode (native, io_uring or threads)\n"
 "      --discard=MODE        set discard mode (ignore, unmap)\n"
 "      --detect-zeroes=MODE  set detect-zeroes mode (off, on, unmap)\n"
@@ -552,7 +554,7 @@ int main(int argc, char **argv)
     bool alloc_depth = false;
     const char *tlscredsid = NULL;
     bool imageOpts = false;
-    bool writethrough = true;
+    bool writethrough = false; /* Client will flush as needed. */
     bool fork_process = false;
     bool list = false;
     int old_stderr = -1;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:11:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256818.440927 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j28-0003tk-Nq; Wed, 12 Jan 2022 19:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256818.440927; Wed, 12 Jan 2022 19:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j28-0003tc-Ko; Wed, 12 Jan 2022 19:11:44 +0000
Received: by outflank-mailman (input) for mailman id 256818;
 Wed, 12 Jan 2022 19: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 1n7j26-0003tK-N0
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j26-00056Z-M9
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j26-0001KN-L8
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=Bm7m5m4864wam09awio+Gzx0aw/67xbZXaJXwkgfb7M=; b=4QoiW6abgGkOSTsKfWyfWfnt7Z
	gnSXdManj/f08Vz9x/GlK0LcfjKfMQbM9ZCciLxONAYx9nY52+enlhjcnrAqxw1kemvya2XzLRcGD
	WuOtuCM8FcEii4ESq1CiN/7uYRzQAVrXMpHFAWbkKl63eOfGlTdm7Fp4jG68+N3Ns4M0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hmp: Unbreak "change vnc"
Message-Id: <E1n7j26-0001KN-L8@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:11:42 +0000

commit 7637373b23f32fb88e100df455addc4107a054dc
Author:     Markus Armbruster <armbru@redhat.com>
AuthorDate: Thu Sep 9 10:12:18 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:41 2021 -0600

    hmp: Unbreak "change vnc"
    
    HMP command "change vnc" can take the password as argument, or prompt
    for it:
    
        (qemu) change vnc password 123
        (qemu) change vnc password
        Password: ***
        (qemu)
    
    This regressed in commit cfb5387a1d "hmp: remove "change vnc TARGET"
    command", v6.0.0.
    
        (qemu) change vnc passwd 123
        Password: ***
        (qemu) change vnc passwd
        (qemu)
    
    The latter passes NULL to qmp_change_vnc_password(), which is a no-no.
    Looks like it puts the display into "password required, but none set"
    state.
    
    The logic error is easy to miss in review, but testing should've
    caught it.
    
    Fix the obvious way.
    
    Fixes: cfb5387a1de2acda23fb5c97d2378b9e7ddf8025
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
    Message-Id: <20210909081219.308065-2-armbru@redhat.com>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 6193344f9337f8b76cd44ce94a32c9900d907d35)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index e00255f7ee..a7e197a90b 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1496,7 +1496,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
         }
         if (strcmp(target, "passwd") == 0 ||
             strcmp(target, "password") == 0) {
-            if (arg) {
+            if (!arg) {
                 MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
                 monitor_read_password(hmp_mon, hmp_change_read_arg, NULL);
                 return;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:11:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256819.440931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j2I-0003yC-PG; Wed, 12 Jan 2022 19:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256819.440931; Wed, 12 Jan 2022 19: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 1n7j2I-0003y4-MF; Wed, 12 Jan 2022 19:11:54 +0000
Received: by outflank-mailman (input) for mailman id 256819;
 Wed, 12 Jan 2022 19: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 1n7j2G-0003xs-Pr
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j2G-00056j-P5
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j2G-0001Kx-OK
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=LiTXjMgGD0FkriOWGO8b1bs2hlpRvpuWtk0mi1BuuqA=; b=FFF+vQfSKZalfMVN07E37B8uVm
	JMPKTNTVnWpeVhMqc5giTJrALWxzclu+Qu8zMGRn6lyvCvdgk722KaWAW422RpMWvZqfVglghHeTB
	GMrs35eM6vQp9ZKkcx0fLFuXKRpIUN9qCJiJfaM87cnYySbOkXPwIw9IIgXPMU9KZbrQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
Message-Id: <E1n7j2G-0001Kx-OK@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:11:52 +0000

commit f0dee5a40d27ad8ce2d180141bb5953fce44a146
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Wed Sep 29 18:24:43 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:49 2021 -0600

    virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
    
    Apparently, we don't have to duplicate the string.
    
    Fixes: 722a3c783ef4 ("virtio-pci: Send qapi events when the virtio-mem size changes")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Markus Armbruster <armbru@redhat.com>
    Message-Id: <20210929162445.64060-2-david@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 75b98cb9f6456ccf194211beffcbf93b0a995fa4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio-mem-pci.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c
index fa5395cd88..7e384b7397 100644
--- a/hw/virtio/virtio-mem-pci.c
+++ b/hw/virtio/virtio-mem-pci.c
@@ -88,13 +88,8 @@ static void virtio_mem_pci_size_change_notify(Notifier *notifier, void *data)
                                          size_change_notifier);
     DeviceState *dev = DEVICE(pci_mem);
     const uint64_t * const size_p = data;
-    const char *id = NULL;
 
-    if (dev->id) {
-        id = g_strdup(dev->id);
-    }
-
-    qapi_event_send_memory_device_size_change(!!id, id, *size_p);
+    qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p);
 }
 
 static void virtio_mem_pci_class_init(ObjectClass *klass, void *data)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:12:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256820.440935 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j2S-00040v-Qf; Wed, 12 Jan 2022 19:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256820.440935; Wed, 12 Jan 2022 19: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 1n7j2S-00040n-Nk; Wed, 12 Jan 2022 19:12:04 +0000
Received: by outflank-mailman (input) for mailman id 256820;
 Wed, 12 Jan 2022 19: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 1n7j2Q-00040K-TC
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j2Q-00057P-SQ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j2Q-0001Lr-RX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=syHnjDit29cywVs9ZxlIU8Bkv2383V6pwqkToGI8PWE=; b=dDFBnQkFRzvo3dpsnnK123BmLB
	ZCSJFu+nYGBhZt1ZyfmDeEh42KM1kSqyXtTmH7FeUSQMEUmDHJIvSVBTnBxtm/rZV0UHvUIyZdDxk
	/IBXXFsOmNVkhxz9jwlOHq/H3JdlOzEth4aMxWHXxrV0l0qDkTC8j4aMN1+8brgJaXpw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] uas: add stream number sanity checks.
Message-Id: <E1n7j2Q-0001Lr-RX@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:12:02 +0000

commit 23ba9f170feca6ae0d8442aab2c89656f9b01288
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Wed Aug 18 14:05:05 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:53 2021 -0600

    uas: add stream number sanity checks.
    
    The device uses the guest-supplied stream number unchecked, which can
    lead to guest-triggered out-of-band access to the UASDevice->data3 and
    UASDevice->status3 fields.  Add the missing checks.
    
    Fixes: CVE-2021-3713
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reported-by: Chen Zhe <chenzhe@huawei.com>
    Reported-by: Tan Jingguo <tanjingguo@huawei.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20210818120505.1258262-2-kraxel@redhat.com>
    (cherry picked from commit 13b250b12ad3c59114a6a17d59caf073ce45b33a)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/usb/dev-uas.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 263056231c..f6309a5ebf 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -840,6 +840,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         }
         break;
     case UAS_PIPE_ID_STATUS:
+        if (p->stream > UAS_MAX_STREAMS) {
+            goto err_stream;
+        }
         if (p->stream) {
             QTAILQ_FOREACH(st, &uas->results, next) {
                 if (st->stream == p->stream) {
@@ -867,6 +870,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         break;
     case UAS_PIPE_ID_DATA_IN:
     case UAS_PIPE_ID_DATA_OUT:
+        if (p->stream > UAS_MAX_STREAMS) {
+            goto err_stream;
+        }
         if (p->stream) {
             req = usb_uas_find_request(uas, p->stream);
         } else {
@@ -902,6 +908,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         p->status = USB_RET_STALL;
         break;
     }
+
+err_stream:
+    error_report("%s: invalid stream %d", __func__, p->stream);
+    p->status = USB_RET_STALL;
+    return;
 }
 
 static void usb_uas_unrealize(USBDevice *dev)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:12:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256821.440939 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j2c-00043h-Si; Wed, 12 Jan 2022 19:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256821.440939; Wed, 12 Jan 2022 19: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 1n7j2c-00043Z-PJ; Wed, 12 Jan 2022 19:12:14 +0000
Received: by outflank-mailman (input) for mailman id 256821;
 Wed, 12 Jan 2022 19: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 1n7j2b-00043D-0F
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j2a-00057a-Vo
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j2a-0001MQ-Uy
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=Y20a2eEzlwgwN4i7dCVpVANljLY95RWkJR/+QtxZLFQ=; b=QjXpneQBV7RbOXYKiVMJlk5lh7
	1KYM1HoY9V4XsG2Q8ZmIIdfpgETdtGB+CFAhvu8kRuUzCKOfEfPbLI8EcKGeXkdpozQLXNtUUc7sC
	VhcxJbEzSZVb6AUjhLDDgOxvLZxr8UcXbkHemgBG8xDk+WXGdpHDT262Tx0uVbcVjlCM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] vhost-user: fix duplicated notifier MR init
Message-Id: <E1n7j2a-0001MQ-Uy@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:12:12 +0000

commit 695c25e167e217aab74f964afe9b93a8a52b4d41
Author:     Xueming Li <xuemingl@nvidia.com>
AuthorDate: Fri Oct 8 16:02:15 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:02 2021 -0600

    vhost-user: fix duplicated notifier MR init
    
    In case of device resume after suspend, VQ notifier MR still valid.
    Duplicated registrations explode memory block list and slow down device
    resume.
    
    Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers")
    Cc: tiwei.bie@intel.com
    Cc: qemu-stable@nongnu.org
    Cc: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
    
    Signed-off-by: Xueming Li <xuemingl@nvidia.com>
    Message-Id: <20211008080215.590292-1-xuemingl@nvidia.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit a1ed9ef1de87c3e86ff68589604298ec90875a14)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/vhost-user.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index aec6cc1990..7b35c5d71d 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1469,8 +1469,9 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
 
     name = g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]",
                            user, queue_idx);
-    memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
-                                      page_size, addr);
+    if (!n->mr.ram) /* Don't init again after suspend. */
+        memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
+                                          page_size, addr);
     g_free(name);
 
     if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:12:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256823.440943 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j2l-00046H-U9; Wed, 12 Jan 2022 19:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256823.440943; Wed, 12 Jan 2022 19: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 1n7j2l-000469-R4; Wed, 12 Jan 2022 19:12:23 +0000
Received: by outflank-mailman (input) for mailman id 256823;
 Wed, 12 Jan 2022 19: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 1n7j2l-00045z-3o
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j2l-00057p-33
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j2l-0001N7-29
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=9TpUNGJj1I2Lm/V6vzeqfGLOraGnyzc8tc4+gZJ+0Ug=; b=csF6eTsGoHnRe0liyW9RFjQST/
	S3QpJ3nUgv+Gw/BPienJ6j8usl/EUuqJf5PJ7EUTknb9QTzUZVSjP2Dl3o0we+1xRMmYn/1eBxWoD
	cJj5IVvXJIigwQ0luIb1k/CBMylkxNB8wmma3EaaxzWR65Eo8C8UrxAPLeldZbfiqzdw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
Message-Id: <E1n7j2l-0001N7-29@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:12:23 +0000

commit 3c6e5df1f6badec09cdbbff29b16668a92816b68
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Mon Oct 11 22:10:47 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:07 2021 -0600

    libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
    
    We end up not copying the mmap_addr of all existing regions, resulting
    in a SEGFAULT once we actually try to map/access anything within our
    memory regions.
    
    Fixes: 875b9fd97b34 ("Support individual region unmap in libvhost-user")
    Cc: qemu-stable@nongnu.org
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
    Cc: Stefan Hajnoczi <stefanha@redhat.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Coiby Xu <coiby.xu@gmail.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20211011201047.62587-1-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 6889eb2d431ae962e3e083b57bff47cd573cb1c4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 subprojects/libvhost-user/libvhost-user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index bf09693255..787f4d2d4f 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -816,6 +816,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
             shadow_regions[j].gpa = dev->regions[i].gpa;
             shadow_regions[j].size = dev->regions[i].size;
             shadow_regions[j].qva = dev->regions[i].qva;
+            shadow_regions[j].mmap_addr = dev->regions[i].mmap_addr;
             shadow_regions[j].mmap_offset = dev->regions[i].mmap_offset;
             j++;
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:12:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256824.440947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j2v-00049E-Vn; Wed, 12 Jan 2022 19:12:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256824.440947; Wed, 12 Jan 2022 19:12:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j2v-000496-Sq; Wed, 12 Jan 2022 19:12:33 +0000
Received: by outflank-mailman (input) for mailman id 256824;
 Wed, 12 Jan 2022 19: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 1n7j2v-00048x-72
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j2v-000585-6L
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j2v-0001Nn-5Z
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=+m9+SJHFYb97ILCRujPAreR3h5mxI2damu887GB9NcM=; b=dNIWGu3lgahhBbqdX+zpSAPG0e
	CaOlLSv+i9VzERrXwMeSy28yObD/bUTT+aZv6u6dWKiOkQQNLorEve3yVz0PR9mIo/9UypAuEPHLQ
	QUuwO+Ue0QBL5qTK3mI1VmUNcb6aYPla6L9UsSzrhufEfshwqELtBRJ5HJCtAp5BdtYs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()
Message-Id: <E1n7j2v-0001Nn-5Z@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:12:33 +0000

commit b19de1137bc158cc2782750f1a94be153a5fd54d
Author:     Helge Deller <deller@gmx.de>
AuthorDate: Tue May 25 22:12:45 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:12 2021 -0600

    hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()
    
    The CDE desktop on HP-UX 10 shows wrongly rendered pixels when the local screen
    menu is closed. This bug was introduced by commit c7050f3f167b
    ("hw/display/artist: Refactor x/y coordination extraction") which converted the
    coordinate extraction in artist_vram_read() and artist_vram_write() to use the
    ADDR_TO_X and ADDR_TO_Y macros, but forgot to right-shift the address by 2 as
    it was done before.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Fixes: c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction")
    Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Cc: Richard Henderson <richard.henderson@linaro.org>
    Cc: Sven Schnelle <svens@stackframe.org>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Message-Id: <YK1aPb8keur9W7h2@ls3530>
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    (cherry picked from commit 01f750f5fef1afd8f6abc0548910f87d473e26d5)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/display/artist.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/display/artist.c b/hw/display/artist.c
index aa7bd594aa..21b7fd1b44 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -1170,8 +1170,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,
     }
 
     buf = vram_write_buffer(s);
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (!buf->size) {
         return;
@@ -1232,8 +1232,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)
         return 0;
     }
 
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (posy > buf->height || posx > buf->width) {
         return 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:12:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256825.440951 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j36-0004CI-1p; Wed, 12 Jan 2022 19:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256825.440951; Wed, 12 Jan 2022 19:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j35-0004C9-UL; Wed, 12 Jan 2022 19:12:43 +0000
Received: by outflank-mailman (input) for mailman id 256825;
 Wed, 12 Jan 2022 19: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 1n7j35-0004C1-BC
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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 1n7j35-00058K-AC
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j35-0001OW-9G
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19: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=DXbQ5HmdQI1bXA7cos5RLgVv9YqRJ7wDsJt1/CLIeZw=; b=CAB9ESxTe7Yv5UIXs1rIBkYeiL
	nvINTvlMUXDCKBHgLPbxQBqdXBGI5RH3+UdOhPzpQCGOOaRd7dbrgyIWfsDfFdh5k/1qs56KpStXA
	iWMJ+gOyAoOBWZpQRPr/oIHQ45pjFlmHsITC0zuPlx0+3923TWbDYqC+UXEDsweK1zQY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model
Message-Id: <E1n7j35-0001OW-9G@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:12:43 +0000

commit ff6d391e10d04a457994be8c032c6c38c0118ebc
Author:     Yang Zhong <yang.zhong@intel.com>
AuthorDate: Fri Aug 20 13:46:11 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:43:09 2021 -0600

    i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model
    
    The AVX_VNNI feature is not in Cooperlake platform, remove it
    from cpu model.
    
    Signed-off-by: Yang Zhong <yang.zhong@intel.com>
    Message-Id: <20210820054611.84303-1-yang.zhong@intel.com>
    Fixes: c1826ea6a052 ("i386/cpu: Expose AVX_VNNI instruction to guest")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    (cherry picked from commit f429dbf8fc526a9cacf531176b28d0c65701475a)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 34a7ce865b..24ddc5b926 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3102,7 +3102,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
             MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO |
             MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO,
         .features[FEAT_7_1_EAX] =
-            CPUID_7_1_EAX_AVX_VNNI | CPUID_7_1_EAX_AVX512_BF16,
+            CPUID_7_1_EAX_AVX512_BF16,
         /* XSAVES is added in version 2 */
         .features[FEAT_XSAVE] =
             CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:12:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256829.440966 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j3G-0004Vy-Fr; Wed, 12 Jan 2022 19:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256829.440966; Wed, 12 Jan 2022 19:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j3G-0004Vk-Av; Wed, 12 Jan 2022 19:12:54 +0000
Received: by outflank-mailman (input) for mailman id 256829;
 Wed, 12 Jan 2022 19:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3F-0004VL-EA
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3F-00058a-DS
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3F-0001PF-CY
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PykOn/aQL99kKoEgDDuN6jwrSsBM/5ntrjykCRMokiE=; b=o8pQ3O9J2KCK81CYzShrbmou/Q
	UovTIAMRQZv8mw9Ce9sPnljk+qFttP2E+xEqSzQioJn53vIZ33tjtb4dSEJkLGpwgik7WWWqJXA5H
	e/tFxuZGQ3LVHmlb/3cvSMf00883vxL82wChwQ1BS2t9lThcpJhUy++jNqBhE3CLW4lE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] 9pfs: fix crash in v9fs_walk()
Message-Id: <E1n7j3F-0001PF-CY@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:12:53 +0000

commit abeee2a470f549b2730365f350416cc932340324
Author:     Christian Schoenebeck <qemu_oss@crudebyte.com>
AuthorDate: Wed Sep 1 18:15:10 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:46:48 2021 -0600

    9pfs: fix crash in v9fs_walk()
    
    v9fs_walk() utilizes the v9fs_co_run_in_worker({...}) macro to run the
    supplied fs driver code block on a background worker thread.
    
    When either the 'Twalk' client request was interrupted or if the client
    requested fid for that 'Twalk' request caused a stat error then that
    fs driver code block was left by 'break' keyword, with the intention to
    return from worker thread back to main thread as well:
    
        v9fs_co_run_in_worker({
            if (v9fs_request_cancelled(pdu)) {
                err = -EINTR;
                break;
            }
            err = s->ops->lstat(&s->ctx, &dpath, &fidst);
            if (err < 0) {
                err = -errno;
                break;
            }
            ...
        });
    
    However that 'break;' statement also skipped the v9fs_co_run_in_worker()
    macro's final and mandatory
    
        /* re-enter back to qemu thread */
        qemu_coroutine_yield();
    
    call and thus caused the rest of v9fs_walk() to be continued being
    executed on the worker thread instead of main thread, eventually
    leading to a crash in the transport virtio transport driver.
    
    To fix this issue and to prevent the same error from happening again by
    other users of v9fs_co_run_in_worker() in future, auto wrap the supplied
    code block into its own
    
        do { } while (0);
    
    loop inside the 'v9fs_co_run_in_worker' macro definition.
    
    Full discussion and backtrace:
    https://lists.gnu.org/archive/html/qemu-devel/2021-08/msg05209.html
    https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg00174.html
    
    Fixes: 8d6cb100731c4d28535adbf2a3c2d1f29be3fef4
    Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Greg Kurz <groug@kaod.org>
    Message-Id: <E1mLTBg-0002Bh-2D@lizzy.crudebyte.com>
    (cherry picked from commit f83df00900816476cca41bb536e4d532b297d76e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/9pfs/coth.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h
index c51289903d..f83c7dda7b 100644
--- a/hw/9pfs/coth.h
+++ b/hw/9pfs/coth.h
@@ -51,7 +51,9 @@
          */                                                             \
         qemu_coroutine_yield();                                         \
         qemu_bh_delete(co_bh);                                          \
-        code_block;                                                     \
+        do {                                                            \
+            code_block;                                                 \
+        } while (0);                                                    \
         /* re-enter back to qemu thread */                              \
         qemu_coroutine_yield();                                         \
     } while (0)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:13:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256831.440970 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j3Q-0004dp-IB; Wed, 12 Jan 2022 19:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256831.440970; Wed, 12 Jan 2022 19:13: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 1n7j3Q-0004df-Ev; Wed, 12 Jan 2022 19:13:04 +0000
Received: by outflank-mailman (input) for mailman id 256831;
 Wed, 12 Jan 2022 19:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3P-0004cv-HM
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3P-00059E-Gd
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3P-0001RY-Fp
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=K+RH/uNXrrl3uyv3erk0WcR60CYFhDtg33CsJHyyoWQ=; b=TB1hoWDhH9RhfA852OTVTSIEuy
	WHuVkZN+yX/OrTW2MZB9m9ls8CPHbE27Tr2M/M/0TL0HahHarXt4D/a14i8Xz5CAr6mZC1GMf/9XG
	NMVYewM/u54MKy0p8kmBoolzVYMP51cPTfFdXb5tFq0dfGg3kEwl96/M1My42YCxvWa0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] plugins/execlog: removed unintended "s" at the end of log lines.
Message-Id: <E1n7j3P-0001RY-Fp@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:13:03 +0000

commit f97853c8cb849cc4773005183c974dec641d8493
Author:     Mahmoud Mandour <ma.mandourr@gmail.com>
AuthorDate: Fri Aug 6 15:10:12 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:48:25 2021 -0600

    plugins/execlog: removed unintended "s" at the end of log lines.
    
    Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20210803151428.125323-1-ma.mandourr@gmail.com>
    Message-Id: <20210806141015.2487502-2-alex.bennee@linaro.org>
    Cc: qemu-stable@nongnu.org
    (cherry picked from commit b40310616d2bd550279dd22b05483c3c613a00ff)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 contrib/plugins/execlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index 2de9f0d7d4..a5275dcc15 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -67,7 +67,7 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *udata)
     /* Print previous instruction in cache */
     if (s->len) {
         qemu_plugin_outs(s->str);
-        qemu_plugin_outs("s\n");
+        qemu_plugin_outs("\n");
     }
 
     /* Store new instruction in cache */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:13:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256835.440973 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j3a-0004pY-JR; Wed, 12 Jan 2022 19:13:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256835.440973; Wed, 12 Jan 2022 19:13: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 1n7j3a-0004pQ-GT; Wed, 12 Jan 2022 19:13:14 +0000
Received: by outflank-mailman (input) for mailman id 256835;
 Wed, 12 Jan 2022 19:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3Z-0004o5-KP
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3Z-00059P-Jh
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3Z-0001SK-J3
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LSPrrrBH16uRiIm7jplMkZnftNiW7P7OYyxmRFoNTCA=; b=p1l3QK/eEFj9ck9q66BmlsP02f
	4zpnOMb05N0tSzLGfXSW0Y66irmBwq+cVYU3IvM3Z77A7bgHPvR25t8ENkbBTt1JDgainFgMs0TT/
	mlB5f8lB1zfHdOit2CSmbPOOP7ysqSdsNZSUKn2px84nZnBLsJdfvar+H3VBCYnathiM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] plugins: do not limit exported symbols if modules are active
Message-Id: <E1n7j3Z-0001SK-J3@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:13:13 +0000

commit ec0803510289fcb15d8b4f8699169ac35f842bfe
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Wed Aug 11 12:05:50 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:49:09 2021 -0600

    plugins: do not limit exported symbols if modules are active
    
    On Mac --enable-modules and --enable-plugins are currently incompatible, because the
    Apple -Wl,-exported_symbols_list command line options prevents the export of any
    symbols needed by the modules.  On x86 -Wl,--dynamic-list does not have this effect,
    but only because the -Wl,--export-dynamic option provided by gmodule-2.0.pc overrides
    it.  On Apple there is no -Wl,--export-dynamic, because it is the default, and thus
    no override.
    
    Either way, when modules are active there is no reason to include the plugin_ldflags.
    While at it, avoid the useless -Wl,--export-dynamic when --enable-plugins is
    specified but --enable-modules is not; this way, the GNU and Apple configurations
    are more similar.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/516
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    [AJB: fix noexport to no-export]
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20210811100550.54714-1-pbonzini@redhat.com>
    Cc: qemu-stable@nongnu.org
    (cherry picked from commit b906acace2d4f68b6ff8de73739a773cc4851436)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 configure           |  5 ++---
 plugins/meson.build | 14 ++++++++------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 9a79a004d7..7659870810 100755
--- a/configure
+++ b/configure
@@ -3187,9 +3187,8 @@ glib_req_ver=2.56
 glib_modules=gthread-2.0
 if test "$modules" = yes; then
     glib_modules="$glib_modules gmodule-export-2.0"
-fi
-if test "$plugins" = "yes"; then
-    glib_modules="$glib_modules gmodule-2.0"
+elif test "$plugins" = "yes"; then
+    glib_modules="$glib_modules gmodule-no-export-2.0"
 fi
 
 for i in $glib_modules; do
diff --git a/plugins/meson.build b/plugins/meson.build
index e77723010e..bfd5c9822a 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -1,9 +1,11 @@
-if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
-  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
-elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
-  plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
-else
-  plugin_ldflags = []
+plugin_ldflags = []
+# Modules need more symbols than just those in plugins/qemu-plugins.symbols
+if not enable_modules
+  if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
+    plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
+  elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
+    plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
+  endif
 endif
 
 specific_ss.add(when: 'CONFIG_PLUGIN', if_true: [files(
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:13:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:13:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256837.440978 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j3k-0004wp-L3; Wed, 12 Jan 2022 19:13:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256837.440978; Wed, 12 Jan 2022 19:13: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 1n7j3k-0004wh-Hw; Wed, 12 Jan 2022 19:13:24 +0000
Received: by outflank-mailman (input) for mailman id 256837;
 Wed, 12 Jan 2022 19:13: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 1n7j3j-0004wU-NX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3j-00059b-Mp
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3j-0001TC-M4
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nOcOHdTR1d0EiddTQuUF6zelbSRuafl0AA0aNY8+/mQ=; b=KexttHGFVTHZMHyMYbQKall+2N
	6lMXTjXvf4KdTueMweVkpbciP1AURkEfVU7RHquy9336CZ6Vyd5PBQ+q5Twmon7rb7aaBSXnqjc+s
	I4pEU42AjUF1RzVBi4x1ofhvmeuHp0QgjJbobfFGW77VZnBb2qkdCjcshVprL6fEjpUE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] qemu-sockets: fix unix socket path copy (again)
Message-Id: <E1n7j3j-0001TC-M4@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:13:23 +0000

commit 3ee93e456d08415cc1abe4110f6e0c9b0ead0bbc
Author:     Michael Tokarev <mjt@tls.msk.ru>
AuthorDate: Wed Sep 1 16:16:24 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:55:36 2021 -0600

    qemu-sockets: fix unix socket path copy (again)
    
    Commit 4cfd970ec188558daa6214f26203fe553fb1e01f added an
    assert which ensures the path within an address of a unix
    socket returned from the kernel is at least one byte and
    does not exceed sun_path buffer. Both of this constraints
    are wrong:
    
    A unix socket can be unnamed, in this case the path is
    completely empty (not even \0)
    
    And some implementations (notable linux) can add extra
    trailing byte (\0) _after_ the sun_path buffer if we
    passed buffer larger than it (and we do).
    
    So remove the assertion (since it causes real-life breakage)
    but at the same time fix the usage of sun_path. Namely,
    we should not access sun_path[0] if kernel did not return
    it at all (this is the case for unnamed sockets),
    and use the returned salen when copyig actual path as an
    upper constraint for the amount of bytes to copy - this
    will ensure we wont exceed the information provided by
    the kernel, regardless whenever there is a trailing \0
    or not. This also helps with unnamed sockets.
    
    Note the case of abstract socket, the sun_path is actually
    a blob and can contain \0 characters, - it should not be
    passed to g_strndup and the like, it should be accessed by
    memcpy-like functions.
    
    Fixes: 4cfd970ec188558daa6214f26203fe553fb1e01f
    Fixes: http://bugs.debian.org/993145
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    CC: qemu-stable@nongnu.org
    (cherry picked from commit 118d527f2e4baec5fe8060b22a6212468b8e4d3f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 util/qemu-sockets.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index f2f3676d1f..c5043999e9 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1345,25 +1345,22 @@ socket_sockaddr_to_address_unix(struct sockaddr_storage *sa,
     SocketAddress *addr;
     struct sockaddr_un *su = (struct sockaddr_un *)sa;
 
-    assert(salen >= sizeof(su->sun_family) + 1 &&
-           salen <= sizeof(struct sockaddr_un));
-
     addr = g_new0(SocketAddress, 1);
     addr->type = SOCKET_ADDRESS_TYPE_UNIX;
+    salen -= offsetof(struct sockaddr_un, sun_path);
 #ifdef CONFIG_LINUX
-    if (!su->sun_path[0]) {
+    if (salen > 0 && !su->sun_path[0]) {
         /* Linux abstract socket */
-        addr->u.q_unix.path = g_strndup(su->sun_path + 1,
-                                        salen - sizeof(su->sun_family) - 1);
+        addr->u.q_unix.path = g_strndup(su->sun_path + 1, salen - 1);
         addr->u.q_unix.has_abstract = true;
         addr->u.q_unix.abstract = true;
         addr->u.q_unix.has_tight = true;
-        addr->u.q_unix.tight = salen < sizeof(*su);
+        addr->u.q_unix.tight = salen < sizeof(su->sun_path);
         return addr;
     }
 #endif
 
-    addr->u.q_unix.path = g_strndup(su->sun_path, sizeof(su->sun_path));
+    addr->u.q_unix.path = g_strndup(su->sun_path, salen);
     return addr;
 }
 #endif /* WIN32 */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:13:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:13:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256838.440982 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j3u-00051Z-Mi; Wed, 12 Jan 2022 19:13:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256838.440982; Wed, 12 Jan 2022 19:13:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j3u-00051R-JW; Wed, 12 Jan 2022 19:13:34 +0000
Received: by outflank-mailman (input) for mailman id 256838;
 Wed, 12 Jan 2022 19:13: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 1n7j3t-00051I-Qh
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13: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 1n7j3t-00059l-Q3
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j3t-0001Tt-PF
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s6F2nKxZTL3zykRQHn73OyKbVSz7zS8t74YakRsTsEw=; b=W8L+k/jiSpKFgYLYQKVpvYtd9H
	jpnoJgZiKpCwy2woZRtdeEReXK81B6H0Lu4UoMEcDd8zvH6kBvGTG8s59smF/QIUB5++P+jNaIvqc
	4PcAAw0LjEwgLs69MdwCX0x/4//XhKI40fn6bcQZkWieE8OHvH9olKRjC73GZCtWGtW0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] vhost-vsock: fix migration issue when seqpacket is supported
Message-Id: <E1n7j3t-0001Tt-PF@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:13:33 +0000

commit 246ccfbf44a0ff5967393adb7b7a79dc7c353eb6
Author:     Stefano Garzarella <sgarzare@redhat.com>
AuthorDate: Tue Sep 21 18:16:41 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:04:13 2021 -0600

    vhost-vsock: fix migration issue when seqpacket is supported
    
    Commit 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support")
    enabled the SEQPACKET feature bit.
    This commit is released with QEMU 6.1, so if we try to migrate a VM where
    the host kernel supports SEQPACKET but machine type version is less than
    6.1, we get the following errors:
    
        Features 0x130000002 unsupported. Allowed features: 0x179000000
        Failed to load virtio-vhost_vsock:virtio
        error while loading state for instance 0x0 of device '0000:00:05.0/virtio-vhost_vsock'
        load of migration failed: Operation not permitted
    
    Let's disable the feature bit for machine types < 6.1.
    We add a new OnOffAuto property for this, called `seqpacket`.
    When it is `auto` (default), QEMU behaves as before, trying to enable the
    feature, when it is `on` QEMU will fail if the backend (vhost-vsock
    kernel module) doesn't support it.
    
    Fixes: 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support")
    Cc: qemu-stable@nongnu.org
    Reported-by: Jiang Wang <jiang.wang@bytedance.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20210921161642.206461-2-sgarzare@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d6a9378f47515c6d70dbff4912c5740c98709880)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/core/machine.c               |  1 +
 hw/virtio/vhost-vsock.c         | 19 ++++++++++++++++---
 include/hw/virtio/vhost-vsock.h |  3 +++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 54e040587d..2cf2f321f9 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -43,6 +43,7 @@ GlobalProperty hw_compat_6_0[] = {
     { "nvme-ns", "eui64-default", "off"},
     { "e1000", "init-vet", "off" },
     { "e1000e", "init-vet", "off" },
+    { "vhost-vsock-device", "seqpacket", "off" },
 };
 const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0);
 
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 1b1a5c70ed..dade0da031 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -114,10 +114,21 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          Error **errp)
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+
+    if (vsock->seqpacket != ON_OFF_AUTO_OFF) {
+        virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
+    }
+
+    requested_features = vhost_get_features(&vvc->vhost_dev, feature_bits,
+                                            requested_features);
+
+    if (vsock->seqpacket == ON_OFF_AUTO_ON &&
+        !virtio_has_feature(requested_features, VIRTIO_VSOCK_F_SEQPACKET)) {
+        error_setg(errp, "vhost-vsock backend doesn't support seqpacket");
+    }
 
-    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
-    return vhost_get_features(&vvc->vhost_dev, feature_bits,
-                                requested_features);
+    return requested_features;
 }
 
 static const VMStateDescription vmstate_virtio_vhost_vsock = {
@@ -218,6 +229,8 @@ static void vhost_vsock_device_unrealize(DeviceState *dev)
 static Property vhost_vsock_properties[] = {
     DEFINE_PROP_UINT64("guest-cid", VHostVSock, conf.guest_cid, 0),
     DEFINE_PROP_STRING("vhostfd", VHostVSock, conf.vhostfd),
+    DEFINE_PROP_ON_OFF_AUTO("seqpacket", VHostVSock, seqpacket,
+                            ON_OFF_AUTO_AUTO),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsock.h
index 84f4e727c7..3f121a624f 100644
--- a/include/hw/virtio/vhost-vsock.h
+++ b/include/hw/virtio/vhost-vsock.h
@@ -30,6 +30,9 @@ struct VHostVSock {
     VHostVSockCommon parent;
     VHostVSockConf conf;
 
+    /* features */
+    OnOffAuto seqpacket;
+
     /*< public >*/
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:13:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:13:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256839.440986 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j45-000559-O8; Wed, 12 Jan 2022 19:13:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256839.440986; Wed, 12 Jan 2022 19:13:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j45-000551-L7; Wed, 12 Jan 2022 19:13:45 +0000
Received: by outflank-mailman (input) for mailman id 256839;
 Wed, 12 Jan 2022 19:13: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 1n7j43-00054g-UK
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13: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 1n7j43-00059x-Ta
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j43-0001UU-Sg
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cCiHsBzqlgvjcMlukinJwDCWWczPbt5ivJw+C4e/oI8=; b=vVob7SfQrpLBrz4XIhag/UZpOM
	/4oSq/O+/SSOYJcuf1MtesuM8cFBkJ6UEL2eONvcplslbI3Tz1Qy4isOlE42lNRf6wn0q5LysUFlU
	8vM3+vhyl3mGp8ejtthzQJKeSZBWb+F1xbOGRhSo+YaVjQr3OF4QhuP3e1F+t6+WgFyE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/arm/virt: Rename default_bus_bypass_iommu
Message-Id: <E1n7j43-0001UU-Sg@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:13:43 +0000

commit 36cfd11a867ebcf015db24b666ec28deb05c101f
Author:     Jean-Philippe Brucker <jean-philippe@linaro.org>
AuthorDate: Tue Oct 26 10:37:34 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:07:27 2021 -0600

    hw/arm/virt: Rename default_bus_bypass_iommu
    
    Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine
    parameter definitions cannot use underscores, because keyval_dashify()
    transforms them to dashes and the parser doesn't find the parameter.
    
    This affects option default_bus_bypass_iommu which was introduced in the
    same release:
    
    $ qemu-system-aarch64 -M virt,default_bus_bypass_iommu=on
    qemu-system-aarch64: Property 'virt-6.1-machine.default-bus-bypass-iommu' not found
    
    Rename the parameter to "default-bus-bypass-iommu". Passing
    "default_bus_bypass_iommu" is still valid since the underscore are
    transformed automatically.
    
    Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option")
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Tested-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20211026093733.2144161-1-jean-philippe@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit 9dad363a223df8269175d218413aa8cd265e078e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/arm/virt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 81eda46b0b..106be60fd4 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2677,10 +2677,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
                                           "Set the IOMMU type. "
                                           "Valid values are none and smmuv3");
 
-    object_class_property_add_bool(oc, "default_bus_bypass_iommu",
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
                                    virt_get_default_bus_bypass_iommu,
                                    virt_set_default_bus_bypass_iommu);
-    object_class_property_set_description(oc, "default_bus_bypass_iommu",
+    object_class_property_set_description(oc, "default-bus-bypass-iommu",
                                           "Set on/off to enable/disable "
                                           "bypass_iommu for default root bus");
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:13:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:13:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256840.440990 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4F-00058e-Pm; Wed, 12 Jan 2022 19:13:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256840.440990; Wed, 12 Jan 2022 19:13:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4F-00058W-Mm; Wed, 12 Jan 2022 19:13:55 +0000
Received: by outflank-mailman (input) for mailman id 256840;
 Wed, 12 Jan 2022 19:13:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4E-00058J-19
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4E-0005A7-0R
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4D-0001VH-Vy
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:13: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=vyncuwjkqetKX2VN9VfJFrU0z81CUniMruayl5yH1cA=; b=jF7zA7k9HvAEmquaeizotmOAIS
	lrCOiaWN7O0qZoWiyVfsfBp3Wk6lKJ/6W+ZSw5J9DRIxTGdfJGVpuOwP5biPQA4+2X82J4Sd+J8G7
	TjQmNsw9Br1FECBlJsLjOX4WnuZe1NnPJEPFgQ3m6bicsui4cppqW+1SrnUiG2HY9mQ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/i386: Rename default_bus_bypass_iommu
Message-Id: <E1n7j4D-0001VH-Vy@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:13:53 +0000

commit 5cf977a2a18a0f6c92b36e852639f26b993d76e5
Author:     Jean-Philippe Brucker <jean-philippe@linaro.org>
AuthorDate: Mon Oct 25 11:47:38 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:07:48 2021 -0600

    hw/i386: Rename default_bus_bypass_iommu
    
    Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine
    parameter definitions cannot use underscores, because keyval_dashify()
    transforms them to dashes and the parser doesn't find the parameter.
    
    This affects option default_bus_bypass_iommu which was introduced in the
    same release:
    
    $ qemu-system-x86_64 -M q35,default_bus_bypass_iommu=on
    qemu-system-x86_64: Property 'pc-q35-6.1-machine.default-bus-bypass-iommu' not found
    
    Rename the parameter to "default-bus-bypass-iommu". Passing
    "default_bus_bypass_iommu" is still valid since the underscore are
    transformed automatically.
    
    Fixes: c9e96b04fc19 ("hw/i386: Add a default_bus_bypass_iommu pc machine option")
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Tested-by: Eric Auger <eric.auger@redhat.com>
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Message-Id: <20211025104737.1560274-1-jean-philippe@linaro.org>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 739b38630c45585cd9d372d44537f69c0b2b4346)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/i386/pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c2b9d62a35..1d421ae2f8 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1763,7 +1763,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     object_class_property_add_bool(oc, "hpet",
         pc_machine_get_hpet, pc_machine_set_hpet);
 
-    object_class_property_add_bool(oc, "default_bus_bypass_iommu",
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
         pc_machine_get_default_bus_bypass_iommu,
         pc_machine_set_default_bus_bypass_iommu);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:14:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256841.440994 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4P-0005BU-RU; Wed, 12 Jan 2022 19:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256841.440994; Wed, 12 Jan 2022 19:14:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4P-0005BM-OH; Wed, 12 Jan 2022 19:14:05 +0000
Received: by outflank-mailman (input) for mailman id 256841;
 Wed, 12 Jan 2022 19:14:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4O-0005B9-5F
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4O-0005An-4R
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4O-0001WK-2u
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GgsC6vFYi0Q2H5Hy2K4Sb+9xeScjb7MrOKYcGf8s4W4=; b=JUdpZ2K5JxQu82Ys3EHE/SKJLH
	0+6LGM2KeWVl1mNP+DdavO24G9D7e6wK3/zVQUmLWm6yJxPtZEzoQqoKLvDWasahYuE0bDHROvOWG
	w1kqXM4tlcbDLDicRJ7u3+BdNCGFQ/G7UAi1XUg4HIsAyLDVHEJ1daxLmlVojoq97J/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] bios-tables-test: allow changes in DSDT ACPI tables for q35
Message-Id: <E1n7j4O-0001WK-2u@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:14:04 +0000

commit c66f5dfc127adaadb67a2d95e5e58e6542aaa9eb
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:36 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:12:31 2021 -0600

    bios-tables-test: allow changes in DSDT ACPI tables for q35
    
    We are going to commit a change to fix IO address range allocated for acpi pci
    hotplug in q35. This affects DSDT tables. This change allows DSDT table
    modification so that unit tests are not broken.
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20210916132838.3469580-2-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 9f29e872d5b3973003701401cf659cfb71c95013)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..c06da38af3 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,13 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT",
+"tests/data/acpi/q35/DSDT.tis.tpm12",
+"tests/data/acpi/q35/DSDT.tis.tpm2",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.mmio64",
+"tests/data/acpi/q35/DSDT.ipmibt",
+"tests/data/acpi/q35/DSDT.cphp",
+"tests/data/acpi/q35/DSDT.memhp",
+"tests/data/acpi/q35/DSDT.numamem",
+"tests/data/acpi/q35/DSDT.nohpet",
+"tests/data/acpi/q35/DSDT.dimmpxm",
+"tests/data/acpi/q35/DSDT.acpihmat",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:14:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:14:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256842.440998 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4Z-0005F4-Ue; Wed, 12 Jan 2022 19:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256842.440998; Wed, 12 Jan 2022 19:14:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4Z-0005Ew-Rd; Wed, 12 Jan 2022 19:14:15 +0000
Received: by outflank-mailman (input) for mailman id 256842;
 Wed, 12 Jan 2022 19:14:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4Y-0005El-8o
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4Y-0005Ar-7z
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4Y-0001XA-6y
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7WStNXN5delufKUjW+WTLntbEQKvVxtE3/YEVVGjX2M=; b=yAHFB9yETOzBUlGAYAd+DE7bHH
	wpKq8F4aSPWHbs98b8MxgpSzpRGzB0nzDQmlg6gumIzpCk6fB5ceP3gup8Ulwv+l5RO5aniGn9LLK
	tDBYYs70xgSwW4EsYCAIlUwvYiIcIjPNYjJ6aHnM7QIuqvxZm8mepgElrQ1BgHdfYMG0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
Message-Id: <E1n7j4Y-0001XA-6y@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:14:14 +0000

commit 9e80a430ed5996734ef35c457d793b8106f16d15
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:37 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:12:38 2021 -0600

    hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
    
    Change caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
    selects an IO address range for acpi based PCI hotplug for q35 arbitrarily. It
    starts at address 0x0cc4 and ends at 0x0cdb. At the time when the patch was
    written but the final version of the patch was not yet pushed upstream, this
    address range was free and did not conflict with any other IO address ranges.
    However, with the following change, this address range was no
    longer conflict free as in this change, the IO address range
    (value of ACPI_PCIHP_SIZE) was incremented by four bytes:
    
    b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
    
    This can be seen from the output of QMP command 'info mtree' :
    
    0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
    0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
    0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
    0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
    0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
    0000000000000cc4-0000000000000cdb (prio 0, i/o): acpi-pci-hotplug
    0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
    
    It shows that there is a region of conflict between IO regions of acpi
    pci hotplug and acpi cpu hotplug.
    
    Unfortunately, the change caf108bc58790 did not update the IO address range
    appropriately before it was pushed upstream to accommodate the increased
    length of the IO address space introduced in change b32bd763a1ca92.
    
    Due to this bug, windows guests complain 'This device cannot find
    enough free resources it can use' in the device manager panel for extended
    IO buses. This issue also breaks the correct functioning of pci hotplug as the
    following shows that the IO space for pci hotplug has been truncated:
    
    (qemu) info mtree -f
    FlatView #0
     AS "I/O", root: io
     Root memory region: io
      0000000000000cc4-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
      0000000000000cd8-0000000000000cf7 (prio 0, i/o): acpi-cpu-hotplug
    
    Therefore, in this fix, we adjust the IO address range for the acpi pci
    hotplug so that it does not conflict with cpu hotplug and there is no
    truncation of IO spaces. The starting IO address of PCI hotplug region
    has been decremented by four bytes in order to accommodate four byte
    increment in the IO address space introduced by change
    b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
    
    After fixing, the following are the corrected IO ranges:
    
    0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
    0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
    0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
    0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
    0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
    0000000000000cc0-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
    0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
    
    This change has been tested using a Windows Server 2019 guest VM. Windows
    no longer complains after this change.
    
    Fixes: caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/561
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Julia Suvorova <jusual@redhat.com>
    Message-Id: <20210916132838.3469580-3-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 0e780da76a6fe283a20283856718bca3986c104f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 include/hw/acpi/ich9.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index a329ce43ab..f04f1791bd 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -29,7 +29,7 @@
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/acpi/tco.h"
 
-#define ACPI_PCIHP_ADDR_ICH9 0x0cc4
+#define ACPI_PCIHP_ADDR_ICH9 0x0cc0
 
 typedef struct ICH9LPCPMRegs {
     /*
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:14:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:14:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256844.441002 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4j-0005Ih-WD; Wed, 12 Jan 2022 19:14:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256844.441002; Wed, 12 Jan 2022 19:14:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4j-0005IZ-TB; Wed, 12 Jan 2022 19:14:25 +0000
Received: by outflank-mailman (input) for mailman id 256844;
 Wed, 12 Jan 2022 19:14:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4i-0005I9-C4
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4i-0005Av-BJ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4i-0001YA-AY
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7LjgaeXAqr9qV382TFbRv9NSGt1Zi/JXH6kENwd38LA=; b=jzJuRQuf0s2LO5SKLwADcLCzaW
	V1DTJdro5kpk/QaS+cj9obiMn6BSauBbNadZwajzvE8mzauTr9wAf/XOkU7UcJsNbcY+KY+4bd8kf
	TCvOW3yfFn5xPV6ytsz38AwkBir3RoD53ChYuelJ8pGT/ppV66ZDvBpIEQBzql1JFzLM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] bios-tables-test: Update ACPI DSDT table golden blobs for q35
Message-Id: <E1n7j4i-0001YA-AY@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:14:24 +0000

commit 3aa2c2cd679dcf86e67f8c466c2e3c0bc5e1155f
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:38 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:27:44 2021 -0600

    bios-tables-test: Update ACPI DSDT table golden blobs for q35
    
    We have modified the IO address range for ACPI pci hotplug in q35. See change:
    
    5adcc9e39e6a5 ("hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35")
    
    The ACPI DSDT table golden blobs must be regenrated in order to make the unit tests
    pass. This change updates the golden ACPI DSDT table blobs.
    
    Following is the ASL diff between the blobs:
    
    @@ -1,30 +1,30 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT, Tue Sep 14 09:04:06 2021
    + * Disassembly of /tmp/aml-52DP90, Tue Sep 14 09:04:06 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
      *     Length           0x00002061 (8289)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xE5
    + *     Checksum         0xF9
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
    @@ -226,46 +226,46 @@
                 Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                 {
                     IO (Decode16,
                         0x0070,             // Range Minimum
                         0x0070,             // Range Maximum
                         0x01,               // Alignment
                         0x08,               // Length
                         )
                     IRQNoFlags ()
                         {8}
                 })
             }
         }
    
         Scope (_SB.PCI0)
         {
    -        OperationRegion (PCST, SystemIO, 0x0CC4, 0x08)
    +        OperationRegion (PCST, SystemIO, 0x0CC0, 0x08)
             Field (PCST, DWordAcc, NoLock, WriteAsZeros)
             {
                 PCIU,   32,
                 PCID,   32
             }
    
    -        OperationRegion (SEJ, SystemIO, 0x0CCC, 0x04)
    +        OperationRegion (SEJ, SystemIO, 0x0CC8, 0x04)
             Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
             {
                 B0EJ,   32
             }
    
    -        OperationRegion (BNMR, SystemIO, 0x0CD4, 0x08)
    +        OperationRegion (BNMR, SystemIO, 0x0CD0, 0x08)
             Field (BNMR, DWordAcc, NoLock, WriteAsZeros)
             {
                 BNUM,   32,
                 PIDX,   32
             }
    
             Mutex (BLCK, 0x00)
             Method (PCEJ, 2, NotSerialized)
             {
                 Acquire (BLCK, 0xFFFF)
                 BNUM = Arg0
                 B0EJ = (One << Arg1)
                 Release (BLCK)
                 Return (Zero)
             }
    
    @@ -3185,34 +3185,34 @@
                         0x0620,             // Range Minimum
                         0x0620,             // Range Maximum
                         0x01,               // Alignment
                         0x10,               // Length
                         )
                 })
             }
    
             Device (PHPR)
             {
                 Name (_HID, "PNP0A06" /* Generic Container Device */)  // _HID: Hardware ID
                 Name (_UID, "PCI Hotplug resources")  // _UID: Unique ID
                 Name (_STA, 0x0B)  // _STA: Status
                 Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                 {
                     IO (Decode16,
    -                    0x0CC4,             // Range Minimum
    -                    0x0CC4,             // Range Maximum
    +                    0x0CC0,             // Range Minimum
    +                    0x0CC0,             // Range Maximum
                         0x01,               // Alignment
                         0x18,               // Length
                         )
                 })
             }
         }
    
         Scope (\)
         {
             Name (_S3, Package (0x04)  // _S3_: S3 System State
             {
                 One,
                 One,
                 Zero,
                 Zero
             })
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20210916132838.3469580-4-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 500eb21cff08dfb0478db9b34f2fdba69eb31496)
    *drop dependency on 75539b886a ("tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs")
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT                    | Bin 8289 -> 8289 bytes
 tests/data/acpi/q35/DSDT.acpihmat           | Bin 9614 -> 9614 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 11003 -> 11003 bytes
 tests/data/acpi/q35/DSDT.cphp               | Bin 8753 -> 8753 bytes
 tests/data/acpi/q35/DSDT.dimmpxm            | Bin 9943 -> 9943 bytes
 tests/data/acpi/q35/DSDT.ipmibt             | Bin 8364 -> 8364 bytes
 tests/data/acpi/q35/DSDT.memhp              | Bin 9648 -> 9648 bytes
 tests/data/acpi/q35/DSDT.mmio64             | Bin 9419 -> 9419 bytes
 tests/data/acpi/q35/DSDT.nohpet             | Bin 8147 -> 8147 bytes
 tests/data/acpi/q35/DSDT.numamem            | Bin 8295 -> 8295 bytes
 tests/data/acpi/q35/DSDT.tis                | Bin 8894 -> 8894 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |  12 ------------
 12 files changed, 12 deletions(-)

diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT
index 842533f53e..281fc82c03 100644
Binary files a/tests/data/acpi/q35/DSDT and b/tests/data/acpi/q35/DSDT differ
diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.acpihmat
index 8d00f2ea0d..8c1e05a11a 100644
Binary files a/tests/data/acpi/q35/DSDT.acpihmat and b/tests/data/acpi/q35/DSDT.acpihmat differ
diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge
index 55ad4bd7ab..6f1464b6c7 100644
Binary files a/tests/data/acpi/q35/DSDT.bridge and b/tests/data/acpi/q35/DSDT.bridge differ
diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp
index ccde2add9f..f8337ff519 100644
Binary files a/tests/data/acpi/q35/DSDT.cphp and b/tests/data/acpi/q35/DSDT.cphp differ
diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.dimmpxm
index b062e30117..fe5820d93d 100644
Binary files a/tests/data/acpi/q35/DSDT.dimmpxm and b/tests/data/acpi/q35/DSDT.dimmpxm differ
diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt
index 1c5737692f..6317410658 100644
Binary files a/tests/data/acpi/q35/DSDT.ipmibt and b/tests/data/acpi/q35/DSDT.ipmibt differ
diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp
index 7b6f6487b2..9bc11518fc 100644
Binary files a/tests/data/acpi/q35/DSDT.memhp and b/tests/data/acpi/q35/DSDT.memhp differ
diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/q35/DSDT.mmio64
index 2e0a772a85..713288a12e 100644
Binary files a/tests/data/acpi/q35/DSDT.mmio64 and b/tests/data/acpi/q35/DSDT.mmio64 differ
diff --git a/tests/data/acpi/q35/DSDT.nohpet b/tests/data/acpi/q35/DSDT.nohpet
index ceb61f4115..e8202e6ddf 100644
Binary files a/tests/data/acpi/q35/DSDT.nohpet and b/tests/data/acpi/q35/DSDT.nohpet differ
diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem
index a3f846df54..151e7cf429 100644
Binary files a/tests/data/acpi/q35/DSDT.numamem and b/tests/data/acpi/q35/DSDT.numamem differ
diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis
index d1433e3c14..c92d4d29c7 100644
Binary files a/tests/data/acpi/q35/DSDT.tis and b/tests/data/acpi/q35/DSDT.tis differ
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index c06da38af3..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,13 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT",
-"tests/data/acpi/q35/DSDT.tis.tpm12",
-"tests/data/acpi/q35/DSDT.tis.tpm2",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.mmio64",
-"tests/data/acpi/q35/DSDT.ipmibt",
-"tests/data/acpi/q35/DSDT.cphp",
-"tests/data/acpi/q35/DSDT.memhp",
-"tests/data/acpi/q35/DSDT.numamem",
-"tests/data/acpi/q35/DSDT.nohpet",
-"tests/data/acpi/q35/DSDT.dimmpxm",
-"tests/data/acpi/q35/DSDT.acpihmat",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:14:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:14:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256845.441006 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j4u-0005MJ-1S; Wed, 12 Jan 2022 19:14:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256845.441006; Wed, 12 Jan 2022 19:14: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 1n7j4t-0005MB-Un; Wed, 12 Jan 2022 19:14:35 +0000
Received: by outflank-mailman (input) for mailman id 256845;
 Wed, 12 Jan 2022 19:14:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4s-0005Lq-GK
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4s-0005Az-Fg
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j4s-0001ZM-EY
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OSr7gaVCuBk4gA8uPEg9/7GOCHTB5/zYxNggEzDz/28=; b=NRP1QdZ78+psaWP6tjrr1ERl4m
	xQovZ+/n02h/EF1oLtPRUuFo8B6DGXR543MybKMs9Vl96Jl+qg6YFzN5t8ZFohZO4UXoaXbWQYfWI
	K8ry/BG+lSWU9gB13jPY3hV29sYTsDsrZBHW+hHfspNLO2RNOp+WcC9AtAK1YOnKmbwE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] block: introduce max_hw_iov for use in scsi-generic
Message-Id: <E1n7j4s-0001ZM-EY@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:14:34 +0000

commit a43e057bd6095108fbe99b6a21d4857186aa3df3
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Sep 23 09:04:36 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:53:15 2021 -0600

    block: introduce max_hw_iov for use in scsi-generic
    
    Linux limits the size of iovecs to 1024 (UIO_MAXIOV in the kernel
    sources, IOV_MAX in POSIX).  Because of this, on some host adapters
    requests with many iovecs are rejected with -EINVAL by the
    io_submit() or readv()/writev() system calls.
    
    In fact, the same limit applies to SG_IO as well.  To fix both the
    EINVAL and the possible performance issues from using fewer iovecs
    than allowed by Linux (some HBAs have max_segments as low as 128),
    introduce a separate entry in BlockLimits to hold the max_segments
    value from sysfs.  This new limit is used only for SG_IO and clamped
    to bs->bl.max_iov anyway, just like max_hw_transfer is clamped to
    bs->bl.max_transfer.
    
    Reported-by: Halil Pasic <pasic@linux.ibm.com>
    Cc: Hanna Reitz <hreitz@redhat.com>
    Cc: Kevin Wolf <kwolf@redhat.com>
    Cc: qemu-block@nongnu.org
    Cc: qemu-stable@nongnu.org
    Fixes: 18473467d5 ("file-posix: try BLKSECTGET on block devices too, do not round to power of 2", 2021-06-25)
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210923130436.1187591-1-pbonzini@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit cc071629539dc1f303175a7e2d4ab854c0a8b20f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 block/block-backend.c          | 6 ++++++
 block/file-posix.c             | 2 +-
 block/io.c                     | 1 +
 hw/scsi/scsi-generic.c         | 2 +-
 include/block/block_int.h      | 7 +++++++
 include/sysemu/block-backend.h | 1 +
 6 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index deb55c272e..6320752aa2 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1978,6 +1978,12 @@ uint32_t blk_get_max_transfer(BlockBackend *blk)
     return ROUND_DOWN(max, blk_get_request_alignment(blk));
 }
 
+int blk_get_max_hw_iov(BlockBackend *blk)
+{
+    return MIN_NON_ZERO(blk->root->bs->bl.max_hw_iov,
+                        blk->root->bs->bl.max_iov);
+}
+
 int blk_get_max_iov(BlockBackend *blk)
 {
     return blk->root->bs->bl.max_iov;
diff --git a/block/file-posix.c b/block/file-posix.c
index cb9bffe047..1567edb3d5 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1273,7 +1273,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
 
         ret = hdev_get_max_segments(s->fd, &st);
         if (ret > 0) {
-            bs->bl.max_iov = ret;
+            bs->bl.max_hw_iov = ret;
         }
     }
 }
diff --git a/block/io.c b/block/io.c
index a19942718b..f38e7f81d8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -136,6 +136,7 @@ static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src)
     dst->min_mem_alignment = MAX(dst->min_mem_alignment,
                                  src->min_mem_alignment);
     dst->max_iov = MIN_NON_ZERO(dst->max_iov, src->max_iov);
+    dst->max_hw_iov = MIN_NON_ZERO(dst->max_hw_iov, src->max_hw_iov);
 }
 
 typedef struct BdrvRefreshLimitsState {
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 665baf900e..0306ccc7b1 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -180,7 +180,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
         page = r->req.cmd.buf[2];
         if (page == 0xb0) {
             uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
-            uint32_t max_iov = blk_get_max_iov(s->conf.blk);
+            uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
 
             assert(max_transfer);
             max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index f1a54db0f8..c31cbd034a 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -702,6 +702,13 @@ typedef struct BlockLimits {
      */
     uint64_t max_hw_transfer;
 
+    /* Maximal number of scatter/gather elements allowed by the hardware.
+     * Applies whenever transfers to the device bypass the kernel I/O
+     * scheduler, for example with SG_IO.  If larger than max_iov
+     * or if zero, blk_get_max_hw_iov will fall back to max_iov.
+     */
+    int max_hw_iov;
+
     /* memory alignment, in bytes so that no bounce buffer is needed */
     size_t min_mem_alignment;
 
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 9ac5f7bbd3..5daec61f6e 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -210,6 +210,7 @@ uint32_t blk_get_request_alignment(BlockBackend *blk);
 uint32_t blk_get_max_transfer(BlockBackend *blk);
 uint64_t blk_get_max_hw_transfer(BlockBackend *blk);
 int blk_get_max_iov(BlockBackend *blk);
+int blk_get_max_hw_iov(BlockBackend *blk);
 void blk_set_guest_block_size(BlockBackend *blk, int align);
 void *blk_try_blockalign(BlockBackend *blk, size_t size);
 void *blk_blockalign(BlockBackend *blk, size_t size);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:14:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:14:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256846.441010 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j54-0005Pl-34; Wed, 12 Jan 2022 19:14:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256846.441010; Wed, 12 Jan 2022 19:14:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j53-0005Pc-WE; Wed, 12 Jan 2022 19:14:46 +0000
Received: by outflank-mailman (input) for mailman id 256846;
 Wed, 12 Jan 2022 19:14:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j52-0005PL-KH
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j52-0005B6-Jd
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j52-0001aC-Hz
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UrSf2dXt/SI8kZDUqPhZ2Ph9qG0KfvQJxMnPvYPU+no=; b=ceFHdBSMRYrgRVTlvazkYB9s3T
	YQhQCEg7fWlIC144dYWbvSAEvt4/YhTrkQIXJyVuR2aIxvQWeImefPsOnPXcn9IK3xG5gam9GFkx2
	THE9/4IU3HYXnaQa8xiYzClTenJkHjXcWb8W8vHYNg55oy/uR2jRZhwtaQwItk2/fD/U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] pci: fix PCI resource reserve capability on BE
Message-Id: <E1n7j52-0001aC-Hz@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:14:44 +0000

commit 24101e36f1c2c782c8c2d055b477e0e0beaf4c68
Author:     Michael S. Tsirkin <mst@redhat.com>
AuthorDate: Wed Oct 20 05:48:54 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:01:41 2021 -0600

    pci: fix PCI resource reserve capability on BE
    
    PCI resource reserve capability should use LE format as all other PCI
    things. If we don't then seabios won't boot:
    
    === PCI new allocation pass #1 ===
    PCI: check devices
    PCI: QEMU resource reserve cap: size 10000000000000 type io
    PCI: secondary bus 1 size 10000000000000 type io
    PCI: secondary bus 1 size 00200000 type mem
    PCI: secondary bus 1 size 00200000 type prefmem
    === PCI new allocation pass #2 ===
    PCI: out of I/O address space
    
    This became more important since we started reserving IO by default,
    previously no one noticed.
    
    Fixes: e2a6290aab ("hw/pcie-root-port: Fix hotplug for PCI devices requiring IO")
    Cc: marcel.apfelbaum@gmail.com
    Fixes: 226263fb5c ("hw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port")
    Cc: zuban32s@gmail.com
    Fixes: 6755e618d0 ("hw/pci: add PCI resource reserve capability to legacy PCI bridge")
    Cc: jing2.liu@linux.intel.com
    Tested-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    (cherry picked from commit 0e464f7d993113119f0fd17b890831440734ce15)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/pci/pci_bridge.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 3789c17edc..6a1e8e433c 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
     PCIBridgeQemuCap cap = {
             .len = cap_len,
             .type = REDHAT_PCI_CAP_RESOURCE_RESERVE,
-            .bus_res = res_reserve.bus,
-            .io = res_reserve.io,
-            .mem = res_reserve.mem_non_pref,
-            .mem_pref_32 = res_reserve.mem_pref_32,
-            .mem_pref_64 = res_reserve.mem_pref_64
+            .bus_res = cpu_to_le32(res_reserve.bus),
+            .io = cpu_to_le64(res_reserve.io),
+            .mem = cpu_to_le32(res_reserve.mem_non_pref),
+            .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32),
+            .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64)
     };
 
     int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:14:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:14:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256848.441015 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5E-0005T9-5k; Wed, 12 Jan 2022 19:14:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256848.441015; Wed, 12 Jan 2022 19:14:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5E-0005T1-1X; Wed, 12 Jan 2022 19:14:56 +0000
Received: by outflank-mailman (input) for mailman id 256848;
 Wed, 12 Jan 2022 19:14:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5C-0005Sr-NZ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5C-0005BJ-Mr
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5C-0001aw-Lw
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:14:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R64Xanw8EL7pz+T//qnVxgr88RhGTO8cSi0Ots/d7N8=; b=KJ96U5/Mxq6hAw7EWSBhFjlnvG
	qFfHz513DGR2Y5AUydv8+i3i3Quefzio8qMJ3It2c+Y/PEsA1w0gpb8aQo/bTa/cUUjt3wyWqz7gU
	NmebclfdigZHibaTHdy0m8DJB8X9eDEQpDJzlkcu3UUgilI/vLOeQ6M/Fjjp3orawu8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
Message-Id: <E1n7j5C-0001aw-Lw@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:14:54 +0000

commit a759dc19ecf11410593db40e2ce7dba3c06f16ac
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:48 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:15 2021 -0600

    tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
    
    We are adding a new unit test to cover the acpi hotplug support in q35 for
    multi-function bridges. This test uses a new table DSDT.multi-bridge.
    We need to allow changes in DSDT acpi table for addition of this new
    unit test.
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-2-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit 6dcb1cc9512c6b4cd8f85abc537abaf6f6c0738b)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT.multi-bridge       | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 1 +
 2 files changed, 1 insertion(+)

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..dabc024f53 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.multi-bridge",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:15:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:15:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256849.441018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5O-0005Wd-8O; Wed, 12 Jan 2022 19:15:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256849.441018; Wed, 12 Jan 2022 19:15:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5O-0005WV-5I; Wed, 12 Jan 2022 19:15:06 +0000
Received: by outflank-mailman (input) for mailman id 256849;
 Wed, 12 Jan 2022 19:15: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 1n7j5M-0005WK-Qw
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5M-0005CB-QE
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5M-0001c4-PH
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UWaouTL0CLOadXW6/EQL+DWMqXtJRh59YuBCp78o1Ao=; b=hsRZHpNjWzvd1gB0cf1AfuE9O6
	AqX+fCkkIl3q6A7/C1naT0ZDrzfSEvKaeOMBCnJIzotPptPJ+lKj9ERawh3BdvvtZmYalg+39Q9Pw
	Zg7ySXtdWB622Nfswd13d7t4xBaJ77u9tOw1kzrhVPHE1edFXkOGTLPDxDo7ErCCJPvM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
Message-Id: <E1n7j5M-0001c4-PH@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:15:04 +0000

commit 8319de607faa33113ec9b47778da77e7ad4d9c8b
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:49 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:20 2021 -0600

    tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
    
    commit d7346e614f4ec ("acpi: x86: pcihp: add support hotplug on multifunction bridges")
    added ACPI hotplug descriptions for cold plugged bridges for functions other
    than 0. For all other devices, the ACPI hotplug descriptions are limited to
    function 0 only. This change adds unit tests for this feature.
    
    This test adds the following devices to qemu and then checks the changes
    introduced in the DSDT table due to the addition of the following devices:
    
    (a) a multifunction bridge device
    (b) a bridge device with function 1
    (c) a non-bridge device with function 2
    
    In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
    For (a) we should find a hotplug AML description for function 0.
    
    The following diff compares the DSDT table AML with the new unit test before
    and after the change d7346e614f4ec is introduced. In other words,
    this diff reflects the changes that occurs in the DSDT table due to the change
    d7346e614f4ec .
    
    @@ -1,60 +1,38 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT.multi-bridge, Thu Oct  7 18:56:05 2021
    + * Disassembly of /tmp/aml-AN0DA1, Thu Oct  7 18:56:05 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
    - *     Length           0x000020FE (8446)
    + *     Length           0x00002187 (8583)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xDE
    + *     Checksum         0x8D
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
    -    /*
    -     * iASL Warning: There was 1 external control method found during
    -     * disassembly, but only 0 were resolved (1 unresolved). Additional
    -     * ACPI tables may be required to properly disassemble the code. This
    -     * resulting disassembler output file may not compile because the
    -     * disassembler did not know how many arguments to assign to the
    -     * unresolved methods. Note: SSDTs can be dynamically loaded at
    -     * runtime and may or may not be available via the host OS.
    -     *
    -     * In addition, the -fe option can be used to specify a file containing
    -     * control method external declarations with the associated method
    -     * argument counts. Each line of the file must be of the form:
    -     *     External (<method pathname>, MethodObj, <argument count>)
    -     * Invocation:
    -     *     iasl -fe refs.txt -d dsdt.aml
    -     *
    -     * The following methods were unresolved and many not compile properly
    -     * because the disassembler had to guess at the number of arguments
    -     * required for each:
    -     */
    -    External (_SB_.PCI0.S19_.PCNT, MethodObj)    // Warning: Unknown method, guessing 1 arguments
    -
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
             Method (DBUG, 1, NotSerialized)
             {
                 ToHexString (Arg0, Local0)
                 ToBuffer (Local0, Local0)
                 Local1 = (SizeOf (Local0) - One)
                 Local2 = Zero
                 While ((Local2 < Local1))
                 {
    @@ -3322,24 +3300,60 @@
                     Method (DVNT, 2, NotSerialized)
                     {
                         If ((Arg0 & One))
                         {
                             Notify (S00, Arg1)
                         }
                     }
    
                     Method (PCNT, 0, NotSerialized)
                     {
                         BNUM = One
                         DVNT (PCIU, One)
                         DVNT (PCID, 0x03)
                     }
                 }
    
    +            Device (S19)
    +            {
    +                Name (_ADR, 0x00030001)  // _ADR: Address
    +                Name (BSEL, Zero)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = Zero
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
                 Method (PCNT, 0, NotSerialized)
                 {
    -                ^S19.PCNT (^S10.PCNT ())
    +                ^S19.PCNT ()
    +                ^S10.PCNT ()
                 }
             }
         }
     }
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-3-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit 04dd78b9e85720226a148eef54b45cb02b463034)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/bios-tables-test.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 51d3a4e239..921f676e4c 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -859,6 +859,23 @@ static void test_acpi_q35_tcg_bridge(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_multif_bridge(void)
+{
+    test_data data = {
+        .machine = MACHINE_Q35,
+        .variant = ".multi-bridge",
+    };
+    test_acpi_one("-device pcie-root-port,id=pcie-root-port-0,"
+                  "multifunction=on,"
+                  "port=0x0,chassis=1,addr=0x2,bus=pcie.0 "
+                  "-device pcie-root-port,id=pcie-root-port-1,"
+                  "port=0x1,chassis=2,addr=0x3.0x1,bus=pcie.0 "
+                  "-device virtio-balloon,id=balloon0,"
+                  "bus=pcie.0,addr=0x4.0x2",
+                  &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_mmio64(void)
 {
     test_data data = {
@@ -1528,6 +1545,7 @@ int main(int argc, char *argv[])
                        test_acpi_piix4_no_acpi_pci_hotplug);
         qtest_add_func("acpi/q35", test_acpi_q35_tcg);
         qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
+        qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge);
         qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
         qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
         qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:15:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:15:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256850.441022 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5Y-0005ZN-9p; Wed, 12 Jan 2022 19:15:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256850.441022; Wed, 12 Jan 2022 19:15:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5Y-0005ZF-6r; Wed, 12 Jan 2022 19:15:16 +0000
Received: by outflank-mailman (input) for mailman id 256850;
 Wed, 12 Jan 2022 19:15:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5W-0005Yz-VG
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15: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 1n7j5W-0005CG-UZ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5W-0001cw-TI
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4Y+tKcb1Po/WAsDbdhaK50NSs9HDZHH8FfLDGrwIgPs=; b=V8mlt8ZgDSskhZruiocPK3Pf0Z
	Lskhtroib1ltjtu+N2z+LaXyJA+3BGuw7ehFGh09sCxsb7W7M3YOC1r2KX3UuX71SoYSvRXJOaJdB
	K+jXCUsw2vbur6WdYf81rV4tGHFH9G3NMgEKW09azc64nTwmb3xxKSEdz0CdTFcZS1o0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
Message-Id: <E1n7j5W-0001cw-TI@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:15:14 +0000

commit bbbdedb38692dc1005a17b465f6b92474356c1c0
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:50 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:24 2021 -0600

    tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
    
    We added a new unit test for testing acpi hotplug on multifunction bridges in
    q35 machines. Here, we update the DSDT table gloden master blob for this unit
    test.
    
    The test adds the following devices to qemu and then checks the changes
    introduced in the DSDT table due to the addition of the following devices:
    
    (a) a multifunction bridge device
    (b) a bridge device with function 1
    (c) a non-bridge device with function 2
    
    In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
    For (a) we should find a hotplug AML description for function 0.
    
    Following is the ASL diff between the original DSDT table and the modified DSDT
    table due to the unit test. We see that multifunction bridge on bus 2 and single
    function bridge on bus 3 function 1 are described, not the non-bridge balloon
    device on bus 4, function 2.
    
    @@ -1,30 +1,30 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT, Thu Oct  7 18:29:19 2021
    + * Disassembly of /tmp/aml-C7JCA1, Thu Oct  7 18:29:19 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
    - *     Length           0x00002061 (8289)
    + *     Length           0x00002187 (8583)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xF9
    + *     Checksum         0x8D
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
    @@ -3265,23 +3265,95 @@
                     Method (_S1D, 0, NotSerialized)  // _S1D: S1 Device State
                     {
                         Return (Zero)
                     }
    
                     Method (_S2D, 0, NotSerialized)  // _S2D: S2 Device State
                     {
                         Return (Zero)
                     }
    
                     Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
                     {
                         Return (Zero)
                     }
                 }
    
    +            Device (S10)
    +            {
    +                Name (_ADR, 0x00020000)  // _ADR: Address
    +                Name (BSEL, One)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = One
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
    +            Device (S19)
    +            {
    +                Name (_ADR, 0x00030001)  // _ADR: Address
    +                Name (BSEL, Zero)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = Zero
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
                 Method (PCNT, 0, NotSerialized)
                 {
    +                ^S19.PCNT ()
    +                ^S10.PCNT ()
                 }
             }
         }
     }
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-4-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit a8339e07f94a47f99560baef59d65a9e039aaf45)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 0 -> 8583 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   1 -
 2 files changed, 1 deletion(-)

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
index e69de29bb2..a24c713d22 100644
Binary files a/tests/data/acpi/q35/DSDT.multi-bridge and b/tests/data/acpi/q35/DSDT.multi-bridge differ
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dabc024f53..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.multi-bridge",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:15:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:15:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256851.441026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5i-0005cS-B9; Wed, 12 Jan 2022 19:15:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256851.441026; Wed, 12 Jan 2022 19:15:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5i-0005cK-8M; Wed, 12 Jan 2022 19:15:26 +0000
Received: by outflank-mailman (input) for mailman id 256851;
 Wed, 12 Jan 2022 19:15:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5h-0005c7-2t
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5h-0005CL-2F
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5h-0001ds-15
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R5aFLrBxyE0iUHQ8vyiG/OnQUmiwg4QKSj3h/8mstns=; b=BhMcCLeBkAowBgpkJcwDM27xXD
	j53b0x5F0cS9TJNpkYNM+r8/RwYNzkUMT1mD+bJcC0J4HHHwqYLi+payjIK/DSh30EkJ2WMCzEaWN
	4frnjbuhAtJ4nEEb0Y88KtqkPRz4rfV33zxq9VyhZ255agklHGZxIpx3V1RK8tFDETD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] block/file-posix: Fix return value translation for AIO discards
Message-Id: <E1n7j5h-0001ds-15@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:15:25 +0000

commit ebf660beb171d40af179f84a967b710199f81511
Author:     Ari Sundholm <ari@tuxera.com>
AuthorDate: Tue Oct 19 14:09:55 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:12:50 2021 -0600

    block/file-posix: Fix return value translation for AIO discards
    
    AIO discards regressed as a result of the following commit:
            0dfc7af2 block/file-posix: Optimize for macOS
    
    When trying to run blkdiscard within a Linux guest, the request would
    fail, with some errors in dmesg:
    
    ---- [ snip ] ----
    [    4.010070] sd 2:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK
    driverbyte=DRIVER_SENSE
    [    4.011061] sd 2:0:0:0: [sda] tag#0 Sense Key : Aborted Command
    [current]
    [    4.011061] sd 2:0:0:0: [sda] tag#0 Add. Sense: I/O process
    terminated
    [    4.011061] sd 2:0:0:0: [sda] tag#0 CDB: Unmap/Read sub-channel 42
    00 00 00 00 00 00 00 18 00
    [    4.011061] blk_update_request: I/O error, dev sda, sector 0
    ---- [ snip ] ----
    
    This turns out to be a result of a flaw in changes to the error value
    translation logic in handle_aiocb_discard(). The default return value
    may be left untranslated in some configurations, and the wrong variable
    is used in one translation.
    
    Fix both issues.
    
    Fixes: 0dfc7af2b28 ("block/file-posix: Optimize for macOS")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Ari Sundholm <ari@tuxera.com>
    Signed-off-by: Emil Karlson <jkarlson@tuxera.com>
    Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-Id: <20211019110954.4170931-1-ari@tuxera.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 13a028336f2c05e7ff47dfdaf30dfac7f4883e80)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 block/file-posix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 1567edb3d5..dd295cfc6d 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1807,7 +1807,7 @@ static int handle_aiocb_copy_range(void *opaque)
 static int handle_aiocb_discard(void *opaque)
 {
     RawPosixAIOData *aiocb = opaque;
-    int ret = -EOPNOTSUPP;
+    int ret = -ENOTSUP;
     BDRVRawState *s = aiocb->bs->opaque;
 
     if (!s->has_discard) {
@@ -1829,7 +1829,7 @@ static int handle_aiocb_discard(void *opaque)
 #ifdef CONFIG_FALLOCATE_PUNCH_HOLE
         ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                            aiocb->aio_offset, aiocb->aio_nbytes);
-        ret = translate_err(-errno);
+        ret = translate_err(ret);
 #elif defined(__APPLE__) && (__MACH__)
         fpunchhole_t fpunchhole;
         fpunchhole.fp_flags = 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:15:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:15:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256852.441030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j5t-0005fm-Cw; Wed, 12 Jan 2022 19:15:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256852.441030; Wed, 12 Jan 2022 19:15: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 1n7j5t-0005fe-9v; Wed, 12 Jan 2022 19:15:37 +0000
Received: by outflank-mailman (input) for mailman id 256852;
 Wed, 12 Jan 2022 19:15:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5r-0005fT-6A
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5r-0005CW-5V
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j5r-0001eZ-4p
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MwQ5m2yzLn/0/ohIt+ZtlOfnbAH4R5RQ9MWhRI9GX2U=; b=oA9D2XEx8jAyaUaEeawLBPfxV9
	9a2l4W3BJca88oFLXAzCaVMf59z1VRXV7JNuSm06FI8fndUGS98z/zXbVXilWkATM2F/ShaXOEfil
	L2x3woFluRgAjK7RsrEnzH/DJI06PrBWnEUHIOXIk6Z15OeLGJScKozj6ClP3odes69k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] Partially revert "build: -no-pie is no functional linker flag"
Message-Id: <E1n7j5r-0001eZ-4p@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:15:35 +0000

commit 43a457841f8c61dd4677ec018c3da4b0323ffb4b
Author:     Jessica Clarke <jrtc27@jrtc27.com>
AuthorDate: Thu Aug 5 20:25:45 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:13:38 2021 -0600

    Partially revert "build: -no-pie is no functional linker flag"
    
    This partially reverts commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53.
    
    This commit was misguided and broke using --disable-pie on any distro
    that enables PIE by default in their compiler driver, including Debian
    and its derivatives. Whilst -no-pie is not a linker flag, it is a
    compiler driver flag that ensures -pie is not automatically passed by it
    to the linker. Without it, all compile_prog checks will fail as any code
    built with the explicit -fno-pie will fail to link with the implicit
    default -pie due to trying to use position-dependent relocations. The
    only bug that needed fixing was LDFLAGS_NOPIE being used as a flag for
    the linker itself in pc-bios/optionrom/Makefile.
    
    Note this does not reinstate exporting LDFLAGS_NOPIE, as it is unused,
    since the only previous use was the one that should not have existed. I
    have also updated the comment for the -fno-pie and -no-pie checks to
    reflect what they're actually needed for.
    
    Fixes: bbd2d5a8120771ec59b86a80a1f51884e0a26e53
    Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
    Message-Id: <20210805192545.38279-1-jrtc27@jrtc27.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit ffd205ef2901bd65fcfbd09a98c0ff7cfcec5e4d)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 configure | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 7659870810..6e308ed77f 100755
--- a/configure
+++ b/configure
@@ -2246,9 +2246,11 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-# Check we support --no-pie first; we will need this for building ROMs.
+# Check we support -fno-pie and -no-pie first; we will need the former for
+# building ROMs, and both for everything if --disable-pie is passed.
 if compile_prog "-Werror -fno-pie" "-no-pie"; then
   CFLAGS_NOPIE="-fno-pie"
+  LDFLAGS_NOPIE="-no-pie"
 fi
 
 if test "$static" = "yes"; then
@@ -2264,6 +2266,7 @@ if test "$static" = "yes"; then
   fi
 elif test "$pie" = "no"; then
   CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
+  CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
   CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:15:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:15:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256853.441034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j62-0005ia-ET; Wed, 12 Jan 2022 19:15:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256853.441034; Wed, 12 Jan 2022 19:15: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 1n7j62-0005iS-BQ; Wed, 12 Jan 2022 19:15:46 +0000
Received: by outflank-mailman (input) for mailman id 256853;
 Wed, 12 Jan 2022 19:15:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j61-0005i7-92
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j61-0005Cd-8O
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j61-0001f9-7n
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0P9/l9UhGX0YFSdqcECok4h96UhDLlOKWOKKAozM4kU=; b=O+4kXbSoCHLUovalsuBxvA+vp6
	iayKl0By7JXdg4dFQU7scqiQnVU+G31WUiLsqwkLuo/Scez55QBibkiI3HVCGh+0hmDsVeyR5Gnj5
	FXdNECJBiKDChFe+ojrKfTbcUOO+g9wDzGqe9m29SbuwqyLieCXOqkhdiPiW1h0Sj5jA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] target-i386: mmu: use pg_mode instead of HF_LMA_MASK
Message-Id: <E1n7j61-0001f9-7n@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:15:45 +0000

commit cddfaf96ab2a6772dd87998af699f91ca15facfd
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Nov 4 14:45:20 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:18:25 2021 -0600

    target-i386: mmu: use pg_mode instead of HF_LMA_MASK
    
    Correctly look up the paging mode of the hypervisor when it is using 64-bit
    mode but the guest is not.
    
    Fixes: 68746930ae ("target/i386: use mmu_translate for NPT walk", 2021-05-11)
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 93eae3583256896dd91a4c2ca38dcbb8d4051cff)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index b6d940e04e..2dea4a248e 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -90,7 +90,7 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f
         target_ulong pdpe_addr;
 
 #ifdef TARGET_X86_64
-        if (env->hflags & HF_LMA_MASK) {
+        if (pg_mode & PG_MODE_LMA) {
             bool la57 = pg_mode & PG_MODE_LA57;
             uint64_t pml5e_addr, pml5e;
             uint64_t pml4e_addr, pml4e;
@@ -287,7 +287,7 @@ do_check_protect_pse36:
         *prot |= PAGE_EXEC;
     }
 
-    if (!(env->hflags & HF_LMA_MASK)) {
+    if (!(pg_mode & PG_MODE_LMA)) {
         pkr = 0;
     } else if (ptep & PG_USER_MASK) {
         pkr = pg_mode & PG_MODE_PKE ? env->pkru : 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:15:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:15:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256854.441038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j6C-0005m7-HA; Wed, 12 Jan 2022 19:15:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256854.441038; Wed, 12 Jan 2022 19:15: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 1n7j6C-0005lz-EG; Wed, 12 Jan 2022 19:15:56 +0000
Received: by outflank-mailman (input) for mailman id 256854;
 Wed, 12 Jan 2022 19:15:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6B-0005lt-CO
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6B-0005Ch-Bk
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6B-0001g4-Av
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:15:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nvUb6BytlKWL77wPgEsli0iszBLjRxk8esMqFlVMHOE=; b=UfLtesCYdEuyIOByUoJHVFhVFN
	xGbGELPg5YpREq5EwG4/P75yB0dRI1NmR3v+JDcMteuMg4SMA/oJ5KPPS93P0e/vCoIERnPXnPYop
	+vPnQ2wNoDRvTX0tQW/Eg7FqNzYBmmd4xWigAsJsUIXI5Uxwa2WQsE/m++mVrOALycEE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] target-i386: mmu: fix handling of noncanonical virtual addresses
Message-Id: <E1n7j6B-0001g4-Av@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:15:55 +0000

commit 3488bb205de0537ba5364ee1ee09cb07a26a4bb0
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Nov 4 14:47:46 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:19:00 2021 -0600

    target-i386: mmu: fix handling of noncanonical virtual addresses
    
    mmu_translate is supposed to return an error code for page faults; it is
    not able to handle other exceptions.  The #GP case for noncanonical
    virtual addresses is not handled correctly, and incorrectly raised as
    a page fault with error code 1.  Since it cannot happen for nested
    page tables, move it directly to handle_mmu_fault, even before the
    invocation of mmu_translate.
    
    Fixes: #676
    Fixes: 661ff4879e ("target/i386: extract mmu_translate", 2021-05-11)
    Cc: qemu-stable@nongnu.org
    Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b04dc92e013d55c9ac8082caefff45dcfb1310e7)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index 2dea4a248e..9fb59058ef 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -94,15 +94,6 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f
             bool la57 = pg_mode & PG_MODE_LA57;
             uint64_t pml5e_addr, pml5e;
             uint64_t pml4e_addr, pml4e;
-            int32_t sext;
-
-            /* test virtual address sign extension */
-            sext = la57 ? (int64_t)addr >> 56 : (int64_t)addr >> 47;
-            if (get_hphys_func && sext != 0 && sext != -1) {
-                env->error_code = 0;
-                cs->exception_index = EXCP0D_GPF;
-                return 1;
-            }
 
             if (la57) {
                 pml5e_addr = ((cr3 & ~0xfff) +
@@ -423,6 +414,18 @@ static int handle_mmu_fault(CPUState *cs, vaddr addr, int size,
         page_size = 4096;
     } else {
         pg_mode = get_pg_mode(env);
+        if (pg_mode & PG_MODE_LMA) {
+            int32_t sext;
+
+            /* test virtual address sign extension */
+            sext = (int64_t)addr >> (pg_mode & PG_MODE_LA57 ? 56 : 47);
+            if (sext != 0 && sext != -1) {
+                env->error_code = 0;
+                cs->exception_index = EXCP0D_GPF;
+                return 1;
+            }
+        }
+
         error_code = mmu_translate(cs, addr, get_hphys, env->cr[3], is_write1,
                                    mmu_idx, pg_mode,
                                    &paddr, &page_size, &prot);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:16:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:16:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256855.441042 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j6M-0005ov-If; Wed, 12 Jan 2022 19:16:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256855.441042; Wed, 12 Jan 2022 19:16: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 1n7j6M-0005on-Fg; Wed, 12 Jan 2022 19:16:06 +0000
Received: by outflank-mailman (input) for mailman id 256855;
 Wed, 12 Jan 2022 19:16:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6L-0005oe-Fq
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6L-0005DH-Er
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6L-0001h1-E7
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0aWG24AGAm2TUJ3Vpn/9c0PFHc8JaFJ9Zg0kM66rNaQ=; b=BUgli90Q+Ba7HNAqYPzWbHo7aw
	Z1u++kq2/HgfSqOh8qzX5Rd9mGLuKkxbZg888nJ+X88Sdhz8RCxgLFR1oIptie5qW90z2dBaoHPU2
	u5yoodidaQncwRSfdwYU9+vaUNGFi3dTH0UI9/9K3TRu8k1sNo3PIo1hfVOJGGggupf0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands
Message-Id: <E1n7j6L-0001h1-E7@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:16:05 +0000

commit c2c7f108b8228091d7ad4bd488c3abb9adc632e7
Author:     Mauro Matteo Cascella <mcascell@redhat.com>
AuthorDate: Thu Nov 4 17:31:38 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:22:44 2021 -0600

    hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands
    
    This avoids an off-by-one read of 'mode_sense_valid' buffer in
    hw/scsi/scsi-disk.c:mode_sense_page().
    
    Fixes: CVE-2021-3930
    Cc: qemu-stable@nongnu.org
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Fixes: a8f4bbe2900 ("scsi-disk: store valid mode pages in a table")
    Fixes: #546
    Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
    Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/scsi/scsi-disk.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index e8a547dbb7..d4914178ea 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1087,6 +1087,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
     uint8_t *p = *p_outbuf + 2;
     int length;
 
+    assert(page < ARRAY_SIZE(mode_sense_valid));
     if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) {
         return -1;
     }
@@ -1428,6 +1429,11 @@ static int scsi_disk_check_mode_select(SCSIDiskState *s, int page,
         return -1;
     }
 
+    /* MODE_PAGE_ALLS is only valid for MODE SENSE commands */
+    if (page == MODE_PAGE_ALLS) {
+        return -1;
+    }
+
     p = mode_current;
     memset(mode_current, 0, inlen + 2);
     len = mode_sense_page(s, page, &p, 0);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:16:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:16:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256856.441045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j6W-0005rf-K4; Wed, 12 Jan 2022 19:16:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256856.441045; Wed, 12 Jan 2022 19:16: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 1n7j6W-0005rW-HC; Wed, 12 Jan 2022 19:16:16 +0000
Received: by outflank-mailman (input) for mailman id 256856;
 Wed, 12 Jan 2022 19:16:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6V-0005rJ-Ib
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6V-0005Ez-Ht
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6V-0001hn-H8
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CMVSTh5QTcp3gcMZ3U0NPd++v0mFDx9tAV7xgKwwOo8=; b=cSxo4LUL88NlvQEQcB+0euJYWn
	KDsj5/PeubbYcfz2ovoeQ67VLYSO9iCYAlhQhl/4qqWuU/A5mDjvsOT4CE3zJBhjaG1j/2/NHlPTG
	SflBZenPZuKxp6WGMRy+zCAySta8GOAUWbHMDMCBXV3gV71i8tgnpNBhHt5/6K8dCfwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw: m68k: virt: Add compat machine for 6.1
Message-Id: <E1n7j6V-0001hn-H8@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:16:15 +0000

commit 7d71e6bfb0a2f03bd35165d4fc11da64b7ccc0d7
Author:     Laurent Vivier <laurent@vivier.eu>
AuthorDate: Sat Nov 6 20:41:57 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:23:21 2021 -0600

    hw: m68k: virt: Add compat machine for 6.1
    
    Add the missing machine type for m68k/virt
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    Message-Id: <20211106194158.4068596-2-laurent@vivier.eu>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 6837f299762679429924242a63f16490862578e3)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/m68k/virt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 4e8bce5aa6..0d9e3f83c1 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -304,7 +304,14 @@ type_init(virt_machine_register_types)
     } \
     type_init(machvirt_machine_##major##_##minor##_init);
 
+static void virt_machine_6_1_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE(6, 1, true)
+
 static void virt_machine_6_0_options(MachineClass *mc)
 {
+    virt_machine_6_1_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len);
 }
-DEFINE_VIRT_MACHINE(6, 0, true)
+DEFINE_VIRT_MACHINE(6, 0, false)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:16:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:16:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256857.441050 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j6g-0005uO-Ly; Wed, 12 Jan 2022 19:16:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256857.441050; Wed, 12 Jan 2022 19:16:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j6g-0005uE-Im; Wed, 12 Jan 2022 19:16:26 +0000
Received: by outflank-mailman (input) for mailman id 256857;
 Wed, 12 Jan 2022 19:16:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6f-0005u8-Li
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6f-0005FC-Ku
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6f-0001ia-KE
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3ghPYvIBEBGcua2w7s/yd8aIEAWHswmAC2Vdqont6VU=; b=hG2G4zOaR2JaANMxfy74PjHwSC
	kT0Qfwbz7M5a0fP2a2ExfEvJwU1SeIxcJyoN5jJtZ7Y4535YJ7ka2pRWIApgI2kvBriwVQByELcA5
	GQtZ/HahBA2ZmzR8jm36AVFJirIyYzzgnTfe00W7bXZnFXtk2QiGYzQ3gVGaJ0agvZAY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] rcu: Introduce force_rcu notifier
Message-Id: <E1n7j6f-0001ia-KE@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:16:25 +0000

commit fceaefb43f059428cbedd81810c57b460cc80a79
Author:     Greg Kurz <groug@kaod.org>
AuthorDate: Tue Nov 9 19:35:22 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:25:55 2021 -0600

    rcu: Introduce force_rcu notifier
    
    The drain_rcu_call() function can be blocked as long as an RCU reader
    stays in a read-side critical section. This is typically what happens
    when a TCG vCPU is executing a busy loop. It can deadlock the QEMU
    monitor as reported in https://gitlab.com/qemu-project/qemu/-/issues/650 .
    
    This can be avoided by allowing drain_rcu_call() to enforce an RCU grace
    period. Since each reader might need to do specific actions to end a
    read-side critical section, do it with notifiers.
    
    Prepare ground for this by adding a notifier list to the RCU reader
    struct and use it in wait_for_readers() if drain_rcu_call() is in
    progress. An API is added for readers to register their notifiers.
    
    This is largely based on a draft from Paolo Bonzini.
    
    Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20211109183523.47726-2-groug@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit ef149763a8fcce70b85dfda27cc1222ecf765750)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 include/qemu/rcu.h | 15 +++++++++++++++
 util/rcu.c         | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index 515d327cf1..e69efbd47f 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -27,6 +27,7 @@
 #include "qemu/thread.h"
 #include "qemu/queue.h"
 #include "qemu/atomic.h"
+#include "qemu/notify.h"
 #include "qemu/sys_membarrier.h"
 
 #ifdef __cplusplus
@@ -66,6 +67,13 @@ struct rcu_reader_data {
 
     /* Data used for registry, protected by rcu_registry_lock */
     QLIST_ENTRY(rcu_reader_data) node;
+
+    /*
+     * NotifierList used to force an RCU grace period.  Accessed under
+     * rcu_registry_lock.  Note that the notifier is called _outside_
+     * the thread!
+     */
+    NotifierList force_rcu;
 };
 
 extern __thread struct rcu_reader_data rcu_reader;
@@ -180,6 +188,13 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(RCUReadAuto, rcu_read_auto_unlock)
 #define RCU_READ_LOCK_GUARD() \
     g_autoptr(RCUReadAuto) _rcu_read_auto __attribute__((unused)) = rcu_read_auto_lock()
 
+/*
+ * Force-RCU notifiers tell readers that they should exit their
+ * read-side critical section.
+ */
+void rcu_add_force_rcu_notifier(Notifier *n);
+void rcu_remove_force_rcu_notifier(Notifier *n);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/util/rcu.c b/util/rcu.c
index 13ac0f75cb..c91da9f137 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -46,6 +46,7 @@
 unsigned long rcu_gp_ctr = RCU_GP_LOCKED;
 
 QemuEvent rcu_gp_event;
+static int in_drain_call_rcu;
 static QemuMutex rcu_registry_lock;
 static QemuMutex rcu_sync_lock;
 
@@ -107,6 +108,8 @@ static void wait_for_readers(void)
                  * get some extra futex wakeups.
                  */
                 qatomic_set(&index->waiting, false);
+            } else if (qatomic_read(&in_drain_call_rcu)) {
+                notifier_list_notify(&index->force_rcu, NULL);
             }
         }
 
@@ -339,8 +342,10 @@ void drain_call_rcu(void)
      * assumed.
      */
 
+    qatomic_inc(&in_drain_call_rcu);
     call_rcu1(&rcu_drain.rcu, drain_rcu_callback);
     qemu_event_wait(&rcu_drain.drain_complete_event);
+    qatomic_dec(&in_drain_call_rcu);
 
     if (locked) {
         qemu_mutex_lock_iothread();
@@ -363,6 +368,20 @@ void rcu_unregister_thread(void)
     qemu_mutex_unlock(&rcu_registry_lock);
 }
 
+void rcu_add_force_rcu_notifier(Notifier *n)
+{
+    qemu_mutex_lock(&rcu_registry_lock);
+    notifier_list_add(&rcu_reader.force_rcu, n);
+    qemu_mutex_unlock(&rcu_registry_lock);
+}
+
+void rcu_remove_force_rcu_notifier(Notifier *n)
+{
+    qemu_mutex_lock(&rcu_registry_lock);
+    notifier_remove(n);
+    qemu_mutex_unlock(&rcu_registry_lock);
+}
+
 static void rcu_init_complete(void)
 {
     QemuThread thread;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:16:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:16:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256858.441054 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j6q-0005xW-NH; Wed, 12 Jan 2022 19:16:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256858.441054; Wed, 12 Jan 2022 19:16:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j6q-0005xO-KI; Wed, 12 Jan 2022 19:16:36 +0000
Received: by outflank-mailman (input) for mailman id 256858;
 Wed, 12 Jan 2022 19:16:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6p-0005xD-Ol
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6p-0005FP-O2
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6p-0001jO-NC
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X9GQbiwVzVUBpHhm/pUe2QTnIslYy/9iYmO5jeY1xLo=; b=4asTI5tGpjA4OebdSIo3Q+G9BM
	db/fgFG10TLslBsvyamThh5HTOXBGXxRw2gI9dgWmAUFwgMgmG8OZbXch7IjDozyh87iG/M+1gkQq
	GMJx36Bhhzs1rC/IJmHH9/w4OLM+RxhVAoaaikXrVgD0qP0VW1EMc7CXyOaB6GnQz3i0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] accel/tcg: Register a force_rcu notifier
Message-Id: <E1n7j6p-0001jO-NC@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:16:35 +0000

commit 36c651c2264da6984c62173e2e0df77d76f064f5
Author:     Greg Kurz <groug@kaod.org>
AuthorDate: Tue Nov 9 19:35:23 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:26:01 2021 -0600

    accel/tcg: Register a force_rcu notifier
    
    A TCG vCPU doing a busy loop systematicaly hangs the QEMU monitor
    if the user passes 'device_add' without argument. This is because
    drain_cpu_all() which is called from qmp_device_add() cannot return
    if readers don't exit read-side critical sections. That is typically
    what busy-looping TCG vCPUs do:
    
    int cpu_exec(CPUState *cpu)
    {
    [...]
        rcu_read_lock();
    [...]
        while (!cpu_handle_exception(cpu, &ret)) {
            // Busy loop keeps vCPU here
        }
    [...]
        rcu_read_unlock();
    
        return ret;
    }
    
    For MTTCG, have all vCPU threads register a force_rcu notifier that will
    kick them out of the loop using async_run_on_cpu(). The notifier is called
    with the rcu_registry_lock mutex held, using async_run_on_cpu() ensures
    there are no deadlocks.
    
    For RR, a single thread runs all vCPUs. Just register a single notifier
    that kicks the current vCPU to the next one.
    
    For MTTCG:
    Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
    
    For RR:
    Suggested-by: Richard Henderson <richard.henderson@linaro.org>
    
    Fixes: 7bed89958bfb ("device_core: use drain_call_rcu in in qmp_device_add")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/650
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20211109183523.47726-3-groug@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit dd47a8f654d84f666b235ce8891e17ee76f9be8b)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 accel/tcg/tcg-accel-ops-mttcg.c | 26 ++++++++++++++++++++++++++
 accel/tcg/tcg-accel-ops-rr.c    | 10 ++++++++++
 2 files changed, 36 insertions(+)

diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c
index 847d2079d2..29632bd4c0 100644
--- a/accel/tcg/tcg-accel-ops-mttcg.c
+++ b/accel/tcg/tcg-accel-ops-mttcg.c
@@ -28,6 +28,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/replay.h"
 #include "qemu/main-loop.h"
+#include "qemu/notify.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
 #include "hw/boards.h"
@@ -35,6 +36,26 @@
 #include "tcg-accel-ops.h"
 #include "tcg-accel-ops-mttcg.h"
 
+typedef struct MttcgForceRcuNotifier {
+    Notifier notifier;
+    CPUState *cpu;
+} MttcgForceRcuNotifier;
+
+static void do_nothing(CPUState *cpu, run_on_cpu_data d)
+{
+}
+
+static void mttcg_force_rcu(Notifier *notify, void *data)
+{
+    CPUState *cpu = container_of(notify, MttcgForceRcuNotifier, notifier)->cpu;
+
+    /*
+     * Called with rcu_registry_lock held, using async_run_on_cpu() ensures
+     * that there are no deadlocks.
+     */
+    async_run_on_cpu(cpu, do_nothing, RUN_ON_CPU_NULL);
+}
+
 /*
  * In the multi-threaded case each vCPU has its own thread. The TLS
  * variable current_cpu can be used deep in the code to find the
@@ -43,12 +64,16 @@
 
 static void *mttcg_cpu_thread_fn(void *arg)
 {
+    MttcgForceRcuNotifier force_rcu;
     CPUState *cpu = arg;
 
     assert(tcg_enabled());
     g_assert(!icount_enabled());
 
     rcu_register_thread();
+    force_rcu.notifier.notify = mttcg_force_rcu;
+    force_rcu.cpu = cpu;
+    rcu_add_force_rcu_notifier(&force_rcu.notifier);
     tcg_register_thread();
 
     qemu_mutex_lock_iothread();
@@ -100,6 +125,7 @@ static void *mttcg_cpu_thread_fn(void *arg)
 
     tcg_cpus_destroy(cpu);
     qemu_mutex_unlock_iothread();
+    rcu_remove_force_rcu_notifier(&force_rcu.notifier);
     rcu_unregister_thread();
     return NULL;
 }
diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index c02c061ecb..aa5b4ac247 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -28,6 +28,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/replay.h"
 #include "qemu/main-loop.h"
+#include "qemu/notify.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
 
@@ -135,6 +136,11 @@ static void rr_deal_with_unplugged_cpus(void)
     }
 }
 
+static void rr_force_rcu(Notifier *notify, void *data)
+{
+    rr_kick_next_cpu();
+}
+
 /*
  * In the single-threaded case each vCPU is simulated in turn. If
  * there is more than a single vCPU we create a simple timer to kick
@@ -145,10 +151,13 @@ static void rr_deal_with_unplugged_cpus(void)
 
 static void *rr_cpu_thread_fn(void *arg)
 {
+    Notifier force_rcu;
     CPUState *cpu = arg;
 
     assert(tcg_enabled());
     rcu_register_thread();
+    force_rcu.notify = rr_force_rcu;
+    rcu_add_force_rcu_notifier(&force_rcu);
     tcg_register_thread();
 
     qemu_mutex_lock_iothread();
@@ -257,6 +266,7 @@ static void *rr_cpu_thread_fn(void *arg)
         rr_deal_with_unplugged_cpus();
     }
 
+    rcu_remove_force_rcu_notifier(&force_rcu);
     rcu_unregister_thread();
     return NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:16:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:16:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256859.441058 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j70-00060T-Pf; Wed, 12 Jan 2022 19:16:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256859.441058; Wed, 12 Jan 2022 19:16:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j70-00060K-Lu; Wed, 12 Jan 2022 19:16:46 +0000
Received: by outflank-mailman (input) for mailman id 256859;
 Wed, 12 Jan 2022 19:16:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6z-00060A-Ri
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6z-0005FZ-R1
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j6z-0001k3-QK
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eDnPReQXpE0e46+rVi7tbiDZPAdZNIpcRrVXHldd2co=; b=Urp/pCSGx9vSfHtD+7yultsOc0
	pV6K72OQ/55EyMqUcJ3DqbCA6xH4FTTf7BvGKVmTDQw06lvrqOw+aZ/3t7lCkgKshq/FMcxy5mz1X
	jN+rHD9nKndpsH/wMUhBPG2fbtnu5S5kWsVB3znjFkT2asuDgiJ7qrSdRc7ZAmQ5ZZEA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] pcie: rename 'native-hotplug' to 'x-native-hotplug'
Message-Id: <E1n7j6z-0001k3-QK@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:16:45 +0000

commit 7204b8f3c61cb2f0d6f81a4261a2ba7298a007ba
Author:     Igor Mammedov <imammedo@redhat.com>
AuthorDate: Fri Nov 12 06:08:53 2021 -0500
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:38:08 2021 -0600

    pcie: rename 'native-hotplug' to 'x-native-hotplug'
    
    Mark property as experimental/internal adding 'x-' prefix.
    
    Property was introduced in 6.1 and it should have provided
    ability to turn on native PCIE hotplug on port even when
    ACPI PCI hotplug is in use is user explicitly sets property
    on CLI. However that never worked since slot is wired to
    ACPI hotplug controller.
    Another non-intended usecase: disable native hotplug on slot
    when APCI based hotplug is disabled, which works but slot has
    'hotplug' property for this taks.
    
    It should be relatively safe to rename it to experimental
    as no users should exist for it and given that the property
    is broken we don't really want to leave it around for much
    longer lest users start using it.
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211112110857.3116853-2-imammedo@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 2aa1842d6d79dcd1b84c58eeb44591a99a9e56df)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/i386/pc_q35.c   | 2 +-
 hw/pci/pcie_port.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 04b4a4788d..9070544a90 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -243,7 +243,7 @@ static void pc_q35_init(MachineState *machine)
                                           NULL);
 
     if (acpi_pcihp) {
-        object_register_sugar_prop(TYPE_PCIE_SLOT, "native-hotplug",
+        object_register_sugar_prop(TYPE_PCIE_SLOT, "x-native-hotplug",
                                    "false", true);
     }
 
diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c
index da850e8dde..e95c1e5519 100644
--- a/hw/pci/pcie_port.c
+++ b/hw/pci/pcie_port.c
@@ -148,7 +148,7 @@ static Property pcie_slot_props[] = {
     DEFINE_PROP_UINT8("chassis", PCIESlot, chassis, 0),
     DEFINE_PROP_UINT16("slot", PCIESlot, slot, 0),
     DEFINE_PROP_BOOL("hotplug", PCIESlot, hotplug, true),
-    DEFINE_PROP_BOOL("native-hotplug", PCIESlot, native_hotplug, true),
+    DEFINE_PROP_BOOL("x-native-hotplug", PCIESlot, native_hotplug, true),
     DEFINE_PROP_END_OF_LIST()
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:16:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:16:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256860.441062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j7A-00068p-Rn; Wed, 12 Jan 2022 19:16:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256860.441062; Wed, 12 Jan 2022 19:16:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j7A-00068h-Oh; Wed, 12 Jan 2022 19:16:56 +0000
Received: by outflank-mailman (input) for mailman id 256860;
 Wed, 12 Jan 2022 19:16:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j79-000653-V7
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16: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 1n7j79-0005Fk-UL
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j79-0001kk-TW
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:16:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0eCYuEvB4c+u33e6ZDfkczpKcH5MgVTT7o+v+1gP2IU=; b=fYSUu/6+6JZ2pQYWdWRw2b4feK
	7FxQudnz8qUJFRCwXpcBQ5yNjvVx0TAZpexYJmrFW9ne3ltTWCYOt4xdhtEMWZpTdd8vAhcv7dHlw
	nl+A5n+54pPOOIhlxUquvV31JK4KBUVwq16ew2AxO8gcq5TZPK8683H1TpVbCGEXQMsE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] virtio: use virtio accessor to access packed descriptor flags
Message-Id: <E1n7j79-0001kk-TW@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:16:55 +0000

commit df1c9c3039e5ded39ae6b37b62b8d064acfe7dd5
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Nov 11 14:38:53 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:43:18 2021 -0600

    virtio: use virtio accessor to access packed descriptor flags
    
    We used to access packed descriptor flags via
    address_space_{write|read}_cached(). When we hit the cache, memcpy()
    is used which is not an atomic operation which may lead a wrong value
    is read or wrote.
    
    So this patch switches to use virito_{stw|lduw}_phys_cached() to make
    sure the aceess is atomic.
    
    Fixes: 86044b24e865f ("virtio: basic packed virtqueue support")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20211111063854.29060-1-jasowang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit f463e761a41ee71e59892121e1c74d9c25c985d2)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 874377f37a..2dbccb6b3f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -509,11 +509,9 @@ static void vring_packed_desc_read_flags(VirtIODevice *vdev,
                                          MemoryRegionCache *cache,
                                          int i)
 {
-    address_space_read_cached(cache,
-                              i * sizeof(VRingPackedDesc) +
-                              offsetof(VRingPackedDesc, flags),
-                              flags, sizeof(*flags));
-    virtio_tswap16s(vdev, flags);
+    hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags);
+
+    *flags = virtio_lduw_phys_cached(vdev, cache, off);
 }
 
 static void vring_packed_desc_read(VirtIODevice *vdev,
@@ -566,8 +564,7 @@ static void vring_packed_desc_write_flags(VirtIODevice *vdev,
 {
     hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags);
 
-    virtio_tswap16s(vdev, &desc->flags);
-    address_space_write_cached(cache, off, &desc->flags, sizeof(desc->flags));
+    virtio_stw_phys_cached(vdev, cache, off, desc->flags);
     address_space_cache_invalidate(cache, off, sizeof(desc->flags));
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:17:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:17:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256861.441066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j7K-0006BZ-TC; Wed, 12 Jan 2022 19:17:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256861.441066; Wed, 12 Jan 2022 19:17: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 1n7j7K-0006BR-QF; Wed, 12 Jan 2022 19:17:06 +0000
Received: by outflank-mailman (input) for mailman id 256861;
 Wed, 12 Jan 2022 19:17:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7K-0006BL-22
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7K-0005GN-1I
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7K-0001lZ-0S
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bLcW3U3GyDx9ly65STnq0nmUeA0hzBb/VTDn2Pcqe3E=; b=qC600aYDIZqpdlw/R26j/orStw
	3VMUMRQpaxubjraadlQCPIy1zxc1NiteQuzXoZXuKHKi5y+dsxMgTKw0U7Eko+NR3LUx3AHwvHj1+
	+XcLh+hTaQKP3PCssSnhrHycVKQIXpHiqbFaQbGNh6Kd7W56i/KaihY53hoUsrO+h7WE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] virtio: use virtio accessor to access packed event
Message-Id: <E1n7j7K-0001lZ-0S@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:17:06 +0000

commit 08e46e6d92b979743f4f0fb36e587b5e75a0bde6
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Nov 11 14:38:54 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:43:25 2021 -0600

    virtio: use virtio accessor to access packed event
    
    We used to access packed descriptor event and off_wrap via
    address_space_{write|read}_cached(). When we hit the cache, memcpy()
    is used which is not atomic which may lead a wrong value to be read or
    wrote.
    
    This patch fixes this by switching to use
    virito_{stw|lduw}_phys_cached() to make sure the access is atomic.
    
    Fixes: 683f7665679c1 ("virtio: event suppression support for packed ring")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20211111063854.29060-2-jasowang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d152cdd6f6fad381e804c8185f0ba938030ccac9)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 2dbccb6b3f..c9567f09ed 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -249,13 +249,10 @@ static void vring_packed_event_read(VirtIODevice *vdev,
     hwaddr off_off = offsetof(VRingPackedDescEvent, off_wrap);
     hwaddr off_flags = offsetof(VRingPackedDescEvent, flags);
 
-    address_space_read_cached(cache, off_flags, &e->flags,
-                              sizeof(e->flags));
+    e->flags = virtio_lduw_phys_cached(vdev, cache, off_flags);
     /* Make sure flags is seen before off_wrap */
     smp_rmb();
-    address_space_read_cached(cache, off_off, &e->off_wrap,
-                              sizeof(e->off_wrap));
-    virtio_tswap16s(vdev, &e->off_wrap);
+    e->off_wrap = virtio_lduw_phys_cached(vdev, cache, off_off);
     virtio_tswap16s(vdev, &e->flags);
 }
 
@@ -265,8 +262,7 @@ static void vring_packed_off_wrap_write(VirtIODevice *vdev,
 {
     hwaddr off = offsetof(VRingPackedDescEvent, off_wrap);
 
-    virtio_tswap16s(vdev, &off_wrap);
-    address_space_write_cached(cache, off, &off_wrap, sizeof(off_wrap));
+    virtio_stw_phys_cached(vdev, cache, off, off_wrap);
     address_space_cache_invalidate(cache, off, sizeof(off_wrap));
 }
 
@@ -275,8 +271,7 @@ static void vring_packed_flags_write(VirtIODevice *vdev,
 {
     hwaddr off = offsetof(VRingPackedDescEvent, flags);
 
-    virtio_tswap16s(vdev, &flags);
-    address_space_write_cached(cache, off, &flags, sizeof(flags));
+    virtio_stw_phys_cached(vdev, cache, off, flags);
     address_space_cache_invalidate(cache, off, sizeof(flags));
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:17:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:17:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256862.441070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j7U-0006EL-Uh; Wed, 12 Jan 2022 19:17:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256862.441070; Wed, 12 Jan 2022 19:17: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 1n7j7U-0006ED-Rk; Wed, 12 Jan 2022 19:17:16 +0000
Received: by outflank-mailman (input) for mailman id 256862;
 Wed, 12 Jan 2022 19:17:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7U-0006E5-55
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7U-0005GX-4Q
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7U-0001mF-3Z
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yf/QZpnlt8hSgaqb4cdDrG9ayyUZB1ahY4fTAvjPaJ4=; b=VaJ0A+drrEbPgUcXzisUdXjoNF
	I2/3adM8ye+JYa6w69e28Cdh6TQ4LIHjlo683Pi8N68Ai/2E8vCXoQM7NoIf3phkMxCEUaDYydKkU
	0CEFGq43si/LQ0bpWZqnRz4K8GeSgJ/U90EAIC7sUqjKJcq6iY0JIpP8wlrYthC+85Io=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] vfio: Fix memory leak of hostwin
Message-Id: <E1n7j7U-0001mF-3Z@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:17:16 +0000

commit 8c2d5911debfd00a7e8b3d8989c23e892c872043
Author:     Peng Liang <liangpeng10@huawei.com>
AuthorDate: Wed Nov 17 09:47:39 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:49:55 2021 -0600

    vfio: Fix memory leak of hostwin
    
    hostwin is allocated and added to hostwin_list in vfio_host_win_add, but
    it is only deleted from hostwin_list in vfio_host_win_del, which causes
    a memory leak.  Also, freeing all elements in hostwin_list is missing in
    vfio_disconnect_container.
    
    Fix: 2e4109de8e58 ("vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2)")
    CC: qemu-stable@nongnu.org
    Signed-off-by: Peng Liang <liangpeng10@huawei.com>
    Link: https://lore.kernel.org/r/20211117014739.1839263-1-liangpeng10@huawei.com
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    (cherry picked from commit f3bc3a73c908df15966e66f88d5a633bd42fd029)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/vfio/common.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 8728d4d5c2..af37346aca 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -551,6 +551,7 @@ static int vfio_host_win_del(VFIOContainer *container, hwaddr min_iova,
     QLIST_FOREACH(hostwin, &container->hostwin_list, hostwin_next) {
         if (hostwin->min_iova == min_iova && hostwin->max_iova == max_iova) {
             QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
             return 0;
         }
     }
@@ -2230,6 +2231,7 @@ static void vfio_disconnect_container(VFIOGroup *group)
     if (QLIST_EMPTY(&container->group_list)) {
         VFIOAddressSpace *space = container->space;
         VFIOGuestIOMMU *giommu, *tmp;
+        VFIOHostDMAWindow *hostwin, *next;
 
         QLIST_REMOVE(container, next);
 
@@ -2240,6 +2242,12 @@ static void vfio_disconnect_container(VFIOGroup *group)
             g_free(giommu);
         }
 
+        QLIST_FOREACH_SAFE(hostwin, &container->hostwin_list, hostwin_next,
+                           next) {
+            QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
+        }
+
         trace_vfio_disconnect_container(container->fd);
         close(container->fd);
         g_free(container);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:17:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:17:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256863.441073 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j7e-0006H4-W7; Wed, 12 Jan 2022 19:17:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256863.441073; Wed, 12 Jan 2022 19:17: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 1n7j7e-0006Gw-TH; Wed, 12 Jan 2022 19:17:26 +0000
Received: by outflank-mailman (input) for mailman id 256863;
 Wed, 12 Jan 2022 19:17:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7e-0006Gm-8F
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7e-0005H8-7d
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7e-0001mt-6q
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tnLrpdBtnHPhRrahXzCIyVMefBDNiVYN2jgaJKq7MRQ=; b=FiXJoyHHjmygyUz1CBhnlespjz
	2rF6I3LSnM5PjARwJZaGQKDX383M/Ek9X/TKFv9G9HaHlJ4dJKsuuaYD7TpJNn6nyYzdOvmi8Z3FG
	A4nzEOrZADi6uwQ48s9Aol9lYNWNT1Zvfz2Aegpnk4kKO1T4q496UlW2+qnp8OEJFbGU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] nbd/server: Don't complain on certain client disconnects
Message-Id: <E1n7j7e-0001mt-6q@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:17:26 +0000

commit 932333c5f00ef5697ce4e1f81750bb4dcee958a1
Author:     Eric Blake <eblake@redhat.com>
AuthorDate: Wed Nov 17 11:02:29 2021 -0600
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:51:17 2021 -0600

    nbd/server: Don't complain on certain client disconnects
    
    When a client disconnects abruptly, but did not have any pending
    requests (for example, when using nbdsh without calling h.shutdown),
    we used to output the following message:
    
    $ qemu-nbd -f raw file
    $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)'
    qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
    
    Then in commit f148ae7, we refactored nbd_receive_request() to use
    nbd_read_eof(); when this returns 0, we regressed into tracing
    uninitialized memory (if tracing is enabled) and reporting a
    less-specific:
    
    qemu-nbd: Disconnect client, due to: Request handling failed in intermediate state
    
    Note that with Unix sockets, we have yet another error message,
    unchanged by the 6.0 regression:
    
    $ qemu-nbd -k /tmp/sock -f raw file
    $ nbdsh -u 'nbd+unix:///?socket=/tmp/sock' -c 'h.trim(1,0)'
    qemu-nbd: Disconnect client, due to: Failed to send reply: Unable to write to socket: Broken pipe
    
    But in all cases, the error message goes away if the client performs a
    soft shutdown by using NBD_CMD_DISC, rather than a hard shutdown by
    abrupt disconnect:
    
    $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)' -c 'h.shutdown()'
    
    This patch fixes things to avoid uninitialized memory, and in general
    avoids warning about a client that does a hard shutdown when not in
    the middle of a packet.  A client that aborts mid-request, or which
    does not read the full server's reply, can still result in warnings,
    but those are indeed much more unusual situations.
    
    CC: qemu-stable@nongnu.org
    Fixes: f148ae7d36 ("nbd/server: Quiesce coroutines on context switch", v6.0.0)
    Signed-off-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    [eblake: defer unrelated typo fixes to later patch]
    Message-Id: <20211117170230.1128262-2-eblake@redhat.com>
    Signed-off-by: Eric Blake <eblake@redhat.com>
    (cherry picked from commit 1644cccea5c71b02b9cf8f78b780e7069a29b189)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 nbd/server.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nbd/server.c b/nbd/server.c
index 3927f7789d..83aeed51c7 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1413,6 +1413,9 @@ static int nbd_receive_request(NBDClient *client, NBDRequest *request,
     if (ret < 0) {
         return ret;
     }
+    if (ret == 0) {
+        return -EIO;
+    }
 
     /* Request
        [ 0 ..  3]   magic   (NBD_REQUEST_MAGIC)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:17:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:17:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256864.441078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j7p-0006KA-1Y; Wed, 12 Jan 2022 19:17:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256864.441078; Wed, 12 Jan 2022 19:17:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j7o-0006K2-Ul; Wed, 12 Jan 2022 19:17:36 +0000
Received: by outflank-mailman (input) for mailman id 256864;
 Wed, 12 Jan 2022 19:17:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7o-0006Jw-BV
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7o-0005Iv-Ao
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7o-0001na-A9
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y9Wm7r0nRQtuPw0RZ54Cd3RPo6Pj/tJN3BKA9S3PQ28=; b=JjP0xq+fxRUopj9+9svE9pkgC4
	YfPRMYE34KKIedjiALFjshOXy08bLkTcQYp1FbmoRkAnL3vkyXd3b+CaLiPmyc+fvdMDJTw7u/ZmH
	EEA1D8SULQQZ5fHboA4K4jiJ+wkpRsGzynN+c/VWpcRkHdtABOpMzuR0K3T6jCqvnMqE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
Message-Id: <E1n7j7o-0001na-A9@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:17:36 +0000

commit 2b2eb343a01bb84a9d988158f706a65b57604d65
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Wed Nov 17 14:12:56 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:52:50 2021 -0600

    hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
    
    Fix missing offset verification.
    
    Cc: qemu-stable@nongnu.org
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
    Fixes: f432fdfa121 ("support changed namespace asynchronous event")
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit e2c57529c9306e4c9aac75d9879f6e7699584a22)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/nvme/ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 6baf9e0420..27dddb87bd 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4164,6 +4164,11 @@ static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint8_t rae, uint32_t buf_len,
     int i = 0;
     uint32_t nsid;
 
+    if (off >= sizeof(nslist)) {
+        trace_pci_nvme_err_invalid_log_page_offset(off, sizeof(nslist));
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+
     memset(nslist, 0x0, sizeof(nslist));
     trans_len = MIN(sizeof(nslist) - off, buf_len);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:17:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:17:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256865.441082 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j80-0006N7-34; Wed, 12 Jan 2022 19:17:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256865.441082; Wed, 12 Jan 2022 19:17: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 1n7j80-0006Mz-07; Wed, 12 Jan 2022 19:17:48 +0000
Received: by outflank-mailman (input) for mailman id 256865;
 Wed, 12 Jan 2022 19:17:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7y-0006Mq-Ef
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7y-0005JH-Dn
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j7y-0001oJ-D6
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KJ8BznHLi8vy7FvPDpNKzNCJGN+bhISCcH+0tJKz1xk=; b=w826uroOzC1ocJMt66z3+Z8qYB
	1Be41pzO7Ub+et+PkTNiKj2uBhe38D4Sj+YMemfTsFzatMtQpGjEteH0GgO9wxmc2SFhJKUpUlSPZ
	fTT1ryFdGfeDN0wpSoJLW8B75DUPOTT/+qmcSbjwFvITN+N5B7tz9npl0Rkhk8ArSAuE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] chardev/wctable: don't free the instance in wctablet_chr_finalize
Message-Id: <E1n7j7y-0001oJ-D6@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:17:46 +0000

commit 4658dfcbc09dcc90025604cce64d6fd01952b882
Author:     Daniil Tatianin <d-tatianin@yandex-team.ru>
AuthorDate: Wed Nov 17 17:23:49 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:54:14 2021 -0600

    chardev/wctable: don't free the instance in wctablet_chr_finalize
    
    Object is supposed to be freed by invoking obj->free, and not
    obj->instance_finalize. This would lead to use-after-free followed by
    double free in object_unref/object_finalize.
    
    Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20211117142349.836279-1-d-tatianin@yandex-team.ru>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit fdc6e168181d06391711171b7c409b34f2981ced)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 chardev/wctablet.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/chardev/wctablet.c b/chardev/wctablet.c
index 95e005f5a5..e8b292c43c 100644
--- a/chardev/wctablet.c
+++ b/chardev/wctablet.c
@@ -320,7 +320,6 @@ static void wctablet_chr_finalize(Object *obj)
     TabletChardev *tablet = WCTABLET_CHARDEV(obj);
 
     qemu_input_handler_unregister(tablet->hs);
-    g_free(tablet);
 }
 
 static void wctablet_chr_open(Chardev *chr,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:17:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:17:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256866.441086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8A-0006Pr-4T; Wed, 12 Jan 2022 19:17:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256866.441086; Wed, 12 Jan 2022 19:17: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 1n7j8A-0006Pj-1e; Wed, 12 Jan 2022 19:17:58 +0000
Received: by outflank-mailman (input) for mailman id 256866;
 Wed, 12 Jan 2022 19:17:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j88-0006PZ-Hq
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j88-0005JV-H9
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j88-0001qU-GO
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:17:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b3xGXnaBMk7o4el4ls1uYAWmKzBmH1oT2aeME09wOqQ=; b=l9AQ3cMUZD/exFkah6dci1RYcV
	CMPsGk2BMLf2I2TF8B5WgpUV2n4eka+KWfPTI9auDUQdTR9TQVySau80Cl9lbWTawWNgl/aD1P/u2
	3R0prbejDng1Cn9vJ8kltjK0LRA//opom5i5gWIS1/GCsF+Tnp1BI4/DlnvJLss5EzSc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/block/fdc: Extract blk_create_empty_drive()
Message-Id: <E1n7j88-0001qU-GO@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:17:56 +0000

commit 7629818574eb67d2a9eb5db313c935bcf1d4e557
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:34 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:04:59 2021 -0600

    hw/block/fdc: Extract blk_create_empty_drive()
    
    We are going to re-use this code in the next commit,
    so extract it as a new blk_create_empty_drive() function.
    
    Inspired-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-2-philmd@redhat.com
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit b154791e7b6d4ca5cdcd54443484d97360bd7ad2)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/fdc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 9014cd30b3..c3e09973ca 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -61,6 +61,12 @@
     } while (0)
 
 
+/* Anonymous BlockBackend for empty drive */
+static BlockBackend *blk_create_empty_drive(void)
+{
+    return blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
+}
+
 /********************************************************/
 /* qdev floppy bus                                      */
 
@@ -486,8 +492,7 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp)
     }
 
     if (!dev->conf.blk) {
-        /* Anonymous BlockBackend for an empty drive */
-        dev->conf.blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
+        dev->conf.blk = blk_create_empty_drive();
         ret = blk_attach_dev(dev->conf.blk, qdev);
         assert(ret == 0);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:18:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:18:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256867.441089 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8K-0006Sd-69; Wed, 12 Jan 2022 19:18:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256867.441089; Wed, 12 Jan 2022 19:18: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 1n7j8K-0006SV-37; Wed, 12 Jan 2022 19:18:08 +0000
Received: by outflank-mailman (input) for mailman id 256867;
 Wed, 12 Jan 2022 19:18:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8I-0006SL-L4
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8I-0005KE-KL
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8I-0001rI-JW
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rernNVFB1uNw4VmEv7E1OI4DItZioVqgT0s5CSTGUCs=; b=HKwOTtfnp5mk2z/g/Vs5KRYlqV
	zhIwSaTxev9sTIYPoE2Xm5tbMtiWDp4NDhfb1ZrKYI7+KLVKp9NnoUSxD3Onz35mQS3PJut/LkJfr
	0YcjgOdUSTxyc1V5rzn9Ngm95nMAluYpGl0dlYzpzBpBGd3V1Psti6A643kd/tbaON3c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196
Message-Id: <E1n7j8I-0001rI-JW@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:18:06 +0000

commit 71ba2adfeb4ca63015d4a51a665e67c46a06e822
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:35 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:05:05 2021 -0600

    hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196
    
    Guest might select another drive on the bus by setting the
    DRIVE_SEL bit of the DIGITAL OUTPUT REGISTER (DOR).
    The current controller model doesn't expect a BlockBackend
    to be NULL. A simple way to fix CVE-2021-20196 is to create
    an empty BlockBackend when it is missing. All further
    accesses will be safely handled, and the controller state
    machines keep behaving correctly.
    
    Cc: qemu-stable@nongnu.org
    Fixes: CVE-2021-20196
    Reported-by: Gaoning Pan (Ant Security Light-Year Lab) <pgn@zju.edu.cn>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-3-philmd@redhat.com
    BugLink: https://bugs.launchpad.net/qemu/+bug/1912780
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/338
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 1ab95af033a419e7a64e2d58e67dd96b20af5233)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/fdc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index c3e09973ca..af398c1116 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -1166,7 +1166,19 @@ static FDrive *get_drv(FDCtrl *fdctrl, int unit)
 
 static FDrive *get_cur_drv(FDCtrl *fdctrl)
 {
-    return get_drv(fdctrl, fdctrl->cur_drv);
+    FDrive *cur_drv = get_drv(fdctrl, fdctrl->cur_drv);
+
+    if (!cur_drv->blk) {
+        /*
+         * Kludge: empty drive line selected. Create an anonymous
+         * BlockBackend to avoid NULL deref with various BlockBackend
+         * API calls within this model (CVE-2021-20196).
+         * Due to the controller QOM model limitations, we don't
+         * attach the created to the controller device.
+         */
+        cur_drv->blk = blk_create_empty_drive();
+    }
+    return cur_drv;
 }
 
 /* Status A register : 0x00 (read-only) */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:18:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:18:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256868.441094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8U-0006Vo-8y; Wed, 12 Jan 2022 19:18:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256868.441094; Wed, 12 Jan 2022 19:18: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 1n7j8U-0006Vg-66; Wed, 12 Jan 2022 19:18:18 +0000
Received: by outflank-mailman (input) for mailman id 256868;
 Wed, 12 Jan 2022 19:18:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8S-0006VT-OF
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8S-0005KI-NX
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8S-0001sA-Md
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ksxteqz3jqtqOqUqueH8mwL3FE2nlMFm0dF9JunHfPU=; b=QmG3E60B9fjhSgmubqWxaUBwdA
	BVPD0AlsUV3lRcXmQxZUnHFd1LPjSTpPGI7mflqRr1zB+SGGckbBEYh0dZsgORY5wLyBAmAwm93e4
	2BQ74gjUxOchktMVVPe0mLtc49NiR6gAtohtYEy2uOalQ3j9XX/DNHOOxfBvr+6VYWWA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196
Message-Id: <E1n7j8S-0001sA-Md@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:18:16 +0000

commit ef0cf1887ee9acb21a8d7a06e83bdbbae0fdf9e6
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:36 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:05:11 2021 -0600

    tests/qtest/fdc-test: Add a regression test for CVE-2021-20196
    
    Without the previous commit, when running 'make check-qtest-i386'
    with QEMU configured with '--enable-sanitizers' we get:
    
      AddressSanitizer:DEADLYSIGNAL
      =================================================================
      ==287878==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000344
      ==287878==The signal is caused by a WRITE memory access.
      ==287878==Hint: address points to the zero page.
          #0 0x564b2e5bac27 in blk_inc_in_flight block/block-backend.c:1346:5
          #1 0x564b2e5bb228 in blk_pwritev_part block/block-backend.c:1317:5
          #2 0x564b2e5bcd57 in blk_pwrite block/block-backend.c:1498:11
          #3 0x564b2ca1cdd3 in fdctrl_write_data hw/block/fdc.c:2221:17
          #4 0x564b2ca1b2f7 in fdctrl_write hw/block/fdc.c:829:9
          #5 0x564b2dc49503 in portio_write softmmu/ioport.c:201:9
    
    Add the reproducer for CVE-2021-20196.
    
    Suggested-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-4-philmd@redhat.com
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit cc20926e9b8077bff6813efc8dcdeae90d1a3b10)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/fdc-test.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
index 26b69f7c5c..8f6eee84a4 100644
--- a/tests/qtest/fdc-test.c
+++ b/tests/qtest/fdc-test.c
@@ -32,6 +32,9 @@
 /* TODO actually test the results and get rid of this */
 #define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__))
 
+#define DRIVE_FLOPPY_BLANK \
+    "-drive if=floppy,file=null-co://,file.read-zeroes=on,format=raw,size=1440k"
+
 #define TEST_IMAGE_SIZE 1440 * 1024
 
 #define FLOPPY_BASE 0x3f0
@@ -546,6 +549,40 @@ static void fuzz_registers(void)
     }
 }
 
+static bool qtest_check_clang_sanitizer(void)
+{
+#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
+    return true;
+#else
+    g_test_skip("QEMU not configured using --enable-sanitizers");
+    return false;
+#endif
+}
+static void test_cve_2021_20196(void)
+{
+    QTestState *s;
+
+    if (!qtest_check_clang_sanitizer()) {
+        return;
+    }
+
+    s = qtest_initf("-nographic -m 32M -nodefaults " DRIVE_FLOPPY_BLANK);
+
+    qtest_outw(s, 0x3f4, 0x0500);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outw(s, 0x3f1, 0x0400);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outb(s, 0x3f5, 0x01);
+    qtest_outw(s, 0x3f1, 0x0500);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_quit(s);
+}
+
 int main(int argc, char **argv)
 {
     int fd;
@@ -576,6 +613,7 @@ int main(int argc, char **argv)
     qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18);
     qtest_add_func("/fdc/read_no_dma_19", test_read_no_dma_19);
     qtest_add_func("/fdc/fuzz-registers", fuzz_registers);
+    qtest_add_func("/fdc/fuzz/cve_2021_20196", test_cve_2021_20196);
 
     ret = g_test_run();
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:18:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:18:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256869.441098 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8e-0006Yj-Ac; Wed, 12 Jan 2022 19:18:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256869.441098; Wed, 12 Jan 2022 19:18:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8e-0006Yb-7d; Wed, 12 Jan 2022 19:18:28 +0000
Received: by outflank-mailman (input) for mailman id 256869;
 Wed, 12 Jan 2022 19:18:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8c-0006YO-RJ
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8c-0005KQ-QW
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8c-0001so-Pk
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q4nc4tJUUpj492dfZJerJbdau+H8fK2DE6OcZBpLqjs=; b=qNStfpzOqWZZcPdJQt+t5kL9Fw
	uX/fbtvl0RuSlWhR3TDBPVc7nxfxODtmlKFFcM4iQ+ieeiBH8JtUvhID+fd4t6eGI3kmztTY7MkG3
	wxVH8kMs/ap/vYZWjupK2kXvuVwdoonaupHJaqK6GfcJFf5nJi2z8b/CaVPHEhOX0Spw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] virtio-blk: Fix clean up of host notifiers for single MR transaction.
Message-Id: <E1n7j8c-0001so-Pk@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:18:26 +0000

commit fec12fc8882b7326e820696ef81da3f1deeca11b
Author:     Mark Mielke <mark.mielke@gmail.com>
AuthorDate: Thu Dec 2 11:26:51 2021 -0500
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:10:56 2021 -0600

    virtio-blk: Fix clean up of host notifiers for single MR transaction.
    
    The code that introduced "virtio-blk: Configure all host notifiers in
    a single MR transaction" introduced a second loop variable to perform
    cleanup in second loop, but mistakenly still refers to the first
    loop variable within the second loop body.
    
    Fixes: d0267da61489 ("virtio-blk: Configure all host notifiers in a single MR transaction")
    Signed-off-by: Mark Mielke <mark.mielke@gmail.com>
    Message-id: CALm7yL08qarOu0dnQkTN+pa=BSRC92g31YpQQNDeAiT4yLZWQQ@mail.gmail.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 5b807181c27a940a3a7ad1f221a2e76a132cbdc0)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/dataplane/virtio-blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 252c3a7a23..ee5a5352dc 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -222,7 +222,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
             memory_region_transaction_commit();
 
             while (j--) {
-                virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
+                virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), j);
             }
             goto fail_host_notifiers;
         }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:18:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:18:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256870.441102 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8o-0006bx-Cg; Wed, 12 Jan 2022 19:18:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256870.441102; Wed, 12 Jan 2022 19:18:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8o-0006bn-9E; Wed, 12 Jan 2022 19:18:38 +0000
Received: by outflank-mailman (input) for mailman id 256870;
 Wed, 12 Jan 2022 19:18: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 1n7j8m-0006bX-UH
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8m-0005KU-TV
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8m-0001tX-Sl
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e1URZdGjs38M1QU66JWk8k+DOfmHasVUqvgLSPrkcCQ=; b=y8NfEVF1e5vOlarc9XAnFFb/xf
	pSnWgg/VDeNPE5/Ra6l33SsROMXMkcBuTPp/nMJ3tJzA/zGneED8cU7QDmrzNcHQsmY4voLFPuu5r
	pZIJNQlvoe+Z6sdzDf+qKSq6S+5SK1iKiHLtlMNb+Om5JHbpQUqwcEsOkUNmbCu/EGJ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
Message-Id: <E1n7j8m-0001tX-Sl@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:18:36 +0000

commit 1ce084af083b6958c8287ea742a008a105bc960d
Author:     Prasad J Pandit <pjp@fedoraproject.org>
AuthorDate: Sat Jan 30 18:46:52 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 17:39:20 2021 -0600

    net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
    
    While activating device in vmxnet3_acticate_device(), it does not
    validate guest supplied configuration values against predefined
    minimum - maximum limits. This may lead to integer overflow or
    OOB access issues. Add checks to avoid it.
    
    Fixes: CVE-2021-20203
    Buglink: https://bugs.launchpad.net/qemu/+bug/1913873
    Reported-by: Gaoning Pan <pgn@zju.edu.cn>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit d05dcd94aee88728facafb993c7280547eb4d645)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/vmxnet3.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 41f796a247..f65af4e9ef 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1441,6 +1441,7 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
+    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU);
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
@@ -1486,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* Read rings memory locations for TX queues */
         pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA);
         size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize);
+        if (size > VMXNET3_TX_RING_MAX_SIZE) {
+            size = VMXNET3_TX_RING_MAX_SIZE;
+        }
 
         vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size,
                           sizeof(struct Vmxnet3_TxDesc), false);
@@ -1496,6 +1500,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* TXC ring */
         pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA);
         size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize);
+        if (size > VMXNET3_TC_RING_MAX_SIZE) {
+            size = VMXNET3_TC_RING_MAX_SIZE;
+        }
         vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size,
                           sizeof(struct Vmxnet3_TxCompDesc), true);
         VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring);
@@ -1537,6 +1544,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
             /* RX rings */
             pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]);
             size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]);
+            if (size > VMXNET3_RX_RING_MAX_SIZE) {
+                size = VMXNET3_RX_RING_MAX_SIZE;
+            }
             vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size,
                               sizeof(struct Vmxnet3_RxDesc), false);
             VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d",
@@ -1546,6 +1556,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* RXC ring */
         pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA);
         size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize);
+        if (size > VMXNET3_RC_RING_MAX_SIZE) {
+            size = VMXNET3_RC_RING_MAX_SIZE;
+        }
         vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size,
                           sizeof(struct Vmxnet3_RxCompDesc), true);
         VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:18:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:18:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256871.441106 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8y-0006eh-Dg; Wed, 12 Jan 2022 19:18:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256871.441106; Wed, 12 Jan 2022 19:18:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j8y-0006eZ-An; Wed, 12 Jan 2022 19:18:48 +0000
Received: by outflank-mailman (input) for mailman id 256871;
 Wed, 12 Jan 2022 19:18:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8x-0006eK-0w
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8x-0005Ki-0C
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j8w-0001uA-Vm
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18: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=Xgg4UnfOTDmqTpN9xEVYwDxsmIMrVN9ec5LHqAVEeyI=; b=ZoYp3svowi8oD5uzGMjBiY7YwP
	n49u22mFh5sxG+4SRRZq1kpHOkGoxgAJwgOKQFljKY0XxFek5Q32kuCdKgCGTGHSiBBTGr4X5oxso
	y651CsEPaZuhD7xlCx9mIjaPmt1HI9NaUvqx7emi01+Di/0XvYlxv1rtSNVtel8xoC9g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] e1000: fix tx re-entrancy problem
Message-Id: <E1n7j8w-0001uA-Vm@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:18:46 +0000

commit 43583f0c079b084ada9214c00125e21bbfc6266a
Author:     Jon Maloy <jmaloy@redhat.com>
AuthorDate: Thu Oct 21 12:10:47 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 17:40:06 2021 -0600

    e1000: fix tx re-entrancy problem
    
    The fact that the MMIO handler is not re-entrant causes an infinite
    loop under certain conditions:
    
    Guest write to TDT ->  Loopback -> RX (DMA to TDT) -> TX
    
    We now eliminate the effect of this problem locally in e1000, by adding
    a boolean in struct E1000State indicating when the TX side is busy. This
    will cause any entering new call to return early instead of interfering
    with the ongoing work, and eliminates any risk of looping.
    
    This is intended to address CVE-2021-20257.
    
    Signed-off-by: Jon Maloy <jmaloy@redhat.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit 25ddb946e6301f42cff3094ea1c25fb78813e7e9)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/e1000.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index a30546c5d5..f5bc81296d 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -107,6 +107,7 @@ struct E1000State_st {
         e1000x_txd_props props;
         e1000x_txd_props tso_props;
         uint16_t tso_frames;
+        bool busy;
     } tx;
 
     struct {
@@ -763,6 +764,11 @@ start_xmit(E1000State *s)
         return;
     }
 
+    if (s->tx.busy) {
+        return;
+    }
+    s->tx.busy = true;
+
     while (s->mac_reg[TDH] != s->mac_reg[TDT]) {
         base = tx_desc_base(s) +
                sizeof(struct e1000_tx_desc) * s->mac_reg[TDH];
@@ -789,6 +795,7 @@ start_xmit(E1000State *s)
             break;
         }
     }
+    s->tx.busy = false;
     set_ics(s, 0, cause);
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:18:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:18:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256872.441110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j98-0006ha-FR; Wed, 12 Jan 2022 19:18:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256872.441110; Wed, 12 Jan 2022 19:18:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j98-0006hS-CI; Wed, 12 Jan 2022 19:18:58 +0000
Received: by outflank-mailman (input) for mailman id 256872;
 Wed, 12 Jan 2022 19:18:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j97-0006hJ-3u
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j97-0005Ks-3H
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j97-0001ul-2V
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:18:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JpV/4wq2fsMdiSXaTlef8sTdM/7PphpoquEJ8QSatUU=; b=zjkrhiDL5fPTdXKITrV5Euto4E
	mBLsleF1hx8/nopBamMNAasXVxwSqU9tErxODm+mPt6rGMOJImAKRgS0e03Hw8PP/OybUSaTZjOqc
	nvtoVUDJzawJJ1/WeApkFRCmAwH1iMY/6gwtb2p/NbF7Cyw7egA8tC6d2KFXJpD5OQ0c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] qxl: fix pre-save logic
Message-Id: <E1n7j97-0001ul-2V@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:18:57 +0000

commit 34833f361b1407ad7b4f02ed5eb852e76ab032e4
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Fri Sep 10 11:42:03 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:12 2021 -0600

    qxl: fix pre-save logic
    
    Oops.  Logic is backwards.
    
    Fixes: 39b8a183e2f3 ("qxl: remove assert in qxl_pre_save.")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/610
    Resolves: https://bugzilla.redhat.com//show_bug.cgi?id=2002907
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20210910094203.3582378-1-kraxel@redhat.com>
    (cherry picked from commit eb94846280df3f1e2a91b6179fc05f9890b7e384)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 43482d4364..29c80b4289 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2252,7 +2252,7 @@ static int qxl_pre_save(void *opaque)
     } else {
         d->last_release_offset = (uint8_t *)d->last_release - ram_start;
     }
-    if (d->last_release_offset < d->vga.vram_size) {
+    if (d->last_release_offset >= d->vga.vram_size) {
         return 1;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:19:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:19:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256873.441114 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j9I-0006k8-Gv; Wed, 12 Jan 2022 19:19:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256873.441114; Wed, 12 Jan 2022 19:19:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j9I-0006k0-Dt; Wed, 12 Jan 2022 19:19:08 +0000
Received: by outflank-mailman (input) for mailman id 256873;
 Wed, 12 Jan 2022 19:19:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9H-0006jt-7F
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9H-0005LQ-6a
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9H-0001vX-5g
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RIn6+Q4aGIPmznBAqGtX7TR0Aa1By1M/JmQNc2pHXZ8=; b=yYtEVMM3+BwOTBr1kggnUHDpdN
	Z79RgF6nqKR4Mwa+wdaSdJ6j0ukxygBSOz5rAX3QfXUrJTWjX9rY1Dal2AXruZ+e1qmSHIcOVllRa
	jGFcMlb5HDKeMwo9M4MlNZZryEzyghHjnNvH6y0X9wZyTYzBvYbmbWBS4YNxG65kqeao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] target/i386: add missing bits to CR4_RESERVED_MASK
Message-Id: <E1n7j9H-0001vX-5g@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:19:07 +0000

commit e88636b4d46b91e130ae715b8d8b90f62e414428
Author:     Daniel P. Berrangé <berrange@redhat.com>
AuthorDate: Tue Aug 31 18:50:33 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:18 2021 -0600

    target/i386: add missing bits to CR4_RESERVED_MASK
    
    Booting Fedora kernels with -cpu max hangs very early in boot. Disabling
    the la57 CPUID bit fixes the problem. git bisect traced the regression to
    
      commit 213ff024a2f92020290296cb9dc29c2af3d4a221 (HEAD, refs/bisect/bad)
      Author: Lara Lazier <laramglazier@gmail.com>
      Date:   Wed Jul 21 17:26:50 2021 +0200
    
        target/i386: Added consistency checks for CR4
    
        All MBZ bits in CR4 must be zero. (APM2 15.5)
        Added reserved bitmask and added checks in both
        helper_vmrun and helper_write_crN.
    
        Signed-off-by: Lara Lazier <laramglazier@gmail.com>
        Message-Id: <20210721152651.14683-2-laramglazier@gmail.com>
        Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    
    In this commit CR4_RESERVED_MASK is missing CR4_LA57_MASK and
    two others. Adding this lets Fedora kernels boot once again.
    
    Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
    Tested-by: Richard W.M. Jones <rjones@redhat.com>
    Message-Id: <20210831175033.175584-1-berrange@redhat.com>
    [Removed VMXE/SMXE, matching the commit message. - Paolo]
    Fixes: 213ff024a2 ("target/i386: Added consistency checks for CR4", 2021-07-22)
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 69e3895f9d37ca39536775b13ce63e8c291427ba)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/cpu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 6c50d3ab4f..21b33fbe2e 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -257,6 +257,7 @@ typedef enum X86Seg {
                 | CR4_DE_MASK | CR4_PSE_MASK | CR4_PAE_MASK \
                 | CR4_MCE_MASK | CR4_PGE_MASK | CR4_PCE_MASK \
                 | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK |CR4_UMIP_MASK \
+                | CR4_LA57_MASK \
                 | CR4_FSGSBASE_MASK | CR4_PCIDE_MASK | CR4_OSXSAVE_MASK \
                 | CR4_SMEP_MASK | CR4_SMAP_MASK | CR4_PKE_MASK | CR4_PKS_MASK))
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:19:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:19:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256874.441118 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j9S-0006mh-IY; Wed, 12 Jan 2022 19:19:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256874.441118; Wed, 12 Jan 2022 19:19:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j9S-0006mZ-FU; Wed, 12 Jan 2022 19:19:18 +0000
Received: by outflank-mailman (input) for mailman id 256874;
 Wed, 12 Jan 2022 19:19:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9R-0006mR-Ak
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9R-0005LU-A8
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9R-0001wX-9O
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Kqj/jENz2ryB496NqlgQLf6SLD1OWKHNkyPlCxWXmww=; b=2JkSIKxzML8WNjZ4uBizSemWno
	Ix8XSx9tL2ZwIBWp1ok05PXKhlRJQFTCmhOlrKz5Yzimp1TSJXokURAdLw924adMj7MolSDJotTnY
	gTUlvvnh43C/GM7uhK8lznSXVaEwaFL+ag1vYrL0NHOrKPVm13OCVSFxTtop4Mu384UU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] tcg/arm: Reduce vector alignment requirement for NEON
Message-Id: <E1n7j9R-0001wX-9O@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:19:17 +0000

commit 711bd602cc432e4ab0c4c59f19d6611302870248
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sun Sep 12 10:49:25 2021 -0700
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:27 2021 -0600

    tcg/arm: Reduce vector alignment requirement for NEON
    
    With arm32, the ABI gives us 8-byte alignment for the stack.
    While it's possible to realign the stack to provide 16-byte alignment,
    it's far easier to simply not encode 16-byte alignment in the
    VLD1 and VST1 instructions that we emit.
    
    Remove the assertion in temp_allocate_frame, limit natural alignment
    to the provided stack alignment, and add a comment.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1999878
    Reported-by: Richard W.M. Jones <rjones@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20210912174925.200132-1-richard.henderson@linaro.org>
    Message-Id: <20211206191335.230683-2-richard.henderson@linaro.org>
    (cherry picked from commit b9537d5904f6e3df896264a6144883ab07db9608)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tcg/arm/tcg-target.c.inc | 13 +++++++++----
 tcg/tcg.c                |  8 +++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
index 007ceee68e..34acfb522c 100644
--- a/tcg/arm/tcg-target.c.inc
+++ b/tcg/arm/tcg-target.c.inc
@@ -2477,8 +2477,13 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg,
         tcg_out_vldst(s, INSN_VLD1 | 0x7d0, arg, arg1, arg2);
         return;
     case TCG_TYPE_V128:
-        /* regs 2; size 8; align 16 */
-        tcg_out_vldst(s, INSN_VLD1 | 0xae0, arg, arg1, arg2);
+        /*
+         * We have only 8-byte alignment for the stack per the ABI.
+         * Rather than dynamically re-align the stack, it's easier
+         * to simply not request alignment beyond that.  So:
+         * regs 2; size 8; align 8
+         */
+        tcg_out_vldst(s, INSN_VLD1 | 0xad0, arg, arg1, arg2);
         return;
     default:
         g_assert_not_reached();
@@ -2497,8 +2502,8 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg,
         tcg_out_vldst(s, INSN_VST1 | 0x7d0, arg, arg1, arg2);
         return;
     case TCG_TYPE_V128:
-        /* regs 2; size 8; align 16 */
-        tcg_out_vldst(s, INSN_VST1 | 0xae0, arg, arg1, arg2);
+        /* See tcg_out_ld re alignment: regs 2; size 8; align 8 */
+        tcg_out_vldst(s, INSN_VST1 | 0xad0, arg, arg1, arg2);
         return;
     default:
         g_assert_not_reached();
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 4142d42d77..ca5bcc4635 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3060,7 +3060,13 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp *ts)
         g_assert_not_reached();
     }
 
-    assert(align <= TCG_TARGET_STACK_ALIGN);
+    /*
+     * Assume the stack is sufficiently aligned.
+     * This affects e.g. ARM NEON, where we have 8 byte stack alignment
+     * and do not require 16 byte vector alignment.  This seems slightly
+     * easier than fully parameterizing the above switch statement.
+     */
+    align = MIN(TCG_TARGET_STACK_ALIGN, align);
     off = ROUND_UP(s->current_frame_offset, align);
 
     /* If we've exhausted the stack frame, restart with a smaller TB. */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:19:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:19:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256875.441122 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j9c-0006pt-LH; Wed, 12 Jan 2022 19:19:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256875.441122; Wed, 12 Jan 2022 19:19: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 1n7j9c-0006pj-IF; Wed, 12 Jan 2022 19:19:28 +0000
Received: by outflank-mailman (input) for mailman id 256875;
 Wed, 12 Jan 2022 19:19:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9b-0006pV-E3
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9b-0005Lh-DH
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9b-0001xI-CT
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=64h1CwLmcYH2GYuhMTyxPjQ6FWql7bULHiPboc98v2c=; b=e/WKko9mExC8iECu6uE7ynVkbB
	y8mfs8BPtqiFF1FLAhX9uiHvqFPmzO2muXZYJ6C9WG+LKWcNsp/9qS0s4GsVfxpCH04/zSAimrfJ7
	+tMmxcrocnY1xpR0O18q20btn4Bz+WV5fGmAaRoFRJiniy+Q6uQZV//4RqFfXYfBIX1k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] tests: tcg: Fix PVH test with binutils 2.36+
Message-Id: <E1n7j9b-0001xI-CT@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:19:27 +0000

commit fddd169de593da46b2ccd316d63c03b416b94437
Author:     Cole Robinson <crobinso@redhat.com>
AuthorDate: Fri Oct 8 12:21:01 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:37 2021 -0600

    tests: tcg: Fix PVH test with binutils 2.36+
    
    binutils started adding a .note.gnu.property ELF section which
    makes the PVH test fail:
    
      TEST    hello on x86_64
    qemu-system-x86_64: Error loading uncompressed kernel without PVH ELF Note
    
    Discard .note.gnu* while keeping the PVH .note bits intact.
    
    This also strips the build-id note, so drop the related comment.
    
    Signed-off-by: Cole Robinson <crobinso@redhat.com>
    Message-Id: <5ab2a54c262c61f64c22dbb49ade3e2db8a740bb.1633708346.git.crobinso@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 8e751e9c38e324737fd3d3aa0562f886313bba3c)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/tcg/x86_64/system/kernel.ld | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/tcg/x86_64/system/kernel.ld b/tests/tcg/x86_64/system/kernel.ld
index 49c12b04ae..ca5d6bd850 100644
--- a/tests/tcg/x86_64/system/kernel.ld
+++ b/tests/tcg/x86_64/system/kernel.ld
@@ -16,7 +16,10 @@ SECTIONS {
 		*(.rodata)
 	} :text
 
-        /* Keep build ID and PVH notes in same section */
+        /DISCARD/ : {
+                *(.note.gnu*)
+        }
+
         .notes :  {
                *(.note.*)
         } :note
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:19:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:19:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256876.441126 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j9m-0006tT-Mv; Wed, 12 Jan 2022 19:19:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256876.441126; Wed, 12 Jan 2022 19:19:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j9m-0006tL-Jl; Wed, 12 Jan 2022 19:19:38 +0000
Received: by outflank-mailman (input) for mailman id 256876;
 Wed, 12 Jan 2022 19:19:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9l-0006t9-Gq
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9l-0005Lr-GB
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9l-0001xv-FT
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1OxQDoQLQw0Nu7xX28b0sI/WmfiX6IB8xH2qnYyF5yY=; b=x38iY5bk9N5/w33LFZDvYdZ3hA
	pClwjQH/0j44IHDjbkR2nxj1uPgtzCwsUpM2/ohT8s5SjIqspjseib4+yhwm7Hs/4Z+TugMTV28mA
	Ok2DnEIpWpNfhAl27jbg6L46L1ZKFzGJdPUK0UrrcDidODnzPb4DFIwCxOVVzUlVGHR8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] Update version for v6.1.1 release
Message-Id: <E1n7j9l-0001xv-FT@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:19:37 +0000

commit 54e1f5be86dd11744e45da8be6afad01d01d59e7
Author:     Michael Roth <michael.roth@amd.com>
AuthorDate: Thu Dec 23 09:52:09 2021 -0600
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Thu Dec 23 09:52:09 2021 -0600

    Update version for v6.1.1 release
    
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index dfda3e0b4f..f3b5af39e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-6.1.0
+6.1.1
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 12 19:19:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Jan 2022 19:19:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256877.441130 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7j9w-0006wJ-OB; Wed, 12 Jan 2022 19:19:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256877.441130; Wed, 12 Jan 2022 19:19: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 1n7j9w-0006wB-LM; Wed, 12 Jan 2022 19:19:48 +0000
Received: by outflank-mailman (input) for mailman id 256877;
 Wed, 12 Jan 2022 19:19:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9v-0006w3-MV
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9v-0005Ly-Lh
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7j9v-0001yX-Kv
 for xen-changelog@lists.xenproject.org; Wed, 12 Jan 2022 19:19:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F2I4vBnntO8GlUN7uBx4xxNyeC9x1cfJ9u0RUYhqqKM=; b=G103aBVeja8UFhuV8eXJLY2f1x
	4F+px1YT5XXYDMInhPbGfPfmUvg1KbDH8eqRqtgt3yO1I+G8N2lcxKlx73o4Bz+DQD6ZMbibh9o5l
	LMih13Kk2q6Qp+MFgTrVEK3uvwXMOy/BcNnmS4ZhRVKMd3aCm+jORishNiuNsedAG+zo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] Merge tag 'v6.1.1' into staging
Message-Id: <E1n7j9v-0001yX-Kv@xenbits.xenproject.org>
Date: Wed, 12 Jan 2022 19:19:47 +0000

commit a68d6d311c2d1fd9d2fa9a0768ea2353e8a79b42
Merge: b6e539830bf45e2d7a6bd86ddfdf003088b173b0 54e1f5be86dd11744e45da8be6afad01d01d59e7
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Jan 12 10:29:29 2022 +0000
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Jan 12 10:29:29 2022 +0000

    Merge tag 'v6.1.1' into staging
    
    v6.1.1 release

 VERSION                                   |   2 +-
 accel/tcg/tcg-accel-ops-mttcg.c           |  26 ++++++++++++++++++++
 accel/tcg/tcg-accel-ops-rr.c              |  10 ++++++++
 block/block-backend.c                     |   6 +++++
 block/file-posix.c                        |   6 ++---
 block/io.c                                |   1 +
 chardev/wctablet.c                        |   1 -
 configure                                 |  10 +++++---
 contrib/plugins/execlog.c                 |   2 +-
 docs/tools/qemu-nbd.rst                   |   6 +++--
 hw/9pfs/coth.h                            |   4 ++-
 hw/arm/virt.c                             |   4 +--
 hw/block/dataplane/virtio-blk.c           |   2 +-
 hw/block/fdc.c                            |  23 +++++++++++++++---
 hw/core/machine.c                         |   1 +
 hw/display/artist.c                       |   8 +++---
 hw/display/qxl.c                          |   2 +-
 hw/i386/pc.c                              |   2 +-
 hw/i386/pc_q35.c                          |   2 +-
 hw/m68k/virt.c                            |   9 ++++++-
 hw/net/e1000.c                            |   7 ++++++
 hw/net/virtio-net.c                       |  39 ++++++++++++++++++++++++------
 hw/net/vmxnet3.c                          |  13 ++++++++++
 hw/nvme/ctrl.c                            |   5 ++++
 hw/pci/pci_bridge.c                       |  10 ++++----
 hw/pci/pcie_port.c                        |   2 +-
 hw/scsi/scsi-disk.c                       |   6 +++++
 hw/scsi/scsi-generic.c                    |   2 +-
 hw/usb/dev-uas.c                          |  11 +++++++++
 hw/vfio/common.c                          |   8 ++++++
 hw/virtio/vhost-user.c                    |   5 ++--
 hw/virtio/vhost-vsock.c                   |  19 ++++++++++++---
 hw/virtio/virtio-balloon.c                |  13 ++++++++++
 hw/virtio/virtio-mem-pci.c                |   7 +-----
 hw/virtio/virtio.c                        |  24 ++++++------------
 include/block/block_int.h                 |   7 ++++++
 include/hw/acpi/ich9.h                    |   2 +-
 include/hw/virtio/vhost-vsock.h           |   3 +++
 include/qemu/rcu.h                        |  15 ++++++++++++
 include/sysemu/block-backend.h            |   1 +
 monitor/hmp-cmds.c                        |   2 +-
 nbd/server.c                              |   3 +++
 plugins/meson.build                       |  14 ++++++-----
 qemu-nbd.c                                |   6 +++--
 subprojects/libvhost-user/libvhost-user.c |   1 +
 target/arm/cpu.c                          |  19 +++++++++++++++
 target/i386/cpu.c                         |   2 +-
 target/i386/cpu.h                         |   1 +
 target/i386/tcg/sysemu/excp_helper.c      |  25 ++++++++++---------
 tcg/arm/tcg-target.c.inc                  |  13 +++++++---
 tcg/tcg.c                                 |   8 +++++-
 tests/data/acpi/q35/DSDT                  | Bin 8289 -> 8289 bytes
 tests/data/acpi/q35/DSDT.acpihmat         | Bin 9614 -> 9614 bytes
 tests/data/acpi/q35/DSDT.bridge           | Bin 11003 -> 11003 bytes
 tests/data/acpi/q35/DSDT.cphp             | Bin 8753 -> 8753 bytes
 tests/data/acpi/q35/DSDT.dimmpxm          | Bin 9943 -> 9943 bytes
 tests/data/acpi/q35/DSDT.ipmibt           | Bin 8364 -> 8364 bytes
 tests/data/acpi/q35/DSDT.memhp            | Bin 9648 -> 9648 bytes
 tests/data/acpi/q35/DSDT.mmio64           | Bin 9419 -> 9419 bytes
 tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
 tests/data/acpi/q35/DSDT.nohpet           | Bin 8147 -> 8147 bytes
 tests/data/acpi/q35/DSDT.numamem          | Bin 8295 -> 8295 bytes
 tests/data/acpi/q35/DSDT.tis              | Bin 8894 -> 8894 bytes
 tests/qtest/bios-tables-test.c            |  18 ++++++++++++++
 tests/qtest/fdc-test.c                    |  38 +++++++++++++++++++++++++++++
 tests/tcg/x86_64/system/kernel.ld         |   5 +++-
 util/qemu-sockets.c                       |  13 ++++------
 util/rcu.c                                |  19 +++++++++++++++
 68 files changed, 409 insertions(+), 104 deletions(-)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 04:44:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 04:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256981.441328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7rxz-0005gI-Nl; Thu, 13 Jan 2022 04:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256981.441328; Thu, 13 Jan 2022 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 1n7rxz-0005g8-KM; Thu, 13 Jan 2022 04:44:03 +0000
Received: by outflank-mailman (input) for mailman id 256981;
 Thu, 13 Jan 2022 04: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 1n7rxx-0005g2-OM
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04: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 1n7rxx-0002a3-LM
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7rxx-0000Z8-Ju
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04: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=c9+kZmo7YrhQfAAx7Oc6lHRiq78MS2BOabaXf/637Hc=; b=NuVrKNrTm0R2VwjLCUqEmy9hak
	UcMg3YFCh2DKrFEXveTXD/xeNFmHrwhSpiE81LLiaPM2eSOIRO3nVufa4sibDO5BQM6XW45AzQXjH
	vIrLG4EOA8PViyyMvQfvzUIJMIMdLe4z6MNMmTRWK1znq1++MaYzxM5pRd1c+TNk2rDQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/paging: tidy paging_mfn_is_dirty()
Message-Id: <E1n7rxx-0000Z8-Ju@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 04:44:01 +0000

commit dc773e0e8997f10c4d369f9b60bc529a05de0b79
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jan 12 08:53:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 12 08:53:05 2022 +0100

    x86/paging: tidy paging_mfn_is_dirty()
    
    The function returning a boolean indicator, make it return bool. Also
    constify its struct domain parameter, albeit requiring to also adjust
    mm_locked_by_me(). Furthermore the function is used by shadow code only.
    
    Since mm_locked_by_me() needs touching anyway, also switch its return
    type to bool.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/paging.h |  2 +-
 xen/arch/x86/mm/mm-locks.h        |  2 +-
 xen/arch/x86/mm/paging.c          | 23 ++++++++++++-----------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index 308f1115dd..2ddcfb022c 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -173,7 +173,7 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn);
 
 /* is this guest page dirty? 
  * This is called from inside paging code, with the paging lock held. */
-int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn);
+bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn);
 
 /*
  * Log-dirty radix tree indexing:
diff --git a/xen/arch/x86/mm/mm-locks.h b/xen/arch/x86/mm/mm-locks.h
index d6c073dc5c..fcfd4706ba 100644
--- a/xen/arch/x86/mm/mm-locks.h
+++ b/xen/arch/x86/mm/mm-locks.h
@@ -40,7 +40,7 @@ static inline void mm_lock_init(mm_lock_t *l)
     l->unlock_level = 0;
 }
 
-static inline int mm_locked_by_me(mm_lock_t *l)
+static inline bool mm_locked_by_me(const mm_lock_t *l)
 {
     return (l->lock.recurse_cpu == current->processor);
 }
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index dd6b2bdf6f..c8fd50822a 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -351,14 +351,14 @@ void paging_mark_dirty(struct domain *d, mfn_t gmfn)
     paging_mark_pfn_dirty(d, pfn);
 }
 
-
+#ifdef CONFIG_SHADOW_PAGING
 /* Is this guest page dirty? */
-int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn)
+bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn)
 {
     pfn_t pfn;
     mfn_t mfn, *l4, *l3, *l2;
     unsigned long *l1;
-    int rv;
+    bool dirty;
 
     ASSERT(paging_locked_by_me(d));
     ASSERT(paging_mode_log_dirty(d));
@@ -367,36 +367,37 @@ int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn)
     pfn = _pfn(get_gpfn_from_mfn(mfn_x(gmfn)));
     /* Invalid pages can't be dirty. */
     if ( unlikely(!VALID_M2P(pfn_x(pfn))) )
-        return 0;
+        return false;
 
     mfn = d->arch.paging.log_dirty.top;
     if ( !mfn_valid(mfn) )
-        return 0;
+        return false;
 
     l4 = map_domain_page(mfn);
     mfn = l4[L4_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l4);
     if ( !mfn_valid(mfn) )
-        return 0;
+        return false;
 
     l3 = map_domain_page(mfn);
     mfn = l3[L3_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l3);
     if ( !mfn_valid(mfn) )
-        return 0;
+        return false;
 
     l2 = map_domain_page(mfn);
     mfn = l2[L2_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l2);
     if ( !mfn_valid(mfn) )
-        return 0;
+        return false;
 
     l1 = map_domain_page(mfn);
-    rv = test_bit(L1_LOGDIRTY_IDX(pfn), l1);
+    dirty = test_bit(L1_LOGDIRTY_IDX(pfn), l1);
     unmap_domain_page(l1);
-    return rv;
-}
 
+    return dirty;
+}
+#endif
 
 /* Read a domain's log-dirty bitmap and stats.  If the operation is a CLEAN,
  * clear the bitmap and stats as well. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 04:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 04:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256982.441332 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ry9-0005hx-Ou; Thu, 13 Jan 2022 04:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256982.441332; Thu, 13 Jan 2022 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 1n7ry9-0005hp-Lv; Thu, 13 Jan 2022 04:44:13 +0000
Received: by outflank-mailman (input) for mailman id 256982;
 Thu, 13 Jan 2022 04: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 1n7ry7-0005he-Q0
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04: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 1n7ry7-0002aU-PC
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ry7-0000aX-Nm
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04: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=uUs5W3n6FrQH+m6uhC+4Sb5x/LiH2fHj9H+5lCr2kU0=; b=y5WQJ0SRa0bqzQUNBQqePa2BI3
	Kc15Vc8J/AtSUpgazhsfj+zlE7zWEn5GjLhKmVvmgUHhpxR11eKVuy91nQyq+gMclP+FNps2epRG/
	OYPUKW2Hej7Bqe24n/TW2qF12+pWlimdwrh54Mi433VOSGxQVGp6mnPgtrq1D44ltGSw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/paging: replace most mfn_valid() in log-dirty handling
Message-Id: <E1n7ry7-0000aX-Nm@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 04:44:11 +0000

commit 77a69c2dc72f0ab2cbd84f4e6e3a9420ec92b997
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jan 12 08:54:20 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 12 08:54:20 2022 +0100

    x86/paging: replace most mfn_valid() in log-dirty handling
    
    Top level table and intermediate table entries get explicitly set to
    INVALID_MFN when un-allocated. There's therefore no need to use the more
    expensive mfn_valid() when checking for that sentinel.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/paging.c | 46 ++++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index c8fd50822a..dc3a4a0b4b 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -74,7 +74,7 @@ static mfn_t paging_new_log_dirty_leaf(struct domain *d)
 {
     mfn_t mfn = paging_new_log_dirty_page(d);
 
-    if ( mfn_valid(mfn) )
+    if ( !mfn_eq(mfn, INVALID_MFN) )
         clear_domain_page(mfn);
 
     return mfn;
@@ -84,7 +84,8 @@ static mfn_t paging_new_log_dirty_leaf(struct domain *d)
 static mfn_t paging_new_log_dirty_node(struct domain *d)
 {
     mfn_t mfn = paging_new_log_dirty_page(d);
-    if ( mfn_valid(mfn) )
+
+    if ( !mfn_eq(mfn, INVALID_MFN) )
     {
         int i;
         mfn_t *node = map_domain_page(mfn);
@@ -98,7 +99,7 @@ static mfn_t paging_new_log_dirty_node(struct domain *d)
 /* get the top of the log-dirty bitmap trie */
 static mfn_t *paging_map_log_dirty_bitmap(struct domain *d)
 {
-    if ( likely(mfn_valid(d->arch.paging.log_dirty.top)) )
+    if ( likely(!mfn_eq(d->arch.paging.log_dirty.top, INVALID_MFN)) )
         return map_domain_page(d->arch.paging.log_dirty.top);
     return NULL;
 }
@@ -116,7 +117,7 @@ static int paging_free_log_dirty_bitmap(struct domain *d, int rc)
 
     paging_lock(d);
 
-    if ( !mfn_valid(d->arch.paging.log_dirty.top) )
+    if ( mfn_eq(d->arch.paging.log_dirty.top, INVALID_MFN) )
     {
         paging_unlock(d);
         return 0;
@@ -143,20 +144,20 @@ static int paging_free_log_dirty_bitmap(struct domain *d, int rc)
 
     for ( ; i4 < LOGDIRTY_NODE_ENTRIES; i4++, i3 = 0 )
     {
-        if ( !mfn_valid(l4[i4]) )
+        if ( mfn_eq(l4[i4], INVALID_MFN) )
             continue;
 
         l3 = map_domain_page(l4[i4]);
 
         for ( ; i3 < LOGDIRTY_NODE_ENTRIES; i3++ )
         {
-            if ( !mfn_valid(l3[i3]) )
+            if ( mfn_eq(l3[i3], INVALID_MFN) )
                 continue;
 
             l2 = map_domain_page(l3[i3]);
 
             for ( i2 = 0; i2 < LOGDIRTY_NODE_ENTRIES; i2++ )
-                if ( mfn_valid(l2[i2]) )
+                if ( !mfn_eq(l2[i2], INVALID_MFN) )
                     paging_free_log_dirty_page(d, l2[i2]);
 
             unmap_domain_page(l2);
@@ -288,35 +289,35 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn)
     /* Recursive: this is called from inside the shadow code */
     paging_lock_recursive(d);
 
-    if ( unlikely(!mfn_valid(d->arch.paging.log_dirty.top)) ) 
+    if ( unlikely(mfn_eq(d->arch.paging.log_dirty.top, INVALID_MFN)) )
     {
          d->arch.paging.log_dirty.top = paging_new_log_dirty_node(d);
-         if ( unlikely(!mfn_valid(d->arch.paging.log_dirty.top)) )
+         if ( unlikely(mfn_eq(d->arch.paging.log_dirty.top, INVALID_MFN)) )
              goto out;
     }
 
     l4 = paging_map_log_dirty_bitmap(d);
     mfn = l4[i4];
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         l4[i4] = mfn = paging_new_log_dirty_node(d);
     unmap_domain_page(l4);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         goto out;
 
     l3 = map_domain_page(mfn);
     mfn = l3[i3];
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         l3[i3] = mfn = paging_new_log_dirty_node(d);
     unmap_domain_page(l3);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         goto out;
 
     l2 = map_domain_page(mfn);
     mfn = l2[i2];
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         l2[i2] = mfn = paging_new_log_dirty_leaf(d);
     unmap_domain_page(l2);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         goto out;
 
     l1 = map_domain_page(mfn);
@@ -370,25 +371,25 @@ bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn)
         return false;
 
     mfn = d->arch.paging.log_dirty.top;
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         return false;
 
     l4 = map_domain_page(mfn);
     mfn = l4[L4_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l4);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         return false;
 
     l3 = map_domain_page(mfn);
     mfn = l3[L3_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l3);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         return false;
 
     l2 = map_domain_page(mfn);
     mfn = l2[L2_LOGDIRTY_IDX(pfn)];
     unmap_domain_page(l2);
-    if ( !mfn_valid(mfn) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
         return false;
 
     l1 = map_domain_page(mfn);
@@ -477,17 +478,18 @@ static int paging_log_dirty_op(struct domain *d,
 
     for ( ; (pages < sc->pages) && (i4 < LOGDIRTY_NODE_ENTRIES); i4++, i3 = 0 )
     {
-        l3 = (l4 && mfn_valid(l4[i4])) ? map_domain_page(l4[i4]) : NULL;
+        l3 = ((l4 && !mfn_eq(l4[i4], INVALID_MFN)) ?
+              map_domain_page(l4[i4]) : NULL);
         for ( ; (pages < sc->pages) && (i3 < LOGDIRTY_NODE_ENTRIES); i3++ )
         {
-            l2 = ((l3 && mfn_valid(l3[i3])) ?
+            l2 = ((l3 && !mfn_eq(l3[i3], INVALID_MFN)) ?
                   map_domain_page(l3[i3]) : NULL);
             for ( i2 = 0;
                   (pages < sc->pages) && (i2 < LOGDIRTY_NODE_ENTRIES);
                   i2++ )
             {
                 unsigned int bytes = PAGE_SIZE;
-                l1 = ((l2 && mfn_valid(l2[i2])) ?
+                l1 = ((l2 && !mfn_eq(l2[i2], INVALID_MFN)) ?
                       map_domain_page(l2[i2]) : NULL);
                 if ( unlikely(((sc->pages - pages + 7) >> 3) < bytes) )
                     bytes = (unsigned int)((sc->pages - pages + 7) >> 3);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 04:44:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 04:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256983.441335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ryJ-0005kl-Qh; Thu, 13 Jan 2022 04:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256983.441335; Thu, 13 Jan 2022 04: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 1n7ryJ-0005kd-NZ; Thu, 13 Jan 2022 04:44:23 +0000
Received: by outflank-mailman (input) for mailman id 256983;
 Thu, 13 Jan 2022 04: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 1n7ryH-0005kJ-Tr
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04: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 1n7ryH-0002ap-T3
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ryH-0000c3-RL
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04: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=U4teUQtJ3654auzENNTNtCaKcTwBBKA0kSBXm+12S3o=; b=FwmrmBfdxixibrgE25njbMfTJu
	1ROUl/pOm/qIEYA7Jdd/+CEwejI/iWhD2dTqxHd5pPu1692mwH1ShKvUpZdH1lMhhMxT1fYFyP5lM
	g/FEOqaHtCJNc3gcZTFtN1PP+a0vUadMz+IshLFWR4O0dcBccs6PpQ85rdXucutorzWc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/debugger: fix make distclean
Message-Id: <E1n7ryH-0000c3-RL@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 04:44:21 +0000

commit 35d15b27c968a555f10fa9c4fd5560b79d8d36eb
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 12 08:54:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 12 08:54:59 2022 +0100

    tools/debugger: fix make distclean
    
    "make distclean" will complain that "-c" is no supported flag for make.
    
    Fix that by using "-C".
    
    The error has been present for a long time, but it was uncovered only
    recently.
    
    Fixes: 2400a9a365c5619 ("tools/debugger: Allow make to recurse into debugger/")
    Fixes: f9c9b127753e9ed ("tools: fix make distclean")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/debugger/gdbsx/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/debugger/gdbsx/Makefile b/tools/debugger/gdbsx/Makefile
index 8d7cd94a31..5571450a89 100644
--- a/tools/debugger/gdbsx/Makefile
+++ b/tools/debugger/gdbsx/Makefile
@@ -14,7 +14,7 @@ clean:
 
 .PHONY: distclean
 distclean: clean
-	set -e; for d in xg gx; do $(MAKE) -c $$d distclean; done
+	set -e; for d in xg gx; do $(MAKE) -C $$d distclean; done
 
 .PHONY: install
 install: all
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 04:44:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 04:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.256984.441340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ryT-0005oX-TR; Thu, 13 Jan 2022 04:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 256984.441340; Thu, 13 Jan 2022 04: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 1n7ryT-0005oP-QY; Thu, 13 Jan 2022 04:44:33 +0000
Received: by outflank-mailman (input) for mailman id 256984;
 Thu, 13 Jan 2022 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 1n7ryS-0005oA-0x
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 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 1n7ryS-0002b3-0F
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ryR-0000dP-VM
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 04: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=s0vJXqUmd+QrIgpsnIKzypZowHIWSXDV/XMUiu3betQ=; b=7MuMh+i289T5vRPY9IbhN9Dzay
	QPOzDBlYIYJ6u/RdGxUU0VINhQnVbAeVnfbste986m0iv89bEmXr0JhMbROO+emXap595cm04ga6e
	apWLmtwM+H1IwUj2W4Qx7diDyOynhGjwngr+XMpf57mNVKGZdt7s1YioRo86wsXvRaKg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: requesting to be TXT reviewer
Message-Id: <E1n7ryR-0000dP-VM@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 04:44:31 +0000

commit 0cf6521ea95dd78accf1e5c13cbfe8156b3611d0
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Jan 12 08:55:20 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 12 08:55:20 2022 +0100

    MAINTAINERS: requesting to be TXT reviewer
    
    I would like to submit myself, Daniel P. Smith, as a reviewer of TXT support in
    Xen.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6e84a05760..4a2884dfa7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -317,6 +317,7 @@ F:	xen/include/xen/hypfs.h
 
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
 R:	Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
+R:	Daniel P. Smith <dpsmith@apertussolutions.com>
 S:	Odd Fixes
 F:	xen/arch/x86/include/asm/tboot.h
 F:	xen/arch/x86/tboot.c
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:33:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257086.441564 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yLr-0006aG-Ap; Thu, 13 Jan 2022 11:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257086.441564; Thu, 13 Jan 2022 11:33: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 1n7yLr-0006a8-7z; Thu, 13 Jan 2022 11:33:07 +0000
Received: by outflank-mailman (input) for mailman id 257086;
 Thu, 13 Jan 2022 11:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yLp-0006a2-My
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33: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 1n7yLp-0003qN-JY
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yLp-0003SZ-IW
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sqvfOFyaC4JRizS8/bAIdStokBoS0KVVhsmInX6Kmvw=; b=gifJ6md1xTgXlgCQQQnhCQnsId
	e8torbHmIU7mY2/e+7W3nstsRhE5C7Ps+Bb1Tk1I+opMeygoanOcoQ3WBNqoLSmYhVA7s1Ms7Fhcm
	SUZRZaHHpZEAUdfqPU6w9aGRQAF1yRh+/yYjrolZIVX6eDDSIc2zR0MwPIHGOsea5EDM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] virtio-balloon: don't start free page hinting if postcopy is possible
Message-Id: <E1n7yLp-0003SZ-IW@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:33:05 +0000

commit aa77e375a5b1b91d7646d8b5f8683778f53fbbd3
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Thu Jul 8 11:53:38 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:18 2021 -0600

    virtio-balloon: don't start free page hinting if postcopy is possible
    
    Postcopy never worked properly with 'free-page-hint=on', as there are
    at least two issues:
    
    1) With postcopy, the guest will never receive a VIRTIO_BALLOON_CMD_ID_DONE
       and consequently won't release free pages back to the OS once
       migration finishes.
    
       The issue is that for postcopy, we won't do a final bitmap sync while
       the guest is stopped on the source and
       virtio_balloon_free_page_hint_notify() will only call
       virtio_balloon_free_page_done() on the source during
       PRECOPY_NOTIFY_CLEANUP, after the VM state was already migrated to
       the destination.
    
    2) Once the VM touches a page on the destination that has been excluded
       from migration on the source via qemu_guest_free_page_hint() while
       postcopy is active, that thread will stall until postcopy finishes
       and all threads are woken up. (with older Linux kernels that won't
       retry faults when woken up via userfaultfd, we might actually get a
       SEGFAULT)
    
       The issue is that the source will refuse to migrate any pages that
       are not marked as dirty in the dirty bmap -- for example, because the
       page might just have been sent. Consequently, the faulting thread will
       stall, waiting for the page to be migrated -- which could take quite
       a while and result in guest OS issues.
    
    While we could fix 1) comparatively easily, 2) is harder to get right and
    might require more involved RAM migration changes on source and destination
    [1].
    
    As it never worked properly, let's not start free page hinting in the
    precopy notifier if the postcopy migration capability was enabled to fix
    it easily. Capabilities cannot be enabled once migration is already
    running.
    
    Note 1: in the future we might either adjust migration code on the source
            to track pages that have actually been sent or adjust
            migration code on source and destination  to eventually send
            pages multiple times from the source and and deal with pages
            that are sent multiple times on the destination.
    
    Note 2: virtio-mem has similar issues, however, access to "unplugged"
            memory by the guest is very rare and we would have to be very
            lucky for it to happen during migration. The spec states
            "The driver SHOULD NOT read from unplugged memory blocks ..."
            and "The driver MUST NOT write to unplugged memory blocks".
            virtio-mem will move away from virtio_balloon_free_page_done()
            soon and handle this case explicitly on the destination.
    
    [1] https://lkml.kernel.org/r/e79fd18c-aa62-c1d8-c7f3-ba3fc2c25fc8@redhat.com
    
    Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
    Cc: qemu-stable@nongnu.org
    Cc: Wei Wang <wei.w.wang@intel.com>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Cc: Alexander Duyck <alexander.duyck@gmail.com>
    Cc: Juan Quintela <quintela@redhat.com>
    Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
    Cc: Peter Xu <peterx@redhat.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20210708095339.20274-2-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Peter Xu <peterx@redhat.com>
    (cherry picked from commit fd51e54fa10221e5a8add894c38cc1cf199f4bc4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio-balloon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 4b5d9e5e50..ae7867a8db 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -30,6 +30,7 @@
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "migration/misc.h"
+#include "migration/migration.h"
 
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
@@ -662,6 +663,18 @@ virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data)
         return 0;
     }
 
+    /*
+     * Pages hinted via qemu_guest_free_page_hint() are cleared from the dirty
+     * bitmap and will not get migrated, especially also not when the postcopy
+     * destination starts using them and requests migration from the source; the
+     * faulting thread will stall until postcopy migration finishes and
+     * all threads are woken up. Let's not start free page hinting if postcopy
+     * is possible.
+     */
+    if (migrate_postcopy_ram()) {
+        return 0;
+    }
+
     switch (pnd->reason) {
     case PRECOPY_NOTIFY_BEFORE_BITMAP_SYNC:
         virtio_balloon_free_page_stop(dev);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:33:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257087.441568 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yM1-0006c6-Cg; Thu, 13 Jan 2022 11:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257087.441568; Thu, 13 Jan 2022 11:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yM1-0006by-9X; Thu, 13 Jan 2022 11:33:17 +0000
Received: by outflank-mailman (input) for mailman id 257087;
 Thu, 13 Jan 2022 11:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yLz-0006bm-Nr
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33: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 1n7yLz-0003qj-N1
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yLz-0003TH-Lw
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nzwqHKHtaCJsZm1Zf7nmWqgHZeLG0YvwOk1TYHw2iYU=; b=3R0YIJ2Wm5lT4brIzjdNjNlu+A
	fBtqC0Dz+/jNEaL1gov7FUJLgkA84tZ13XNPpIwV8kMraueUx6AyEkM4l5fc5cfd9Tar4krgCcVZ7
	rkFRJbCuLkSU6xLgO1+hgtxPASeOaFW5FO1wrgHYuLoz2TBIgIwu7fLtxM9qrhtfC1kE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] target/arm: Don't skip M-profile reset entirely in user mode
Message-Id: <E1n7yLz-0003TH-Lw@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:33:15 +0000

commit 3054f772de9c2e97e7c196d4f3e70d58aca1e807
Author:     Peter Maydell <peter.maydell@linaro.org>
AuthorDate: Mon Sep 20 09:54:33 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:25 2021 -0600

    target/arm: Don't skip M-profile reset entirely in user mode
    
    Currently all of the M-profile specific code in arm_cpu_reset() is
    inside a !defined(CONFIG_USER_ONLY) ifdef block.  This is
    unintentional: it happened because originally the only
    M-profile-specific handling was the setup of the initial SP and PC
    from the vector table, which is system-emulation only.  But then we
    added a lot of other M-profile setup to the same "if (ARM_FEATURE_M)"
    code block without noticing that it was all inside a not-user-mode
    ifdef.  This has generally been harmless, but with the addition of
    v8.1M low-overhead-loop support we ran into a problem: the reset of
    FPSCR.LTPSIZE to 4 was only being done for system emulation mode, so
    if a user-mode guest tried to execute the LE instruction it would
    incorrectly take a UsageFault.
    
    Adjust the ifdefs so only the really system-emulation specific parts
    are covered.  Because this means we now run some reset code that sets
    up initial values in the FPCCR and similar FPU related registers,
    explicitly set up the registers controlling FPU context handling in
    user-emulation mode so that the FPU works by design and not by
    chance.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/613
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-id: 20210914120725.24992-2-peter.maydell@linaro.org
    (cherry picked from commit b62ceeaf8096fdbbbfdc6087da0028bc4a4dd77e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/arm/cpu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 2866dd7658..af60c07ca1 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -265,12 +265,15 @@ static void arm_cpu_reset(DeviceState *dev)
         env->uncached_cpsr = ARM_CPU_MODE_SVC;
     }
     env->daif = PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F;
+#endif
 
     if (arm_feature(env, ARM_FEATURE_M)) {
+#ifndef CONFIG_USER_ONLY
         uint32_t initial_msp; /* Loaded from 0x0 */
         uint32_t initial_pc; /* Loaded from 0x4 */
         uint8_t *rom;
         uint32_t vecbase;
+#endif
 
         if (cpu_isar_feature(aa32_lob, cpu)) {
             /*
@@ -324,6 +327,8 @@ static void arm_cpu_reset(DeviceState *dev)
             env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK |
                 R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK;
         }
+
+#ifndef CONFIG_USER_ONLY
         /* Unlike A/R profile, M profile defines the reset LR value */
         env->regs[14] = 0xffffffff;
 
@@ -352,8 +357,22 @@ static void arm_cpu_reset(DeviceState *dev)
         env->regs[13] = initial_msp & 0xFFFFFFFC;
         env->regs[15] = initial_pc & ~1;
         env->thumb = initial_pc & 1;
+#else
+        /*
+         * For user mode we run non-secure and with access to the FPU.
+         * The FPU context is active (ie does not need further setup)
+         * and is owned by non-secure.
+         */
+        env->v7m.secure = false;
+        env->v7m.nsacr = 0xcff;
+        env->v7m.cpacr[M_REG_NS] = 0xf0ffff;
+        env->v7m.fpccr[M_REG_S] &=
+            ~(R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK);
+        env->v7m.control[M_REG_S] |= R_V7M_CONTROL_FPCA_MASK;
+#endif
     }
 
+#ifndef CONFIG_USER_ONLY
     /* AArch32 has a hard highvec setting of 0xFFFF0000.  If we are currently
      * executing as AArch32 then check if highvecs are enabled and
      * adjust the PC accordingly.
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:33:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:33:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257088.441572 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMB-0006f7-E9; Thu, 13 Jan 2022 11:33:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257088.441572; Thu, 13 Jan 2022 11:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMB-0006ez-B0; Thu, 13 Jan 2022 11:33:27 +0000
Received: by outflank-mailman (input) for mailman id 257088;
 Thu, 13 Jan 2022 11:33:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yM9-0006eO-RU
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33: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 1n7yM9-0003r4-QX
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yM9-0003Ts-PU
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P0LoLLQopBwzMV/PaB7eiM68b94KvneXPna7AixKgQc=; b=diWzXPRjgsC6HR1hRIwgf8Kur9
	6IFn8LSh43B9A1vztga3/FC4NnU56a8RbuhMfTzsXBNGo3Bym+2LbJZqJow99rMAf3Z1u/QBs1t4Z
	xX8U8LzaPAPkrpHt0CDHvrVGwhpHDpZZsv/8L9rilmf8NY5CH0HxIhKg7irj4gV9L65A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] virtio-net: fix use after unmap/free for sg
Message-Id: <E1n7yM9-0003Ts-PU@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:33:25 +0000

commit 9e41f16fca436a666ee79f5219797a2c58b6cf19
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Sep 2 13:44:12 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:31 2021 -0600

    virtio-net: fix use after unmap/free for sg
    
    When mergeable buffer is enabled, we try to set the num_buffers after
    the virtqueue elem has been unmapped. This will lead several issues,
    E.g a use after free when the descriptor has an address which belongs
    to the non direct access region. In this case we use bounce buffer
    that is allocated during address_space_map() and freed during
    address_space_unmap().
    
    Fixing this by storing the elems temporarily in an array and delay the
    unmap after we set the the num_buffers.
    
    This addresses CVE-2021-3748.
    
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Fixes: fbe78f4f55c6 ("virtio-net support")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit bedd7e93d01961fcb16a97ae45d93acf357e11f6)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/virtio-net.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 16d20cdee5..f205331dcf 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1746,10 +1746,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
     VirtIONet *n = qemu_get_nic_opaque(nc);
     VirtIONetQueue *q = virtio_net_get_subqueue(nc);
     VirtIODevice *vdev = VIRTIO_DEVICE(n);
+    VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE];
+    size_t lens[VIRTQUEUE_MAX_SIZE];
     struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
     struct virtio_net_hdr_mrg_rxbuf mhdr;
     unsigned mhdr_cnt = 0;
-    size_t offset, i, guest_offset;
+    size_t offset, i, guest_offset, j;
+    ssize_t err;
 
     if (!virtio_net_can_receive(nc)) {
         return -1;
@@ -1780,6 +1783,12 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
 
         total = 0;
 
+        if (i == VIRTQUEUE_MAX_SIZE) {
+            virtio_error(vdev, "virtio-net unexpected long buffer chain");
+            err = size;
+            goto err;
+        }
+
         elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement));
         if (!elem) {
             if (i) {
@@ -1791,7 +1800,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                              n->guest_hdr_len, n->host_hdr_len,
                              vdev->guest_features);
             }
-            return -1;
+            err = -1;
+            goto err;
         }
 
         if (elem->in_num < 1) {
@@ -1799,7 +1809,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                          "virtio-net receive queue contains no in buffers");
             virtqueue_detach_element(q->rx_vq, elem, 0);
             g_free(elem);
-            return -1;
+            err = -1;
+            goto err;
         }
 
         sg = elem->in_sg;
@@ -1836,12 +1847,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
         if (!n->mergeable_rx_bufs && offset < size) {
             virtqueue_unpop(q->rx_vq, elem, total);
             g_free(elem);
-            return size;
+            err = size;
+            goto err;
         }
 
-        /* signal other side */
-        virtqueue_fill(q->rx_vq, elem, total, i++);
-        g_free(elem);
+        elems[i] = elem;
+        lens[i] = total;
+        i++;
     }
 
     if (mhdr_cnt) {
@@ -1851,10 +1863,23 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                      &mhdr.num_buffers, sizeof mhdr.num_buffers);
     }
 
+    for (j = 0; j < i; j++) {
+        /* signal other side */
+        virtqueue_fill(q->rx_vq, elems[j], lens[j], j);
+        g_free(elems[j]);
+    }
+
     virtqueue_flush(q->rx_vq, i);
     virtio_notify(vdev, q->rx_vq);
 
     return size;
+
+err:
+    for (j = 0; j < i; j++) {
+        g_free(elems[j]);
+    }
+
+    return err;
 }
 
 static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:33:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257089.441576 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yML-0006ib-FR; Thu, 13 Jan 2022 11:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257089.441576; Thu, 13 Jan 2022 11:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yML-0006iT-CT; Thu, 13 Jan 2022 11:33:37 +0000
Received: by outflank-mailman (input) for mailman id 257089;
 Thu, 13 Jan 2022 11:33: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 1n7yMJ-0006iB-Ur
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33: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 1n7yMJ-0003rJ-U6
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yMJ-0003Ua-Sz
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZBVzfYsaYmOVJ9wLsVb1EsflToEPEU1t+1DVyGuocyg=; b=AqJefIZV70fC+eZwC8WpaJN3o1
	3KPU4B3fMDIJj/giWj/vwRJ79Q7MOJhhbNnqcsTxC66VOJflRhCNZuTiFZ2YWfQACzOUhoLUnLaYE
	MdoHXsQyD9F6FcZIcDKKjPMofD4RsxV2Ilj4wqt+SeDWkvLZ9xqNKF3RwTc9avucRKJE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] qemu-nbd: Change default cache mode to writeback
Message-Id: <E1n7yMJ-0003Ua-Sz@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:33:35 +0000

commit 4c34ef3d341deff67bed735efca91d2ce0f9368c
Author:     Nir Soffer <nirsof@gmail.com>
AuthorDate: Fri Aug 13 23:55:19 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:36 2021 -0600

    qemu-nbd: Change default cache mode to writeback
    
    Both qemu and qemu-img use writeback cache mode by default, which is
    already documented in qemu(1). qemu-nbd uses writethrough cache mode by
    default, and the default cache mode is not documented.
    
    According to the qemu-nbd(8):
    
       --cache=CACHE
              The  cache  mode  to be used with the file.  See the
              documentation of the emulator's -drive cache=... option for
              allowed values.
    
    qemu(1) says:
    
        The default mode is cache=writeback.
    
    So users have no reason to assume that qemu-nbd is using writethough
    cache mode. The only hint is the painfully slow writing when using the
    defaults.
    
    Looking in git history, it seems that qemu used writethrough in the past
    to support broken guests that did not flush data properly, or could not
    flush due to limitations in qemu. But qemu-nbd clients can use
    NBD_CMD_FLUSH to flush data, so using writethrough does not help anyone.
    
    Change the default cache mode to writback, and document the default and
    available values properly in the online help and manual.
    
    With this change converting image via qemu-nbd is 3.5 times faster.
    
        $ qemu-img create dst.img 50g
        $ qemu-nbd -t -f raw -k /tmp/nbd.sock dst.img
    
    Before this change:
    
        $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
        Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
          Time (mean ± σ):     83.639 s ±  5.970 s    [User: 2.733 s, System: 6.112 s]
          Range (min … max):   76.749 s … 87.245 s    3 runs
    
    After this change:
    
        $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
        Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
          Time (mean ± σ):     23.522 s ±  0.433 s    [User: 2.083 s, System: 5.475 s]
          Range (min … max):   23.234 s … 24.019 s    3 runs
    
    Users can avoid the issue by using --cache=writeback[1] but the defaults
    should give good performance for the common use case.
    
    [1] https://bugzilla.redhat.com/1990656
    
    Signed-off-by: Nir Soffer <nsoffer@redhat.com>
    Message-Id: <20210813205519.50518-1-nsoffer@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    CC: qemu-stable@nongnu.org
    Signed-off-by: Eric Blake <eblake@redhat.com>
    (cherry picked from commit 09615257058a0ae87b837bb041f56f7312d9ead8)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 docs/tools/qemu-nbd.rst | 6 ++++--
 qemu-nbd.c              | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst
index ee862fa0bc..5643da26e9 100644
--- a/docs/tools/qemu-nbd.rst
+++ b/docs/tools/qemu-nbd.rst
@@ -98,8 +98,10 @@ driver options if ``--image-opts`` is specified.
 
 .. option:: --cache=CACHE
 
-  The cache mode to be used with the file.  See the documentation of
-  the emulator's ``-drive cache=...`` option for allowed values.
+  The cache mode to be used with the file. Valid values are:
+  ``none``, ``writeback`` (the default), ``writethrough``,
+  ``directsync`` and ``unsafe``. See the documentation of
+  the emulator's ``-drive cache=...`` option for more info.
 
 .. option:: -n, --nocache
 
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 26ffbf15af..6c18fcd19a 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -135,7 +135,9 @@ static void usage(const char *name)
 "                            'snapshot.id=[ID],snapshot.name=[NAME]', or\n"
 "                            '[ID_OR_NAME]'\n"
 "  -n, --nocache             disable host cache\n"
-"      --cache=MODE          set cache mode (none, writeback, ...)\n"
+"      --cache=MODE          set cache mode used to access the disk image, the\n"
+"                            valid options are: 'none', 'writeback' (default),\n"
+"                            'writethrough', 'directsync' and 'unsafe'\n"
 "      --aio=MODE            set AIO mode (native, io_uring or threads)\n"
 "      --discard=MODE        set discard mode (ignore, unmap)\n"
 "      --detect-zeroes=MODE  set detect-zeroes mode (off, on, unmap)\n"
@@ -552,7 +554,7 @@ int main(int argc, char **argv)
     bool alloc_depth = false;
     const char *tlscredsid = NULL;
     bool imageOpts = false;
-    bool writethrough = true;
+    bool writethrough = false; /* Client will flush as needed. */
     bool fork_process = false;
     bool list = false;
     int old_stderr = -1;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:33:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:33:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257090.441580 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMV-0006le-HD; Thu, 13 Jan 2022 11:33:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257090.441580; Thu, 13 Jan 2022 11:33:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMV-0006lW-E2; Thu, 13 Jan 2022 11:33:47 +0000
Received: by outflank-mailman (input) for mailman id 257090;
 Thu, 13 Jan 2022 11:33: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 1n7yMU-0006lL-2d
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33: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 1n7yMU-0003rV-1L
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yMU-0003VT-0J
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33: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=uN4x/4PzrsuzKKYMJgWXHhFrEmXmxqTgWd2IhXscwXY=; b=d+TbS5MheTqfxruL6N+q4MF3MG
	1yNK1lab358Wf5h/VSSaPrPoizXD89wnnY3VKroiHhNb6QxvsZ3ohG+1Sd/MRxXSvq1mq0MWltfZR
	kCVCpK6R5ZLhZBMbG2E5Gk7SnogHZCGElIfzsO1Ayp/NmpQJhna8jnimMjinOvp9J0OE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hmp: Unbreak "change vnc"
Message-Id: <E1n7yMU-0003VT-0J@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:33:46 +0000

commit 7637373b23f32fb88e100df455addc4107a054dc
Author:     Markus Armbruster <armbru@redhat.com>
AuthorDate: Thu Sep 9 10:12:18 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:41 2021 -0600

    hmp: Unbreak "change vnc"
    
    HMP command "change vnc" can take the password as argument, or prompt
    for it:
    
        (qemu) change vnc password 123
        (qemu) change vnc password
        Password: ***
        (qemu)
    
    This regressed in commit cfb5387a1d "hmp: remove "change vnc TARGET"
    command", v6.0.0.
    
        (qemu) change vnc passwd 123
        Password: ***
        (qemu) change vnc passwd
        (qemu)
    
    The latter passes NULL to qmp_change_vnc_password(), which is a no-no.
    Looks like it puts the display into "password required, but none set"
    state.
    
    The logic error is easy to miss in review, but testing should've
    caught it.
    
    Fix the obvious way.
    
    Fixes: cfb5387a1de2acda23fb5c97d2378b9e7ddf8025
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
    Message-Id: <20210909081219.308065-2-armbru@redhat.com>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 6193344f9337f8b76cd44ce94a32c9900d907d35)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index e00255f7ee..a7e197a90b 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1496,7 +1496,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
         }
         if (strcmp(target, "passwd") == 0 ||
             strcmp(target, "password") == 0) {
-            if (arg) {
+            if (!arg) {
                 MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
                 monitor_read_password(hmp_mon, hmp_change_read_arg, NULL);
                 return;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:33:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:33:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257091.441584 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMf-0006ot-Jf; Thu, 13 Jan 2022 11:33:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257091.441584; Thu, 13 Jan 2022 11:33:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMf-0006om-Gt; Thu, 13 Jan 2022 11:33:57 +0000
Received: by outflank-mailman (input) for mailman id 257091;
 Thu, 13 Jan 2022 11:33:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yMe-0006oX-5L
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33: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 1n7yMe-0003rh-4Z
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yMe-0003WC-3a
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:33: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=Ni5WZEjfs18g53fbLEbg+bPa6eiJ2j3l5gy9lid4SVg=; b=CQfH5RmAOPziNHCoW+0mjTUoqD
	WcIbkSh6aCHliW5iYi73Gg1GRAAOfqZ/oUDyFGXKieow1ngMetpDulHvQ3VFLSCI9pP6+byBygViX
	MW4prm27etdPM069HyA7h+FrmF9/2J8wAFkyLjEvY2q27keaKNOwM81i/3QIf6zHS42o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
Message-Id: <E1n7yMe-0003WC-3a@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:33:56 +0000

commit f0dee5a40d27ad8ce2d180141bb5953fce44a146
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Wed Sep 29 18:24:43 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:49 2021 -0600

    virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
    
    Apparently, we don't have to duplicate the string.
    
    Fixes: 722a3c783ef4 ("virtio-pci: Send qapi events when the virtio-mem size changes")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Markus Armbruster <armbru@redhat.com>
    Message-Id: <20210929162445.64060-2-david@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 75b98cb9f6456ccf194211beffcbf93b0a995fa4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio-mem-pci.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c
index fa5395cd88..7e384b7397 100644
--- a/hw/virtio/virtio-mem-pci.c
+++ b/hw/virtio/virtio-mem-pci.c
@@ -88,13 +88,8 @@ static void virtio_mem_pci_size_change_notify(Notifier *notifier, void *data)
                                          size_change_notifier);
     DeviceState *dev = DEVICE(pci_mem);
     const uint64_t * const size_p = data;
-    const char *id = NULL;
 
-    if (dev->id) {
-        id = g_strdup(dev->id);
-    }
-
-    qapi_event_send_memory_device_size_change(!!id, id, *size_p);
+    qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p);
 }
 
 static void virtio_mem_pci_class_init(ObjectClass *klass, void *data)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:34:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257092.441588 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMp-0006rn-LM; Thu, 13 Jan 2022 11:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257092.441588; Thu, 13 Jan 2022 11:34:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMp-0006rf-IT; Thu, 13 Jan 2022 11:34:07 +0000
Received: by outflank-mailman (input) for mailman id 257092;
 Thu, 13 Jan 2022 11:34:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yMo-0006rV-8e
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34: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 1n7yMo-0003sB-7s
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yMo-0003XO-72
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jn6z5IHvNQ/MEx39H3z68SZQ4c/hwww+Z0QHZynBqXw=; b=Jcv1oUAWeqEWNIVSGj70r8hXm3
	J9GqcsTDwHcbdmhOAeJ0tdQRIoTB64Wq2w6/7uuuUgrZ0o0/2zbDCOttwuUBdHIc0snfY2frWChrl
	JgnOaTATxoa935XDSTfiMItmumGyWiyRKTg66Bq9vHYZxhfMCgZD1ycX8UAX1YYD2/6Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] uas: add stream number sanity checks.
Message-Id: <E1n7yMo-0003XO-72@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:34:06 +0000

commit 23ba9f170feca6ae0d8442aab2c89656f9b01288
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Wed Aug 18 14:05:05 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:53 2021 -0600

    uas: add stream number sanity checks.
    
    The device uses the guest-supplied stream number unchecked, which can
    lead to guest-triggered out-of-band access to the UASDevice->data3 and
    UASDevice->status3 fields.  Add the missing checks.
    
    Fixes: CVE-2021-3713
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reported-by: Chen Zhe <chenzhe@huawei.com>
    Reported-by: Tan Jingguo <tanjingguo@huawei.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20210818120505.1258262-2-kraxel@redhat.com>
    (cherry picked from commit 13b250b12ad3c59114a6a17d59caf073ce45b33a)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/usb/dev-uas.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 263056231c..f6309a5ebf 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -840,6 +840,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         }
         break;
     case UAS_PIPE_ID_STATUS:
+        if (p->stream > UAS_MAX_STREAMS) {
+            goto err_stream;
+        }
         if (p->stream) {
             QTAILQ_FOREACH(st, &uas->results, next) {
                 if (st->stream == p->stream) {
@@ -867,6 +870,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         break;
     case UAS_PIPE_ID_DATA_IN:
     case UAS_PIPE_ID_DATA_OUT:
+        if (p->stream > UAS_MAX_STREAMS) {
+            goto err_stream;
+        }
         if (p->stream) {
             req = usb_uas_find_request(uas, p->stream);
         } else {
@@ -902,6 +908,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         p->status = USB_RET_STALL;
         break;
     }
+
+err_stream:
+    error_report("%s: invalid stream %d", __func__, p->stream);
+    p->status = USB_RET_STALL;
+    return;
 }
 
 static void usb_uas_unrealize(USBDevice *dev)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:34:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:34:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257093.441592 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMz-0006uO-Ml; Thu, 13 Jan 2022 11:34:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257093.441592; Thu, 13 Jan 2022 11:34:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yMz-0006uG-K2; Thu, 13 Jan 2022 11:34:17 +0000
Received: by outflank-mailman (input) for mailman id 257093;
 Thu, 13 Jan 2022 11:34:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yMy-0006u7-Bu
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34: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 1n7yMy-0003sg-B7
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yMy-0003YS-AG
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zQ6sL6qs3UlObaUyi8lHXF01xIyraGZrXTLrHJgv4ow=; b=rXMyh2GCWVkI73aAAu2AwyegGG
	dWDqwG7bJRkje2TUacZEOKU6ExcKVnrQO9tvVe2OblA2jc426MAv8lVs9fsf9gLtm0+PMMy1R3ysn
	fjosOI1oXfzlf3OsnC+2Iv+L1oXDp5EJ3psway0eqNSTulYJaXWA5UjPSx8TuPm3SSr8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] vhost-user: fix duplicated notifier MR init
Message-Id: <E1n7yMy-0003YS-AG@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:34:16 +0000

commit 695c25e167e217aab74f964afe9b93a8a52b4d41
Author:     Xueming Li <xuemingl@nvidia.com>
AuthorDate: Fri Oct 8 16:02:15 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:02 2021 -0600

    vhost-user: fix duplicated notifier MR init
    
    In case of device resume after suspend, VQ notifier MR still valid.
    Duplicated registrations explode memory block list and slow down device
    resume.
    
    Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers")
    Cc: tiwei.bie@intel.com
    Cc: qemu-stable@nongnu.org
    Cc: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
    
    Signed-off-by: Xueming Li <xuemingl@nvidia.com>
    Message-Id: <20211008080215.590292-1-xuemingl@nvidia.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit a1ed9ef1de87c3e86ff68589604298ec90875a14)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/vhost-user.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index aec6cc1990..7b35c5d71d 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1469,8 +1469,9 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
 
     name = g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]",
                            user, queue_idx);
-    memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
-                                      page_size, addr);
+    if (!n->mr.ram) /* Don't init again after suspend. */
+        memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
+                                          page_size, addr);
     g_free(name);
 
     if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:34:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:34:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257094.441597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yN9-0006xB-Oo; Thu, 13 Jan 2022 11:34:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257094.441597; Thu, 13 Jan 2022 11:34:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yN9-0006wz-LZ; Thu, 13 Jan 2022 11:34:27 +0000
Received: by outflank-mailman (input) for mailman id 257094;
 Thu, 13 Jan 2022 11:34:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yN8-0006ws-F6
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34: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 1n7yN8-0003su-EP
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yN8-0003ZS-DU
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1ccT3EFaR0nLa1MBAwW9V5z/i2SiacMZseGZQ872pO0=; b=VNpbwpjNwSzJVXjX5p2uhpvT/M
	nBi9iDL1+eLhrv0RYsTiJAxl/rTzJVTs8SnegCj7K76xL4Coc3LYvM7sRCYN4uB5wjXFqQ7ynh6hN
	OeoIMobFR22qzPlZQxkR7HAh635MpBsGqTIKEBivRUcVJwOqMaJ5qaMyYEVGLINMHwYc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
Message-Id: <E1n7yN8-0003ZS-DU@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:34:26 +0000

commit 3c6e5df1f6badec09cdbbff29b16668a92816b68
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Mon Oct 11 22:10:47 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:07 2021 -0600

    libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
    
    We end up not copying the mmap_addr of all existing regions, resulting
    in a SEGFAULT once we actually try to map/access anything within our
    memory regions.
    
    Fixes: 875b9fd97b34 ("Support individual region unmap in libvhost-user")
    Cc: qemu-stable@nongnu.org
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
    Cc: Stefan Hajnoczi <stefanha@redhat.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Coiby Xu <coiby.xu@gmail.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20211011201047.62587-1-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 6889eb2d431ae962e3e083b57bff47cd573cb1c4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 subprojects/libvhost-user/libvhost-user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index bf09693255..787f4d2d4f 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -816,6 +816,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
             shadow_regions[j].gpa = dev->regions[i].gpa;
             shadow_regions[j].size = dev->regions[i].size;
             shadow_regions[j].qva = dev->regions[i].qva;
+            shadow_regions[j].mmap_addr = dev->regions[i].mmap_addr;
             shadow_regions[j].mmap_offset = dev->regions[i].mmap_offset;
             j++;
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:34:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:34:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257095.441600 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yNJ-000707-Q8; Thu, 13 Jan 2022 11:34:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257095.441600; Thu, 13 Jan 2022 11:34:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yNJ-0006zz-N9; Thu, 13 Jan 2022 11:34:37 +0000
Received: by outflank-mailman (input) for mailman id 257095;
 Thu, 13 Jan 2022 11:34:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNI-0006zm-I7
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34: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 1n7yNI-0003t6-HP
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNI-0003aT-Gk
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FGqblHIHt7x3zyijCtk6N7HS2CsQdBRcdofNZhbrx4E=; b=NjwyFKIGKDKShCECMJIdt4ybJg
	kDqhq8IkOOVO78G7Mzf0HDgK9s0vgqrb17TDfdZIjmO/GGSm+fq1KZaIOdE4fm4Tgu8fV/TYxclq8
	02ZdpyUSyoRNQZcMvSjY4kzhoXyreUQaYXtfTtFGWp06p4z++889KAheC9EX2vYIMmoU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()
Message-Id: <E1n7yNI-0003aT-Gk@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:34:36 +0000

commit b19de1137bc158cc2782750f1a94be153a5fd54d
Author:     Helge Deller <deller@gmx.de>
AuthorDate: Tue May 25 22:12:45 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:12 2021 -0600

    hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()
    
    The CDE desktop on HP-UX 10 shows wrongly rendered pixels when the local screen
    menu is closed. This bug was introduced by commit c7050f3f167b
    ("hw/display/artist: Refactor x/y coordination extraction") which converted the
    coordinate extraction in artist_vram_read() and artist_vram_write() to use the
    ADDR_TO_X and ADDR_TO_Y macros, but forgot to right-shift the address by 2 as
    it was done before.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Fixes: c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction")
    Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Cc: Richard Henderson <richard.henderson@linaro.org>
    Cc: Sven Schnelle <svens@stackframe.org>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Message-Id: <YK1aPb8keur9W7h2@ls3530>
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    (cherry picked from commit 01f750f5fef1afd8f6abc0548910f87d473e26d5)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/display/artist.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/display/artist.c b/hw/display/artist.c
index aa7bd594aa..21b7fd1b44 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -1170,8 +1170,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,
     }
 
     buf = vram_write_buffer(s);
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (!buf->size) {
         return;
@@ -1232,8 +1232,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)
         return 0;
     }
 
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (posy > buf->height || posx > buf->width) {
         return 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:34:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:34:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257097.441603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yNT-000736-Rc; Thu, 13 Jan 2022 11:34:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257097.441603; Thu, 13 Jan 2022 11:34: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 1n7yNT-00072y-Ok; Thu, 13 Jan 2022 11:34:47 +0000
Received: by outflank-mailman (input) for mailman id 257097;
 Thu, 13 Jan 2022 11:34:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNS-00072b-Lf
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34: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 1n7yNS-0003tH-Ky
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNS-0003bV-K4
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GfbKKcdMH3aTrEqVcfouv2hddEGS6q7lbW1CYim5/wE=; b=2qRk0Z9Vek2p6zJYW6vYpS6BL6
	lYeSMLxAt9krVH/fLsQ+e3Sbcsf/N36wNPLlpC51ebZ9+BFscSbADGasIJYF9GxtclnYfcHud515u
	pDyaRodYGPVBTaI3nPX71mjRzLBlVWx7EEmQe/AYXqbYG1ogruCkHeh7IkfaClmQXoCY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model
Message-Id: <E1n7yNS-0003bV-K4@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:34:46 +0000

commit ff6d391e10d04a457994be8c032c6c38c0118ebc
Author:     Yang Zhong <yang.zhong@intel.com>
AuthorDate: Fri Aug 20 13:46:11 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:43:09 2021 -0600

    i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model
    
    The AVX_VNNI feature is not in Cooperlake platform, remove it
    from cpu model.
    
    Signed-off-by: Yang Zhong <yang.zhong@intel.com>
    Message-Id: <20210820054611.84303-1-yang.zhong@intel.com>
    Fixes: c1826ea6a052 ("i386/cpu: Expose AVX_VNNI instruction to guest")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    (cherry picked from commit f429dbf8fc526a9cacf531176b28d0c65701475a)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 34a7ce865b..24ddc5b926 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3102,7 +3102,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
             MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO |
             MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO,
         .features[FEAT_7_1_EAX] =
-            CPUID_7_1_EAX_AVX_VNNI | CPUID_7_1_EAX_AVX512_BF16,
+            CPUID_7_1_EAX_AVX512_BF16,
         /* XSAVES is added in version 2 */
         .features[FEAT_XSAVE] =
             CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:34:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:34:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257098.441608 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yNd-000761-TJ; Thu, 13 Jan 2022 11:34:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257098.441608; Thu, 13 Jan 2022 11:34:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yNd-00075t-QJ; Thu, 13 Jan 2022 11:34:57 +0000
Received: by outflank-mailman (input) for mailman id 257098;
 Thu, 13 Jan 2022 11:34:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNc-00075h-P1
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34: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 1n7yNc-0003tP-OJ
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNc-0003cY-NU
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:34:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hOUGnqLlUjFcmKm7q6NrLmr0b2jOGdon5yy9iW8rmeA=; b=6exOg033EdAywkZZZ9dC2squJ+
	oJMODMY6aF/jSXF2NkFHIqhwP7h2nZ06OZQ+fwP574eWdTzHmxj81CrjahhRmgT++1fgokDkqewlc
	x5hodYFe+V2l7xxyFqeMNwhkb79A+xpsGufM5vqyJvtxAxJjUFuaE91Zyi3pakCKN4Ic=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] 9pfs: fix crash in v9fs_walk()
Message-Id: <E1n7yNc-0003cY-NU@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:34:56 +0000

commit abeee2a470f549b2730365f350416cc932340324
Author:     Christian Schoenebeck <qemu_oss@crudebyte.com>
AuthorDate: Wed Sep 1 18:15:10 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:46:48 2021 -0600

    9pfs: fix crash in v9fs_walk()
    
    v9fs_walk() utilizes the v9fs_co_run_in_worker({...}) macro to run the
    supplied fs driver code block on a background worker thread.
    
    When either the 'Twalk' client request was interrupted or if the client
    requested fid for that 'Twalk' request caused a stat error then that
    fs driver code block was left by 'break' keyword, with the intention to
    return from worker thread back to main thread as well:
    
        v9fs_co_run_in_worker({
            if (v9fs_request_cancelled(pdu)) {
                err = -EINTR;
                break;
            }
            err = s->ops->lstat(&s->ctx, &dpath, &fidst);
            if (err < 0) {
                err = -errno;
                break;
            }
            ...
        });
    
    However that 'break;' statement also skipped the v9fs_co_run_in_worker()
    macro's final and mandatory
    
        /* re-enter back to qemu thread */
        qemu_coroutine_yield();
    
    call and thus caused the rest of v9fs_walk() to be continued being
    executed on the worker thread instead of main thread, eventually
    leading to a crash in the transport virtio transport driver.
    
    To fix this issue and to prevent the same error from happening again by
    other users of v9fs_co_run_in_worker() in future, auto wrap the supplied
    code block into its own
    
        do { } while (0);
    
    loop inside the 'v9fs_co_run_in_worker' macro definition.
    
    Full discussion and backtrace:
    https://lists.gnu.org/archive/html/qemu-devel/2021-08/msg05209.html
    https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg00174.html
    
    Fixes: 8d6cb100731c4d28535adbf2a3c2d1f29be3fef4
    Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Greg Kurz <groug@kaod.org>
    Message-Id: <E1mLTBg-0002Bh-2D@lizzy.crudebyte.com>
    (cherry picked from commit f83df00900816476cca41bb536e4d532b297d76e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/9pfs/coth.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h
index c51289903d..f83c7dda7b 100644
--- a/hw/9pfs/coth.h
+++ b/hw/9pfs/coth.h
@@ -51,7 +51,9 @@
          */                                                             \
         qemu_coroutine_yield();                                         \
         qemu_bh_delete(co_bh);                                          \
-        code_block;                                                     \
+        do {                                                            \
+            code_block;                                                 \
+        } while (0);                                                    \
         /* re-enter back to qemu thread */                              \
         qemu_coroutine_yield();                                         \
     } while (0)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:35:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:35:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257099.441612 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yNn-00078q-VI; Thu, 13 Jan 2022 11:35:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257099.441612; Thu, 13 Jan 2022 11:35: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 1n7yNn-00078g-Rn; Thu, 13 Jan 2022 11:35:07 +0000
Received: by outflank-mailman (input) for mailman id 257099;
 Thu, 13 Jan 2022 11:35:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNm-00078W-S2
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35: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 1n7yNm-0003tk-RM
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNm-0003dk-Qb
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YzwvbfPWK6IEmsehbsdMdaF6JdsK4t5YcHHVppYH+qM=; b=x+2ANN+DJu4LN+f/6Hy9VuUaQT
	APNXk+8iZH1JCLxkJ77vFsQBNws+SGUwDHIeIphhKU2t1wm6ttykNSVAK2c4g9M/k8mSouTjazZ7k
	OVIkzGAt/I7AocippKVN1qXN8GMQT+0kf19xbSZasRm/xG6Qv+dHEqful48stJKptx6Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] plugins/execlog: removed unintended "s" at the end of log lines.
Message-Id: <E1n7yNm-0003dk-Qb@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:35:06 +0000

commit f97853c8cb849cc4773005183c974dec641d8493
Author:     Mahmoud Mandour <ma.mandourr@gmail.com>
AuthorDate: Fri Aug 6 15:10:12 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:48:25 2021 -0600

    plugins/execlog: removed unintended "s" at the end of log lines.
    
    Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20210803151428.125323-1-ma.mandourr@gmail.com>
    Message-Id: <20210806141015.2487502-2-alex.bennee@linaro.org>
    Cc: qemu-stable@nongnu.org
    (cherry picked from commit b40310616d2bd550279dd22b05483c3c613a00ff)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 contrib/plugins/execlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index 2de9f0d7d4..a5275dcc15 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -67,7 +67,7 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *udata)
     /* Print previous instruction in cache */
     if (s->len) {
         qemu_plugin_outs(s->str);
-        qemu_plugin_outs("s\n");
+        qemu_plugin_outs("\n");
     }
 
     /* Store new instruction in cache */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:35:19 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:35:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257100.441616 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yNz-0007CL-1q; Thu, 13 Jan 2022 11:35:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257100.441616; Thu, 13 Jan 2022 11:35:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yNy-0007CC-VG; Thu, 13 Jan 2022 11:35:18 +0000
Received: by outflank-mailman (input) for mailman id 257100;
 Thu, 13 Jan 2022 11:35: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 1n7yNw-0007C3-VO
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35: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 1n7yNw-0003uF-Uj
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yNw-0003ey-Tw
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=J4aciLjzYIHg5P5KpjBERn4oYbW+3kwIai2wHe5Iw3M=; b=3izl4F7LTmr3BVQwY/xNLX6Pdg
	2D8xkB+/uvGFQTsItSkVdhUYhbMYG59gxjANoLkTPae/fHMn48KGNBpWSi6RwRauBvTBHTpDFQCXe
	MJZoNhoZm+DxhGzoPV1UEHC9PnsPonol9WleJ9k+h3Gw7xQ7R4/n1VMde8yLQM1gmehs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] plugins: do not limit exported symbols if modules are active
Message-Id: <E1n7yNw-0003ey-Tw@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:35:16 +0000

commit ec0803510289fcb15d8b4f8699169ac35f842bfe
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Wed Aug 11 12:05:50 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:49:09 2021 -0600

    plugins: do not limit exported symbols if modules are active
    
    On Mac --enable-modules and --enable-plugins are currently incompatible, because the
    Apple -Wl,-exported_symbols_list command line options prevents the export of any
    symbols needed by the modules.  On x86 -Wl,--dynamic-list does not have this effect,
    but only because the -Wl,--export-dynamic option provided by gmodule-2.0.pc overrides
    it.  On Apple there is no -Wl,--export-dynamic, because it is the default, and thus
    no override.
    
    Either way, when modules are active there is no reason to include the plugin_ldflags.
    While at it, avoid the useless -Wl,--export-dynamic when --enable-plugins is
    specified but --enable-modules is not; this way, the GNU and Apple configurations
    are more similar.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/516
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    [AJB: fix noexport to no-export]
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20210811100550.54714-1-pbonzini@redhat.com>
    Cc: qemu-stable@nongnu.org
    (cherry picked from commit b906acace2d4f68b6ff8de73739a773cc4851436)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 configure           |  5 ++---
 plugins/meson.build | 14 ++++++++------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 9a79a004d7..7659870810 100755
--- a/configure
+++ b/configure
@@ -3187,9 +3187,8 @@ glib_req_ver=2.56
 glib_modules=gthread-2.0
 if test "$modules" = yes; then
     glib_modules="$glib_modules gmodule-export-2.0"
-fi
-if test "$plugins" = "yes"; then
-    glib_modules="$glib_modules gmodule-2.0"
+elif test "$plugins" = "yes"; then
+    glib_modules="$glib_modules gmodule-no-export-2.0"
 fi
 
 for i in $glib_modules; do
diff --git a/plugins/meson.build b/plugins/meson.build
index e77723010e..bfd5c9822a 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -1,9 +1,11 @@
-if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
-  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
-elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
-  plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
-else
-  plugin_ldflags = []
+plugin_ldflags = []
+# Modules need more symbols than just those in plugins/qemu-plugins.symbols
+if not enable_modules
+  if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
+    plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
+  elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
+    plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
+  endif
 endif
 
 specific_ss.add(when: 'CONFIG_PLUGIN', if_true: [files(
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:35:29 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:35:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257101.441619 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yO9-0007F0-3U; Thu, 13 Jan 2022 11:35:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257101.441619; Thu, 13 Jan 2022 11:35:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yO9-0007Es-0S; Thu, 13 Jan 2022 11:35:29 +0000
Received: by outflank-mailman (input) for mailman id 257101;
 Thu, 13 Jan 2022 11:35: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 1n7yO7-0007Ec-2D
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35: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 1n7yO7-0003uL-1W
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yO7-0003g9-0l
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35: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=RMezBWTEgocGLH45bM8AZXq9h71v6eTjNr5/su95dlU=; b=osB5/v/lHDeo3Tju9XWOlXUVhB
	9xsbeJ4WsgPAliVdwWkLuz584ocA3/Ok60lVkHzKLbshTX14hMe10oxs8okWlp5RqrQdGHu5HP8Sz
	ad2N794bkKcAXEUkw6nzYOQkOtidcFXHBRzAo7VWz+ZHfAlPbkUI7frnkG2PzbujNAsw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] qemu-sockets: fix unix socket path copy (again)
Message-Id: <E1n7yO7-0003g9-0l@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:35:27 +0000

commit 3ee93e456d08415cc1abe4110f6e0c9b0ead0bbc
Author:     Michael Tokarev <mjt@tls.msk.ru>
AuthorDate: Wed Sep 1 16:16:24 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:55:36 2021 -0600

    qemu-sockets: fix unix socket path copy (again)
    
    Commit 4cfd970ec188558daa6214f26203fe553fb1e01f added an
    assert which ensures the path within an address of a unix
    socket returned from the kernel is at least one byte and
    does not exceed sun_path buffer. Both of this constraints
    are wrong:
    
    A unix socket can be unnamed, in this case the path is
    completely empty (not even \0)
    
    And some implementations (notable linux) can add extra
    trailing byte (\0) _after_ the sun_path buffer if we
    passed buffer larger than it (and we do).
    
    So remove the assertion (since it causes real-life breakage)
    but at the same time fix the usage of sun_path. Namely,
    we should not access sun_path[0] if kernel did not return
    it at all (this is the case for unnamed sockets),
    and use the returned salen when copyig actual path as an
    upper constraint for the amount of bytes to copy - this
    will ensure we wont exceed the information provided by
    the kernel, regardless whenever there is a trailing \0
    or not. This also helps with unnamed sockets.
    
    Note the case of abstract socket, the sun_path is actually
    a blob and can contain \0 characters, - it should not be
    passed to g_strndup and the like, it should be accessed by
    memcpy-like functions.
    
    Fixes: 4cfd970ec188558daa6214f26203fe553fb1e01f
    Fixes: http://bugs.debian.org/993145
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    CC: qemu-stable@nongnu.org
    (cherry picked from commit 118d527f2e4baec5fe8060b22a6212468b8e4d3f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 util/qemu-sockets.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index f2f3676d1f..c5043999e9 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1345,25 +1345,22 @@ socket_sockaddr_to_address_unix(struct sockaddr_storage *sa,
     SocketAddress *addr;
     struct sockaddr_un *su = (struct sockaddr_un *)sa;
 
-    assert(salen >= sizeof(su->sun_family) + 1 &&
-           salen <= sizeof(struct sockaddr_un));
-
     addr = g_new0(SocketAddress, 1);
     addr->type = SOCKET_ADDRESS_TYPE_UNIX;
+    salen -= offsetof(struct sockaddr_un, sun_path);
 #ifdef CONFIG_LINUX
-    if (!su->sun_path[0]) {
+    if (salen > 0 && !su->sun_path[0]) {
         /* Linux abstract socket */
-        addr->u.q_unix.path = g_strndup(su->sun_path + 1,
-                                        salen - sizeof(su->sun_family) - 1);
+        addr->u.q_unix.path = g_strndup(su->sun_path + 1, salen - 1);
         addr->u.q_unix.has_abstract = true;
         addr->u.q_unix.abstract = true;
         addr->u.q_unix.has_tight = true;
-        addr->u.q_unix.tight = salen < sizeof(*su);
+        addr->u.q_unix.tight = salen < sizeof(su->sun_path);
         return addr;
     }
 #endif
 
-    addr->u.q_unix.path = g_strndup(su->sun_path, sizeof(su->sun_path));
+    addr->u.q_unix.path = g_strndup(su->sun_path, salen);
     return addr;
 }
 #endif /* WIN32 */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:35:39 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:35:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257102.441624 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yOJ-0007Hi-4j; Thu, 13 Jan 2022 11:35:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257102.441624; Thu, 13 Jan 2022 11:35:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yOJ-0007Ha-1r; Thu, 13 Jan 2022 11:35:39 +0000
Received: by outflank-mailman (input) for mailman id 257102;
 Thu, 13 Jan 2022 11:35:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOH-0007HI-5R
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOH-0003uV-4h
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOH-0003h9-41
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pAoIuTti5uKuAAqP8OkTfop/PidoPwbY5+V44d6/7Uk=; b=cLx+HAgoUcLY4aswS+V2B78rYe
	0Xzpgfgzj/WqJE2ODdS8txO57OpebaNjKB6Nb0xi+BMQnnxYEL/1CQepRMgP4agGwRc3F7xqyy/7P
	2Ap2LelJ3lLhUraV8WyIAeiUoxQVFHo0iB1kdQTDM8L8+bM6Tx8W9x1iJoTYldus5YkU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] vhost-vsock: fix migration issue when seqpacket is supported
Message-Id: <E1n7yOH-0003h9-41@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:35:37 +0000

commit 246ccfbf44a0ff5967393adb7b7a79dc7c353eb6
Author:     Stefano Garzarella <sgarzare@redhat.com>
AuthorDate: Tue Sep 21 18:16:41 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:04:13 2021 -0600

    vhost-vsock: fix migration issue when seqpacket is supported
    
    Commit 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support")
    enabled the SEQPACKET feature bit.
    This commit is released with QEMU 6.1, so if we try to migrate a VM where
    the host kernel supports SEQPACKET but machine type version is less than
    6.1, we get the following errors:
    
        Features 0x130000002 unsupported. Allowed features: 0x179000000
        Failed to load virtio-vhost_vsock:virtio
        error while loading state for instance 0x0 of device '0000:00:05.0/virtio-vhost_vsock'
        load of migration failed: Operation not permitted
    
    Let's disable the feature bit for machine types < 6.1.
    We add a new OnOffAuto property for this, called `seqpacket`.
    When it is `auto` (default), QEMU behaves as before, trying to enable the
    feature, when it is `on` QEMU will fail if the backend (vhost-vsock
    kernel module) doesn't support it.
    
    Fixes: 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support")
    Cc: qemu-stable@nongnu.org
    Reported-by: Jiang Wang <jiang.wang@bytedance.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20210921161642.206461-2-sgarzare@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d6a9378f47515c6d70dbff4912c5740c98709880)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/core/machine.c               |  1 +
 hw/virtio/vhost-vsock.c         | 19 ++++++++++++++++---
 include/hw/virtio/vhost-vsock.h |  3 +++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 54e040587d..2cf2f321f9 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -43,6 +43,7 @@ GlobalProperty hw_compat_6_0[] = {
     { "nvme-ns", "eui64-default", "off"},
     { "e1000", "init-vet", "off" },
     { "e1000e", "init-vet", "off" },
+    { "vhost-vsock-device", "seqpacket", "off" },
 };
 const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0);
 
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 1b1a5c70ed..dade0da031 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -114,10 +114,21 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          Error **errp)
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+
+    if (vsock->seqpacket != ON_OFF_AUTO_OFF) {
+        virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
+    }
+
+    requested_features = vhost_get_features(&vvc->vhost_dev, feature_bits,
+                                            requested_features);
+
+    if (vsock->seqpacket == ON_OFF_AUTO_ON &&
+        !virtio_has_feature(requested_features, VIRTIO_VSOCK_F_SEQPACKET)) {
+        error_setg(errp, "vhost-vsock backend doesn't support seqpacket");
+    }
 
-    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
-    return vhost_get_features(&vvc->vhost_dev, feature_bits,
-                                requested_features);
+    return requested_features;
 }
 
 static const VMStateDescription vmstate_virtio_vhost_vsock = {
@@ -218,6 +229,8 @@ static void vhost_vsock_device_unrealize(DeviceState *dev)
 static Property vhost_vsock_properties[] = {
     DEFINE_PROP_UINT64("guest-cid", VHostVSock, conf.guest_cid, 0),
     DEFINE_PROP_STRING("vhostfd", VHostVSock, conf.vhostfd),
+    DEFINE_PROP_ON_OFF_AUTO("seqpacket", VHostVSock, seqpacket,
+                            ON_OFF_AUTO_AUTO),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsock.h
index 84f4e727c7..3f121a624f 100644
--- a/include/hw/virtio/vhost-vsock.h
+++ b/include/hw/virtio/vhost-vsock.h
@@ -30,6 +30,9 @@ struct VHostVSock {
     VHostVSockCommon parent;
     VHostVSockConf conf;
 
+    /* features */
+    OnOffAuto seqpacket;
+
     /*< public >*/
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:35:49 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:35:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257103.441628 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yOT-0007L0-6c; Thu, 13 Jan 2022 11:35:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257103.441628; Thu, 13 Jan 2022 11:35:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yOT-0007Kq-3U; Thu, 13 Jan 2022 11:35:49 +0000
Received: by outflank-mailman (input) for mailman id 257103;
 Thu, 13 Jan 2022 11:35:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOR-0007Ke-8q
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOR-0003ub-88
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOR-0003iS-7J
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aBQj6LQfEVdArZo4Wc4qkQeo1hD9XSTwnLH4y3Z2LlQ=; b=h9gfME3kHE3adSZhgCoE6brbwk
	Llf6eFBGD0ISUqWCQlKuLnXeldPfPQZJkTnj7xxf9SKlRtR8ExphK63P6OfP6aFsPKHTDyrzuI7AU
	FmrBKZqylbUbyiB8UP+JYyklTEQQHNiKRJREmDZZ9iC8bT3Z6rHymPTEbq8tIJZYtYy0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw/arm/virt: Rename default_bus_bypass_iommu
Message-Id: <E1n7yOR-0003iS-7J@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:35:47 +0000

commit 36cfd11a867ebcf015db24b666ec28deb05c101f
Author:     Jean-Philippe Brucker <jean-philippe@linaro.org>
AuthorDate: Tue Oct 26 10:37:34 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:07:27 2021 -0600

    hw/arm/virt: Rename default_bus_bypass_iommu
    
    Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine
    parameter definitions cannot use underscores, because keyval_dashify()
    transforms them to dashes and the parser doesn't find the parameter.
    
    This affects option default_bus_bypass_iommu which was introduced in the
    same release:
    
    $ qemu-system-aarch64 -M virt,default_bus_bypass_iommu=on
    qemu-system-aarch64: Property 'virt-6.1-machine.default-bus-bypass-iommu' not found
    
    Rename the parameter to "default-bus-bypass-iommu". Passing
    "default_bus_bypass_iommu" is still valid since the underscore are
    transformed automatically.
    
    Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option")
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Tested-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20211026093733.2144161-1-jean-philippe@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit 9dad363a223df8269175d218413aa8cd265e078e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/arm/virt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 81eda46b0b..106be60fd4 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2677,10 +2677,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
                                           "Set the IOMMU type. "
                                           "Valid values are none and smmuv3");
 
-    object_class_property_add_bool(oc, "default_bus_bypass_iommu",
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
                                    virt_get_default_bus_bypass_iommu,
                                    virt_set_default_bus_bypass_iommu);
-    object_class_property_set_description(oc, "default_bus_bypass_iommu",
+    object_class_property_set_description(oc, "default-bus-bypass-iommu",
                                           "Set on/off to enable/disable "
                                           "bypass_iommu for default root bus");
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:35:59 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:35:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257105.441636 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yOd-0007RF-Hw; Thu, 13 Jan 2022 11:35:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257105.441636; Thu, 13 Jan 2022 11:35:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yOd-0007Qf-E4; Thu, 13 Jan 2022 11:35:59 +0000
Received: by outflank-mailman (input) for mailman id 257105;
 Thu, 13 Jan 2022 11:35:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOb-0007NS-Br
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOb-0003uj-BF
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOb-0003jo-AU
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:35:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=upr7/ixpIv8zrJ1wuD9PNWJBONDL6L39xVA0oHKjX10=; b=v30Hi19j9z+gJQqtYrX957woMA
	uZKO9TrQGmIuS8IZti7piedywkOeOYwf531j0TTGoHF1Iv2FWgNX+n/13rs42XDPgvnd8BrfT9VTK
	H7rCf4Og+zt204P3ghwKFan/BLSPmxHm7CpWI6W9nc2rSg61aC2W5ggmE/VxMqBZaHk8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw/i386: Rename default_bus_bypass_iommu
Message-Id: <E1n7yOb-0003jo-AU@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:35:57 +0000

commit 5cf977a2a18a0f6c92b36e852639f26b993d76e5
Author:     Jean-Philippe Brucker <jean-philippe@linaro.org>
AuthorDate: Mon Oct 25 11:47:38 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:07:48 2021 -0600

    hw/i386: Rename default_bus_bypass_iommu
    
    Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine
    parameter definitions cannot use underscores, because keyval_dashify()
    transforms them to dashes and the parser doesn't find the parameter.
    
    This affects option default_bus_bypass_iommu which was introduced in the
    same release:
    
    $ qemu-system-x86_64 -M q35,default_bus_bypass_iommu=on
    qemu-system-x86_64: Property 'pc-q35-6.1-machine.default-bus-bypass-iommu' not found
    
    Rename the parameter to "default-bus-bypass-iommu". Passing
    "default_bus_bypass_iommu" is still valid since the underscore are
    transformed automatically.
    
    Fixes: c9e96b04fc19 ("hw/i386: Add a default_bus_bypass_iommu pc machine option")
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Tested-by: Eric Auger <eric.auger@redhat.com>
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Message-Id: <20211025104737.1560274-1-jean-philippe@linaro.org>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 739b38630c45585cd9d372d44537f69c0b2b4346)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/i386/pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c2b9d62a35..1d421ae2f8 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1763,7 +1763,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     object_class_property_add_bool(oc, "hpet",
         pc_machine_get_hpet, pc_machine_set_hpet);
 
-    object_class_property_add_bool(oc, "default_bus_bypass_iommu",
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
         pc_machine_get_default_bus_bypass_iommu,
         pc_machine_set_default_bus_bypass_iommu);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:36:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:36:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257106.441648 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yOm-0007jY-Ps; Thu, 13 Jan 2022 11:36:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257106.441648; Thu, 13 Jan 2022 11:36: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 1n7yOm-0007jQ-MR; Thu, 13 Jan 2022 11:36:08 +0000
Received: by outflank-mailman (input) for mailman id 257106;
 Thu, 13 Jan 2022 11:36: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 1n7yOl-0007io-Ey
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOl-0003vw-EL
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOl-0003mG-DX
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cN2JotxVO0jO/5LKXmU9uKjE4vuvKQw26JBF+J4unqk=; b=fKQOaTUI0BcEJOtRob6oU9zFlv
	0ho2d8nQzY66jo3pDzQzkYyjDFpAVhCuWKYpzZWFSciGGI2SseOfQ1lbnGoJ2o7++bHer29kmvnJy
	KIAPEPflcDe1pnbVoR35iI3yx+HVVB6q7qmEMGqT8PHjNGrsVzG4W/qx6vtjuofWq6oo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] bios-tables-test: allow changes in DSDT ACPI tables for q35
Message-Id: <E1n7yOl-0003mG-DX@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:36:07 +0000

commit c66f5dfc127adaadb67a2d95e5e58e6542aaa9eb
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:36 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:12:31 2021 -0600

    bios-tables-test: allow changes in DSDT ACPI tables for q35
    
    We are going to commit a change to fix IO address range allocated for acpi pci
    hotplug in q35. This affects DSDT tables. This change allows DSDT table
    modification so that unit tests are not broken.
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20210916132838.3469580-2-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 9f29e872d5b3973003701401cf659cfb71c95013)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..c06da38af3 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,13 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT",
+"tests/data/acpi/q35/DSDT.tis.tpm12",
+"tests/data/acpi/q35/DSDT.tis.tpm2",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.mmio64",
+"tests/data/acpi/q35/DSDT.ipmibt",
+"tests/data/acpi/q35/DSDT.cphp",
+"tests/data/acpi/q35/DSDT.memhp",
+"tests/data/acpi/q35/DSDT.numamem",
+"tests/data/acpi/q35/DSDT.nohpet",
+"tests/data/acpi/q35/DSDT.dimmpxm",
+"tests/data/acpi/q35/DSDT.acpihmat",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:36:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:36:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257108.441650 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yOw-0007rx-R8; Thu, 13 Jan 2022 11:36:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257108.441650; Thu, 13 Jan 2022 11:36: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 1n7yOw-0007ro-Nx; Thu, 13 Jan 2022 11:36:18 +0000
Received: by outflank-mailman (input) for mailman id 257108;
 Thu, 13 Jan 2022 11:36: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 1n7yOv-0007q6-IA
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36: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 1n7yOv-0003xD-HT
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yOv-0003nI-Gi
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36: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=5PACkQcQXBpmS5g7Bg97gOWrOlXUQ3mVKFkgBgXuj2s=; b=DPDyAmLLjgp2EvEnsNFyXkT/sk
	BE2kdx3D7KtdE7vcHok7wCtPhavEUchQ+gj8szDlxC1w0jzzY1gohfy5KH8ZwUMeRqGTNXKV7cNb9
	f2ElWx+KUFyhtRH0kZV5azCxm2jNM2gcI34vI5vA/Dj321N2CGIPw1fjQ6nlhtPAYi9g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
Message-Id: <E1n7yOv-0003nI-Gi@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:36:17 +0000

commit 9e80a430ed5996734ef35c457d793b8106f16d15
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:37 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:12:38 2021 -0600

    hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
    
    Change caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
    selects an IO address range for acpi based PCI hotplug for q35 arbitrarily. It
    starts at address 0x0cc4 and ends at 0x0cdb. At the time when the patch was
    written but the final version of the patch was not yet pushed upstream, this
    address range was free and did not conflict with any other IO address ranges.
    However, with the following change, this address range was no
    longer conflict free as in this change, the IO address range
    (value of ACPI_PCIHP_SIZE) was incremented by four bytes:
    
    b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
    
    This can be seen from the output of QMP command 'info mtree' :
    
    0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
    0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
    0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
    0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
    0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
    0000000000000cc4-0000000000000cdb (prio 0, i/o): acpi-pci-hotplug
    0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
    
    It shows that there is a region of conflict between IO regions of acpi
    pci hotplug and acpi cpu hotplug.
    
    Unfortunately, the change caf108bc58790 did not update the IO address range
    appropriately before it was pushed upstream to accommodate the increased
    length of the IO address space introduced in change b32bd763a1ca92.
    
    Due to this bug, windows guests complain 'This device cannot find
    enough free resources it can use' in the device manager panel for extended
    IO buses. This issue also breaks the correct functioning of pci hotplug as the
    following shows that the IO space for pci hotplug has been truncated:
    
    (qemu) info mtree -f
    FlatView #0
     AS "I/O", root: io
     Root memory region: io
      0000000000000cc4-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
      0000000000000cd8-0000000000000cf7 (prio 0, i/o): acpi-cpu-hotplug
    
    Therefore, in this fix, we adjust the IO address range for the acpi pci
    hotplug so that it does not conflict with cpu hotplug and there is no
    truncation of IO spaces. The starting IO address of PCI hotplug region
    has been decremented by four bytes in order to accommodate four byte
    increment in the IO address space introduced by change
    b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
    
    After fixing, the following are the corrected IO ranges:
    
    0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
    0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
    0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
    0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
    0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
    0000000000000cc0-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
    0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
    
    This change has been tested using a Windows Server 2019 guest VM. Windows
    no longer complains after this change.
    
    Fixes: caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/561
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Julia Suvorova <jusual@redhat.com>
    Message-Id: <20210916132838.3469580-3-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 0e780da76a6fe283a20283856718bca3986c104f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 include/hw/acpi/ich9.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index a329ce43ab..f04f1791bd 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -29,7 +29,7 @@
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/acpi/tco.h"
 
-#define ACPI_PCIHP_ADDR_ICH9 0x0cc4
+#define ACPI_PCIHP_ADDR_ICH9 0x0cc0
 
 typedef struct ICH9LPCPMRegs {
     /*
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:36:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:36:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257110.441655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yP6-00081u-Tw; Thu, 13 Jan 2022 11:36:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257110.441655; Thu, 13 Jan 2022 11:36: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 1n7yP6-00081m-R6; Thu, 13 Jan 2022 11:36:28 +0000
Received: by outflank-mailman (input) for mailman id 257110;
 Thu, 13 Jan 2022 11:36: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 1n7yP5-00081X-Lb
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36: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 1n7yP5-0003xS-Km
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yP5-0003oO-Js
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36: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=L3rBQa4+aV5gAPdBXpXwcgCtU/zErdjDwvLlwJ6D0/4=; b=dZilaMGIvGCIZDfoxWKn7UUCXw
	6Wh7Moh7aHcqsQfYHRTDhWgNulgxEm9uN3AzZ5Ttwr4evk4yRBJBLPgUwev42GfqsA+516LnymU/8
	8/5soBHGhQkPy2ObG7m79qkGobrIt9nK5oovYAZxLFpNTRwEdWETGpyz3rAAJnPcGwLo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] bios-tables-test: Update ACPI DSDT table golden blobs for q35
Message-Id: <E1n7yP5-0003oO-Js@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:36:27 +0000

commit 3aa2c2cd679dcf86e67f8c466c2e3c0bc5e1155f
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:38 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:27:44 2021 -0600

    bios-tables-test: Update ACPI DSDT table golden blobs for q35
    
    We have modified the IO address range for ACPI pci hotplug in q35. See change:
    
    5adcc9e39e6a5 ("hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35")
    
    The ACPI DSDT table golden blobs must be regenrated in order to make the unit tests
    pass. This change updates the golden ACPI DSDT table blobs.
    
    Following is the ASL diff between the blobs:
    
    @@ -1,30 +1,30 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT, Tue Sep 14 09:04:06 2021
    + * Disassembly of /tmp/aml-52DP90, Tue Sep 14 09:04:06 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
      *     Length           0x00002061 (8289)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xE5
    + *     Checksum         0xF9
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
    @@ -226,46 +226,46 @@
                 Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                 {
                     IO (Decode16,
                         0x0070,             // Range Minimum
                         0x0070,             // Range Maximum
                         0x01,               // Alignment
                         0x08,               // Length
                         )
                     IRQNoFlags ()
                         {8}
                 })
             }
         }
    
         Scope (_SB.PCI0)
         {
    -        OperationRegion (PCST, SystemIO, 0x0CC4, 0x08)
    +        OperationRegion (PCST, SystemIO, 0x0CC0, 0x08)
             Field (PCST, DWordAcc, NoLock, WriteAsZeros)
             {
                 PCIU,   32,
                 PCID,   32
             }
    
    -        OperationRegion (SEJ, SystemIO, 0x0CCC, 0x04)
    +        OperationRegion (SEJ, SystemIO, 0x0CC8, 0x04)
             Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
             {
                 B0EJ,   32
             }
    
    -        OperationRegion (BNMR, SystemIO, 0x0CD4, 0x08)
    +        OperationRegion (BNMR, SystemIO, 0x0CD0, 0x08)
             Field (BNMR, DWordAcc, NoLock, WriteAsZeros)
             {
                 BNUM,   32,
                 PIDX,   32
             }
    
             Mutex (BLCK, 0x00)
             Method (PCEJ, 2, NotSerialized)
             {
                 Acquire (BLCK, 0xFFFF)
                 BNUM = Arg0
                 B0EJ = (One << Arg1)
                 Release (BLCK)
                 Return (Zero)
             }
    
    @@ -3185,34 +3185,34 @@
                         0x0620,             // Range Minimum
                         0x0620,             // Range Maximum
                         0x01,               // Alignment
                         0x10,               // Length
                         )
                 })
             }
    
             Device (PHPR)
             {
                 Name (_HID, "PNP0A06" /* Generic Container Device */)  // _HID: Hardware ID
                 Name (_UID, "PCI Hotplug resources")  // _UID: Unique ID
                 Name (_STA, 0x0B)  // _STA: Status
                 Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                 {
                     IO (Decode16,
    -                    0x0CC4,             // Range Minimum
    -                    0x0CC4,             // Range Maximum
    +                    0x0CC0,             // Range Minimum
    +                    0x0CC0,             // Range Maximum
                         0x01,               // Alignment
                         0x18,               // Length
                         )
                 })
             }
         }
    
         Scope (\)
         {
             Name (_S3, Package (0x04)  // _S3_: S3 System State
             {
                 One,
                 One,
                 Zero,
                 Zero
             })
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20210916132838.3469580-4-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 500eb21cff08dfb0478db9b34f2fdba69eb31496)
    *drop dependency on 75539b886a ("tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs")
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT                    | Bin 8289 -> 8289 bytes
 tests/data/acpi/q35/DSDT.acpihmat           | Bin 9614 -> 9614 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 11003 -> 11003 bytes
 tests/data/acpi/q35/DSDT.cphp               | Bin 8753 -> 8753 bytes
 tests/data/acpi/q35/DSDT.dimmpxm            | Bin 9943 -> 9943 bytes
 tests/data/acpi/q35/DSDT.ipmibt             | Bin 8364 -> 8364 bytes
 tests/data/acpi/q35/DSDT.memhp              | Bin 9648 -> 9648 bytes
 tests/data/acpi/q35/DSDT.mmio64             | Bin 9419 -> 9419 bytes
 tests/data/acpi/q35/DSDT.nohpet             | Bin 8147 -> 8147 bytes
 tests/data/acpi/q35/DSDT.numamem            | Bin 8295 -> 8295 bytes
 tests/data/acpi/q35/DSDT.tis                | Bin 8894 -> 8894 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |  12 ------------
 12 files changed, 12 deletions(-)

diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT
index 842533f53e..281fc82c03 100644
Binary files a/tests/data/acpi/q35/DSDT and b/tests/data/acpi/q35/DSDT differ
diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.acpihmat
index 8d00f2ea0d..8c1e05a11a 100644
Binary files a/tests/data/acpi/q35/DSDT.acpihmat and b/tests/data/acpi/q35/DSDT.acpihmat differ
diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge
index 55ad4bd7ab..6f1464b6c7 100644
Binary files a/tests/data/acpi/q35/DSDT.bridge and b/tests/data/acpi/q35/DSDT.bridge differ
diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp
index ccde2add9f..f8337ff519 100644
Binary files a/tests/data/acpi/q35/DSDT.cphp and b/tests/data/acpi/q35/DSDT.cphp differ
diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.dimmpxm
index b062e30117..fe5820d93d 100644
Binary files a/tests/data/acpi/q35/DSDT.dimmpxm and b/tests/data/acpi/q35/DSDT.dimmpxm differ
diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt
index 1c5737692f..6317410658 100644
Binary files a/tests/data/acpi/q35/DSDT.ipmibt and b/tests/data/acpi/q35/DSDT.ipmibt differ
diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp
index 7b6f6487b2..9bc11518fc 100644
Binary files a/tests/data/acpi/q35/DSDT.memhp and b/tests/data/acpi/q35/DSDT.memhp differ
diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/q35/DSDT.mmio64
index 2e0a772a85..713288a12e 100644
Binary files a/tests/data/acpi/q35/DSDT.mmio64 and b/tests/data/acpi/q35/DSDT.mmio64 differ
diff --git a/tests/data/acpi/q35/DSDT.nohpet b/tests/data/acpi/q35/DSDT.nohpet
index ceb61f4115..e8202e6ddf 100644
Binary files a/tests/data/acpi/q35/DSDT.nohpet and b/tests/data/acpi/q35/DSDT.nohpet differ
diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem
index a3f846df54..151e7cf429 100644
Binary files a/tests/data/acpi/q35/DSDT.numamem and b/tests/data/acpi/q35/DSDT.numamem differ
diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis
index d1433e3c14..c92d4d29c7 100644
Binary files a/tests/data/acpi/q35/DSDT.tis and b/tests/data/acpi/q35/DSDT.tis differ
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index c06da38af3..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,13 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT",
-"tests/data/acpi/q35/DSDT.tis.tpm12",
-"tests/data/acpi/q35/DSDT.tis.tpm2",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.mmio64",
-"tests/data/acpi/q35/DSDT.ipmibt",
-"tests/data/acpi/q35/DSDT.cphp",
-"tests/data/acpi/q35/DSDT.memhp",
-"tests/data/acpi/q35/DSDT.numamem",
-"tests/data/acpi/q35/DSDT.nohpet",
-"tests/data/acpi/q35/DSDT.dimmpxm",
-"tests/data/acpi/q35/DSDT.acpihmat",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:36:39 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:36:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257111.441659 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPH-00085w-07; Thu, 13 Jan 2022 11:36:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257111.441659; Thu, 13 Jan 2022 11:36:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPG-00085p-Sr; Thu, 13 Jan 2022 11:36:38 +0000
Received: by outflank-mailman (input) for mailman id 257111;
 Thu, 13 Jan 2022 11:36:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPF-00085d-PL
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPF-0003xb-Od
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPF-0003pS-Nv
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qG489MG8g7kAZfgIzeru7zX+q9CScrbkKWdZjpaCNMM=; b=7PWlHshSO9PBs69suI7GgwEpGT
	4GIK4qVp1PMK310xfjvYQgGOtRky752MCQbuJBnzI8b9ityM+bCg1YF5g0L/Rq4QU+K7cF5vcR/ly
	iBEAhTwbai2W/xcfoEQ+HC91DLbD7sWm61WiSDMrwOlJxPLhAxZJhMeIi+14+4rpQCWQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] block: introduce max_hw_iov for use in scsi-generic
Message-Id: <E1n7yPF-0003pS-Nv@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:36:37 +0000

commit a43e057bd6095108fbe99b6a21d4857186aa3df3
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Sep 23 09:04:36 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:53:15 2021 -0600

    block: introduce max_hw_iov for use in scsi-generic
    
    Linux limits the size of iovecs to 1024 (UIO_MAXIOV in the kernel
    sources, IOV_MAX in POSIX).  Because of this, on some host adapters
    requests with many iovecs are rejected with -EINVAL by the
    io_submit() or readv()/writev() system calls.
    
    In fact, the same limit applies to SG_IO as well.  To fix both the
    EINVAL and the possible performance issues from using fewer iovecs
    than allowed by Linux (some HBAs have max_segments as low as 128),
    introduce a separate entry in BlockLimits to hold the max_segments
    value from sysfs.  This new limit is used only for SG_IO and clamped
    to bs->bl.max_iov anyway, just like max_hw_transfer is clamped to
    bs->bl.max_transfer.
    
    Reported-by: Halil Pasic <pasic@linux.ibm.com>
    Cc: Hanna Reitz <hreitz@redhat.com>
    Cc: Kevin Wolf <kwolf@redhat.com>
    Cc: qemu-block@nongnu.org
    Cc: qemu-stable@nongnu.org
    Fixes: 18473467d5 ("file-posix: try BLKSECTGET on block devices too, do not round to power of 2", 2021-06-25)
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210923130436.1187591-1-pbonzini@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit cc071629539dc1f303175a7e2d4ab854c0a8b20f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 block/block-backend.c          | 6 ++++++
 block/file-posix.c             | 2 +-
 block/io.c                     | 1 +
 hw/scsi/scsi-generic.c         | 2 +-
 include/block/block_int.h      | 7 +++++++
 include/sysemu/block-backend.h | 1 +
 6 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index deb55c272e..6320752aa2 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1978,6 +1978,12 @@ uint32_t blk_get_max_transfer(BlockBackend *blk)
     return ROUND_DOWN(max, blk_get_request_alignment(blk));
 }
 
+int blk_get_max_hw_iov(BlockBackend *blk)
+{
+    return MIN_NON_ZERO(blk->root->bs->bl.max_hw_iov,
+                        blk->root->bs->bl.max_iov);
+}
+
 int blk_get_max_iov(BlockBackend *blk)
 {
     return blk->root->bs->bl.max_iov;
diff --git a/block/file-posix.c b/block/file-posix.c
index cb9bffe047..1567edb3d5 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1273,7 +1273,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
 
         ret = hdev_get_max_segments(s->fd, &st);
         if (ret > 0) {
-            bs->bl.max_iov = ret;
+            bs->bl.max_hw_iov = ret;
         }
     }
 }
diff --git a/block/io.c b/block/io.c
index a19942718b..f38e7f81d8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -136,6 +136,7 @@ static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src)
     dst->min_mem_alignment = MAX(dst->min_mem_alignment,
                                  src->min_mem_alignment);
     dst->max_iov = MIN_NON_ZERO(dst->max_iov, src->max_iov);
+    dst->max_hw_iov = MIN_NON_ZERO(dst->max_hw_iov, src->max_hw_iov);
 }
 
 typedef struct BdrvRefreshLimitsState {
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 665baf900e..0306ccc7b1 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -180,7 +180,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
         page = r->req.cmd.buf[2];
         if (page == 0xb0) {
             uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
-            uint32_t max_iov = blk_get_max_iov(s->conf.blk);
+            uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
 
             assert(max_transfer);
             max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index f1a54db0f8..c31cbd034a 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -702,6 +702,13 @@ typedef struct BlockLimits {
      */
     uint64_t max_hw_transfer;
 
+    /* Maximal number of scatter/gather elements allowed by the hardware.
+     * Applies whenever transfers to the device bypass the kernel I/O
+     * scheduler, for example with SG_IO.  If larger than max_iov
+     * or if zero, blk_get_max_hw_iov will fall back to max_iov.
+     */
+    int max_hw_iov;
+
     /* memory alignment, in bytes so that no bounce buffer is needed */
     size_t min_mem_alignment;
 
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 9ac5f7bbd3..5daec61f6e 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -210,6 +210,7 @@ uint32_t blk_get_request_alignment(BlockBackend *blk);
 uint32_t blk_get_max_transfer(BlockBackend *blk);
 uint64_t blk_get_max_hw_transfer(BlockBackend *blk);
 int blk_get_max_iov(BlockBackend *blk);
+int blk_get_max_hw_iov(BlockBackend *blk);
 void blk_set_guest_block_size(BlockBackend *blk, int align);
 void *blk_try_blockalign(BlockBackend *blk, size_t size);
 void *blk_blockalign(BlockBackend *blk, size_t size);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:36:49 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:36:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257112.441665 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPR-0008BJ-2B; Thu, 13 Jan 2022 11:36:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257112.441665; Thu, 13 Jan 2022 11:36:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPQ-0008B7-UY; Thu, 13 Jan 2022 11:36:48 +0000
Received: by outflank-mailman (input) for mailman id 257112;
 Thu, 13 Jan 2022 11:36:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPP-0008An-SV
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPP-0003xj-Rk
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPP-0003qZ-R3
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=US2njwuzTSW/OGjlTETmmqruDg6T32oNPz7myK3lRWg=; b=24T/02a4mY0zuRPlXCabQRuKoT
	UlLhPT2oHEcqws2uvD0ZxPsYo3wxyFiHSdwZu/bYo7Zyn3fK+iASMmpuNmzh10QFbGRF9ms0wf5Rx
	jq6+QH/jko7hMixN7R/ou3+mrtDZLKisHDP+zAkwvHJLoS5h6cVWRbwqT2ZsKI1LNImg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] pci: fix PCI resource reserve capability on BE
Message-Id: <E1n7yPP-0003qZ-R3@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:36:47 +0000

commit 24101e36f1c2c782c8c2d055b477e0e0beaf4c68
Author:     Michael S. Tsirkin <mst@redhat.com>
AuthorDate: Wed Oct 20 05:48:54 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:01:41 2021 -0600

    pci: fix PCI resource reserve capability on BE
    
    PCI resource reserve capability should use LE format as all other PCI
    things. If we don't then seabios won't boot:
    
    === PCI new allocation pass #1 ===
    PCI: check devices
    PCI: QEMU resource reserve cap: size 10000000000000 type io
    PCI: secondary bus 1 size 10000000000000 type io
    PCI: secondary bus 1 size 00200000 type mem
    PCI: secondary bus 1 size 00200000 type prefmem
    === PCI new allocation pass #2 ===
    PCI: out of I/O address space
    
    This became more important since we started reserving IO by default,
    previously no one noticed.
    
    Fixes: e2a6290aab ("hw/pcie-root-port: Fix hotplug for PCI devices requiring IO")
    Cc: marcel.apfelbaum@gmail.com
    Fixes: 226263fb5c ("hw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port")
    Cc: zuban32s@gmail.com
    Fixes: 6755e618d0 ("hw/pci: add PCI resource reserve capability to legacy PCI bridge")
    Cc: jing2.liu@linux.intel.com
    Tested-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    (cherry picked from commit 0e464f7d993113119f0fd17b890831440734ce15)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/pci/pci_bridge.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 3789c17edc..6a1e8e433c 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
     PCIBridgeQemuCap cap = {
             .len = cap_len,
             .type = REDHAT_PCI_CAP_RESOURCE_RESERVE,
-            .bus_res = res_reserve.bus,
-            .io = res_reserve.io,
-            .mem = res_reserve.mem_non_pref,
-            .mem_pref_32 = res_reserve.mem_pref_32,
-            .mem_pref_64 = res_reserve.mem_pref_64
+            .bus_res = cpu_to_le32(res_reserve.bus),
+            .io = cpu_to_le64(res_reserve.io),
+            .mem = cpu_to_le32(res_reserve.mem_non_pref),
+            .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32),
+            .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64)
     };
 
     int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:36:59 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:36:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257113.441667 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPb-0008Jq-2i; Thu, 13 Jan 2022 11:36:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257113.441667; Thu, 13 Jan 2022 11:36:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPa-0008Jg-W1; Thu, 13 Jan 2022 11:36:58 +0000
Received: by outflank-mailman (input) for mailman id 257113;
 Thu, 13 Jan 2022 11:36:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPZ-0008JX-Vc
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPZ-0003y8-Ut
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPZ-0003rd-UE
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:36:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=quF3ucj/gPfntrIkNPl97QyAdjG3YMmbbdftX9w5UEM=; b=1AF4mcvDUPu2gTPZ7dD2a+vrEH
	MmIFjEx4vtIDruVZgpYgn73UJXRWZNOMRbRrFp7GsGv5SY7mA2962OkR6BSBZAQGLZiyJJ0fkJV+s
	jrE1+CrkqVv4GE48sB9muwnJS213kD+aKSlqbJyYt+JwTQCGpf8qxjWGa4xt9855m5i8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
Message-Id: <E1n7yPZ-0003rd-UE@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:36:57 +0000

commit a759dc19ecf11410593db40e2ce7dba3c06f16ac
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:48 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:15 2021 -0600

    tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
    
    We are adding a new unit test to cover the acpi hotplug support in q35 for
    multi-function bridges. This test uses a new table DSDT.multi-bridge.
    We need to allow changes in DSDT acpi table for addition of this new
    unit test.
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-2-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit 6dcb1cc9512c6b4cd8f85abc537abaf6f6c0738b)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT.multi-bridge       | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 1 +
 2 files changed, 1 insertion(+)

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..dabc024f53 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.multi-bridge",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:37:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:37:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257114.441671 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPl-0008Nk-4F; Thu, 13 Jan 2022 11:37:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257114.441671; Thu, 13 Jan 2022 11:37:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPl-0008Nc-1H; Thu, 13 Jan 2022 11:37:09 +0000
Received: by outflank-mailman (input) for mailman id 257114;
 Thu, 13 Jan 2022 11:37:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPk-0008NT-2b
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPk-0003yp-1v
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPk-0003sr-17
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=USQbS4fUM74ZhNMflGohtmXD0zIMPBPZEdKjbKAWZbc=; b=qCR4i1T4F1aCxedVleK8HLJx9+
	G8EfNNA/UEJkWB26sQ+h7fqz91ar+C2n5O9Bd2GS20LASjX+ANWSDTd0H0akonBMUrvg4cCygJpNb
	GJl1ZDU9thXNkp8JIO62hRd4Liow/UglavISU5CbdEzHtfa9XQ64yEPf//BZWOp06/mE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
Message-Id: <E1n7yPk-0003sr-17@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:37:08 +0000

commit 8319de607faa33113ec9b47778da77e7ad4d9c8b
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:49 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:20 2021 -0600

    tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
    
    commit d7346e614f4ec ("acpi: x86: pcihp: add support hotplug on multifunction bridges")
    added ACPI hotplug descriptions for cold plugged bridges for functions other
    than 0. For all other devices, the ACPI hotplug descriptions are limited to
    function 0 only. This change adds unit tests for this feature.
    
    This test adds the following devices to qemu and then checks the changes
    introduced in the DSDT table due to the addition of the following devices:
    
    (a) a multifunction bridge device
    (b) a bridge device with function 1
    (c) a non-bridge device with function 2
    
    In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
    For (a) we should find a hotplug AML description for function 0.
    
    The following diff compares the DSDT table AML with the new unit test before
    and after the change d7346e614f4ec is introduced. In other words,
    this diff reflects the changes that occurs in the DSDT table due to the change
    d7346e614f4ec .
    
    @@ -1,60 +1,38 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT.multi-bridge, Thu Oct  7 18:56:05 2021
    + * Disassembly of /tmp/aml-AN0DA1, Thu Oct  7 18:56:05 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
    - *     Length           0x000020FE (8446)
    + *     Length           0x00002187 (8583)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xDE
    + *     Checksum         0x8D
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
    -    /*
    -     * iASL Warning: There was 1 external control method found during
    -     * disassembly, but only 0 were resolved (1 unresolved). Additional
    -     * ACPI tables may be required to properly disassemble the code. This
    -     * resulting disassembler output file may not compile because the
    -     * disassembler did not know how many arguments to assign to the
    -     * unresolved methods. Note: SSDTs can be dynamically loaded at
    -     * runtime and may or may not be available via the host OS.
    -     *
    -     * In addition, the -fe option can be used to specify a file containing
    -     * control method external declarations with the associated method
    -     * argument counts. Each line of the file must be of the form:
    -     *     External (<method pathname>, MethodObj, <argument count>)
    -     * Invocation:
    -     *     iasl -fe refs.txt -d dsdt.aml
    -     *
    -     * The following methods were unresolved and many not compile properly
    -     * because the disassembler had to guess at the number of arguments
    -     * required for each:
    -     */
    -    External (_SB_.PCI0.S19_.PCNT, MethodObj)    // Warning: Unknown method, guessing 1 arguments
    -
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
             Method (DBUG, 1, NotSerialized)
             {
                 ToHexString (Arg0, Local0)
                 ToBuffer (Local0, Local0)
                 Local1 = (SizeOf (Local0) - One)
                 Local2 = Zero
                 While ((Local2 < Local1))
                 {
    @@ -3322,24 +3300,60 @@
                     Method (DVNT, 2, NotSerialized)
                     {
                         If ((Arg0 & One))
                         {
                             Notify (S00, Arg1)
                         }
                     }
    
                     Method (PCNT, 0, NotSerialized)
                     {
                         BNUM = One
                         DVNT (PCIU, One)
                         DVNT (PCID, 0x03)
                     }
                 }
    
    +            Device (S19)
    +            {
    +                Name (_ADR, 0x00030001)  // _ADR: Address
    +                Name (BSEL, Zero)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = Zero
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
                 Method (PCNT, 0, NotSerialized)
                 {
    -                ^S19.PCNT (^S10.PCNT ())
    +                ^S19.PCNT ()
    +                ^S10.PCNT ()
                 }
             }
         }
     }
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-3-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit 04dd78b9e85720226a148eef54b45cb02b463034)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/bios-tables-test.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 51d3a4e239..921f676e4c 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -859,6 +859,23 @@ static void test_acpi_q35_tcg_bridge(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_multif_bridge(void)
+{
+    test_data data = {
+        .machine = MACHINE_Q35,
+        .variant = ".multi-bridge",
+    };
+    test_acpi_one("-device pcie-root-port,id=pcie-root-port-0,"
+                  "multifunction=on,"
+                  "port=0x0,chassis=1,addr=0x2,bus=pcie.0 "
+                  "-device pcie-root-port,id=pcie-root-port-1,"
+                  "port=0x1,chassis=2,addr=0x3.0x1,bus=pcie.0 "
+                  "-device virtio-balloon,id=balloon0,"
+                  "bus=pcie.0,addr=0x4.0x2",
+                  &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_mmio64(void)
 {
     test_data data = {
@@ -1528,6 +1545,7 @@ int main(int argc, char *argv[])
                        test_acpi_piix4_no_acpi_pci_hotplug);
         qtest_add_func("acpi/q35", test_acpi_q35_tcg);
         qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
+        qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge);
         qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
         qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
         qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:37:19 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:37:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257115.441675 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPv-0008Rc-7O; Thu, 13 Jan 2022 11:37:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257115.441675; Thu, 13 Jan 2022 11:37:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yPv-0008RU-4U; Thu, 13 Jan 2022 11:37:19 +0000
Received: by outflank-mailman (input) for mailman id 257115;
 Thu, 13 Jan 2022 11:37:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPu-0008RL-5g
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPu-0003z7-50
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yPu-0003ty-4M
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wm3HHnBYZtAQf0EePIuV1rssA5O78hbkzsH0ZyIfe6I=; b=CWk4cgIOO7UvyLa0lpEMqx6ZCn
	GprWEoA2KShW+FNfihnyv2gtdzxftH3HeetP4GGECBsokdQMtT1nRTlW5XHCAh2lgoPtlC2PyyGR6
	iFTII136ve9+/b3oXmMQ3mnWHzxWFS6qsAZenY57c68WzUsUjUpTKJBnBYb6SVLd7yqA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
Message-Id: <E1n7yPu-0003ty-4M@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:37:18 +0000

commit bbbdedb38692dc1005a17b465f6b92474356c1c0
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:50 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:24 2021 -0600

    tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
    
    We added a new unit test for testing acpi hotplug on multifunction bridges in
    q35 machines. Here, we update the DSDT table gloden master blob for this unit
    test.
    
    The test adds the following devices to qemu and then checks the changes
    introduced in the DSDT table due to the addition of the following devices:
    
    (a) a multifunction bridge device
    (b) a bridge device with function 1
    (c) a non-bridge device with function 2
    
    In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
    For (a) we should find a hotplug AML description for function 0.
    
    Following is the ASL diff between the original DSDT table and the modified DSDT
    table due to the unit test. We see that multifunction bridge on bus 2 and single
    function bridge on bus 3 function 1 are described, not the non-bridge balloon
    device on bus 4, function 2.
    
    @@ -1,30 +1,30 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT, Thu Oct  7 18:29:19 2021
    + * Disassembly of /tmp/aml-C7JCA1, Thu Oct  7 18:29:19 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
    - *     Length           0x00002061 (8289)
    + *     Length           0x00002187 (8583)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xF9
    + *     Checksum         0x8D
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
    @@ -3265,23 +3265,95 @@
                     Method (_S1D, 0, NotSerialized)  // _S1D: S1 Device State
                     {
                         Return (Zero)
                     }
    
                     Method (_S2D, 0, NotSerialized)  // _S2D: S2 Device State
                     {
                         Return (Zero)
                     }
    
                     Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
                     {
                         Return (Zero)
                     }
                 }
    
    +            Device (S10)
    +            {
    +                Name (_ADR, 0x00020000)  // _ADR: Address
    +                Name (BSEL, One)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = One
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
    +            Device (S19)
    +            {
    +                Name (_ADR, 0x00030001)  // _ADR: Address
    +                Name (BSEL, Zero)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = Zero
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
                 Method (PCNT, 0, NotSerialized)
                 {
    +                ^S19.PCNT ()
    +                ^S10.PCNT ()
                 }
             }
         }
     }
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-4-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit a8339e07f94a47f99560baef59d65a9e039aaf45)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 0 -> 8583 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   1 -
 2 files changed, 1 deletion(-)

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
index e69de29bb2..a24c713d22 100644
Binary files a/tests/data/acpi/q35/DSDT.multi-bridge and b/tests/data/acpi/q35/DSDT.multi-bridge differ
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dabc024f53..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.multi-bridge",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:37:30 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:37:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257117.441679 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQ6-0008Ul-8z; Thu, 13 Jan 2022 11:37:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257117.441679; Thu, 13 Jan 2022 11:37:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQ6-0008Ud-63; Thu, 13 Jan 2022 11:37:30 +0000
Received: by outflank-mailman (input) for mailman id 257117;
 Thu, 13 Jan 2022 11:37:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQ4-0008US-8v
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQ4-0003zE-8H
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQ4-0003vE-7Z
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HVjXMxYHPrHdAuHhd4nLZA9HEjRmMawa8WEc881VXgQ=; b=R8LC7LqXvimsdn7BU1mjtEnA89
	wu9McoV9Q/k5ptr2JhiOxW2UUmMhRc6G8hXaFqMMgmlWQwuJMFiSj1+yW66sMZ21zQ7J5sIECwEKu
	FJUT43yhNa6y1lsIGGhlGt9DgN9I4FtmmX33DsNMWQJAXE8VW8bx6gvFT3vPSBh+G/LE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] block/file-posix: Fix return value translation for AIO discards
Message-Id: <E1n7yQ4-0003vE-7Z@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:37:28 +0000

commit ebf660beb171d40af179f84a967b710199f81511
Author:     Ari Sundholm <ari@tuxera.com>
AuthorDate: Tue Oct 19 14:09:55 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:12:50 2021 -0600

    block/file-posix: Fix return value translation for AIO discards
    
    AIO discards regressed as a result of the following commit:
            0dfc7af2 block/file-posix: Optimize for macOS
    
    When trying to run blkdiscard within a Linux guest, the request would
    fail, with some errors in dmesg:
    
    ---- [ snip ] ----
    [    4.010070] sd 2:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK
    driverbyte=DRIVER_SENSE
    [    4.011061] sd 2:0:0:0: [sda] tag#0 Sense Key : Aborted Command
    [current]
    [    4.011061] sd 2:0:0:0: [sda] tag#0 Add. Sense: I/O process
    terminated
    [    4.011061] sd 2:0:0:0: [sda] tag#0 CDB: Unmap/Read sub-channel 42
    00 00 00 00 00 00 00 18 00
    [    4.011061] blk_update_request: I/O error, dev sda, sector 0
    ---- [ snip ] ----
    
    This turns out to be a result of a flaw in changes to the error value
    translation logic in handle_aiocb_discard(). The default return value
    may be left untranslated in some configurations, and the wrong variable
    is used in one translation.
    
    Fix both issues.
    
    Fixes: 0dfc7af2b28 ("block/file-posix: Optimize for macOS")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Ari Sundholm <ari@tuxera.com>
    Signed-off-by: Emil Karlson <jkarlson@tuxera.com>
    Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-Id: <20211019110954.4170931-1-ari@tuxera.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 13a028336f2c05e7ff47dfdaf30dfac7f4883e80)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 block/file-posix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 1567edb3d5..dd295cfc6d 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1807,7 +1807,7 @@ static int handle_aiocb_copy_range(void *opaque)
 static int handle_aiocb_discard(void *opaque)
 {
     RawPosixAIOData *aiocb = opaque;
-    int ret = -EOPNOTSUPP;
+    int ret = -ENOTSUP;
     BDRVRawState *s = aiocb->bs->opaque;
 
     if (!s->has_discard) {
@@ -1829,7 +1829,7 @@ static int handle_aiocb_discard(void *opaque)
 #ifdef CONFIG_FALLOCATE_PUNCH_HOLE
         ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                            aiocb->aio_offset, aiocb->aio_nbytes);
-        ret = translate_err(-errno);
+        ret = translate_err(ret);
 #elif defined(__APPLE__) && (__MACH__)
         fpunchhole_t fpunchhole;
         fpunchhole.fp_flags = 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:37:40 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:37:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257119.441682 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQG-00006G-AR; Thu, 13 Jan 2022 11:37:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257119.441682; Thu, 13 Jan 2022 11:37:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQG-000068-7Y; Thu, 13 Jan 2022 11:37:40 +0000
Received: by outflank-mailman (input) for mailman id 257119;
 Thu, 13 Jan 2022 11:37:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQE-00005m-CC
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQE-0003zK-BX
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQE-0003wH-Ap
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TrUHsqZVLdgQ4YTLwE94vtxck4/72PWmB1qxP3wSozk=; b=qswMqncfhThM7icUbuNMVql2TM
	pagfjnl7A7/ES/BFH4yBNfpER/DW6WQfjmFV7WfxT4PkN9B3K1WbUbF++jKvOSyJt6HfEKO7VFlMB
	IpJmKXpwgA6DYjNXZ1ZfTXEDdYsGRmCB+1JLpOHXOwdhsbPsGSojJpsqHmLFCqGlFKE0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] Partially revert "build: -no-pie is no functional linker flag"
Message-Id: <E1n7yQE-0003wH-Ap@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:37:38 +0000

commit 43a457841f8c61dd4677ec018c3da4b0323ffb4b
Author:     Jessica Clarke <jrtc27@jrtc27.com>
AuthorDate: Thu Aug 5 20:25:45 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:13:38 2021 -0600

    Partially revert "build: -no-pie is no functional linker flag"
    
    This partially reverts commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53.
    
    This commit was misguided and broke using --disable-pie on any distro
    that enables PIE by default in their compiler driver, including Debian
    and its derivatives. Whilst -no-pie is not a linker flag, it is a
    compiler driver flag that ensures -pie is not automatically passed by it
    to the linker. Without it, all compile_prog checks will fail as any code
    built with the explicit -fno-pie will fail to link with the implicit
    default -pie due to trying to use position-dependent relocations. The
    only bug that needed fixing was LDFLAGS_NOPIE being used as a flag for
    the linker itself in pc-bios/optionrom/Makefile.
    
    Note this does not reinstate exporting LDFLAGS_NOPIE, as it is unused,
    since the only previous use was the one that should not have existed. I
    have also updated the comment for the -fno-pie and -no-pie checks to
    reflect what they're actually needed for.
    
    Fixes: bbd2d5a8120771ec59b86a80a1f51884e0a26e53
    Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
    Message-Id: <20210805192545.38279-1-jrtc27@jrtc27.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit ffd205ef2901bd65fcfbd09a98c0ff7cfcec5e4d)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 configure | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 7659870810..6e308ed77f 100755
--- a/configure
+++ b/configure
@@ -2246,9 +2246,11 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-# Check we support --no-pie first; we will need this for building ROMs.
+# Check we support -fno-pie and -no-pie first; we will need the former for
+# building ROMs, and both for everything if --disable-pie is passed.
 if compile_prog "-Werror -fno-pie" "-no-pie"; then
   CFLAGS_NOPIE="-fno-pie"
+  LDFLAGS_NOPIE="-no-pie"
 fi
 
 if test "$static" = "yes"; then
@@ -2264,6 +2266,7 @@ if test "$static" = "yes"; then
   fi
 elif test "$pie" = "no"; then
   CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
+  CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
   CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:37:50 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:37:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257120.441687 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQQ-00009a-Bs; Thu, 13 Jan 2022 11:37:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257120.441687; Thu, 13 Jan 2022 11:37:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQQ-00009S-8v; Thu, 13 Jan 2022 11:37:50 +0000
Received: by outflank-mailman (input) for mailman id 257120;
 Thu, 13 Jan 2022 11:37:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQO-00009B-FE
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQO-0003zd-Ea
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQO-0003xU-Dw
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WO+e/Cf6tend9c4zO+OIySgQwekZvMRIXaiW7aBynC8=; b=wZVeY421yuHRNFHaU6XBjNckUV
	ZAuwTRiNSHoW8ZkknIBs5A31RWNjkrdaUaBCZRYNsmb7f9cCkgTe93b0igUdX/OV4hzn+BKqZBoH5
	0TJd45DT7+BXWl0jiBj6hj0h43F2r/7/MOe1HR35/LdBYgfNJjBSKp+Ej/8ySmztVeA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] target-i386: mmu: use pg_mode instead of HF_LMA_MASK
Message-Id: <E1n7yQO-0003xU-Dw@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:37:48 +0000

commit cddfaf96ab2a6772dd87998af699f91ca15facfd
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Nov 4 14:45:20 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:18:25 2021 -0600

    target-i386: mmu: use pg_mode instead of HF_LMA_MASK
    
    Correctly look up the paging mode of the hypervisor when it is using 64-bit
    mode but the guest is not.
    
    Fixes: 68746930ae ("target/i386: use mmu_translate for NPT walk", 2021-05-11)
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 93eae3583256896dd91a4c2ca38dcbb8d4051cff)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index b6d940e04e..2dea4a248e 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -90,7 +90,7 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f
         target_ulong pdpe_addr;
 
 #ifdef TARGET_X86_64
-        if (env->hflags & HF_LMA_MASK) {
+        if (pg_mode & PG_MODE_LMA) {
             bool la57 = pg_mode & PG_MODE_LA57;
             uint64_t pml5e_addr, pml5e;
             uint64_t pml4e_addr, pml4e;
@@ -287,7 +287,7 @@ do_check_protect_pse36:
         *prot |= PAGE_EXEC;
     }
 
-    if (!(env->hflags & HF_LMA_MASK)) {
+    if (!(pg_mode & PG_MODE_LMA)) {
         pkr = 0;
     } else if (ptep & PG_USER_MASK) {
         pkr = pg_mode & PG_MODE_PKE ? env->pkru : 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:38:00 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:38:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257121.441691 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQa-0000Cj-DI; Thu, 13 Jan 2022 11:38:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257121.441691; Thu, 13 Jan 2022 11:38:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQa-0000Cc-AM; Thu, 13 Jan 2022 11:38:00 +0000
Received: by outflank-mailman (input) for mailman id 257121;
 Thu, 13 Jan 2022 11:37:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQY-0000CL-IP
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQY-0003zk-Hk
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQY-000404-Gt
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:37:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cRhyzsCsC+9pYohP5xjXcw8XqDFNbZ0+DWxUBENOwu8=; b=xQOndWlviJswgaj9iWqvYrMGoU
	v83xEZX4V6QA8OiEnPKjur+ebePiQ1ei5/wlmmkvrZ+01So6YdrtxsaYZV6rzX6/lxBKpnTl0y8zB
	FsGvfHrsT61BB86o5s0WLG6eJ0pdiV2M/wxdb5qef2BM+rdeT0ifmQOCwq2IogFbnOE8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] target-i386: mmu: fix handling of noncanonical virtual addresses
Message-Id: <E1n7yQY-000404-Gt@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:37:58 +0000

commit 3488bb205de0537ba5364ee1ee09cb07a26a4bb0
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Nov 4 14:47:46 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:19:00 2021 -0600

    target-i386: mmu: fix handling of noncanonical virtual addresses
    
    mmu_translate is supposed to return an error code for page faults; it is
    not able to handle other exceptions.  The #GP case for noncanonical
    virtual addresses is not handled correctly, and incorrectly raised as
    a page fault with error code 1.  Since it cannot happen for nested
    page tables, move it directly to handle_mmu_fault, even before the
    invocation of mmu_translate.
    
    Fixes: #676
    Fixes: 661ff4879e ("target/i386: extract mmu_translate", 2021-05-11)
    Cc: qemu-stable@nongnu.org
    Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b04dc92e013d55c9ac8082caefff45dcfb1310e7)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index 2dea4a248e..9fb59058ef 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -94,15 +94,6 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f
             bool la57 = pg_mode & PG_MODE_LA57;
             uint64_t pml5e_addr, pml5e;
             uint64_t pml4e_addr, pml4e;
-            int32_t sext;
-
-            /* test virtual address sign extension */
-            sext = la57 ? (int64_t)addr >> 56 : (int64_t)addr >> 47;
-            if (get_hphys_func && sext != 0 && sext != -1) {
-                env->error_code = 0;
-                cs->exception_index = EXCP0D_GPF;
-                return 1;
-            }
 
             if (la57) {
                 pml5e_addr = ((cr3 & ~0xfff) +
@@ -423,6 +414,18 @@ static int handle_mmu_fault(CPUState *cs, vaddr addr, int size,
         page_size = 4096;
     } else {
         pg_mode = get_pg_mode(env);
+        if (pg_mode & PG_MODE_LMA) {
+            int32_t sext;
+
+            /* test virtual address sign extension */
+            sext = (int64_t)addr >> (pg_mode & PG_MODE_LA57 ? 56 : 47);
+            if (sext != 0 && sext != -1) {
+                env->error_code = 0;
+                cs->exception_index = EXCP0D_GPF;
+                return 1;
+            }
+        }
+
         error_code = mmu_translate(cs, addr, get_hphys, env->cr[3], is_write1,
                                    mmu_idx, pg_mode,
                                    &paddr, &page_size, &prot);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:38:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:38:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257122.441694 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQk-0000Fe-F8; Thu, 13 Jan 2022 11:38:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257122.441694; Thu, 13 Jan 2022 11:38:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQk-0000FW-CA; Thu, 13 Jan 2022 11:38:10 +0000
Received: by outflank-mailman (input) for mailman id 257122;
 Thu, 13 Jan 2022 11:38:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQi-0000FK-N6
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQi-00040V-Kl
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQi-000416-K8
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x+dD/dQrLf+yqbk+cnLENy6SaVufuN5f4C7fE0+ZG5k=; b=msQQi8SmjpzqbVaLPv/MYf8SMQ
	+eWpYmw4nTKiwaZKFIp8L4cWj88nBGxyrp7exsdElIb9vm8TmPOk8wv3CB3l10LqoeDZY8afx0oSt
	eUHMhex/UTSZq/mWy5Ah3u8Y9q3trmgdo9R/UCR2B52i0Ib3VbcDqmaZpXCJ7OYVecTQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands
Message-Id: <E1n7yQi-000416-K8@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:38:08 +0000

commit c2c7f108b8228091d7ad4bd488c3abb9adc632e7
Author:     Mauro Matteo Cascella <mcascell@redhat.com>
AuthorDate: Thu Nov 4 17:31:38 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:22:44 2021 -0600

    hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands
    
    This avoids an off-by-one read of 'mode_sense_valid' buffer in
    hw/scsi/scsi-disk.c:mode_sense_page().
    
    Fixes: CVE-2021-3930
    Cc: qemu-stable@nongnu.org
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Fixes: a8f4bbe2900 ("scsi-disk: store valid mode pages in a table")
    Fixes: #546
    Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
    Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/scsi/scsi-disk.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index e8a547dbb7..d4914178ea 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1087,6 +1087,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
     uint8_t *p = *p_outbuf + 2;
     int length;
 
+    assert(page < ARRAY_SIZE(mode_sense_valid));
     if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) {
         return -1;
     }
@@ -1428,6 +1429,11 @@ static int scsi_disk_check_mode_select(SCSIDiskState *s, int page,
         return -1;
     }
 
+    /* MODE_PAGE_ALLS is only valid for MODE SENSE commands */
+    if (page == MODE_PAGE_ALLS) {
+        return -1;
+    }
+
     p = mode_current;
     memset(mode_current, 0, inlen + 2);
     len = mode_sense_page(s, page, &p, 0);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:38:20 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:38:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257123.441699 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQu-0000JS-Hw; Thu, 13 Jan 2022 11:38:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257123.441699; Thu, 13 Jan 2022 11:38:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yQu-0000JK-F0; Thu, 13 Jan 2022 11:38:20 +0000
Received: by outflank-mailman (input) for mailman id 257123;
 Thu, 13 Jan 2022 11:38:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQs-0000J8-OV
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQs-00040h-Nq
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yQs-00042V-Mv
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DINmt6apI7mcZOCGHH6XQtAQ3xyUOMr70Wgaplq2iXM=; b=VzzZxxA4BnzFZYtRJ1zedvcC07
	XPVKB7GcnLK2YoC7qDg4ox/A83lRdOG4tBJYjyqJ1Hh/rD8ykZcmOhxRZjmKaYD4+JFAuK4GJnuvW
	wRknryXix9PqITTIcBxIXDFRd079lNW+vitFVV+VWPdn5erlt7g0pvluSCkZrgP1tNao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw: m68k: virt: Add compat machine for 6.1
Message-Id: <E1n7yQs-00042V-Mv@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:38:18 +0000

commit 7d71e6bfb0a2f03bd35165d4fc11da64b7ccc0d7
Author:     Laurent Vivier <laurent@vivier.eu>
AuthorDate: Sat Nov 6 20:41:57 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:23:21 2021 -0600

    hw: m68k: virt: Add compat machine for 6.1
    
    Add the missing machine type for m68k/virt
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    Message-Id: <20211106194158.4068596-2-laurent@vivier.eu>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 6837f299762679429924242a63f16490862578e3)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/m68k/virt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 4e8bce5aa6..0d9e3f83c1 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -304,7 +304,14 @@ type_init(virt_machine_register_types)
     } \
     type_init(machvirt_machine_##major##_##minor##_init);
 
+static void virt_machine_6_1_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE(6, 1, true)
+
 static void virt_machine_6_0_options(MachineClass *mc)
 {
+    virt_machine_6_1_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len);
 }
-DEFINE_VIRT_MACHINE(6, 0, true)
+DEFINE_VIRT_MACHINE(6, 0, false)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:38:30 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:38:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257124.441703 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yR4-0000MO-JV; Thu, 13 Jan 2022 11:38:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257124.441703; Thu, 13 Jan 2022 11:38:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yR4-0000MG-GW; Thu, 13 Jan 2022 11:38:30 +0000
Received: by outflank-mailman (input) for mailman id 257124;
 Thu, 13 Jan 2022 11:38:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yR2-0000M8-Rw
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yR2-00040x-Qy
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yR2-00043d-Q9
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vMLoa9eQlcYGExvW33sqEr6ace6WiccNP4FLz8PYzYM=; b=ibjPVJVxoKdaSkz6QEpR2oNAMB
	/o+VKxD8NiFM2mBCr90KAj/C+XwvYczR/dUyzb9qEdkmvbCqgvaELwvYRdVKj+oxlVECmy4HS7XCx
	B7FcLsc+lo4LJFtjrmAM+fx9dBsh66ZB0gPD0CyDkgiiLDuZ9wykRbxYeF/y9+avA4c4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] rcu: Introduce force_rcu notifier
Message-Id: <E1n7yR2-00043d-Q9@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:38:28 +0000

commit fceaefb43f059428cbedd81810c57b460cc80a79
Author:     Greg Kurz <groug@kaod.org>
AuthorDate: Tue Nov 9 19:35:22 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:25:55 2021 -0600

    rcu: Introduce force_rcu notifier
    
    The drain_rcu_call() function can be blocked as long as an RCU reader
    stays in a read-side critical section. This is typically what happens
    when a TCG vCPU is executing a busy loop. It can deadlock the QEMU
    monitor as reported in https://gitlab.com/qemu-project/qemu/-/issues/650 .
    
    This can be avoided by allowing drain_rcu_call() to enforce an RCU grace
    period. Since each reader might need to do specific actions to end a
    read-side critical section, do it with notifiers.
    
    Prepare ground for this by adding a notifier list to the RCU reader
    struct and use it in wait_for_readers() if drain_rcu_call() is in
    progress. An API is added for readers to register their notifiers.
    
    This is largely based on a draft from Paolo Bonzini.
    
    Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20211109183523.47726-2-groug@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit ef149763a8fcce70b85dfda27cc1222ecf765750)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 include/qemu/rcu.h | 15 +++++++++++++++
 util/rcu.c         | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index 515d327cf1..e69efbd47f 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -27,6 +27,7 @@
 #include "qemu/thread.h"
 #include "qemu/queue.h"
 #include "qemu/atomic.h"
+#include "qemu/notify.h"
 #include "qemu/sys_membarrier.h"
 
 #ifdef __cplusplus
@@ -66,6 +67,13 @@ struct rcu_reader_data {
 
     /* Data used for registry, protected by rcu_registry_lock */
     QLIST_ENTRY(rcu_reader_data) node;
+
+    /*
+     * NotifierList used to force an RCU grace period.  Accessed under
+     * rcu_registry_lock.  Note that the notifier is called _outside_
+     * the thread!
+     */
+    NotifierList force_rcu;
 };
 
 extern __thread struct rcu_reader_data rcu_reader;
@@ -180,6 +188,13 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(RCUReadAuto, rcu_read_auto_unlock)
 #define RCU_READ_LOCK_GUARD() \
     g_autoptr(RCUReadAuto) _rcu_read_auto __attribute__((unused)) = rcu_read_auto_lock()
 
+/*
+ * Force-RCU notifiers tell readers that they should exit their
+ * read-side critical section.
+ */
+void rcu_add_force_rcu_notifier(Notifier *n);
+void rcu_remove_force_rcu_notifier(Notifier *n);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/util/rcu.c b/util/rcu.c
index 13ac0f75cb..c91da9f137 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -46,6 +46,7 @@
 unsigned long rcu_gp_ctr = RCU_GP_LOCKED;
 
 QemuEvent rcu_gp_event;
+static int in_drain_call_rcu;
 static QemuMutex rcu_registry_lock;
 static QemuMutex rcu_sync_lock;
 
@@ -107,6 +108,8 @@ static void wait_for_readers(void)
                  * get some extra futex wakeups.
                  */
                 qatomic_set(&index->waiting, false);
+            } else if (qatomic_read(&in_drain_call_rcu)) {
+                notifier_list_notify(&index->force_rcu, NULL);
             }
         }
 
@@ -339,8 +342,10 @@ void drain_call_rcu(void)
      * assumed.
      */
 
+    qatomic_inc(&in_drain_call_rcu);
     call_rcu1(&rcu_drain.rcu, drain_rcu_callback);
     qemu_event_wait(&rcu_drain.drain_complete_event);
+    qatomic_dec(&in_drain_call_rcu);
 
     if (locked) {
         qemu_mutex_lock_iothread();
@@ -363,6 +368,20 @@ void rcu_unregister_thread(void)
     qemu_mutex_unlock(&rcu_registry_lock);
 }
 
+void rcu_add_force_rcu_notifier(Notifier *n)
+{
+    qemu_mutex_lock(&rcu_registry_lock);
+    notifier_list_add(&rcu_reader.force_rcu, n);
+    qemu_mutex_unlock(&rcu_registry_lock);
+}
+
+void rcu_remove_force_rcu_notifier(Notifier *n)
+{
+    qemu_mutex_lock(&rcu_registry_lock);
+    notifier_remove(n);
+    qemu_mutex_unlock(&rcu_registry_lock);
+}
+
 static void rcu_init_complete(void)
 {
     QemuThread thread;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:38:40 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:38:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257125.441707 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRE-0000PE-LP; Thu, 13 Jan 2022 11:38:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257125.441707; Thu, 13 Jan 2022 11:38:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRE-0000P6-IJ; Thu, 13 Jan 2022 11:38:40 +0000
Received: by outflank-mailman (input) for mailman id 257125;
 Thu, 13 Jan 2022 11:38:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRC-0000On-Uq
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRC-000419-U8
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRC-00044g-TG
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JKRCuQWm4HTYIFOn3PpvagQuAZCqkeQzW2/XZHRKSuU=; b=ivUJnfWvZSTz+dHwI8BDukA1/c
	/t6IcT8be1uHD0rjxk5ur7KwElpaLLWEkCuvdt1oDGIpa3rWkzAEKqQRKFxObwuxQiRxHcX3ixRXf
	zoe4WsXA2fmTsCxOWbyoBPDWsEsnhhGFhE57t68CiSBu8r3vhYOctbBEhiSn5z7VN3hM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] accel/tcg: Register a force_rcu notifier
Message-Id: <E1n7yRC-00044g-TG@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:38:38 +0000

commit 36c651c2264da6984c62173e2e0df77d76f064f5
Author:     Greg Kurz <groug@kaod.org>
AuthorDate: Tue Nov 9 19:35:23 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:26:01 2021 -0600

    accel/tcg: Register a force_rcu notifier
    
    A TCG vCPU doing a busy loop systematicaly hangs the QEMU monitor
    if the user passes 'device_add' without argument. This is because
    drain_cpu_all() which is called from qmp_device_add() cannot return
    if readers don't exit read-side critical sections. That is typically
    what busy-looping TCG vCPUs do:
    
    int cpu_exec(CPUState *cpu)
    {
    [...]
        rcu_read_lock();
    [...]
        while (!cpu_handle_exception(cpu, &ret)) {
            // Busy loop keeps vCPU here
        }
    [...]
        rcu_read_unlock();
    
        return ret;
    }
    
    For MTTCG, have all vCPU threads register a force_rcu notifier that will
    kick them out of the loop using async_run_on_cpu(). The notifier is called
    with the rcu_registry_lock mutex held, using async_run_on_cpu() ensures
    there are no deadlocks.
    
    For RR, a single thread runs all vCPUs. Just register a single notifier
    that kicks the current vCPU to the next one.
    
    For MTTCG:
    Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
    
    For RR:
    Suggested-by: Richard Henderson <richard.henderson@linaro.org>
    
    Fixes: 7bed89958bfb ("device_core: use drain_call_rcu in in qmp_device_add")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/650
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20211109183523.47726-3-groug@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit dd47a8f654d84f666b235ce8891e17ee76f9be8b)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 accel/tcg/tcg-accel-ops-mttcg.c | 26 ++++++++++++++++++++++++++
 accel/tcg/tcg-accel-ops-rr.c    | 10 ++++++++++
 2 files changed, 36 insertions(+)

diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c
index 847d2079d2..29632bd4c0 100644
--- a/accel/tcg/tcg-accel-ops-mttcg.c
+++ b/accel/tcg/tcg-accel-ops-mttcg.c
@@ -28,6 +28,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/replay.h"
 #include "qemu/main-loop.h"
+#include "qemu/notify.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
 #include "hw/boards.h"
@@ -35,6 +36,26 @@
 #include "tcg-accel-ops.h"
 #include "tcg-accel-ops-mttcg.h"
 
+typedef struct MttcgForceRcuNotifier {
+    Notifier notifier;
+    CPUState *cpu;
+} MttcgForceRcuNotifier;
+
+static void do_nothing(CPUState *cpu, run_on_cpu_data d)
+{
+}
+
+static void mttcg_force_rcu(Notifier *notify, void *data)
+{
+    CPUState *cpu = container_of(notify, MttcgForceRcuNotifier, notifier)->cpu;
+
+    /*
+     * Called with rcu_registry_lock held, using async_run_on_cpu() ensures
+     * that there are no deadlocks.
+     */
+    async_run_on_cpu(cpu, do_nothing, RUN_ON_CPU_NULL);
+}
+
 /*
  * In the multi-threaded case each vCPU has its own thread. The TLS
  * variable current_cpu can be used deep in the code to find the
@@ -43,12 +64,16 @@
 
 static void *mttcg_cpu_thread_fn(void *arg)
 {
+    MttcgForceRcuNotifier force_rcu;
     CPUState *cpu = arg;
 
     assert(tcg_enabled());
     g_assert(!icount_enabled());
 
     rcu_register_thread();
+    force_rcu.notifier.notify = mttcg_force_rcu;
+    force_rcu.cpu = cpu;
+    rcu_add_force_rcu_notifier(&force_rcu.notifier);
     tcg_register_thread();
 
     qemu_mutex_lock_iothread();
@@ -100,6 +125,7 @@ static void *mttcg_cpu_thread_fn(void *arg)
 
     tcg_cpus_destroy(cpu);
     qemu_mutex_unlock_iothread();
+    rcu_remove_force_rcu_notifier(&force_rcu.notifier);
     rcu_unregister_thread();
     return NULL;
 }
diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index c02c061ecb..aa5b4ac247 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -28,6 +28,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/replay.h"
 #include "qemu/main-loop.h"
+#include "qemu/notify.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
 
@@ -135,6 +136,11 @@ static void rr_deal_with_unplugged_cpus(void)
     }
 }
 
+static void rr_force_rcu(Notifier *notify, void *data)
+{
+    rr_kick_next_cpu();
+}
+
 /*
  * In the single-threaded case each vCPU is simulated in turn. If
  * there is more than a single vCPU we create a simple timer to kick
@@ -145,10 +151,13 @@ static void rr_deal_with_unplugged_cpus(void)
 
 static void *rr_cpu_thread_fn(void *arg)
 {
+    Notifier force_rcu;
     CPUState *cpu = arg;
 
     assert(tcg_enabled());
     rcu_register_thread();
+    force_rcu.notify = rr_force_rcu;
+    rcu_add_force_rcu_notifier(&force_rcu);
     tcg_register_thread();
 
     qemu_mutex_lock_iothread();
@@ -257,6 +266,7 @@ static void *rr_cpu_thread_fn(void *arg)
         rr_deal_with_unplugged_cpus();
     }
 
+    rcu_remove_force_rcu_notifier(&force_rcu);
     rcu_unregister_thread();
     return NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:38:50 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:38:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257126.441711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRO-0000SP-Me; Thu, 13 Jan 2022 11:38:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257126.441711; Thu, 13 Jan 2022 11:38:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRO-0000SH-Jj; Thu, 13 Jan 2022 11:38:50 +0000
Received: by outflank-mailman (input) for mailman id 257126;
 Thu, 13 Jan 2022 11:38:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRN-0000Rx-1v
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRN-00041L-18
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRN-00045d-0H
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zMkW84+F7llEY29yl7EOtQd8pvifscokpvzeEMo1Qns=; b=AGf/hdF5tfwjjjMS0ftyifRba3
	4dgF5fSt+bVLlZyRgAFfBtpJMt9YWR8/hHnIMWARldjw6caZk61MVVTPyoxjW4ISuhDRtueMWAbYw
	4gfoPBWzCvkbqNUMXEzbAkjIqrcibJm8X1yh4u68xv2JsYorJPuRld0RgcqyZOotl/k0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] pcie: rename 'native-hotplug' to 'x-native-hotplug'
Message-Id: <E1n7yRN-00045d-0H@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:38:49 +0000

commit 7204b8f3c61cb2f0d6f81a4261a2ba7298a007ba
Author:     Igor Mammedov <imammedo@redhat.com>
AuthorDate: Fri Nov 12 06:08:53 2021 -0500
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:38:08 2021 -0600

    pcie: rename 'native-hotplug' to 'x-native-hotplug'
    
    Mark property as experimental/internal adding 'x-' prefix.
    
    Property was introduced in 6.1 and it should have provided
    ability to turn on native PCIE hotplug on port even when
    ACPI PCI hotplug is in use is user explicitly sets property
    on CLI. However that never worked since slot is wired to
    ACPI hotplug controller.
    Another non-intended usecase: disable native hotplug on slot
    when APCI based hotplug is disabled, which works but slot has
    'hotplug' property for this taks.
    
    It should be relatively safe to rename it to experimental
    as no users should exist for it and given that the property
    is broken we don't really want to leave it around for much
    longer lest users start using it.
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211112110857.3116853-2-imammedo@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 2aa1842d6d79dcd1b84c58eeb44591a99a9e56df)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/i386/pc_q35.c   | 2 +-
 hw/pci/pcie_port.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 04b4a4788d..9070544a90 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -243,7 +243,7 @@ static void pc_q35_init(MachineState *machine)
                                           NULL);
 
     if (acpi_pcihp) {
-        object_register_sugar_prop(TYPE_PCIE_SLOT, "native-hotplug",
+        object_register_sugar_prop(TYPE_PCIE_SLOT, "x-native-hotplug",
                                    "false", true);
     }
 
diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c
index da850e8dde..e95c1e5519 100644
--- a/hw/pci/pcie_port.c
+++ b/hw/pci/pcie_port.c
@@ -148,7 +148,7 @@ static Property pcie_slot_props[] = {
     DEFINE_PROP_UINT8("chassis", PCIESlot, chassis, 0),
     DEFINE_PROP_UINT16("slot", PCIESlot, slot, 0),
     DEFINE_PROP_BOOL("hotplug", PCIESlot, hotplug, true),
-    DEFINE_PROP_BOOL("native-hotplug", PCIESlot, native_hotplug, true),
+    DEFINE_PROP_BOOL("x-native-hotplug", PCIESlot, native_hotplug, true),
     DEFINE_PROP_END_OF_LIST()
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:38:59 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:38:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257127.441714 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRX-0000VI-O6; Thu, 13 Jan 2022 11:38:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257127.441714; Thu, 13 Jan 2022 11:38:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRX-0000VA-LA; Thu, 13 Jan 2022 11:38:59 +0000
Received: by outflank-mailman (input) for mailman id 257127;
 Thu, 13 Jan 2022 11:38:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRX-0000V1-4u
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRX-00041a-4G
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRX-00046U-3X
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:38:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hxn8bHb2+SZojqTBSDvrtlBmnIRQTUIOy4+eYnmTwo0=; b=14FRX6RHO2ik/K81EWpRGODDdd
	tRC18bAoy8xdtCHJdqpbhKiYAOGhML5u2OvQuQAxzUtcGa5ZadH8TYLNl6lJvVR5TvkA1H85N+iMw
	PI4OjY/2e1s9sjJJA6DtHLJfVngEYzXqsmzhwyRcPtSV2IUPhjMM4rT8YJL195+Bk7g4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] virtio: use virtio accessor to access packed descriptor flags
Message-Id: <E1n7yRX-00046U-3X@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:38:59 +0000

commit df1c9c3039e5ded39ae6b37b62b8d064acfe7dd5
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Nov 11 14:38:53 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:43:18 2021 -0600

    virtio: use virtio accessor to access packed descriptor flags
    
    We used to access packed descriptor flags via
    address_space_{write|read}_cached(). When we hit the cache, memcpy()
    is used which is not an atomic operation which may lead a wrong value
    is read or wrote.
    
    So this patch switches to use virito_{stw|lduw}_phys_cached() to make
    sure the aceess is atomic.
    
    Fixes: 86044b24e865f ("virtio: basic packed virtqueue support")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20211111063854.29060-1-jasowang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit f463e761a41ee71e59892121e1c74d9c25c985d2)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 874377f37a..2dbccb6b3f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -509,11 +509,9 @@ static void vring_packed_desc_read_flags(VirtIODevice *vdev,
                                          MemoryRegionCache *cache,
                                          int i)
 {
-    address_space_read_cached(cache,
-                              i * sizeof(VRingPackedDesc) +
-                              offsetof(VRingPackedDesc, flags),
-                              flags, sizeof(*flags));
-    virtio_tswap16s(vdev, flags);
+    hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags);
+
+    *flags = virtio_lduw_phys_cached(vdev, cache, off);
 }
 
 static void vring_packed_desc_read(VirtIODevice *vdev,
@@ -566,8 +564,7 @@ static void vring_packed_desc_write_flags(VirtIODevice *vdev,
 {
     hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags);
 
-    virtio_tswap16s(vdev, &desc->flags);
-    address_space_write_cached(cache, off, &desc->flags, sizeof(desc->flags));
+    virtio_stw_phys_cached(vdev, cache, off, desc->flags);
     address_space_cache_invalidate(cache, off, sizeof(desc->flags));
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:39:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:39:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257128.441719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRh-0000Ya-Pm; Thu, 13 Jan 2022 11:39:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257128.441719; Thu, 13 Jan 2022 11:39:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRh-0000YS-Mh; Thu, 13 Jan 2022 11:39:09 +0000
Received: by outflank-mailman (input) for mailman id 257128;
 Thu, 13 Jan 2022 11:39:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRh-0000YF-8C
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRh-00042I-7S
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRh-00047P-6j
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sA07sHzMhIbCOWCwLwou+G5AqqCQEz7M2De1Fz+SWDI=; b=Lb7+rUQFUTeACljjTptdjEYN+j
	cyokDAivzpH5Lq6XiyuGqAycWZWJ/x9XsGiVUXYISaUpZacRB8OrfxWMGEyjD2fuexuUQw+SS0Snb
	N8+uBThm7fyEmG0pw7RykTfiwj2kmA3fsf1MArrUZbPDn2NGH7vxkXApsgYaUQwWhDg0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] virtio: use virtio accessor to access packed event
Message-Id: <E1n7yRh-00047P-6j@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:39:09 +0000

commit 08e46e6d92b979743f4f0fb36e587b5e75a0bde6
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Nov 11 14:38:54 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:43:25 2021 -0600

    virtio: use virtio accessor to access packed event
    
    We used to access packed descriptor event and off_wrap via
    address_space_{write|read}_cached(). When we hit the cache, memcpy()
    is used which is not atomic which may lead a wrong value to be read or
    wrote.
    
    This patch fixes this by switching to use
    virito_{stw|lduw}_phys_cached() to make sure the access is atomic.
    
    Fixes: 683f7665679c1 ("virtio: event suppression support for packed ring")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20211111063854.29060-2-jasowang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d152cdd6f6fad381e804c8185f0ba938030ccac9)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 2dbccb6b3f..c9567f09ed 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -249,13 +249,10 @@ static void vring_packed_event_read(VirtIODevice *vdev,
     hwaddr off_off = offsetof(VRingPackedDescEvent, off_wrap);
     hwaddr off_flags = offsetof(VRingPackedDescEvent, flags);
 
-    address_space_read_cached(cache, off_flags, &e->flags,
-                              sizeof(e->flags));
+    e->flags = virtio_lduw_phys_cached(vdev, cache, off_flags);
     /* Make sure flags is seen before off_wrap */
     smp_rmb();
-    address_space_read_cached(cache, off_off, &e->off_wrap,
-                              sizeof(e->off_wrap));
-    virtio_tswap16s(vdev, &e->off_wrap);
+    e->off_wrap = virtio_lduw_phys_cached(vdev, cache, off_off);
     virtio_tswap16s(vdev, &e->flags);
 }
 
@@ -265,8 +262,7 @@ static void vring_packed_off_wrap_write(VirtIODevice *vdev,
 {
     hwaddr off = offsetof(VRingPackedDescEvent, off_wrap);
 
-    virtio_tswap16s(vdev, &off_wrap);
-    address_space_write_cached(cache, off, &off_wrap, sizeof(off_wrap));
+    virtio_stw_phys_cached(vdev, cache, off, off_wrap);
     address_space_cache_invalidate(cache, off, sizeof(off_wrap));
 }
 
@@ -275,8 +271,7 @@ static void vring_packed_flags_write(VirtIODevice *vdev,
 {
     hwaddr off = offsetof(VRingPackedDescEvent, flags);
 
-    virtio_tswap16s(vdev, &flags);
-    address_space_write_cached(cache, off, &flags, sizeof(flags));
+    virtio_stw_phys_cached(vdev, cache, off, flags);
     address_space_cache_invalidate(cache, off, sizeof(flags));
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:39:19 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:39:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257129.441723 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRr-0000cF-SK; Thu, 13 Jan 2022 11:39:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257129.441723; Thu, 13 Jan 2022 11:39:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yRr-0000c7-PQ; Thu, 13 Jan 2022 11:39:19 +0000
Received: by outflank-mailman (input) for mailman id 257129;
 Thu, 13 Jan 2022 11:39:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRr-0000by-BM
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRr-00042U-Ae
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yRr-000488-9o
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tnwi73JzM1MBrWusU5cOrd5RhC7N404Hc3rmF6F7t/k=; b=3okhg16gJp04Q9lxJt9yaPzf1D
	Y4+TIlawh/i1Mx4w0WNwFJAVdT1vw6TA4pNPa7RtFrKVsTkCblmeRcj8Dn9SOXUleuaZpQisKb1be
	iEn+qcMosO/8PwF2U0OoXC6ibw8R1OOgPHyOo+VRS8ESkvgQ/DI0gK3GytkammmU89x8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] vfio: Fix memory leak of hostwin
Message-Id: <E1n7yRr-000488-9o@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:39:19 +0000

commit 8c2d5911debfd00a7e8b3d8989c23e892c872043
Author:     Peng Liang <liangpeng10@huawei.com>
AuthorDate: Wed Nov 17 09:47:39 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:49:55 2021 -0600

    vfio: Fix memory leak of hostwin
    
    hostwin is allocated and added to hostwin_list in vfio_host_win_add, but
    it is only deleted from hostwin_list in vfio_host_win_del, which causes
    a memory leak.  Also, freeing all elements in hostwin_list is missing in
    vfio_disconnect_container.
    
    Fix: 2e4109de8e58 ("vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2)")
    CC: qemu-stable@nongnu.org
    Signed-off-by: Peng Liang <liangpeng10@huawei.com>
    Link: https://lore.kernel.org/r/20211117014739.1839263-1-liangpeng10@huawei.com
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    (cherry picked from commit f3bc3a73c908df15966e66f88d5a633bd42fd029)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/vfio/common.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 8728d4d5c2..af37346aca 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -551,6 +551,7 @@ static int vfio_host_win_del(VFIOContainer *container, hwaddr min_iova,
     QLIST_FOREACH(hostwin, &container->hostwin_list, hostwin_next) {
         if (hostwin->min_iova == min_iova && hostwin->max_iova == max_iova) {
             QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
             return 0;
         }
     }
@@ -2230,6 +2231,7 @@ static void vfio_disconnect_container(VFIOGroup *group)
     if (QLIST_EMPTY(&container->group_list)) {
         VFIOAddressSpace *space = container->space;
         VFIOGuestIOMMU *giommu, *tmp;
+        VFIOHostDMAWindow *hostwin, *next;
 
         QLIST_REMOVE(container, next);
 
@@ -2240,6 +2242,12 @@ static void vfio_disconnect_container(VFIOGroup *group)
             g_free(giommu);
         }
 
+        QLIST_FOREACH_SAFE(hostwin, &container->hostwin_list, hostwin_next,
+                           next) {
+            QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
+        }
+
         trace_vfio_disconnect_container(container->fd);
         close(container->fd);
         g_free(container);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:39:29 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:39:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257130.441727 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yS1-0000f2-U4; Thu, 13 Jan 2022 11:39:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257130.441727; Thu, 13 Jan 2022 11:39:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yS1-0000eu-R4; Thu, 13 Jan 2022 11:39:29 +0000
Received: by outflank-mailman (input) for mailman id 257130;
 Thu, 13 Jan 2022 11:39:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yS1-0000eo-EW
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yS1-00042i-Dj
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yS1-00048l-D5
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Uk/zdPhMJWOZNfB/UOY8f3PLwOo4uJveDn61Jh7D+fE=; b=i3ZZ48hYKvjGmMRItWRPnWG31J
	TmyNIUeMjZL6r56GgZgmusd3ALDPkrspwXMIwfCGv2ekLDXZ0s5hDLouLCTXQShhoT5vaxWU40qzX
	40Rr7GZiWaKE5irhOlC1NNiOOBiGtNtSOo1giRMByORnVMmLzWjiynWAbDBexC9bvJGQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] nbd/server: Don't complain on certain client disconnects
Message-Id: <E1n7yS1-00048l-D5@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:39:29 +0000

commit 932333c5f00ef5697ce4e1f81750bb4dcee958a1
Author:     Eric Blake <eblake@redhat.com>
AuthorDate: Wed Nov 17 11:02:29 2021 -0600
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:51:17 2021 -0600

    nbd/server: Don't complain on certain client disconnects
    
    When a client disconnects abruptly, but did not have any pending
    requests (for example, when using nbdsh without calling h.shutdown),
    we used to output the following message:
    
    $ qemu-nbd -f raw file
    $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)'
    qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
    
    Then in commit f148ae7, we refactored nbd_receive_request() to use
    nbd_read_eof(); when this returns 0, we regressed into tracing
    uninitialized memory (if tracing is enabled) and reporting a
    less-specific:
    
    qemu-nbd: Disconnect client, due to: Request handling failed in intermediate state
    
    Note that with Unix sockets, we have yet another error message,
    unchanged by the 6.0 regression:
    
    $ qemu-nbd -k /tmp/sock -f raw file
    $ nbdsh -u 'nbd+unix:///?socket=/tmp/sock' -c 'h.trim(1,0)'
    qemu-nbd: Disconnect client, due to: Failed to send reply: Unable to write to socket: Broken pipe
    
    But in all cases, the error message goes away if the client performs a
    soft shutdown by using NBD_CMD_DISC, rather than a hard shutdown by
    abrupt disconnect:
    
    $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)' -c 'h.shutdown()'
    
    This patch fixes things to avoid uninitialized memory, and in general
    avoids warning about a client that does a hard shutdown when not in
    the middle of a packet.  A client that aborts mid-request, or which
    does not read the full server's reply, can still result in warnings,
    but those are indeed much more unusual situations.
    
    CC: qemu-stable@nongnu.org
    Fixes: f148ae7d36 ("nbd/server: Quiesce coroutines on context switch", v6.0.0)
    Signed-off-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    [eblake: defer unrelated typo fixes to later patch]
    Message-Id: <20211117170230.1128262-2-eblake@redhat.com>
    Signed-off-by: Eric Blake <eblake@redhat.com>
    (cherry picked from commit 1644cccea5c71b02b9cf8f78b780e7069a29b189)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 nbd/server.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nbd/server.c b/nbd/server.c
index 3927f7789d..83aeed51c7 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1413,6 +1413,9 @@ static int nbd_receive_request(NBDClient *client, NBDRequest *request,
     if (ret < 0) {
         return ret;
     }
+    if (ret == 0) {
+        return -EIO;
+    }
 
     /* Request
        [ 0 ..  3]   magic   (NBD_REQUEST_MAGIC)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:39:39 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:39:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257131.441731 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySB-0000hd-VX; Thu, 13 Jan 2022 11:39:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257131.441731; Thu, 13 Jan 2022 11:39:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySB-0000hV-Sc; Thu, 13 Jan 2022 11:39:39 +0000
Received: by outflank-mailman (input) for mailman id 257131;
 Thu, 13 Jan 2022 11:39:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySB-0000hP-Hq
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySB-00042r-HD
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySB-00049J-GO
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5LTDQ4Vrjx8OdgEXpQFoYttbeP4fjnpd8L/Z5bGE4GE=; b=RNH1SoNJB1DKQ3ExnybWWqdcKU
	Qwpd540LEITbGv/a8NzvIlkYxFUoTTrTDfj6xLNViB5OtLv5K4EGntZIZsxxmhupwjDllSmF7Xkv6
	NkWKSfy9qRK3uuxExagVLkiedSBlK56+mxt98EzOJfE97BSm57Aks2h3rWfEEgV0UVUE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
Message-Id: <E1n7ySB-00049J-GO@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:39:39 +0000

commit 2b2eb343a01bb84a9d988158f706a65b57604d65
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Wed Nov 17 14:12:56 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:52:50 2021 -0600

    hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
    
    Fix missing offset verification.
    
    Cc: qemu-stable@nongnu.org
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
    Fixes: f432fdfa121 ("support changed namespace asynchronous event")
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit e2c57529c9306e4c9aac75d9879f6e7699584a22)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/nvme/ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 6baf9e0420..27dddb87bd 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4164,6 +4164,11 @@ static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint8_t rae, uint32_t buf_len,
     int i = 0;
     uint32_t nsid;
 
+    if (off >= sizeof(nslist)) {
+        trace_pci_nvme_err_invalid_log_page_offset(off, sizeof(nslist));
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+
     memset(nslist, 0x0, sizeof(nslist));
     trans_len = MIN(sizeof(nslist) - off, buf_len);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:39:51 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:39:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257132.441735 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySN-0000ky-0p; Thu, 13 Jan 2022 11:39:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257132.441735; Thu, 13 Jan 2022 11:39:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySM-0000kq-UE; Thu, 13 Jan 2022 11:39:50 +0000
Received: by outflank-mailman (input) for mailman id 257132;
 Thu, 13 Jan 2022 11:39:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySL-0000kZ-Ky
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySL-000436-KJ
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySL-0004A0-JV
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WCYpmpjYj+nW6c7rPutQePnj83fXyEntxqsRzJedCHY=; b=dS9jU3txs3XT+owf7OQX8MsX4U
	JKHwstmDL7hdsDbnhXP6o9oBitSQXqRZQu9okyBvc5zFMgpr1wzhWAhE2n41o8h6flVMtGdKAN8W+
	Fj4YJdw9ONJ8c59rVhWfxJZo8tmyG8Z9ZIP15b6X1a+K+vBNsCrt18vzCtQeoww8mSH0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] chardev/wctable: don't free the instance in wctablet_chr_finalize
Message-Id: <E1n7ySL-0004A0-JV@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:39:49 +0000

commit 4658dfcbc09dcc90025604cce64d6fd01952b882
Author:     Daniil Tatianin <d-tatianin@yandex-team.ru>
AuthorDate: Wed Nov 17 17:23:49 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:54:14 2021 -0600

    chardev/wctable: don't free the instance in wctablet_chr_finalize
    
    Object is supposed to be freed by invoking obj->free, and not
    obj->instance_finalize. This would lead to use-after-free followed by
    double free in object_unref/object_finalize.
    
    Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20211117142349.836279-1-d-tatianin@yandex-team.ru>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit fdc6e168181d06391711171b7c409b34f2981ced)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 chardev/wctablet.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/chardev/wctablet.c b/chardev/wctablet.c
index 95e005f5a5..e8b292c43c 100644
--- a/chardev/wctablet.c
+++ b/chardev/wctablet.c
@@ -320,7 +320,6 @@ static void wctablet_chr_finalize(Object *obj)
     TabletChardev *tablet = WCTABLET_CHARDEV(obj);
 
     qemu_input_handler_unregister(tablet->hs);
-    g_free(tablet);
 }
 
 static void wctablet_chr_open(Chardev *chr,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:40:01 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:40:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257133.441739 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySX-0000no-2V; Thu, 13 Jan 2022 11:40:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257133.441739; Thu, 13 Jan 2022 11:40:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySW-0000ng-Vh; Thu, 13 Jan 2022 11:40:00 +0000
Received: by outflank-mailman (input) for mailman id 257133;
 Thu, 13 Jan 2022 11:39:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySV-0000nV-O8
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySV-00043S-NM
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySV-0004Ar-Mi
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:39:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MUsosAxgchsAhFWsH7Xbr2Qq4g9T+Uz6Iv0uc8nhp4Q=; b=b3jDl3M1XzwGW68Y1nDqIw8kal
	sHaTT4WjrRaO72SG6hoiGExigfBV37YJ4oBZZc5w+8+/otTsrB+ENlPYY2UPGnc2/MqcenEY6/G8R
	GRlOkVzp6dekuMu/9TMkBvCK+vik9EQfnth+vsUuSX82wcCjXyjpzD2zUAaWqmZLS/7s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw/block/fdc: Extract blk_create_empty_drive()
Message-Id: <E1n7ySV-0004Ar-Mi@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:39:59 +0000

commit 7629818574eb67d2a9eb5db313c935bcf1d4e557
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:34 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:04:59 2021 -0600

    hw/block/fdc: Extract blk_create_empty_drive()
    
    We are going to re-use this code in the next commit,
    so extract it as a new blk_create_empty_drive() function.
    
    Inspired-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-2-philmd@redhat.com
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit b154791e7b6d4ca5cdcd54443484d97360bd7ad2)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/fdc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 9014cd30b3..c3e09973ca 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -61,6 +61,12 @@
     } while (0)
 
 
+/* Anonymous BlockBackend for empty drive */
+static BlockBackend *blk_create_empty_drive(void)
+{
+    return blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
+}
+
 /********************************************************/
 /* qdev floppy bus                                      */
 
@@ -486,8 +492,7 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp)
     }
 
     if (!dev->conf.blk) {
-        /* Anonymous BlockBackend for an empty drive */
-        dev->conf.blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
+        dev->conf.blk = blk_create_empty_drive();
         ret = blk_attach_dev(dev->conf.blk, qdev);
         assert(ret == 0);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:40:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:40:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257134.441743 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySh-0001b7-4G; Thu, 13 Jan 2022 11:40:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257134.441743; Thu, 13 Jan 2022 11:40: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 1n7ySh-0001az-0v; Thu, 13 Jan 2022 11:40:11 +0000
Received: by outflank-mailman (input) for mailman id 257134;
 Thu, 13 Jan 2022 11:40:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySf-0001ap-RP
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySf-000444-Qd
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySf-0004Co-Pp
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nv0ST4XtUmYXCXjufQtk2D1dbkua6KgDLYqULlHyHfo=; b=jRZFQY2Gu4aHDOZIingHdRlflb
	ibo5sA8yo4KxOHbON8q+cq3tKEe0mbntvs5DaskzVkyluhPAN3zx+uiP76v6GzCy5NvJDeiyNjwNa
	M7DrKSrNcAcABM3/egIm2LX9M5CiZtNblxi3FSKkJhXBYNFJzrndA2w4eVDNoSyO486E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196
Message-Id: <E1n7ySf-0004Co-Pp@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:40:09 +0000

commit 71ba2adfeb4ca63015d4a51a665e67c46a06e822
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:35 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:05:05 2021 -0600

    hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196
    
    Guest might select another drive on the bus by setting the
    DRIVE_SEL bit of the DIGITAL OUTPUT REGISTER (DOR).
    The current controller model doesn't expect a BlockBackend
    to be NULL. A simple way to fix CVE-2021-20196 is to create
    an empty BlockBackend when it is missing. All further
    accesses will be safely handled, and the controller state
    machines keep behaving correctly.
    
    Cc: qemu-stable@nongnu.org
    Fixes: CVE-2021-20196
    Reported-by: Gaoning Pan (Ant Security Light-Year Lab) <pgn@zju.edu.cn>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-3-philmd@redhat.com
    BugLink: https://bugs.launchpad.net/qemu/+bug/1912780
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/338
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 1ab95af033a419e7a64e2d58e67dd96b20af5233)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/fdc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index c3e09973ca..af398c1116 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -1166,7 +1166,19 @@ static FDrive *get_drv(FDCtrl *fdctrl, int unit)
 
 static FDrive *get_cur_drv(FDCtrl *fdctrl)
 {
-    return get_drv(fdctrl, fdctrl->cur_drv);
+    FDrive *cur_drv = get_drv(fdctrl, fdctrl->cur_drv);
+
+    if (!cur_drv->blk) {
+        /*
+         * Kludge: empty drive line selected. Create an anonymous
+         * BlockBackend to avoid NULL deref with various BlockBackend
+         * API calls within this model (CVE-2021-20196).
+         * Due to the controller QOM model limitations, we don't
+         * attach the created to the controller device.
+         */
+        cur_drv->blk = blk_create_empty_drive();
+    }
+    return cur_drv;
 }
 
 /* Status A register : 0x00 (read-only) */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:40:21 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:40:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257135.441747 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySr-0001do-5I; Thu, 13 Jan 2022 11:40:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257135.441747; Thu, 13 Jan 2022 11:40:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7ySr-0001df-2Q; Thu, 13 Jan 2022 11:40:21 +0000
Received: by outflank-mailman (input) for mailman id 257135;
 Thu, 13 Jan 2022 11:40:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySp-0001dV-UH
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySp-00044I-Td
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySp-0004Dy-Sw
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uTtNDsu1w4O+4YUvnPLBl7nXY0qzGPnv8lEObOqbwEs=; b=2oF7PPr+TgQNbBlHZw5HDOnXEa
	gCn/uuwo01XnyBXFag1MbaLb8lFKdWqpT1ovlGuIdSeyDA6Xa5MY7hncpwRlwbbj8zfJxgM6596km
	xBHgph7zeOpwMy8Tk7ZlTkvM8aTzqJ57GQqTN6dROiidqKriwHX6sQCgxv42lyKZ6Mc0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196
Message-Id: <E1n7ySp-0004Dy-Sw@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:40:19 +0000

commit ef0cf1887ee9acb21a8d7a06e83bdbbae0fdf9e6
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:36 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:05:11 2021 -0600

    tests/qtest/fdc-test: Add a regression test for CVE-2021-20196
    
    Without the previous commit, when running 'make check-qtest-i386'
    with QEMU configured with '--enable-sanitizers' we get:
    
      AddressSanitizer:DEADLYSIGNAL
      =================================================================
      ==287878==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000344
      ==287878==The signal is caused by a WRITE memory access.
      ==287878==Hint: address points to the zero page.
          #0 0x564b2e5bac27 in blk_inc_in_flight block/block-backend.c:1346:5
          #1 0x564b2e5bb228 in blk_pwritev_part block/block-backend.c:1317:5
          #2 0x564b2e5bcd57 in blk_pwrite block/block-backend.c:1498:11
          #3 0x564b2ca1cdd3 in fdctrl_write_data hw/block/fdc.c:2221:17
          #4 0x564b2ca1b2f7 in fdctrl_write hw/block/fdc.c:829:9
          #5 0x564b2dc49503 in portio_write softmmu/ioport.c:201:9
    
    Add the reproducer for CVE-2021-20196.
    
    Suggested-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-4-philmd@redhat.com
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit cc20926e9b8077bff6813efc8dcdeae90d1a3b10)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/fdc-test.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
index 26b69f7c5c..8f6eee84a4 100644
--- a/tests/qtest/fdc-test.c
+++ b/tests/qtest/fdc-test.c
@@ -32,6 +32,9 @@
 /* TODO actually test the results and get rid of this */
 #define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__))
 
+#define DRIVE_FLOPPY_BLANK \
+    "-drive if=floppy,file=null-co://,file.read-zeroes=on,format=raw,size=1440k"
+
 #define TEST_IMAGE_SIZE 1440 * 1024
 
 #define FLOPPY_BASE 0x3f0
@@ -546,6 +549,40 @@ static void fuzz_registers(void)
     }
 }
 
+static bool qtest_check_clang_sanitizer(void)
+{
+#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
+    return true;
+#else
+    g_test_skip("QEMU not configured using --enable-sanitizers");
+    return false;
+#endif
+}
+static void test_cve_2021_20196(void)
+{
+    QTestState *s;
+
+    if (!qtest_check_clang_sanitizer()) {
+        return;
+    }
+
+    s = qtest_initf("-nographic -m 32M -nodefaults " DRIVE_FLOPPY_BLANK);
+
+    qtest_outw(s, 0x3f4, 0x0500);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outw(s, 0x3f1, 0x0400);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outb(s, 0x3f5, 0x01);
+    qtest_outw(s, 0x3f1, 0x0500);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_quit(s);
+}
+
 int main(int argc, char **argv)
 {
     int fd;
@@ -576,6 +613,7 @@ int main(int argc, char **argv)
     qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18);
     qtest_add_func("/fdc/read_no_dma_19", test_read_no_dma_19);
     qtest_add_func("/fdc/fuzz-registers", fuzz_registers);
+    qtest_add_func("/fdc/fuzz/cve_2021_20196", test_cve_2021_20196);
 
     ret = g_test_run();
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:40:31 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:40:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257136.441751 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yT1-0001hJ-8D; Thu, 13 Jan 2022 11:40:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257136.441751; Thu, 13 Jan 2022 11:40:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yT1-0001h9-5K; Thu, 13 Jan 2022 11:40:31 +0000
Received: by outflank-mailman (input) for mailman id 257136;
 Thu, 13 Jan 2022 11:40:30 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yT0-0001h1-1K
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:30 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yT0-00044O-0V
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7ySz-0004F8-Vv
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=K3jjmD/XiSElY0mM+QbZ1Kq85+wZNuAUTAa9zfd53IA=; b=LNCmWpSDishTiJzu/ogusJNUeY
	VspXXF6w7r+VDl0BkG6uTpwC/aDoOWmjy4CwXgrx+AB//HLXldyzfM91XKcniYk7WVmQk2JP/ncVt
	C9QnBzwBP3Zt+cW0MKKIPAgvzIPZ1wIZqXc09BFlcwKLlLXrrUDRd+NWHHvCLcjTwtSc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] virtio-blk: Fix clean up of host notifiers for single MR transaction.
Message-Id: <E1n7ySz-0004F8-Vv@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:40:29 +0000

commit fec12fc8882b7326e820696ef81da3f1deeca11b
Author:     Mark Mielke <mark.mielke@gmail.com>
AuthorDate: Thu Dec 2 11:26:51 2021 -0500
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:10:56 2021 -0600

    virtio-blk: Fix clean up of host notifiers for single MR transaction.
    
    The code that introduced "virtio-blk: Configure all host notifiers in
    a single MR transaction" introduced a second loop variable to perform
    cleanup in second loop, but mistakenly still refers to the first
    loop variable within the second loop body.
    
    Fixes: d0267da61489 ("virtio-blk: Configure all host notifiers in a single MR transaction")
    Signed-off-by: Mark Mielke <mark.mielke@gmail.com>
    Message-id: CALm7yL08qarOu0dnQkTN+pa=BSRC92g31YpQQNDeAiT4yLZWQQ@mail.gmail.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 5b807181c27a940a3a7ad1f221a2e76a132cbdc0)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/dataplane/virtio-blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 252c3a7a23..ee5a5352dc 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -222,7 +222,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
             memory_region_transaction_commit();
 
             while (j--) {
-                virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
+                virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), j);
             }
             goto fail_host_notifiers;
         }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:40:41 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:40:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257137.441754 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTB-0001k6-9h; Thu, 13 Jan 2022 11:40:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257137.441754; Thu, 13 Jan 2022 11:40:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTB-0001jx-6g; Thu, 13 Jan 2022 11:40:41 +0000
Received: by outflank-mailman (input) for mailman id 257137;
 Thu, 13 Jan 2022 11:40:40 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTA-0001jg-4W
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:40 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTA-00044b-3i
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTA-0004Fy-2o
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:40 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GGdMe8vVjhreEFEa9fbbu1S+I/h3rHyekYUjjOMD0mo=; b=j5x3h1E/Rw9YCLgPC5T6esGsxX
	U+9xpKJVSxixR2A4OiViW9DXBT87PbSHm+XBkrgGhCdgX+IR3mZFwnZpCD2AX76BAz2lC23zbkOlq
	63kqkMo8quga9JVPmF0me+f5greGJ/3o0++8TNHjfQYwq/VoyCHr8iw5PceLuUcp73I4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
Message-Id: <E1n7yTA-0004Fy-2o@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:40:40 +0000

commit 1ce084af083b6958c8287ea742a008a105bc960d
Author:     Prasad J Pandit <pjp@fedoraproject.org>
AuthorDate: Sat Jan 30 18:46:52 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 17:39:20 2021 -0600

    net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
    
    While activating device in vmxnet3_acticate_device(), it does not
    validate guest supplied configuration values against predefined
    minimum - maximum limits. This may lead to integer overflow or
    OOB access issues. Add checks to avoid it.
    
    Fixes: CVE-2021-20203
    Buglink: https://bugs.launchpad.net/qemu/+bug/1913873
    Reported-by: Gaoning Pan <pgn@zju.edu.cn>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit d05dcd94aee88728facafb993c7280547eb4d645)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/vmxnet3.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 41f796a247..f65af4e9ef 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1441,6 +1441,7 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
+    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU);
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
@@ -1486,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* Read rings memory locations for TX queues */
         pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA);
         size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize);
+        if (size > VMXNET3_TX_RING_MAX_SIZE) {
+            size = VMXNET3_TX_RING_MAX_SIZE;
+        }
 
         vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size,
                           sizeof(struct Vmxnet3_TxDesc), false);
@@ -1496,6 +1500,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* TXC ring */
         pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA);
         size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize);
+        if (size > VMXNET3_TC_RING_MAX_SIZE) {
+            size = VMXNET3_TC_RING_MAX_SIZE;
+        }
         vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size,
                           sizeof(struct Vmxnet3_TxCompDesc), true);
         VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring);
@@ -1537,6 +1544,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
             /* RX rings */
             pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]);
             size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]);
+            if (size > VMXNET3_RX_RING_MAX_SIZE) {
+                size = VMXNET3_RX_RING_MAX_SIZE;
+            }
             vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size,
                               sizeof(struct Vmxnet3_RxDesc), false);
             VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d",
@@ -1546,6 +1556,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* RXC ring */
         pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA);
         size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize);
+        if (size > VMXNET3_RC_RING_MAX_SIZE) {
+            size = VMXNET3_RC_RING_MAX_SIZE;
+        }
         vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size,
                           sizeof(struct Vmxnet3_RxCompDesc), true);
         VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:40:51 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:40:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257138.441759 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTL-0001mx-B7; Thu, 13 Jan 2022 11:40:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257138.441759; Thu, 13 Jan 2022 11:40:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTL-0001mp-87; Thu, 13 Jan 2022 11:40:51 +0000
Received: by outflank-mailman (input) for mailman id 257138;
 Thu, 13 Jan 2022 11:40:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTK-0001mi-7f
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:50 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTK-00044r-6x
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTK-0004Gv-68
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:40:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WelBMktNHBzduwoyaXTex/c9owmzSkLYYNlaAFHnu2k=; b=wboqC4BIW3VZz5g4TzxtjjKdxN
	aeApmUzHuOSAcMT3GlW4cIENuunkrKUY+1TVK1Mxrrh9qXcurHbXv6ajxL/R5yOmXJbJm0GHENWCR
	eI5jnF5tCiW7GdD8Da3o7pFrgLP3PvVZT8IPWmw9G4f5BuPNk4E/GZ5X70oP1/8BvBO4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] e1000: fix tx re-entrancy problem
Message-Id: <E1n7yTK-0004Gv-68@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:40:50 +0000

commit 43583f0c079b084ada9214c00125e21bbfc6266a
Author:     Jon Maloy <jmaloy@redhat.com>
AuthorDate: Thu Oct 21 12:10:47 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 17:40:06 2021 -0600

    e1000: fix tx re-entrancy problem
    
    The fact that the MMIO handler is not re-entrant causes an infinite
    loop under certain conditions:
    
    Guest write to TDT ->  Loopback -> RX (DMA to TDT) -> TX
    
    We now eliminate the effect of this problem locally in e1000, by adding
    a boolean in struct E1000State indicating when the TX side is busy. This
    will cause any entering new call to return early instead of interfering
    with the ongoing work, and eliminates any risk of looping.
    
    This is intended to address CVE-2021-20257.
    
    Signed-off-by: Jon Maloy <jmaloy@redhat.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit 25ddb946e6301f42cff3094ea1c25fb78813e7e9)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/e1000.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index a30546c5d5..f5bc81296d 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -107,6 +107,7 @@ struct E1000State_st {
         e1000x_txd_props props;
         e1000x_txd_props tso_props;
         uint16_t tso_frames;
+        bool busy;
     } tx;
 
     struct {
@@ -763,6 +764,11 @@ start_xmit(E1000State *s)
         return;
     }
 
+    if (s->tx.busy) {
+        return;
+    }
+    s->tx.busy = true;
+
     while (s->mac_reg[TDH] != s->mac_reg[TDT]) {
         base = tx_desc_base(s) +
                sizeof(struct e1000_tx_desc) * s->mac_reg[TDH];
@@ -789,6 +795,7 @@ start_xmit(E1000State *s)
             break;
         }
     }
+    s->tx.busy = false;
     set_ics(s, 0, cause);
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:41:01 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:41:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257139.441763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTV-0001pm-CP; Thu, 13 Jan 2022 11:41:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257139.441763; Thu, 13 Jan 2022 11:41:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTV-0001pe-9Y; Thu, 13 Jan 2022 11:41:01 +0000
Received: by outflank-mailman (input) for mailman id 257139;
 Thu, 13 Jan 2022 11:41:00 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTU-0001pU-B4
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:00 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTU-00044x-AK
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTU-0004Hk-9Y
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XhquVxK7eZwyOOxQ8t0yc3yekfcxvFx/ojToaFShNCc=; b=AKH329YSC04OBVaqC8IF/6fo0N
	/WTlWlCx10lPDWduDxTbpp4jG/Gx56BoX0RnjkpQcYk5EFpPq/gEE9dBk7jyTkHX8CzvQk0FrfDUt
	ICllSeapUofg0TEhWyt1exQk9meg0pLjldRshmSbRE5fgedd6MZdFcx5KKwY0ekqQF0Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] qxl: fix pre-save logic
Message-Id: <E1n7yTU-0004Hk-9Y@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:41:00 +0000

commit 34833f361b1407ad7b4f02ed5eb852e76ab032e4
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Fri Sep 10 11:42:03 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:12 2021 -0600

    qxl: fix pre-save logic
    
    Oops.  Logic is backwards.
    
    Fixes: 39b8a183e2f3 ("qxl: remove assert in qxl_pre_save.")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/610
    Resolves: https://bugzilla.redhat.com//show_bug.cgi?id=2002907
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20210910094203.3582378-1-kraxel@redhat.com>
    (cherry picked from commit eb94846280df3f1e2a91b6179fc05f9890b7e384)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 43482d4364..29c80b4289 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2252,7 +2252,7 @@ static int qxl_pre_save(void *opaque)
     } else {
         d->last_release_offset = (uint8_t *)d->last_release - ram_start;
     }
-    if (d->last_release_offset < d->vga.vram_size) {
+    if (d->last_release_offset >= d->vga.vram_size) {
         return 1;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:41:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:41:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257141.441778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTf-00029m-La; Thu, 13 Jan 2022 11:41:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257141.441778; Thu, 13 Jan 2022 11:41: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 1n7yTf-00029e-IQ; Thu, 13 Jan 2022 11:41:11 +0000
Received: by outflank-mailman (input) for mailman id 257141;
 Thu, 13 Jan 2022 11:41:10 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTe-000294-E1
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:10 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTe-000473-DN
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:10 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTe-0004Io-Cb
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:10 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jseOZQ4BqAxEta3MZ4OlIHW/zty+v6MJo6ygd44CJQ0=; b=ls0jbinLmqpfLC7sEA/NgfD6lc
	yiAm+oTssqqhpgnMIknxDTZhgiw5RcnZHBpLVTPpomAIjRrnLLT8H9E5a5ltzhK0Zp/3KKz8zv5NP
	yjTeiXAMErXD2DReCNNYbsmdvJqFM3eQ/U1tEQY2UASNrd81v7Dt6eLxEiF7cq55O0QU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] target/i386: add missing bits to CR4_RESERVED_MASK
Message-Id: <E1n7yTe-0004Io-Cb@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:41:10 +0000

commit e88636b4d46b91e130ae715b8d8b90f62e414428
Author:     Daniel P. Berrangé <berrange@redhat.com>
AuthorDate: Tue Aug 31 18:50:33 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:18 2021 -0600

    target/i386: add missing bits to CR4_RESERVED_MASK
    
    Booting Fedora kernels with -cpu max hangs very early in boot. Disabling
    the la57 CPUID bit fixes the problem. git bisect traced the regression to
    
      commit 213ff024a2f92020290296cb9dc29c2af3d4a221 (HEAD, refs/bisect/bad)
      Author: Lara Lazier <laramglazier@gmail.com>
      Date:   Wed Jul 21 17:26:50 2021 +0200
    
        target/i386: Added consistency checks for CR4
    
        All MBZ bits in CR4 must be zero. (APM2 15.5)
        Added reserved bitmask and added checks in both
        helper_vmrun and helper_write_crN.
    
        Signed-off-by: Lara Lazier <laramglazier@gmail.com>
        Message-Id: <20210721152651.14683-2-laramglazier@gmail.com>
        Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    
    In this commit CR4_RESERVED_MASK is missing CR4_LA57_MASK and
    two others. Adding this lets Fedora kernels boot once again.
    
    Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
    Tested-by: Richard W.M. Jones <rjones@redhat.com>
    Message-Id: <20210831175033.175584-1-berrange@redhat.com>
    [Removed VMXE/SMXE, matching the commit message. - Paolo]
    Fixes: 213ff024a2 ("target/i386: Added consistency checks for CR4", 2021-07-22)
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 69e3895f9d37ca39536775b13ce63e8c291427ba)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/cpu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 6c50d3ab4f..21b33fbe2e 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -257,6 +257,7 @@ typedef enum X86Seg {
                 | CR4_DE_MASK | CR4_PSE_MASK | CR4_PAE_MASK \
                 | CR4_MCE_MASK | CR4_PGE_MASK | CR4_PCE_MASK \
                 | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK |CR4_UMIP_MASK \
+                | CR4_LA57_MASK \
                 | CR4_FSGSBASE_MASK | CR4_PCIDE_MASK | CR4_OSXSAVE_MASK \
                 | CR4_SMEP_MASK | CR4_SMAP_MASK | CR4_PKE_MASK | CR4_PKS_MASK))
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:41:21 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:41:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257142.441782 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTp-0002Gh-N2; Thu, 13 Jan 2022 11:41:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257142.441782; Thu, 13 Jan 2022 11:41:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTp-0002GZ-Ju; Thu, 13 Jan 2022 11:41:21 +0000
Received: by outflank-mailman (input) for mailman id 257142;
 Thu, 13 Jan 2022 11:41:20 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTo-0002GA-Hg
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:20 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTo-00047E-Gy
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:20 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTo-0004Js-GI
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:20 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pMuQh8OnKdhH3JGO5fT3XlLE/dBarWcsDzavGJio6jo=; b=Gom6NgoBa7otw3N5aTFGTrKeCa
	pmOprVLwy1lIQGi5vx85W/fsKtyIPbPcV6fwRO1YMFcUtZ+X6ZdX9L+Elf1oCGvwYcDzEvf+VcMx2
	XKwADQl5VGx/l6AWq2NjP8ka9tbmxe8t4hBv8LpixWGXbFLhSGMciGd9dAHHrGZI2S/s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] tcg/arm: Reduce vector alignment requirement for NEON
Message-Id: <E1n7yTo-0004Js-GI@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:41:20 +0000

commit 711bd602cc432e4ab0c4c59f19d6611302870248
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sun Sep 12 10:49:25 2021 -0700
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:27 2021 -0600

    tcg/arm: Reduce vector alignment requirement for NEON
    
    With arm32, the ABI gives us 8-byte alignment for the stack.
    While it's possible to realign the stack to provide 16-byte alignment,
    it's far easier to simply not encode 16-byte alignment in the
    VLD1 and VST1 instructions that we emit.
    
    Remove the assertion in temp_allocate_frame, limit natural alignment
    to the provided stack alignment, and add a comment.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1999878
    Reported-by: Richard W.M. Jones <rjones@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20210912174925.200132-1-richard.henderson@linaro.org>
    Message-Id: <20211206191335.230683-2-richard.henderson@linaro.org>
    (cherry picked from commit b9537d5904f6e3df896264a6144883ab07db9608)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tcg/arm/tcg-target.c.inc | 13 +++++++++----
 tcg/tcg.c                |  8 +++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
index 007ceee68e..34acfb522c 100644
--- a/tcg/arm/tcg-target.c.inc
+++ b/tcg/arm/tcg-target.c.inc
@@ -2477,8 +2477,13 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg,
         tcg_out_vldst(s, INSN_VLD1 | 0x7d0, arg, arg1, arg2);
         return;
     case TCG_TYPE_V128:
-        /* regs 2; size 8; align 16 */
-        tcg_out_vldst(s, INSN_VLD1 | 0xae0, arg, arg1, arg2);
+        /*
+         * We have only 8-byte alignment for the stack per the ABI.
+         * Rather than dynamically re-align the stack, it's easier
+         * to simply not request alignment beyond that.  So:
+         * regs 2; size 8; align 8
+         */
+        tcg_out_vldst(s, INSN_VLD1 | 0xad0, arg, arg1, arg2);
         return;
     default:
         g_assert_not_reached();
@@ -2497,8 +2502,8 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg,
         tcg_out_vldst(s, INSN_VST1 | 0x7d0, arg, arg1, arg2);
         return;
     case TCG_TYPE_V128:
-        /* regs 2; size 8; align 16 */
-        tcg_out_vldst(s, INSN_VST1 | 0xae0, arg, arg1, arg2);
+        /* See tcg_out_ld re alignment: regs 2; size 8; align 8 */
+        tcg_out_vldst(s, INSN_VST1 | 0xad0, arg, arg1, arg2);
         return;
     default:
         g_assert_not_reached();
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 4142d42d77..ca5bcc4635 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3060,7 +3060,13 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp *ts)
         g_assert_not_reached();
     }
 
-    assert(align <= TCG_TARGET_STACK_ALIGN);
+    /*
+     * Assume the stack is sufficiently aligned.
+     * This affects e.g. ARM NEON, where we have 8 byte stack alignment
+     * and do not require 16 byte vector alignment.  This seems slightly
+     * easier than fully parameterizing the above switch statement.
+     */
+    align = MIN(TCG_TARGET_STACK_ALIGN, align);
     off = ROUND_UP(s->current_frame_offset, align);
 
     /* If we've exhausted the stack frame, restart with a smaller TB. */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:41:31 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:41:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257145.441788 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTz-0002Os-Pj; Thu, 13 Jan 2022 11:41:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257145.441788; Thu, 13 Jan 2022 11:41:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yTz-0002Oj-LQ; Thu, 13 Jan 2022 11:41:31 +0000
Received: by outflank-mailman (input) for mailman id 257145;
 Thu, 13 Jan 2022 11:41:30 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTy-0002OU-Kd
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:30 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTy-00047K-Jq
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yTy-0004KZ-J8
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:30 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OrzScbPzGwyHnRizf7qXX5ZebM8VgGJ4XbY3Nwsk1FM=; b=hxZE5ldJGT4F/Epwbmr60nLDud
	oOYzYP/LUMCuKdoj2iqzGzts1Q4rOe0HnY6H/UW1bjPARj66uo0Ue+CYnacnySNukgzNfXP1r6f3P
	A7csN32qg1Rz+D19Bw8ozgESqoNpwjo3A99hdrr5f+7DUoAWvan506eYOtEghOhkuVSY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] tests: tcg: Fix PVH test with binutils 2.36+
Message-Id: <E1n7yTy-0004KZ-J8@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:41:30 +0000

commit fddd169de593da46b2ccd316d63c03b416b94437
Author:     Cole Robinson <crobinso@redhat.com>
AuthorDate: Fri Oct 8 12:21:01 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:37 2021 -0600

    tests: tcg: Fix PVH test with binutils 2.36+
    
    binutils started adding a .note.gnu.property ELF section which
    makes the PVH test fail:
    
      TEST    hello on x86_64
    qemu-system-x86_64: Error loading uncompressed kernel without PVH ELF Note
    
    Discard .note.gnu* while keeping the PVH .note bits intact.
    
    This also strips the build-id note, so drop the related comment.
    
    Signed-off-by: Cole Robinson <crobinso@redhat.com>
    Message-Id: <5ab2a54c262c61f64c22dbb49ade3e2db8a740bb.1633708346.git.crobinso@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 8e751e9c38e324737fd3d3aa0562f886313bba3c)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/tcg/x86_64/system/kernel.ld | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/tcg/x86_64/system/kernel.ld b/tests/tcg/x86_64/system/kernel.ld
index 49c12b04ae..ca5d6bd850 100644
--- a/tests/tcg/x86_64/system/kernel.ld
+++ b/tests/tcg/x86_64/system/kernel.ld
@@ -16,7 +16,10 @@ SECTIONS {
 		*(.rodata)
 	} :text
 
-        /* Keep build ID and PVH notes in same section */
+        /DISCARD/ : {
+                *(.note.gnu*)
+        }
+
         .notes :  {
                *(.note.*)
         } :note
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:41:41 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:41:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257146.441790 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yU9-0002VR-Rb; Thu, 13 Jan 2022 11:41:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257146.441790; Thu, 13 Jan 2022 11:41:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yU9-0002VJ-Oo; Thu, 13 Jan 2022 11:41:41 +0000
Received: by outflank-mailman (input) for mailman id 257146;
 Thu, 13 Jan 2022 11:41:40 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yU8-0002V7-Nd
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:40 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yU8-00047T-Ms
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yU8-0004LI-M7
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:40 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rSsOz1jgOFAhYF9Qz7fDckaTgh1j+5hPLK0yxxPUVzA=; b=RoW2nF0t5VOIrVd8atXdzwnPRa
	Wdnp0yZlAXlQhihkNnZ7Iom8btrzBHUXpPq8K0RI1W1bntCCsFnFgagEP+pGB8WBC+T4ySLqB1Cgy
	e+4rZWy+gRg2myziJo2iAjUODg8GhttsLRVz37SkvCDkCSttbYK6xhrGlnpIZNyCdmAY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] Update version for v6.1.1 release
Message-Id: <E1n7yU8-0004LI-M7@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:41:40 +0000

commit 54e1f5be86dd11744e45da8be6afad01d01d59e7
Author:     Michael Roth <michael.roth@amd.com>
AuthorDate: Thu Dec 23 09:52:09 2021 -0600
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Thu Dec 23 09:52:09 2021 -0600

    Update version for v6.1.1 release
    
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index dfda3e0b4f..f3b5af39e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-6.1.0
+6.1.1
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 11:41:52 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 11:41:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257147.441794 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n7yUK-0002bn-TR; Thu, 13 Jan 2022 11:41:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257147.441794; Thu, 13 Jan 2022 11:41: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 1n7yUK-0002bf-QJ; Thu, 13 Jan 2022 11:41:52 +0000
Received: by outflank-mailman (input) for mailman id 257147;
 Thu, 13 Jan 2022 11:41:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yUI-0002Zw-TT
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:50 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yUI-00047i-Sm
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n7yUI-0004MD-Rx
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 11:41:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t/+bPuz6/1jr0WzUUsRpSxvCyhHJu0mUiOFG8ceJ81E=; b=o4Hg2h9MQtzB6J+eMBJjQEkkHC
	vyiqrZ5YVuiZ04tPfNR5BJ29i4FC/s6IZm/uZy9Ini+ki3bf0xO1Oa/7KgUz6r6ZwpCEQ3TjB0L+Y
	mORTwgk2rwIQOc9mp3S8yXuJbjWfnExmpzWF+Gs8X5xMQlaV8BhtRBUl7Zs8y+7N7J3U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.16] Merge tag 'v6.1.1' into staging-4.16
Message-Id: <E1n7yUI-0004MD-Rx@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 11:41:50 +0000

commit 29a2f95d36d2a01bcacc0f3136801b2d9197f4d7
Merge: b6e539830bf45e2d7a6bd86ddfdf003088b173b0 54e1f5be86dd11744e45da8be6afad01d01d59e7
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Jan 12 09:53:56 2022 +0000
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Jan 12 09:53:56 2022 +0000

    Merge tag 'v6.1.1' into staging-4.16
    
    v6.1.1 release

 VERSION                                   |   2 +-
 accel/tcg/tcg-accel-ops-mttcg.c           |  26 ++++++++++++++++++++
 accel/tcg/tcg-accel-ops-rr.c              |  10 ++++++++
 block/block-backend.c                     |   6 +++++
 block/file-posix.c                        |   6 ++---
 block/io.c                                |   1 +
 chardev/wctablet.c                        |   1 -
 configure                                 |  10 +++++---
 contrib/plugins/execlog.c                 |   2 +-
 docs/tools/qemu-nbd.rst                   |   6 +++--
 hw/9pfs/coth.h                            |   4 ++-
 hw/arm/virt.c                             |   4 +--
 hw/block/dataplane/virtio-blk.c           |   2 +-
 hw/block/fdc.c                            |  23 +++++++++++++++---
 hw/core/machine.c                         |   1 +
 hw/display/artist.c                       |   8 +++---
 hw/display/qxl.c                          |   2 +-
 hw/i386/pc.c                              |   2 +-
 hw/i386/pc_q35.c                          |   2 +-
 hw/m68k/virt.c                            |   9 ++++++-
 hw/net/e1000.c                            |   7 ++++++
 hw/net/virtio-net.c                       |  39 ++++++++++++++++++++++++------
 hw/net/vmxnet3.c                          |  13 ++++++++++
 hw/nvme/ctrl.c                            |   5 ++++
 hw/pci/pci_bridge.c                       |  10 ++++----
 hw/pci/pcie_port.c                        |   2 +-
 hw/scsi/scsi-disk.c                       |   6 +++++
 hw/scsi/scsi-generic.c                    |   2 +-
 hw/usb/dev-uas.c                          |  11 +++++++++
 hw/vfio/common.c                          |   8 ++++++
 hw/virtio/vhost-user.c                    |   5 ++--
 hw/virtio/vhost-vsock.c                   |  19 ++++++++++++---
 hw/virtio/virtio-balloon.c                |  13 ++++++++++
 hw/virtio/virtio-mem-pci.c                |   7 +-----
 hw/virtio/virtio.c                        |  24 ++++++------------
 include/block/block_int.h                 |   7 ++++++
 include/hw/acpi/ich9.h                    |   2 +-
 include/hw/virtio/vhost-vsock.h           |   3 +++
 include/qemu/rcu.h                        |  15 ++++++++++++
 include/sysemu/block-backend.h            |   1 +
 monitor/hmp-cmds.c                        |   2 +-
 nbd/server.c                              |   3 +++
 plugins/meson.build                       |  14 ++++++-----
 qemu-nbd.c                                |   6 +++--
 subprojects/libvhost-user/libvhost-user.c |   1 +
 target/arm/cpu.c                          |  19 +++++++++++++++
 target/i386/cpu.c                         |   2 +-
 target/i386/cpu.h                         |   1 +
 target/i386/tcg/sysemu/excp_helper.c      |  25 ++++++++++---------
 tcg/arm/tcg-target.c.inc                  |  13 +++++++---
 tcg/tcg.c                                 |   8 +++++-
 tests/data/acpi/q35/DSDT                  | Bin 8289 -> 8289 bytes
 tests/data/acpi/q35/DSDT.acpihmat         | Bin 9614 -> 9614 bytes
 tests/data/acpi/q35/DSDT.bridge           | Bin 11003 -> 11003 bytes
 tests/data/acpi/q35/DSDT.cphp             | Bin 8753 -> 8753 bytes
 tests/data/acpi/q35/DSDT.dimmpxm          | Bin 9943 -> 9943 bytes
 tests/data/acpi/q35/DSDT.ipmibt           | Bin 8364 -> 8364 bytes
 tests/data/acpi/q35/DSDT.memhp            | Bin 9648 -> 9648 bytes
 tests/data/acpi/q35/DSDT.mmio64           | Bin 9419 -> 9419 bytes
 tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
 tests/data/acpi/q35/DSDT.nohpet           | Bin 8147 -> 8147 bytes
 tests/data/acpi/q35/DSDT.numamem          | Bin 8295 -> 8295 bytes
 tests/data/acpi/q35/DSDT.tis              | Bin 8894 -> 8894 bytes
 tests/qtest/bios-tables-test.c            |  18 ++++++++++++++
 tests/qtest/fdc-test.c                    |  38 +++++++++++++++++++++++++++++
 tests/tcg/x86_64/system/kernel.ld         |   5 +++-
 util/qemu-sockets.c                       |  13 ++++------
 util/rcu.c                                |  19 +++++++++++++++
 68 files changed, 409 insertions(+), 104 deletions(-)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 13:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 13:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257223.441940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n80Ob-0004i0-Op; Thu, 13 Jan 2022 13:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257223.441940; Thu, 13 Jan 2022 13:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n80Ob-0004hs-Lq; Thu, 13 Jan 2022 13:44:05 +0000
Received: by outflank-mailman (input) for mailman id 257223;
 Thu, 13 Jan 2022 13:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Oa-0004hi-Os
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Oa-0006W9-N6
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Oa-00063m-MD
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PSIg0I+YDPpvzgzyvb0fUrKI1XN0S7tcR8LzogkiLEc=; b=EognmTeXQjS3EnExuAnPGj+zid
	KZqcPj6sHLfDZfTZoJmWuZYLCbpxbj//nGARwmFw/nf2WdP51LfT2pN5pO9SUzRXxgEsFtn83Ub4L
	BoJ3Sj8QUunbcIqBDLAblgoQRWbJ/jWV5DAeUGKCSbluw5EavQcukIg6REC3i17ICHbg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: use relative counts in calibration loops
Message-Id: <E1n80Oa-00063m-MD@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 13:44:04 +0000

commit 467191641d2a2fd2e43b3ae7b80399f89d339980
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 13 14:30:18 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 13 14:30:18 2022 +0100

    x86/time: use relative counts in calibration loops
    
    Looping until reaching/exceeding a certain value is error prone: If the
    target value is close enough to the wrapping point, the loop may not
    terminate at all. Switch to using delta values, which then allows to
    fold the two loops each into just one.
    
    Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a290aba3e8..84b62f2024 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -378,7 +378,7 @@ static u64 read_hpet_count(void)
 static int64_t __init init_hpet(struct platform_timesource *pts)
 {
     uint64_t hpet_rate, start;
-    uint32_t count, target;
+    uint32_t count, target, elapsed;
     /*
      * Allow HPET to be setup, but report a frequency of 0 so it's not selected
      * as a timer source. This is required so it can be used in legacy
@@ -451,11 +451,8 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
 
     count = hpet_read32(HPET_COUNTER);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(hpet_rate);
-    if ( target < count )
-        while ( hpet_read32(HPET_COUNTER) >= count )
-            continue;
-    while ( hpet_read32(HPET_COUNTER) < target )
+    target = CALIBRATE_VALUE(hpet_rate);
+    while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
@@ -493,8 +490,8 @@ static u64 read_pmtimer_count(void)
 
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
-    u64 start;
-    u32 count, target, mask;
+    uint64_t start;
+    uint32_t count, target, mask, elapsed;
 
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -502,13 +499,10 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     pts->counter_bits = pmtmr_width;
     mask = 0xffffffff >> (32 - pmtmr_width);
 
-    count = inl(pmtmr_ioport) & mask;
+    count = inl(pmtmr_ioport);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
-    if ( target < count )
-        while ( (inl(pmtmr_ioport) & mask) >= count )
-            continue;
-    while ( (inl(pmtmr_ioport) & mask) < target )
+    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
+    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 13:44:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 13:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257224.441945 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n80Ol-0004kG-QG; Thu, 13 Jan 2022 13:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257224.441945; Thu, 13 Jan 2022 13:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n80Ol-0004k8-NP; Thu, 13 Jan 2022 13:44:15 +0000
Received: by outflank-mailman (input) for mailman id 257224;
 Thu, 13 Jan 2022 13:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Ok-0004k2-R6
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Ok-0006Wf-QK
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Ok-00064t-PR
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nsvL6/EnWEng8zakD2WTX74bNwkcrcmwMMocxVwVHl4=; b=IoExmO2rLDwVfRDRmc0zBhY/as
	Xdfbb3NXajn+mFZXwlF5N8X8LkOKZXlmnTTaY0tiZqWwXtTjpBCGu11zFheq2SL12TIskepFsu3OH
	rYkMPXQEnkJobUuWP7RvME0aGQpHdbRlnnUn2W46u+1Wwo0ZGoz4JV9Kdfznh9ghDI1o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: improve TSC / CPU freq calibration accuracy
Message-Id: <E1n80Ok-00064t-PR@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 13:44:14 +0000

commit a5c9a80af34eefcd6e31d0ed2b083f452cd9076d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 13 14:31:52 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 13 14:31:52 2022 +0100

    x86/time: improve TSC / CPU freq calibration accuracy
    
    While the problem report was for extreme errors, even smaller ones would
    better be avoided: The calculated period to run calibration loops over
    can (and usually will) be shorter than the actual time elapsed between
    first and last platform timer and TSC reads. Adjust values returned from
    the init functions accordingly.
    
    On a Skylake system I've tested this on accuracy (using HPET) went from
    detecting in some cases more than 220kHz too high a value to about
    ±2kHz. On other systems (or on this system, but with PMTMR) the original
    error range was much smaller, with less (in some cases only very little)
    improvement.
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 84b62f2024..1daff92dca 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -287,6 +287,23 @@ static char *freq_string(u64 freq)
     return s;
 }
 
+static uint64_t adjust_elapsed(uint64_t elapsed, uint32_t actual,
+                               uint32_t target)
+{
+    if ( likely(actual > target) )
+    {
+        /*
+         * A (perhaps significant) delay before the last timer read (e.g. due
+         * to a SMI or NMI) can lead to (perhaps severe) inaccuracy if not
+         * accounting for the time elapsed beyond the originally calculated
+         * duration of the calibration interval.
+         */
+        elapsed = muldiv64(elapsed, target, actual);
+    }
+
+    return elapsed * CALIBRATE_FRAC;
+}
+
 /************************************************************
  * PLATFORM TIMER 1: PROGRAMMABLE INTERVAL TIMER (LEGACY PIT)
  */
@@ -455,7 +472,7 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
     while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static void resume_hpet(struct platform_timesource *pts)
@@ -505,7 +522,7 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static struct platform_timesource __initdata plt_pmtimer =
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 13:44:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 13:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257225.441949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n80Ov-0004n6-Rv; Thu, 13 Jan 2022 13:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257225.441949; Thu, 13 Jan 2022 13:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n80Ov-0004my-Oz; Thu, 13 Jan 2022 13:44:25 +0000
Received: by outflank-mailman (input) for mailman id 257225;
 Thu, 13 Jan 2022 13:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Ou-0004mp-UC
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Ou-0006Wq-TP
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80Ou-000668-SR
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HVqxAhARla7jRkPq/OoreuOznX/9hzYg+0bYK/NtF2Q=; b=3gHwXt8NOQxpq3eUYHTRPjlnza
	Kmc3w2+FaOLr5M990cuOBfhxt0lAarPvZd7RBYzpmH6HkATVieJSty4ZPithY9+x5jPzCTZF0NYDS
	GAIjau0pyYnbJeL4vWoF5abD7J52VKoRbFds8BDbUHmLGUOJXFHT3DPoWjXnBGWmuc1s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: correct usage comments in Kbuild.include
Message-Id: <E1n80Ou-000668-SR@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 13:44:24 +0000

commit 6bce8cc00594f41830739b76e367423fd4e7444d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 13 14:32:34 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 13 14:32:34 2022 +0100

    build: correct usage comments in Kbuild.include
    
    Macros with arguments need to be invoked via $(call ...); don't misguide
    people looking up usage of such macros.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/scripts/Kbuild.include | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
index 83c7e1457b..f75d724ed7 100644
--- a/xen/scripts/Kbuild.include
+++ b/xen/scripts/Kbuild.include
@@ -43,15 +43,15 @@ define as-option-add-closure
     endif
 endef
 
-# $(if-success,<command>,<then>,<else>)
+# $(call if-success,<command>,<then>,<else>)
 # Return <then> if <command> exits with 0, <else> otherwise.
 if-success = $(shell { $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
 
-# $(success,<command>)
+# $(call success,<command>)
 # Return y if <command> exits with 0, n otherwise
 success = $(call if-success,$(1),y,n)
 
-# $(ld-option,<flag>)
+# $(call ld-option,<flag>)
 # Return y if the linker supports <flag>, n otherwise
 ld-option = $(call success,$(LD) -v $(1))
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 13:44:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 13:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257226.441953 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n80P6-0004qI-TT; Thu, 13 Jan 2022 13:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257226.441953; Thu, 13 Jan 2022 13:44:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n80P6-0004qA-QV; Thu, 13 Jan 2022 13:44:36 +0000
Received: by outflank-mailman (input) for mailman id 257226;
 Thu, 13 Jan 2022 13:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80P5-0004q0-0s
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44: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 1n80P5-0006X0-0C
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n80P4-000677-Vf
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 13:44:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eNg+2rcf+6G1i1YrcTI0pNOFmc/qdHEBF6e+Ls9FTU8=; b=iF0g7HU1klAsgQ7xgieZcKBLgw
	kewFALkOmg8cx1O8+oYX5j2t0dEwtFr9y0iNdZANo3qnEVQZy9rHIB0P0F0SFq0hOkn6kR8QJsxcD
	on0WS5/kvoANVRF6p3jILGLHPeHF264/P8jhXWH6ZZ/57VcHQRk7K6Equ2Q8gv58ZD9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl/PCI: Fix PV hotplug & stubdom coldplug
Message-Id: <E1n80P4-000677-Vf@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 13:44:34 +0000

commit 73ee2795aaef2cb086ac078bffe1c6b33c0ea91b
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu Jan 13 14:33:16 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 13 14:33:16 2022 +0100

    libxl/PCI: Fix PV hotplug & stubdom coldplug
    
    commit 0fdb48ffe7a1 "libxl: Make sure devices added by pci-attach are
    reflected in the config" broken PCI hotplug (xl pci-attach) for PV
    domains when it moved libxl__create_pci_backend() later in the function.
    
    This also broke HVM + stubdom PCI passthrough coldplug.  For that, the
    PCI devices are hotplugged to a running PV stubdom, and then the QEMU
    QMP device_add commands are made to QEMU inside the stubdom.
    
    A running PV domain calls libxl__wait_for_backend().  With the current
    placement of libxl__create_pci_backend(), the path does not exist and
    the call immediately fails:
    libxl: error: libxl_device.c:1388:libxl__wait_for_backend: Backend /local/domain/0/backend/pci/43/0 does not exist
    libxl: error: libxl_pci.c:1764:device_pci_add_done: Domain 42:libxl__device_pci_add failed for PCI device 0:2:0.0 (rc -3)
    libxl: error: libxl_create.c:1857:domcreate_attach_devices: Domain 42:unable to add pci devices
    
    The wait is only relevant when:
    1) The domain is PV
    2) The domain is running
    3) The backend is already present
    
    This is because:
    
    1) xen-pcifront is only used for PV.  It does not load for HVM domains
       where QEMU is used.
    
    2) If the domain is not running (starting), then the frontend state will
       be Initialising.  xen-pciback waits for the frontend to transition to
       at Initialised before attempting to connect.  So a wait for a
       non-running domain is not applicable as the backend will not
       transition to Connected.
    
    3) For presence, num_devs is already used to determine if the backend
       needs to be created.  Re-use num_devs to determine if the backend
       wait is necessary.  The wait is necessary to avoid racing with
       another PCI attachment reconfiguring the front/back or changing to
       some other state like closing.  If we are creating the backend, then
       we don't have to worry about the state since it is being created.
    
    Fixes: 0fdb48ffe7a1 ("libxl: Make sure devices added by pci-attach are
    reflected in the config")
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 4c2d7aeefb..4bbbfe9f16 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -157,9 +157,11 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc,
     if (domtype == LIBXL_DOMAIN_TYPE_INVALID)
         return ERROR_FAIL;
 
-    if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", XenbusStateConnected)) < 0)
-            return ERROR_FAIL;
+    /* Wait is only needed if the backend already exists (num_devs != NULL) */
+    if (num_devs && !starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
+        rc = libxl__wait_for_backend(gc, be_path,
+                                     GCSPRINTF("%d", XenbusStateConnected));
+        if (rc) return rc;
     }
 
     back = flexarray_make(gc, 16, 1);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 15:22:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 15:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257254.442023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n81vR-0000bI-LD; Thu, 13 Jan 2022 15:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257254.442023; Thu, 13 Jan 2022 15:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n81vR-0000bB-IS; Thu, 13 Jan 2022 15:22:05 +0000
Received: by outflank-mailman (input) for mailman id 257254;
 Thu, 13 Jan 2022 15:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n81vQ-0000b2-UF
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n81vQ-0008IO-Sd
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n81vQ-0005kM-RZ
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3KjB5bC9drTQuUWrGNCAILHlJrRfxmva40KeOBF5uwo=; b=5wtqfZeMseyregF4/v00ekEK9k
	gIIr9payBLIzVZBTfAns2lusHQtjTEuHFsnKTqYKQDwLbUzbbjfTaGTomHq/YQgmTU9DSKv3DBXcy
	QIldypWKnWstgCWZsoNNTRjmWyejFcwWgajDYSk3cdU+9zpV4zVmQoJe7av2qmaNKpQw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Simplify hvm_enable_msr_interception()
Message-Id: <E1n81vQ-0005kM-RZ@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 15:22:04 +0000

commit 32a971bfa6760d8fb260d9d721c5ecdd894deafd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Nov 30 14:37:59 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 13 15:19:43 2022 +0000

    x86/hvm: Simplify hvm_enable_msr_interception()
    
    The sole caller doesn't check the return value, and both vendors implement the
    hook.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/hvm.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index bd2cbb0e7b..2767427aa9 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -631,15 +631,9 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
     return hvm_funcs.nhvm_intr_blocked(v);
 }
 
-static inline bool_t hvm_enable_msr_interception(struct domain *d, uint32_t msr)
+static inline void hvm_enable_msr_interception(struct domain *d, uint32_t msr)
 {
-    if ( hvm_funcs.enable_msr_interception )
-    {
-        hvm_funcs.enable_msr_interception(d, msr);
-        return 1;
-    }
-
-    return 0;
+    hvm_funcs.enable_msr_interception(d, msr);
 }
 
 static inline bool_t hvm_is_singlestep_supported(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 15:22:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 15:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257255.442028 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n81vb-0000f2-NR; Thu, 13 Jan 2022 15:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257255.442028; Thu, 13 Jan 2022 15:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n81vb-0000es-K3; Thu, 13 Jan 2022 15:22:15 +0000
Received: by outflank-mailman (input) for mailman id 257255;
 Thu, 13 Jan 2022 15:22: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 1n81vb-0000ee-17
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22: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 1n81vb-0008Ip-0C
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n81va-0005l7-VU
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IQcZysE+a8ECa0nGO+j4muD2Nq8H15et2icllT9Nloo=; b=k/N1Oj8VvzUGxPb+AaLf8jyatv
	KEwkJRdJDL0sm+iTOAfQtqWe9pXUSqjOfghu48f3S9K14xp6V+ZznPcW/MEFJ449npBl8oJIevD72
	k02bgayrYwzNlVIgLJGeY0Y9MSxqtAOJ8PKivUbNXt+GBG4Qi+zeKkrr6zGN2CXzr4N0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Rework nested hap functions to reduce parameters
Message-Id: <E1n81va-0005l7-VU@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 15:22:14 +0000

commit ddf820e1d6e82051be95eeb30a570426423e4f9f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Nov 30 17:05:09 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 13 15:19:43 2022 +0000

    x86/hvm: Rework nested hap functions to reduce parameters
    
    Most functions in this call chain have 8 parameters, meaning that the final
    two booleans are spilled to the stack for calls.
    
    First, delete nestedhap_walk_L1_p2m and introduce nhvm_hap_walk_L1_p2m() as a
    thin wrapper around hvm_funcs, just like all the other nhvm_*() hooks.  This
    involves including xen/mm.h as the forward declaration of struct npfec is no
    longer enough.
    
    Next, replace the triple of booleans with struct npfec, which contains the
    same information in the bottom 3 bits.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c                       |  5 +---
 xen/arch/x86/hvm/svm/nestedsvm.c             | 11 ++++----
 xen/arch/x86/hvm/vmx/vvmx.c                  | 10 +++----
 xen/arch/x86/include/asm/hvm/hvm.h           | 14 +++++++---
 xen/arch/x86/include/asm/hvm/nestedhvm.h     |  6 +----
 xen/arch/x86/include/asm/hvm/svm/nestedsvm.h |  6 ++---
 xen/arch/x86/include/asm/hvm/vmx/vvmx.h      |  8 +++---
 xen/arch/x86/mm/hap/nested_hap.c             | 40 +++++++---------------------
 xen/arch/x86/mm/p2m.c                        | 12 +++++----
 9 files changed, 47 insertions(+), 65 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index d233550ae4..b0ee49a61a 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1775,10 +1775,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
          * the same as for shadow paging.
          */
 
-         rv = nestedhvm_hap_nested_page_fault(curr, &gpa,
-                                              npfec.read_access,
-                                              npfec.write_access,
-                                              npfec.insn_fetch);
+        rv = nestedhvm_hap_nested_page_fault(curr, &gpa, npfec);
         switch (rv) {
         case NESTEDHVM_PAGEFAULT_DONE:
         case NESTEDHVM_PAGEFAULT_RETRY:
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 6d90630040..abc178d8d4 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -1216,10 +1216,9 @@ nsvm_vmcb_hap_enabled(struct vcpu *v)
  * walk is successful, the translated value is returned in
  * L1_gpa. The result value tells what to do next.
  */
-int
-nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                     unsigned int *page_order, uint8_t *p2m_acc,
-                     bool_t access_r, bool_t access_w, bool_t access_x)
+int nsvm_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec)
 {
     uint32_t pfec;
     unsigned long nested_cr3, gfn;
@@ -1227,9 +1226,9 @@ nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
     nested_cr3 = nhvm_vcpu_p2m_base(v);
 
     pfec = PFEC_user_mode | PFEC_page_present;
-    if ( access_w )
+    if ( npfec.write_access )
         pfec |= PFEC_write_access;
-    if ( access_x )
+    if ( npfec.insn_fetch )
         pfec |= PFEC_insn_fetch;
 
     /* Walk the guest-supplied NPT table, just as if it were a pagetable */
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index e9f94daf64..7419ee9dd0 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2346,16 +2346,16 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
  * walk is successful, the translated value is returned in
  * L1_gpa. The result value tells what to do next.
  */
-int
-nvmx_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                     unsigned int *page_order, uint8_t *p2m_acc,
-                     bool_t access_r, bool_t access_w, bool_t access_x)
+int nvmx_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec)
 {
     int rc;
     unsigned long gfn;
     uint64_t exit_qual;
     uint32_t exit_reason = EXIT_REASON_EPT_VIOLATION;
-    uint32_t rwx_rights = (access_x << 2) | (access_w << 1) | access_r;
+    uint32_t rwx_rights =
+        (npfec.insn_fetch << 2) | (npfec.write_access << 1) | npfec.read_access;
     struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
 
     vmx_vmcs_enter(v);
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 2767427aa9..cd9e73e266 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -20,6 +20,8 @@
 #ifndef __ASM_X86_HVM_HVM_H__
 #define __ASM_X86_HVM_HVM_H__
 
+#include <xen/mm.h>
+
 #include <asm/alternative.h>
 #include <asm/asm_defns.h>
 #include <asm/current.h>
@@ -203,8 +205,7 @@ struct hvm_function_table {
     /*Walk nested p2m  */
     int (*nhvm_hap_walk_L1_p2m)(struct vcpu *v, paddr_t L2_gpa,
                                 paddr_t *L1_gpa, unsigned int *page_order,
-                                uint8_t *p2m_acc, bool_t access_r,
-                                bool_t access_w, bool_t access_x);
+                                uint8_t *p2m_acc, struct npfec npfec);
 
     void (*enable_msr_interception)(struct domain *d, uint32_t msr);
     bool_t (*is_singlestep_supported)(void);
@@ -350,7 +351,6 @@ int hvm_debug_op(struct vcpu *v, int32_t op);
 void hvm_toggle_singlestep(struct vcpu *v);
 void hvm_fast_singlestep(struct vcpu *v, uint16_t p2midx);
 
-struct npfec;
 int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
                               struct npfec npfec);
 
@@ -631,6 +631,14 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
     return hvm_funcs.nhvm_intr_blocked(v);
 }
 
+static inline int nhvm_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec)
+{
+    return hvm_funcs.nhvm_hap_walk_L1_p2m(
+        v, L2_gpa, L1_gpa, page_order, p2m_acc, npfec);
+}
+
 static inline void hvm_enable_msr_interception(struct domain *d, uint32_t msr)
 {
     hvm_funcs.enable_msr_interception(d, msr);
diff --git a/xen/arch/x86/include/asm/hvm/nestedhvm.h b/xen/arch/x86/include/asm/hvm/nestedhvm.h
index d263925786..7184928c2b 100644
--- a/xen/arch/x86/include/asm/hvm/nestedhvm.h
+++ b/xen/arch/x86/include/asm/hvm/nestedhvm.h
@@ -58,11 +58,7 @@ bool_t nestedhvm_vcpu_in_guestmode(struct vcpu *v);
 #define NESTEDHVM_PAGEFAULT_RETRY      5
 #define NESTEDHVM_PAGEFAULT_DIRECT_MMIO 6
 int nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa,
-    bool_t access_r, bool_t access_w, bool_t access_x);
-
-int nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                          unsigned int *page_order, uint8_t *p2m_acc,
-                          bool_t access_r, bool_t access_w, bool_t access_x);
+                                    struct npfec npfec);
 
 /* IO permission map */
 unsigned long *nestedhvm_vcpu_iomap_get(bool_t ioport_80, bool_t ioport_ed);
diff --git a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
index 0873698457..c3ef235414 100644
--- a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
+++ b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
@@ -122,9 +122,9 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v);
 void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v);
 void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v);
 bool_t nestedsvm_gif_isset(struct vcpu *v);
-int nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                         unsigned int *page_order, uint8_t *p2m_acc,
-                         bool_t access_r, bool_t access_w, bool_t access_x);
+int nsvm_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec);
 
 #define NSVM_INTR_NOTHANDLED     3
 #define NSVM_INTR_NOTINTERCEPTED 2
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vvmx.h b/xen/arch/x86/include/asm/hvm/vmx/vvmx.h
index d5f68f30b1..e4ca3bc6ee 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vvmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vvmx.h
@@ -100,10 +100,10 @@ bool_t nvmx_ept_enabled(struct vcpu *v);
 #define EPT_TRANSLATE_MISCONFIG     2
 #define EPT_TRANSLATE_RETRY         3
 
-int
-nvmx_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                     unsigned int *page_order, uint8_t *p2m_acc,
-                     bool_t access_r, bool_t access_w, bool_t access_x);
+int nvmx_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec);
+
 /*
  * Virtual VMCS layout
  *
diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c
index 50fa2dd9f4..d8a7b3b401 100644
--- a/xen/arch/x86/mm/hap/nested_hap.c
+++ b/xen/arch/x86/mm/hap/nested_hap.c
@@ -113,31 +113,13 @@ nestedhap_fix_p2m(struct vcpu *v, struct p2m_domain *p2m,
     }
 }
 
-/* This function uses L2_gpa to walk the P2M page table in L1. If the
- * walk is successful, the translated value is returned in
- * L1_gpa. The result value tells what to do next.
- */
-int
-nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                      unsigned int *page_order, uint8_t *p2m_acc,
-                      bool_t access_r, bool_t access_w, bool_t access_x)
-{
-    ASSERT(hvm_funcs.nhvm_hap_walk_L1_p2m);
-
-    return hvm_funcs.nhvm_hap_walk_L1_p2m(v, L2_gpa, L1_gpa, page_order,
-        p2m_acc, access_r, access_w, access_x);
-}
-
-
 /* This function uses L1_gpa to walk the P2M table in L0 hypervisor. If the
  * walk is successful, the translated value is returned in L0_gpa. The return 
  * value tells the upper level what to do.
  */
-static int
-nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa,
-                      p2m_type_t *p2mt, p2m_access_t *p2ma,
-                      unsigned int *page_order,
-                      bool_t access_r, bool_t access_w, bool_t access_x)
+static int nestedhap_walk_L0_p2m(
+    struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa, p2m_type_t *p2mt,
+    p2m_access_t *p2ma, unsigned int *page_order, struct npfec npfec)
 {
     mfn_t mfn;
     int rc;
@@ -154,7 +136,7 @@ nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa,
         goto out;
 
     rc = NESTEDHVM_PAGEFAULT_L0_ERROR;
-    if ( access_w && p2m_is_readonly(*p2mt) )
+    if ( npfec.write_access && p2m_is_readonly(*p2mt) )
         goto out;
 
     if ( p2m_is_paging(*p2mt) || p2m_is_shared(*p2mt) || !p2m_is_ram(*p2mt) )
@@ -176,9 +158,8 @@ out:
  *
  * Returns:
  */
-int
-nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa,
-    bool_t access_r, bool_t access_w, bool_t access_x)
+int nestedhvm_hap_nested_page_fault(
+    struct vcpu *v, paddr_t *L2_gpa, struct npfec npfec)
 {
     int rv;
     paddr_t L1_gpa, L0_gpa;
@@ -192,8 +173,8 @@ nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa,
     p2m = p2m_get_hostp2m(d); /* L0 p2m */
 
     /* walk the L1 P2M table */
-    rv = nestedhap_walk_L1_p2m(v, *L2_gpa, &L1_gpa, &page_order_21, &p2ma_21,
-        access_r, access_w, access_x);
+    rv = nhvm_hap_walk_L1_p2m(v, *L2_gpa, &L1_gpa, &page_order_21, &p2ma_21,
+                              npfec);
 
     /* let caller to handle these two cases */
     switch (rv) {
@@ -209,9 +190,8 @@ nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa,
     }
 
     /* ==> we have to walk L0 P2M */
-    rv = nestedhap_walk_L0_p2m(p2m, L1_gpa, &L0_gpa,
-        &p2mt_10, &p2ma_10, &page_order_10,
-        access_r, access_w, access_x);
+    rv = nestedhap_walk_L0_p2m(p2m, L1_gpa, &L0_gpa, &p2mt_10, &p2ma_10,
+                               &page_order_10, npfec);
 
     /* let upper level caller to handle these two cases */
     switch (rv) {
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 98c8201f92..3f81e99fd6 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1930,6 +1930,11 @@ unsigned long paging_gva_to_gfn(struct vcpu *v,
         const struct paging_mode *mode;
         uint8_t l1_p2ma;
         unsigned int l1_page_order;
+        struct npfec npfec = {
+            .read_access  = 1,
+            .write_access = *pfec & PFEC_write_access,
+            .insn_fetch   = *pfec & PFEC_insn_fetch,
+        };
         int rv;
 
         /* translate l2 guest va into l2 guest gfn */
@@ -1940,11 +1945,8 @@ unsigned long paging_gva_to_gfn(struct vcpu *v,
         if ( l2_gfn == gfn_x(INVALID_GFN) )
             return gfn_x(INVALID_GFN);
 
-        rv = nestedhap_walk_L1_p2m(v, pfn_to_paddr(l2_gfn), &l1_gpa,
-                                   &l1_page_order, &l1_p2ma,
-                                   1,
-                                   !!(*pfec & PFEC_write_access),
-                                   !!(*pfec & PFEC_insn_fetch));
+        rv = nhvm_hap_walk_L1_p2m(
+            v, pfn_to_paddr(l2_gfn), &l1_gpa, &l1_page_order, &l1_p2ma, npfec);
 
         if ( rv != NESTEDHVM_PAGEFAULT_DONE )
             return gfn_x(INVALID_GFN);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 15:22:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 15:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257256.442031 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n81vm-0000iy-Qg; Thu, 13 Jan 2022 15:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257256.442031; Thu, 13 Jan 2022 15:22: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 1n81vm-0000iq-NQ; Thu, 13 Jan 2022 15:22:26 +0000
Received: by outflank-mailman (input) for mailman id 257256;
 Thu, 13 Jan 2022 15:22: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 1n81vl-0000iX-4X
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22: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 1n81vl-0008JB-3g
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n81vl-0005m0-2l
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 15:22: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=16r9I0HuZw8eY6V715KKF/afzZRAXlhtKZw5Lwi5Tow=; b=3uCh5PiZm3QmIVE5P2HQNdujhg
	4pHoZRIiLsvrldB+Y6G8jlG2MuLc+XeoI/FU68Um5oAyTssq8eexfNjq5nX5iTLYMFElTMOANgzP7
	n7ognu9cUsttYbatKjPU4ZBt9fPYD0cKJTg5xTwnrLYHkY2W5g4rkBLYPkitoRU65W6c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Improve hvm_set_guest_pat() code generation
Message-Id: <E1n81vl-0005m0-2l@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 15:22:25 +0000

commit 9ce0a5e207f3968e65d0af33a15bee5bdf5c8a7f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 12 13:54:12 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 13 15:19:43 2022 +0000

    x86/hvm: Improve hvm_set_guest_pat() code generation
    
    This is a fastpath on virtual vmentry/exit, and forcing guest_pat to be
    spilled to the stack is bad.  Performing the shift in a register is far more
    efficient.
    
    Drop the (IMO useless) log message.  MSR_PAT only gets altered on boot, and a
    bad value will be entirely evident in the ensuing #GP backtrace.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b0ee49a61a..10ee4e9570 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -299,13 +299,13 @@ 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, u64 guest_pat)
+int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
 {
-    int i;
-    uint8_t *value = (uint8_t *)&guest_pat;
+    unsigned int i;
+    uint64_t tmp;
 
-    for ( i = 0; i < 8; i++ )
-        switch ( value[i] )
+    for ( i = 0, tmp = guest_pat; i < 8; i++, tmp >>= 8 )
+        switch ( tmp & 0xff )
         {
         case PAT_TYPE_UC_MINUS:
         case PAT_TYPE_UNCACHABLE:
@@ -315,8 +315,6 @@ int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat)
         case PAT_TYPE_WRTHROUGH:
             break;
         default:
-            HVM_DBG_LOG(DBG_LEVEL_MSR, "invalid guest PAT: %"PRIx64"\n",
-                        guest_pat); 
             return 0;
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 13 21:11:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Jan 2022 21:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257406.442239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n87N9-000271-Ks; Thu, 13 Jan 2022 21:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257406.442239; Thu, 13 Jan 2022 21: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 1n87N9-00026t-Hj; Thu, 13 Jan 2022 21:11:03 +0000
Received: by outflank-mailman (input) for mailman id 257406;
 Thu, 13 Jan 2022 21: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 1n87N7-00026n-HV
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 21: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 1n87N7-0006M8-Ey
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 21:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n87N7-0005eQ-Dv
 for xen-changelog@lists.xenproject.org; Thu, 13 Jan 2022 21: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=y+kd8kiOwa9wj7XHoc8eR4yZDeBFIRn6apiLI3MepCA=; b=egQwOzKyTbJFdxvgwW6VAxZTV+
	wpr6AtDNj3KpmoHjiJDeMtnalxMHDnr9vNFjfaOIrDZimOeBvWLS5ll4z496vubeWFO+byoFO2ZcW
	71Q/LrHRheoUbdGjloBWgf3VfEqhcyqR7c0xoO6QqJduhe2hf9MZYhMSUFsX3Z7qxfq4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/evtchn: Deduplicate xenevtchn_fd()
Message-Id: <E1n87N7-0005eQ-Dv@xenbits.xenproject.org>
Date: Thu, 13 Jan 2022 21:11:01 +0000

commit 2e8aa1663c76a189998bf51b869b9e468c992c89
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 10 12:29:05 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 12 10:49:05 2022 +0000

    tools/libs/evtchn: Deduplicate xenevtchn_fd()
    
    struct xenevtchn_handle is common in private.h, meaning that xenevtchn_fd()
    has exactly one correct implementation.
    
    Implement it in core.c, rather than identically for each OS.  This matches all
    other libraries (call, gnttab, gntshr) which implement an fd getter.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/evtchn/core.c    | 5 +++++
 tools/libs/evtchn/freebsd.c | 5 -----
 tools/libs/evtchn/linux.c   | 5 -----
 tools/libs/evtchn/minios.c  | 5 -----
 tools/libs/evtchn/netbsd.c  | 5 -----
 tools/libs/evtchn/solaris.c | 5 -----
 6 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/tools/libs/evtchn/core.c b/tools/libs/evtchn/core.c
index c402d9393b..de925fc963 100644
--- a/tools/libs/evtchn/core.c
+++ b/tools/libs/evtchn/core.c
@@ -120,6 +120,11 @@ int xenevtchn_close(xenevtchn_handle *xce)
     return rc;
 }
 
+int xenevtchn_fd(xenevtchn_handle *xce)
+{
+    return xce->fd;
+}
+
 int xenevtchn_restrict(xenevtchn_handle *xce, domid_t domid)
 {
     return osdep_evtchn_restrict(xce, domid);
diff --git a/tools/libs/evtchn/freebsd.c b/tools/libs/evtchn/freebsd.c
index 7427ab2408..c4d075350b 100644
--- a/tools/libs/evtchn/freebsd.c
+++ b/tools/libs/evtchn/freebsd.c
@@ -63,11 +63,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return -1;
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
diff --git a/tools/libs/evtchn/linux.c b/tools/libs/evtchn/linux.c
index f27b6def39..e61b77ca61 100644
--- a/tools/libs/evtchn/linux.c
+++ b/tools/libs/evtchn/linux.c
@@ -66,11 +66,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return ioctl(xce->fd, IOCTL_EVTCHN_RESTRICT_DOMID, &restrict_domid);
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index e5dfdc5ef5..8f84048b11 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
@@ -112,11 +112,6 @@ void minios_evtchn_close_fd(int fd)
     files[fd].type = FTYPE_NONE;
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int ret;
diff --git a/tools/libs/evtchn/netbsd.c b/tools/libs/evtchn/netbsd.c
index 1cebc21ffc..0b223c4beb 100644
--- a/tools/libs/evtchn/netbsd.c
+++ b/tools/libs/evtchn/netbsd.c
@@ -58,11 +58,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return -1;
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
diff --git a/tools/libs/evtchn/solaris.c b/tools/libs/evtchn/solaris.c
index df9579df17..7fef88a73e 100644
--- a/tools/libs/evtchn/solaris.c
+++ b/tools/libs/evtchn/solaris.c
@@ -57,11 +57,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return -1;
 }
 
-int xenevtchn_fd(xenevtchn_handle *xce)
-{
-    return xce->fd;
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:55:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257451.442330 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Arx-0002GQ-A0; Fri, 14 Jan 2022 00:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257451.442330; Fri, 14 Jan 2022 00:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Arx-0002GI-7D; Fri, 14 Jan 2022 00:55:05 +0000
Received: by outflank-mailman (input) for mailman id 257451;
 Fri, 14 Jan 2022 00:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Arv-0002GC-9H
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Arv-0002EU-6p
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Arv-0005Sz-5a
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=04T+XU6ggu6ILug31ODlSAv6xFNkSOMSN0c6gYt94xo=; b=h6gw88SIANAmbuKhhmTuhC/YAK
	7VAbD2YeU1/MRp/Ac1XrLhGNG4SJU1elrDvwSi7mD5cHCl/WLtRwi1zZP7mHtpjbQL1VvNY1hMkzC
	Rp5hM43rG9qyLWhBT/KPatB7pTQa/I3NDtspgVNBV66RVO50M+wr+9mcsyX8bFEkXDyo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] virtio-balloon: don't start free page hinting if postcopy is possible
Message-Id: <E1n8Arv-0005Sz-5a@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:55:03 +0000

commit aa77e375a5b1b91d7646d8b5f8683778f53fbbd3
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Thu Jul 8 11:53:38 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:18 2021 -0600

    virtio-balloon: don't start free page hinting if postcopy is possible
    
    Postcopy never worked properly with 'free-page-hint=on', as there are
    at least two issues:
    
    1) With postcopy, the guest will never receive a VIRTIO_BALLOON_CMD_ID_DONE
       and consequently won't release free pages back to the OS once
       migration finishes.
    
       The issue is that for postcopy, we won't do a final bitmap sync while
       the guest is stopped on the source and
       virtio_balloon_free_page_hint_notify() will only call
       virtio_balloon_free_page_done() on the source during
       PRECOPY_NOTIFY_CLEANUP, after the VM state was already migrated to
       the destination.
    
    2) Once the VM touches a page on the destination that has been excluded
       from migration on the source via qemu_guest_free_page_hint() while
       postcopy is active, that thread will stall until postcopy finishes
       and all threads are woken up. (with older Linux kernels that won't
       retry faults when woken up via userfaultfd, we might actually get a
       SEGFAULT)
    
       The issue is that the source will refuse to migrate any pages that
       are not marked as dirty in the dirty bmap -- for example, because the
       page might just have been sent. Consequently, the faulting thread will
       stall, waiting for the page to be migrated -- which could take quite
       a while and result in guest OS issues.
    
    While we could fix 1) comparatively easily, 2) is harder to get right and
    might require more involved RAM migration changes on source and destination
    [1].
    
    As it never worked properly, let's not start free page hinting in the
    precopy notifier if the postcopy migration capability was enabled to fix
    it easily. Capabilities cannot be enabled once migration is already
    running.
    
    Note 1: in the future we might either adjust migration code on the source
            to track pages that have actually been sent or adjust
            migration code on source and destination  to eventually send
            pages multiple times from the source and and deal with pages
            that are sent multiple times on the destination.
    
    Note 2: virtio-mem has similar issues, however, access to "unplugged"
            memory by the guest is very rare and we would have to be very
            lucky for it to happen during migration. The spec states
            "The driver SHOULD NOT read from unplugged memory blocks ..."
            and "The driver MUST NOT write to unplugged memory blocks".
            virtio-mem will move away from virtio_balloon_free_page_done()
            soon and handle this case explicitly on the destination.
    
    [1] https://lkml.kernel.org/r/e79fd18c-aa62-c1d8-c7f3-ba3fc2c25fc8@redhat.com
    
    Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
    Cc: qemu-stable@nongnu.org
    Cc: Wei Wang <wei.w.wang@intel.com>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Cc: Alexander Duyck <alexander.duyck@gmail.com>
    Cc: Juan Quintela <quintela@redhat.com>
    Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
    Cc: Peter Xu <peterx@redhat.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20210708095339.20274-2-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Peter Xu <peterx@redhat.com>
    (cherry picked from commit fd51e54fa10221e5a8add894c38cc1cf199f4bc4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio-balloon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 4b5d9e5e50..ae7867a8db 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -30,6 +30,7 @@
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "migration/misc.h"
+#include "migration/migration.h"
 
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
@@ -662,6 +663,18 @@ virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data)
         return 0;
     }
 
+    /*
+     * Pages hinted via qemu_guest_free_page_hint() are cleared from the dirty
+     * bitmap and will not get migrated, especially also not when the postcopy
+     * destination starts using them and requests migration from the source; the
+     * faulting thread will stall until postcopy migration finishes and
+     * all threads are woken up. Let's not start free page hinting if postcopy
+     * is possible.
+     */
+    if (migrate_postcopy_ram()) {
+        return 0;
+    }
+
     switch (pnd->reason) {
     case PRECOPY_NOTIFY_BEFORE_BITMAP_SYNC:
         virtio_balloon_free_page_stop(dev);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:55:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257452.442335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8As6-0002I2-Bk; Fri, 14 Jan 2022 00:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257452.442335; Fri, 14 Jan 2022 00: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 1n8As6-0002Hu-8i; Fri, 14 Jan 2022 00:55:14 +0000
Received: by outflank-mailman (input) for mailman id 257452;
 Fri, 14 Jan 2022 00:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8As5-0002Hk-B0
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8As5-0002EY-AA
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8As5-0005Tf-9J
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6cg+vC855tiQyN/+4ONwGjMQTkcnhm4hEPg38Q1TNnA=; b=fhSjhqzagOxW3fbojndXs8UAaI
	/+Eq1fdZ/jdvu/MmQDM5dsAwARk9wWBEy3cx7cMg1k1I9UoWN+dQaZdgJ170soQcblZKxvG/HMDEt
	VgDveAuhiWkDuilMK9nTPGTXGV0xqFkwWsOCDEMunl6ejv8PhwN0RDJbbHKa+nT4WoN4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] target/arm: Don't skip M-profile reset entirely in user mode
Message-Id: <E1n8As5-0005Tf-9J@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:55:13 +0000

commit 3054f772de9c2e97e7c196d4f3e70d58aca1e807
Author:     Peter Maydell <peter.maydell@linaro.org>
AuthorDate: Mon Sep 20 09:54:33 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:25 2021 -0600

    target/arm: Don't skip M-profile reset entirely in user mode
    
    Currently all of the M-profile specific code in arm_cpu_reset() is
    inside a !defined(CONFIG_USER_ONLY) ifdef block.  This is
    unintentional: it happened because originally the only
    M-profile-specific handling was the setup of the initial SP and PC
    from the vector table, which is system-emulation only.  But then we
    added a lot of other M-profile setup to the same "if (ARM_FEATURE_M)"
    code block without noticing that it was all inside a not-user-mode
    ifdef.  This has generally been harmless, but with the addition of
    v8.1M low-overhead-loop support we ran into a problem: the reset of
    FPSCR.LTPSIZE to 4 was only being done for system emulation mode, so
    if a user-mode guest tried to execute the LE instruction it would
    incorrectly take a UsageFault.
    
    Adjust the ifdefs so only the really system-emulation specific parts
    are covered.  Because this means we now run some reset code that sets
    up initial values in the FPCCR and similar FPU related registers,
    explicitly set up the registers controlling FPU context handling in
    user-emulation mode so that the FPU works by design and not by
    chance.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/613
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-id: 20210914120725.24992-2-peter.maydell@linaro.org
    (cherry picked from commit b62ceeaf8096fdbbbfdc6087da0028bc4a4dd77e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/arm/cpu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 2866dd7658..af60c07ca1 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -265,12 +265,15 @@ static void arm_cpu_reset(DeviceState *dev)
         env->uncached_cpsr = ARM_CPU_MODE_SVC;
     }
     env->daif = PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F;
+#endif
 
     if (arm_feature(env, ARM_FEATURE_M)) {
+#ifndef CONFIG_USER_ONLY
         uint32_t initial_msp; /* Loaded from 0x0 */
         uint32_t initial_pc; /* Loaded from 0x4 */
         uint8_t *rom;
         uint32_t vecbase;
+#endif
 
         if (cpu_isar_feature(aa32_lob, cpu)) {
             /*
@@ -324,6 +327,8 @@ static void arm_cpu_reset(DeviceState *dev)
             env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK |
                 R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK;
         }
+
+#ifndef CONFIG_USER_ONLY
         /* Unlike A/R profile, M profile defines the reset LR value */
         env->regs[14] = 0xffffffff;
 
@@ -352,8 +357,22 @@ static void arm_cpu_reset(DeviceState *dev)
         env->regs[13] = initial_msp & 0xFFFFFFFC;
         env->regs[15] = initial_pc & ~1;
         env->thumb = initial_pc & 1;
+#else
+        /*
+         * For user mode we run non-secure and with access to the FPU.
+         * The FPU context is active (ie does not need further setup)
+         * and is owned by non-secure.
+         */
+        env->v7m.secure = false;
+        env->v7m.nsacr = 0xcff;
+        env->v7m.cpacr[M_REG_NS] = 0xf0ffff;
+        env->v7m.fpccr[M_REG_S] &=
+            ~(R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK);
+        env->v7m.control[M_REG_S] |= R_V7M_CONTROL_FPCA_MASK;
+#endif
     }
 
+#ifndef CONFIG_USER_ONLY
     /* AArch32 has a hard highvec setting of 0xFFFF0000.  If we are currently
      * executing as AArch32 then check if highvecs are enabled and
      * adjust the PC accordingly.
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:55:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257453.442339 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AsG-0002LP-DS; Fri, 14 Jan 2022 00:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257453.442339; Fri, 14 Jan 2022 00: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 1n8AsG-0002LH-AE; Fri, 14 Jan 2022 00:55:24 +0000
Received: by outflank-mailman (input) for mailman id 257453;
 Fri, 14 Jan 2022 00:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AsF-0002Kz-Eb
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AsF-0002F8-Dl
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AsF-0005UM-Cp
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sjYjiDXG14HNMx9wBqu/AQL34/jMX1AaaZ7jTSTArLM=; b=YrUjK1x5Q+CVBZEfPCTNcayQDC
	VvG+C2U+SAgvTSOaIfXgO0x2BJRcEwSeDUxop+bgFYVNqHpnPeniyLLnshELTaeeDuwcgLH20uQur
	O4a3Wvn6gya2MFiEEq57If+uUNNCpz79s5/2JTljD2GGgGFiuEuHepcNyI8661dVvqCc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] virtio-net: fix use after unmap/free for sg
Message-Id: <E1n8AsF-0005UM-Cp@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:55:23 +0000

commit 9e41f16fca436a666ee79f5219797a2c58b6cf19
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Sep 2 13:44:12 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:31 2021 -0600

    virtio-net: fix use after unmap/free for sg
    
    When mergeable buffer is enabled, we try to set the num_buffers after
    the virtqueue elem has been unmapped. This will lead several issues,
    E.g a use after free when the descriptor has an address which belongs
    to the non direct access region. In this case we use bounce buffer
    that is allocated during address_space_map() and freed during
    address_space_unmap().
    
    Fixing this by storing the elems temporarily in an array and delay the
    unmap after we set the the num_buffers.
    
    This addresses CVE-2021-3748.
    
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Fixes: fbe78f4f55c6 ("virtio-net support")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit bedd7e93d01961fcb16a97ae45d93acf357e11f6)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/virtio-net.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 16d20cdee5..f205331dcf 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1746,10 +1746,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
     VirtIONet *n = qemu_get_nic_opaque(nc);
     VirtIONetQueue *q = virtio_net_get_subqueue(nc);
     VirtIODevice *vdev = VIRTIO_DEVICE(n);
+    VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE];
+    size_t lens[VIRTQUEUE_MAX_SIZE];
     struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
     struct virtio_net_hdr_mrg_rxbuf mhdr;
     unsigned mhdr_cnt = 0;
-    size_t offset, i, guest_offset;
+    size_t offset, i, guest_offset, j;
+    ssize_t err;
 
     if (!virtio_net_can_receive(nc)) {
         return -1;
@@ -1780,6 +1783,12 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
 
         total = 0;
 
+        if (i == VIRTQUEUE_MAX_SIZE) {
+            virtio_error(vdev, "virtio-net unexpected long buffer chain");
+            err = size;
+            goto err;
+        }
+
         elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement));
         if (!elem) {
             if (i) {
@@ -1791,7 +1800,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                              n->guest_hdr_len, n->host_hdr_len,
                              vdev->guest_features);
             }
-            return -1;
+            err = -1;
+            goto err;
         }
 
         if (elem->in_num < 1) {
@@ -1799,7 +1809,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                          "virtio-net receive queue contains no in buffers");
             virtqueue_detach_element(q->rx_vq, elem, 0);
             g_free(elem);
-            return -1;
+            err = -1;
+            goto err;
         }
 
         sg = elem->in_sg;
@@ -1836,12 +1847,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
         if (!n->mergeable_rx_bufs && offset < size) {
             virtqueue_unpop(q->rx_vq, elem, total);
             g_free(elem);
-            return size;
+            err = size;
+            goto err;
         }
 
-        /* signal other side */
-        virtqueue_fill(q->rx_vq, elem, total, i++);
-        g_free(elem);
+        elems[i] = elem;
+        lens[i] = total;
+        i++;
     }
 
     if (mhdr_cnt) {
@@ -1851,10 +1863,23 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                      &mhdr.num_buffers, sizeof mhdr.num_buffers);
     }
 
+    for (j = 0; j < i; j++) {
+        /* signal other side */
+        virtqueue_fill(q->rx_vq, elems[j], lens[j], j);
+        g_free(elems[j]);
+    }
+
     virtqueue_flush(q->rx_vq, i);
     virtio_notify(vdev, q->rx_vq);
 
     return size;
+
+err:
+    for (j = 0; j < i; j++) {
+        g_free(elems[j]);
+    }
+
+    return err;
 }
 
 static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:55:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257454.442344 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AsQ-0002OH-FH; Fri, 14 Jan 2022 00:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257454.442344; Fri, 14 Jan 2022 00: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 1n8AsQ-0002O9-Bp; Fri, 14 Jan 2022 00:55:34 +0000
Received: by outflank-mailman (input) for mailman id 257454;
 Fri, 14 Jan 2022 00:55:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AsP-0002O0-IA
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AsP-0002FJ-HO
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AsP-0005V0-GQ
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ExiOK2rfOerHlSIarQz0aoFuXrBMIPk6DI1Ji7qTMEc=; b=AcjywCKlJlgfXoY8Ymu9IaGKvm
	NUlZbD45q/RwitdMro8pzXpYxZUp0oGfpK+oCP9lInWoeGZIdcZ40t14p9QsJlp/DJcK/x4DqnkOi
	A3Wn/eFAD8qC8Ol8kIlZpuB7a5oitruzwUOqmJpTk+Vr+CgX9r4CEAYzuv/jjaqQRhSg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] qemu-nbd: Change default cache mode to writeback
Message-Id: <E1n8AsP-0005V0-GQ@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:55:33 +0000

commit 4c34ef3d341deff67bed735efca91d2ce0f9368c
Author:     Nir Soffer <nirsof@gmail.com>
AuthorDate: Fri Aug 13 23:55:19 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:36 2021 -0600

    qemu-nbd: Change default cache mode to writeback
    
    Both qemu and qemu-img use writeback cache mode by default, which is
    already documented in qemu(1). qemu-nbd uses writethrough cache mode by
    default, and the default cache mode is not documented.
    
    According to the qemu-nbd(8):
    
       --cache=CACHE
              The  cache  mode  to be used with the file.  See the
              documentation of the emulator's -drive cache=... option for
              allowed values.
    
    qemu(1) says:
    
        The default mode is cache=writeback.
    
    So users have no reason to assume that qemu-nbd is using writethough
    cache mode. The only hint is the painfully slow writing when using the
    defaults.
    
    Looking in git history, it seems that qemu used writethrough in the past
    to support broken guests that did not flush data properly, or could not
    flush due to limitations in qemu. But qemu-nbd clients can use
    NBD_CMD_FLUSH to flush data, so using writethrough does not help anyone.
    
    Change the default cache mode to writback, and document the default and
    available values properly in the online help and manual.
    
    With this change converting image via qemu-nbd is 3.5 times faster.
    
        $ qemu-img create dst.img 50g
        $ qemu-nbd -t -f raw -k /tmp/nbd.sock dst.img
    
    Before this change:
    
        $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
        Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
          Time (mean ± σ):     83.639 s ±  5.970 s    [User: 2.733 s, System: 6.112 s]
          Range (min … max):   76.749 s … 87.245 s    3 runs
    
    After this change:
    
        $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
        Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
          Time (mean ± σ):     23.522 s ±  0.433 s    [User: 2.083 s, System: 5.475 s]
          Range (min … max):   23.234 s … 24.019 s    3 runs
    
    Users can avoid the issue by using --cache=writeback[1] but the defaults
    should give good performance for the common use case.
    
    [1] https://bugzilla.redhat.com/1990656
    
    Signed-off-by: Nir Soffer <nsoffer@redhat.com>
    Message-Id: <20210813205519.50518-1-nsoffer@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    CC: qemu-stable@nongnu.org
    Signed-off-by: Eric Blake <eblake@redhat.com>
    (cherry picked from commit 09615257058a0ae87b837bb041f56f7312d9ead8)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 docs/tools/qemu-nbd.rst | 6 ++++--
 qemu-nbd.c              | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst
index ee862fa0bc..5643da26e9 100644
--- a/docs/tools/qemu-nbd.rst
+++ b/docs/tools/qemu-nbd.rst
@@ -98,8 +98,10 @@ driver options if ``--image-opts`` is specified.
 
 .. option:: --cache=CACHE
 
-  The cache mode to be used with the file.  See the documentation of
-  the emulator's ``-drive cache=...`` option for allowed values.
+  The cache mode to be used with the file. Valid values are:
+  ``none``, ``writeback`` (the default), ``writethrough``,
+  ``directsync`` and ``unsafe``. See the documentation of
+  the emulator's ``-drive cache=...`` option for more info.
 
 .. option:: -n, --nocache
 
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 26ffbf15af..6c18fcd19a 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -135,7 +135,9 @@ static void usage(const char *name)
 "                            'snapshot.id=[ID],snapshot.name=[NAME]', or\n"
 "                            '[ID_OR_NAME]'\n"
 "  -n, --nocache             disable host cache\n"
-"      --cache=MODE          set cache mode (none, writeback, ...)\n"
+"      --cache=MODE          set cache mode used to access the disk image, the\n"
+"                            valid options are: 'none', 'writeback' (default),\n"
+"                            'writethrough', 'directsync' and 'unsafe'\n"
 "      --aio=MODE            set AIO mode (native, io_uring or threads)\n"
 "      --discard=MODE        set discard mode (ignore, unmap)\n"
 "      --detect-zeroes=MODE  set detect-zeroes mode (off, on, unmap)\n"
@@ -552,7 +554,7 @@ int main(int argc, char **argv)
     bool alloc_depth = false;
     const char *tlscredsid = NULL;
     bool imageOpts = false;
-    bool writethrough = true;
+    bool writethrough = false; /* Client will flush as needed. */
     bool fork_process = false;
     bool list = false;
     int old_stderr = -1;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:55:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257455.442347 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Asa-0002S1-Hp; Fri, 14 Jan 2022 00:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257455.442347; Fri, 14 Jan 2022 00: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 1n8Asa-0002Rt-Ew; Fri, 14 Jan 2022 00:55:44 +0000
Received: by outflank-mailman (input) for mailman id 257455;
 Fri, 14 Jan 2022 00:55: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 1n8AsZ-0002Rk-LZ
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55: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 1n8AsZ-0002FT-Kj
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AsZ-0005VW-Jn
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dv9xsKX8tUydXZsWpdf+DtKgo/Gi5DlxAEGAUO6oNyA=; b=2+p9+vcrWqs+ZqekDTuB6IGX3S
	aPexmQanM1NNG/iFT4ZYolyOvqEi73YMi3yCINYQ/7rmirPl928FUJsT2QuXgqb39/scFm0iOBGTV
	FlV3sXHAeCAIKCNHokPCo/4roHkqL9zdLmIQqhaEKaTA9/D98ciRORGHQBgi8sH2+vYg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hmp: Unbreak "change vnc"
Message-Id: <E1n8AsZ-0005VW-Jn@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:55:43 +0000

commit 7637373b23f32fb88e100df455addc4107a054dc
Author:     Markus Armbruster <armbru@redhat.com>
AuthorDate: Thu Sep 9 10:12:18 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:41 2021 -0600

    hmp: Unbreak "change vnc"
    
    HMP command "change vnc" can take the password as argument, or prompt
    for it:
    
        (qemu) change vnc password 123
        (qemu) change vnc password
        Password: ***
        (qemu)
    
    This regressed in commit cfb5387a1d "hmp: remove "change vnc TARGET"
    command", v6.0.0.
    
        (qemu) change vnc passwd 123
        Password: ***
        (qemu) change vnc passwd
        (qemu)
    
    The latter passes NULL to qmp_change_vnc_password(), which is a no-no.
    Looks like it puts the display into "password required, but none set"
    state.
    
    The logic error is easy to miss in review, but testing should've
    caught it.
    
    Fix the obvious way.
    
    Fixes: cfb5387a1de2acda23fb5c97d2378b9e7ddf8025
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
    Message-Id: <20210909081219.308065-2-armbru@redhat.com>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 6193344f9337f8b76cd44ce94a32c9900d907d35)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index e00255f7ee..a7e197a90b 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1496,7 +1496,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
         }
         if (strcmp(target, "passwd") == 0 ||
             strcmp(target, "password") == 0) {
-            if (arg) {
+            if (!arg) {
                 MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
                 monitor_read_password(hmp_mon, hmp_change_read_arg, NULL);
                 return;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:55:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257456.442351 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Ask-0002V0-Jr; Fri, 14 Jan 2022 00:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257456.442351; Fri, 14 Jan 2022 00: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 1n8Ask-0002Us-GS; Fri, 14 Jan 2022 00:55:54 +0000
Received: by outflank-mailman (input) for mailman id 257456;
 Fri, 14 Jan 2022 00:55: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 1n8Asj-0002Uj-Oo
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55: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 1n8Asj-0002Fd-Nz
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Asj-0005WD-ND
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:55:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VF7+m+Xjyc1JRgyr3crfR4aVx9G8Skbh/eDlJcGcVe4=; b=kcY+C/DimZDL8YhDmGRzi5CVTZ
	wx16oBUzatF+8LVqaEzeC1CffHfV0O/g3nlBAgbuIE9QQHRazJM/PITCGa9GYgIMXVwQaUcYfitDo
	iXAhkXe+2TYeov/m2uHwFjI+87gW9+K+ziAhK7BngpRp1F6Nfoc7KLSW0nInNfnOh37A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
Message-Id: <E1n8Asj-0005WD-ND@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:55:53 +0000

commit f0dee5a40d27ad8ce2d180141bb5953fce44a146
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Wed Sep 29 18:24:43 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:49 2021 -0600

    virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event
    
    Apparently, we don't have to duplicate the string.
    
    Fixes: 722a3c783ef4 ("virtio-pci: Send qapi events when the virtio-mem size changes")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Reviewed-by: Markus Armbruster <armbru@redhat.com>
    Message-Id: <20210929162445.64060-2-david@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 75b98cb9f6456ccf194211beffcbf93b0a995fa4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio-mem-pci.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c
index fa5395cd88..7e384b7397 100644
--- a/hw/virtio/virtio-mem-pci.c
+++ b/hw/virtio/virtio-mem-pci.c
@@ -88,13 +88,8 @@ static void virtio_mem_pci_size_change_notify(Notifier *notifier, void *data)
                                          size_change_notifier);
     DeviceState *dev = DEVICE(pci_mem);
     const uint64_t * const size_p = data;
-    const char *id = NULL;
 
-    if (dev->id) {
-        id = g_strdup(dev->id);
-    }
-
-    qapi_event_send_memory_device_size_change(!!id, id, *size_p);
+    qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p);
 }
 
 static void virtio_mem_pci_class_init(ObjectClass *klass, void *data)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:56:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257457.442355 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Asu-0002Xp-Kx; Fri, 14 Jan 2022 00:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257457.442355; Fri, 14 Jan 2022 00: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 1n8Asu-0002Xh-Hy; Fri, 14 Jan 2022 00:56:04 +0000
Received: by outflank-mailman (input) for mailman id 257457;
 Fri, 14 Jan 2022 00: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 1n8Ast-0002Xa-S4
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00: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 1n8Ast-0002G0-RH
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ast-0005X9-QO
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/m0iBq6E7Wb+U/0K1moDh0TSyR9XRfPIecWaWNXEJ70=; b=HnqM5z5Gn4OloWJciCd4HtNbPP
	DHMl/B8ebCzpGreuYP9jkD2Rf7l9gSZXL9tqzKdTqyDJAtE8hM45z3KdQ0iXBpTx/3Uv0NYEBjXM5
	M6a5fJ+OiXVaHSv6USUlx1l02qm43rli80dPonp+N3i8KeliVQFZ8iyGQ3b44iFMu1so=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] uas: add stream number sanity checks.
Message-Id: <E1n8Ast-0005X9-QO@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:56:03 +0000

commit 23ba9f170feca6ae0d8442aab2c89656f9b01288
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Wed Aug 18 14:05:05 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:56:53 2021 -0600

    uas: add stream number sanity checks.
    
    The device uses the guest-supplied stream number unchecked, which can
    lead to guest-triggered out-of-band access to the UASDevice->data3 and
    UASDevice->status3 fields.  Add the missing checks.
    
    Fixes: CVE-2021-3713
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reported-by: Chen Zhe <chenzhe@huawei.com>
    Reported-by: Tan Jingguo <tanjingguo@huawei.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20210818120505.1258262-2-kraxel@redhat.com>
    (cherry picked from commit 13b250b12ad3c59114a6a17d59caf073ce45b33a)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/usb/dev-uas.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 263056231c..f6309a5ebf 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -840,6 +840,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         }
         break;
     case UAS_PIPE_ID_STATUS:
+        if (p->stream > UAS_MAX_STREAMS) {
+            goto err_stream;
+        }
         if (p->stream) {
             QTAILQ_FOREACH(st, &uas->results, next) {
                 if (st->stream == p->stream) {
@@ -867,6 +870,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         break;
     case UAS_PIPE_ID_DATA_IN:
     case UAS_PIPE_ID_DATA_OUT:
+        if (p->stream > UAS_MAX_STREAMS) {
+            goto err_stream;
+        }
         if (p->stream) {
             req = usb_uas_find_request(uas, p->stream);
         } else {
@@ -902,6 +908,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
         p->status = USB_RET_STALL;
         break;
     }
+
+err_stream:
+    error_report("%s: invalid stream %d", __func__, p->stream);
+    p->status = USB_RET_STALL;
+    return;
 }
 
 static void usb_uas_unrealize(USBDevice *dev)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:56:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257458.442360 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8At4-0002aT-NH; Fri, 14 Jan 2022 00:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257458.442360; Fri, 14 Jan 2022 00: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 1n8At4-0002aL-JU; Fri, 14 Jan 2022 00:56:14 +0000
Received: by outflank-mailman (input) for mailman id 257458;
 Fri, 14 Jan 2022 00:56: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 1n8At3-0002aC-VO
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00: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 1n8At3-0002Hi-Ub
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8At3-0005Xd-Tp
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00: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=a1/uetHQosgcvdGCq5i5NNJzu/hLRVBN9vO0W0RMCBc=; b=1rKD75Xf4qOz9QR8SGJQYqjjvH
	5sCAfq+xpf9cLE3QtvUx+1YsbFj/i4GF3UAxLNMx3FOGKkn2H74E8FvSrF1H+ZTKZtnR82hxQSuqW
	tMxMmTWHrXn/QNzTXIOktv5Fto3AlKQ/QfyTqe+oM80QX36NJwpnwNPUbfoE2rWhqJJA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] vhost-user: fix duplicated notifier MR init
Message-Id: <E1n8At3-0005Xd-Tp@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:56:13 +0000

commit 695c25e167e217aab74f964afe9b93a8a52b4d41
Author:     Xueming Li <xuemingl@nvidia.com>
AuthorDate: Fri Oct 8 16:02:15 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:02 2021 -0600

    vhost-user: fix duplicated notifier MR init
    
    In case of device resume after suspend, VQ notifier MR still valid.
    Duplicated registrations explode memory block list and slow down device
    resume.
    
    Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers")
    Cc: tiwei.bie@intel.com
    Cc: qemu-stable@nongnu.org
    Cc: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
    
    Signed-off-by: Xueming Li <xuemingl@nvidia.com>
    Message-Id: <20211008080215.590292-1-xuemingl@nvidia.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit a1ed9ef1de87c3e86ff68589604298ec90875a14)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/vhost-user.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index aec6cc1990..7b35c5d71d 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1469,8 +1469,9 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
 
     name = g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]",
                            user, queue_idx);
-    memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
-                                      page_size, addr);
+    if (!n->mr.ram) /* Don't init again after suspend. */
+        memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
+                                          page_size, addr);
     g_free(name);
 
     if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:56:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:56:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257462.442374 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AtF-0002tB-1k; Fri, 14 Jan 2022 00:56:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257462.442374; Fri, 14 Jan 2022 00: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 1n8AtE-0002sz-UF; Fri, 14 Jan 2022 00:56:24 +0000
Received: by outflank-mailman (input) for mailman id 257462;
 Fri, 14 Jan 2022 00:56: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 1n8AtE-0002kE-2i
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56: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 1n8AtE-0002IJ-22
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AtE-0005YM-17
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56: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=GqhqwcqzPpztLPTHjz2L4xnT+OVNahOoxhwvingmdKI=; b=07q1WMQ4fscxXGc8UcywpYPNjy
	IUgRoXfv5YJp+FngxjKA7srudrQobLW1ZNuGYTXcndrcvyNUomUdmg946Cc+FJt8UJbDaxqZX3hkK
	RlgqreFbCxQDbpmTx5s0ypxFFlIjhqeLhf6yK8mBTCGQoohmffwoFPVsuMyRfQ/2YKDc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
Message-Id: <E1n8AtE-0005YM-17@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:56:24 +0000

commit 3c6e5df1f6badec09cdbbff29b16668a92816b68
Author:     David Hildenbrand <david@redhat.com>
AuthorDate: Mon Oct 11 22:10:47 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:07 2021 -0600

    libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr
    
    We end up not copying the mmap_addr of all existing regions, resulting
    in a SEGFAULT once we actually try to map/access anything within our
    memory regions.
    
    Fixes: 875b9fd97b34 ("Support individual region unmap in libvhost-user")
    Cc: qemu-stable@nongnu.org
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
    Cc: Stefan Hajnoczi <stefanha@redhat.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Coiby Xu <coiby.xu@gmail.com>
    Signed-off-by: David Hildenbrand <david@redhat.com>
    Message-Id: <20211011201047.62587-1-david@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 6889eb2d431ae962e3e083b57bff47cd573cb1c4)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 subprojects/libvhost-user/libvhost-user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c
index bf09693255..787f4d2d4f 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -816,6 +816,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
             shadow_regions[j].gpa = dev->regions[i].gpa;
             shadow_regions[j].size = dev->regions[i].size;
             shadow_regions[j].qva = dev->regions[i].qva;
+            shadow_regions[j].mmap_addr = dev->regions[i].mmap_addr;
             shadow_regions[j].mmap_offset = dev->regions[i].mmap_offset;
             j++;
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:56:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:56:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257464.442378 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AtP-0002z6-2w; Fri, 14 Jan 2022 00:56:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257464.442378; Fri, 14 Jan 2022 00:56:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AtO-0002yw-W6; Fri, 14 Jan 2022 00:56:34 +0000
Received: by outflank-mailman (input) for mailman id 257464;
 Fri, 14 Jan 2022 00:56: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 1n8AtO-0002yR-5u
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56: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 1n8AtO-0002IW-5B
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AtO-0005Z3-4S
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56: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=JFiOsIh3Cg+SXaNr0KP2kM58niDcBbGSLEm/ekVZ4f0=; b=c1tPKOaag3O05NMsKDJ/K8VPM1
	mqFeFHSfW7idLMGF1PQ5O1gFfTTam1PtG0nurqUqu+o45Ad7VXL1k0U051JHRVciiVm26NKZHEgoB
	KFkCd83egy8ptLU2kj6RaH359YbrRk1bI41FHKRJrAmYMqrVKHvhIhwgbCrP9UlO29yk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()
Message-Id: <E1n8AtO-0005Z3-4S@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:56:34 +0000

commit b19de1137bc158cc2782750f1a94be153a5fd54d
Author:     Helge Deller <deller@gmx.de>
AuthorDate: Tue May 25 22:12:45 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 08:57:12 2021 -0600

    hw/display/artist: Fix bug in coordinate extraction in artist_vram_read() and artist_vram_write()
    
    The CDE desktop on HP-UX 10 shows wrongly rendered pixels when the local screen
    menu is closed. This bug was introduced by commit c7050f3f167b
    ("hw/display/artist: Refactor x/y coordination extraction") which converted the
    coordinate extraction in artist_vram_read() and artist_vram_write() to use the
    ADDR_TO_X and ADDR_TO_Y macros, but forgot to right-shift the address by 2 as
    it was done before.
    
    Signed-off-by: Helge Deller <deller@gmx.de>
    Fixes: c7050f3f167b ("hw/display/artist: Refactor x/y coordination extraction")
    Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Cc: Richard Henderson <richard.henderson@linaro.org>
    Cc: Sven Schnelle <svens@stackframe.org>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Message-Id: <YK1aPb8keur9W7h2@ls3530>
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    (cherry picked from commit 01f750f5fef1afd8f6abc0548910f87d473e26d5)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/display/artist.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/display/artist.c b/hw/display/artist.c
index aa7bd594aa..21b7fd1b44 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -1170,8 +1170,8 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,
     }
 
     buf = vram_write_buffer(s);
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (!buf->size) {
         return;
@@ -1232,8 +1232,8 @@ static uint64_t artist_vram_read(void *opaque, hwaddr addr, unsigned size)
         return 0;
     }
 
-    posy = ADDR_TO_Y(addr);
-    posx = ADDR_TO_X(addr);
+    posy = ADDR_TO_Y(addr >> 2);
+    posx = ADDR_TO_X(addr >> 2);
 
     if (posy > buf->height || posx > buf->width) {
         return 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:56:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:56:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257468.442381 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AtZ-00039m-4d; Fri, 14 Jan 2022 00:56:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257468.442381; Fri, 14 Jan 2022 00:56:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AtZ-00039e-1l; Fri, 14 Jan 2022 00:56:45 +0000
Received: by outflank-mailman (input) for mailman id 257468;
 Fri, 14 Jan 2022 00:56: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 1n8AtY-00038Q-9Q
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56: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 1n8AtY-0002Ia-8j
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AtY-0005Ze-7z
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QBs8SVl5PykYcOB8C3A86iMpQkYjy0yN976hLPJ9ySw=; b=P+o2nsNQIwZ6GJNjFvFmSv0MZP
	SizQ8Aht0Ar9PS7flsdhyt0A4rfDTFw7UJtj4YUSCgRlb+zcc60dq1nKP7sby/mFRnPq3rwdYPgcO
	20+MPBE5D026KN5erO26vw4RFaOaWm3xaQaNsHOcwWycWY1AL0l0BTpOE2Z771wDpuI0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model
Message-Id: <E1n8AtY-0005Ze-7z@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:56:44 +0000

commit ff6d391e10d04a457994be8c032c6c38c0118ebc
Author:     Yang Zhong <yang.zhong@intel.com>
AuthorDate: Fri Aug 20 13:46:11 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:43:09 2021 -0600

    i386/cpu: Remove AVX_VNNI feature from Cooperlake cpu model
    
    The AVX_VNNI feature is not in Cooperlake platform, remove it
    from cpu model.
    
    Signed-off-by: Yang Zhong <yang.zhong@intel.com>
    Message-Id: <20210820054611.84303-1-yang.zhong@intel.com>
    Fixes: c1826ea6a052 ("i386/cpu: Expose AVX_VNNI instruction to guest")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
    (cherry picked from commit f429dbf8fc526a9cacf531176b28d0c65701475a)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 34a7ce865b..24ddc5b926 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3102,7 +3102,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {
             MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY | MSR_ARCH_CAP_MDS_NO |
             MSR_ARCH_CAP_PSCHANGE_MC_NO | MSR_ARCH_CAP_TAA_NO,
         .features[FEAT_7_1_EAX] =
-            CPUID_7_1_EAX_AVX_VNNI | CPUID_7_1_EAX_AVX512_BF16,
+            CPUID_7_1_EAX_AVX512_BF16,
         /* XSAVES is added in version 2 */
         .features[FEAT_XSAVE] =
             CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC |
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:56:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:56:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257469.442386 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Atk-0003H3-6N; Fri, 14 Jan 2022 00:56:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257469.442386; Fri, 14 Jan 2022 00:56: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 1n8Atk-0003Gw-3P; Fri, 14 Jan 2022 00:56:56 +0000
Received: by outflank-mailman (input) for mailman id 257469;
 Fri, 14 Jan 2022 00:56: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 1n8Ati-0003Gl-Cq
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56: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 1n8Ati-0002Ie-C3
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ati-0005aL-BF
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:56:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SG06Dvskkws7Na9RpwPKo0aAWfqdAcu/MCVxfxnjAlE=; b=I2CKAHvgBXIXcrOhdTXP1IUYF9
	ZxSFmdae/p7b+46etFNqUfY2gjpABkxxq4WHsVwVm7QQMDQFMpWzgTvw2apaFlLN4ySXTb3Wm60AN
	t08A48o+wertL1yhPpD5/l93gZoZzZIdRvSSsurqpV24Kh6iwk7SNiCtdSCFeNVXqefU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] 9pfs: fix crash in v9fs_walk()
Message-Id: <E1n8Ati-0005aL-BF@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:56:54 +0000

commit abeee2a470f549b2730365f350416cc932340324
Author:     Christian Schoenebeck <qemu_oss@crudebyte.com>
AuthorDate: Wed Sep 1 18:15:10 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:46:48 2021 -0600

    9pfs: fix crash in v9fs_walk()
    
    v9fs_walk() utilizes the v9fs_co_run_in_worker({...}) macro to run the
    supplied fs driver code block on a background worker thread.
    
    When either the 'Twalk' client request was interrupted or if the client
    requested fid for that 'Twalk' request caused a stat error then that
    fs driver code block was left by 'break' keyword, with the intention to
    return from worker thread back to main thread as well:
    
        v9fs_co_run_in_worker({
            if (v9fs_request_cancelled(pdu)) {
                err = -EINTR;
                break;
            }
            err = s->ops->lstat(&s->ctx, &dpath, &fidst);
            if (err < 0) {
                err = -errno;
                break;
            }
            ...
        });
    
    However that 'break;' statement also skipped the v9fs_co_run_in_worker()
    macro's final and mandatory
    
        /* re-enter back to qemu thread */
        qemu_coroutine_yield();
    
    call and thus caused the rest of v9fs_walk() to be continued being
    executed on the worker thread instead of main thread, eventually
    leading to a crash in the transport virtio transport driver.
    
    To fix this issue and to prevent the same error from happening again by
    other users of v9fs_co_run_in_worker() in future, auto wrap the supplied
    code block into its own
    
        do { } while (0);
    
    loop inside the 'v9fs_co_run_in_worker' macro definition.
    
    Full discussion and backtrace:
    https://lists.gnu.org/archive/html/qemu-devel/2021-08/msg05209.html
    https://lists.gnu.org/archive/html/qemu-devel/2021-09/msg00174.html
    
    Fixes: 8d6cb100731c4d28535adbf2a3c2d1f29be3fef4
    Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Greg Kurz <groug@kaod.org>
    Message-Id: <E1mLTBg-0002Bh-2D@lizzy.crudebyte.com>
    (cherry picked from commit f83df00900816476cca41bb536e4d532b297d76e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/9pfs/coth.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/9pfs/coth.h b/hw/9pfs/coth.h
index c51289903d..f83c7dda7b 100644
--- a/hw/9pfs/coth.h
+++ b/hw/9pfs/coth.h
@@ -51,7 +51,9 @@
          */                                                             \
         qemu_coroutine_yield();                                         \
         qemu_bh_delete(co_bh);                                          \
-        code_block;                                                     \
+        do {                                                            \
+            code_block;                                                 \
+        } while (0);                                                    \
         /* re-enter back to qemu thread */                              \
         qemu_coroutine_yield();                                         \
     } while (0)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:57:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:57:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257471.442390 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Atu-0003Ky-9J; Fri, 14 Jan 2022 00:57:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257471.442390; Fri, 14 Jan 2022 00:57: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 1n8Atu-0003Kq-6C; Fri, 14 Jan 2022 00:57:06 +0000
Received: by outflank-mailman (input) for mailman id 257471;
 Fri, 14 Jan 2022 00:57: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 1n8Ats-0003KU-G8
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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 1n8Ats-0002Iv-FI
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ats-0005bC-EP
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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=OqJ141GJl1f86s10RAwDlwPjMy53o4Q5Tw+UDnM4+9M=; b=10LxoEkfV38QXinSwX84lZC4a5
	eIQ579hi7DXukcdsquaE0tWjWi2SXrcivumaGT8VIOjkv1qSMf7Iu8ieCQc7qsoYsO7t2MMST8pgf
	thPvos8MnOAdtsemqJlRbGflDruq+CKJlLd0gFFeMe3zSTD4QjJsoz9nDwCm9NlIod9k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] plugins/execlog: removed unintended "s" at the end of log lines.
Message-Id: <E1n8Ats-0005bC-EP@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:57:04 +0000

commit f97853c8cb849cc4773005183c974dec641d8493
Author:     Mahmoud Mandour <ma.mandourr@gmail.com>
AuthorDate: Fri Aug 6 15:10:12 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:48:25 2021 -0600

    plugins/execlog: removed unintended "s" at the end of log lines.
    
    Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20210803151428.125323-1-ma.mandourr@gmail.com>
    Message-Id: <20210806141015.2487502-2-alex.bennee@linaro.org>
    Cc: qemu-stable@nongnu.org
    (cherry picked from commit b40310616d2bd550279dd22b05483c3c613a00ff)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 contrib/plugins/execlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index 2de9f0d7d4..a5275dcc15 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -67,7 +67,7 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *udata)
     /* Print previous instruction in cache */
     if (s->len) {
         qemu_plugin_outs(s->str);
-        qemu_plugin_outs("s\n");
+        qemu_plugin_outs("\n");
     }
 
     /* Store new instruction in cache */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:57:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:57:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257472.442394 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Au4-0003TQ-Ac; Fri, 14 Jan 2022 00:57:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257472.442394; Fri, 14 Jan 2022 00:57: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 1n8Au4-0003TI-7g; Fri, 14 Jan 2022 00:57:16 +0000
Received: by outflank-mailman (input) for mailman id 257472;
 Fri, 14 Jan 2022 00:57: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 1n8Au2-0003Sj-JN
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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 1n8Au2-0002Iz-Id
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Au2-0005bj-Ho
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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=5AtBVzVpQM8vuUVr7ojp6+oxU3HvYr7CBk9pwoPsfwA=; b=M6T5Talw3e9m73qfBMw6TXsUB/
	jWRXpG+xS/BdFtXilt+JyXM7R3UbU81fVvz7ptp+DrkQbNaDnhwkwetafMOjhAz8Lwgrie2mUk/Fs
	3gTGhoXLKWukRrjHUqT7rgj8msSMepjYc+CgX69muFJV06awOkvdQBwT9Pc36yTTS9LU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] plugins: do not limit exported symbols if modules are active
Message-Id: <E1n8Au2-0005bj-Ho@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:57:14 +0000

commit ec0803510289fcb15d8b4f8699169ac35f842bfe
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Wed Aug 11 12:05:50 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:49:09 2021 -0600

    plugins: do not limit exported symbols if modules are active
    
    On Mac --enable-modules and --enable-plugins are currently incompatible, because the
    Apple -Wl,-exported_symbols_list command line options prevents the export of any
    symbols needed by the modules.  On x86 -Wl,--dynamic-list does not have this effect,
    but only because the -Wl,--export-dynamic option provided by gmodule-2.0.pc overrides
    it.  On Apple there is no -Wl,--export-dynamic, because it is the default, and thus
    no override.
    
    Either way, when modules are active there is no reason to include the plugin_ldflags.
    While at it, avoid the useless -Wl,--export-dynamic when --enable-plugins is
    specified but --enable-modules is not; this way, the GNU and Apple configurations
    are more similar.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/516
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    [AJB: fix noexport to no-export]
    Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
    Message-Id: <20210811100550.54714-1-pbonzini@redhat.com>
    Cc: qemu-stable@nongnu.org
    (cherry picked from commit b906acace2d4f68b6ff8de73739a773cc4851436)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 configure           |  5 ++---
 plugins/meson.build | 14 ++++++++------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 9a79a004d7..7659870810 100755
--- a/configure
+++ b/configure
@@ -3187,9 +3187,8 @@ glib_req_ver=2.56
 glib_modules=gthread-2.0
 if test "$modules" = yes; then
     glib_modules="$glib_modules gmodule-export-2.0"
-fi
-if test "$plugins" = "yes"; then
-    glib_modules="$glib_modules gmodule-2.0"
+elif test "$plugins" = "yes"; then
+    glib_modules="$glib_modules gmodule-no-export-2.0"
 fi
 
 for i in $glib_modules; do
diff --git a/plugins/meson.build b/plugins/meson.build
index e77723010e..bfd5c9822a 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -1,9 +1,11 @@
-if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
-  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
-elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
-  plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
-else
-  plugin_ldflags = []
+plugin_ldflags = []
+# Modules need more symbols than just those in plugins/qemu-plugins.symbols
+if not enable_modules
+  if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
+    plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
+  elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
+    plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
+  endif
 endif
 
 specific_ss.add(when: 'CONFIG_PLUGIN', if_true: [files(
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:57:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:57:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257473.442398 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AuE-0003WV-C1; Fri, 14 Jan 2022 00:57:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257473.442398; Fri, 14 Jan 2022 00:57: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 1n8AuE-0003WN-9B; Fri, 14 Jan 2022 00:57:26 +0000
Received: by outflank-mailman (input) for mailman id 257473;
 Fri, 14 Jan 2022 00:57: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 1n8AuC-0003WD-Mf
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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 1n8AuC-0002JV-Lv
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AuC-0005lb-L6
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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=E1Fc1G+rdWPdh3PgLjWcNYAAcNcxG4fxzkqYQmYRGCM=; b=ozd1hoiCy4E2cHbCS6UW/lOm7y
	BW1Pj9xo7UVjWlAaK9pHpiRar37C7DN9shfmULzJb+zVpdxSHScv8Bx2YnnyHcRsEkGZ8wPcjSzm/
	iEHk6pBiJIuK+isMpF4RThpPMsuI35SX496bAfoBVAxwtA5lLdVQaWoxFRT5NuaJY69I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] qemu-sockets: fix unix socket path copy (again)
Message-Id: <E1n8AuC-0005lb-L6@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:57:24 +0000

commit 3ee93e456d08415cc1abe4110f6e0c9b0ead0bbc
Author:     Michael Tokarev <mjt@tls.msk.ru>
AuthorDate: Wed Sep 1 16:16:24 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 12:55:36 2021 -0600

    qemu-sockets: fix unix socket path copy (again)
    
    Commit 4cfd970ec188558daa6214f26203fe553fb1e01f added an
    assert which ensures the path within an address of a unix
    socket returned from the kernel is at least one byte and
    does not exceed sun_path buffer. Both of this constraints
    are wrong:
    
    A unix socket can be unnamed, in this case the path is
    completely empty (not even \0)
    
    And some implementations (notable linux) can add extra
    trailing byte (\0) _after_ the sun_path buffer if we
    passed buffer larger than it (and we do).
    
    So remove the assertion (since it causes real-life breakage)
    but at the same time fix the usage of sun_path. Namely,
    we should not access sun_path[0] if kernel did not return
    it at all (this is the case for unnamed sockets),
    and use the returned salen when copyig actual path as an
    upper constraint for the amount of bytes to copy - this
    will ensure we wont exceed the information provided by
    the kernel, regardless whenever there is a trailing \0
    or not. This also helps with unnamed sockets.
    
    Note the case of abstract socket, the sun_path is actually
    a blob and can contain \0 characters, - it should not be
    passed to g_strndup and the like, it should be accessed by
    memcpy-like functions.
    
    Fixes: 4cfd970ec188558daa6214f26203fe553fb1e01f
    Fixes: http://bugs.debian.org/993145
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    CC: qemu-stable@nongnu.org
    (cherry picked from commit 118d527f2e4baec5fe8060b22a6212468b8e4d3f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 util/qemu-sockets.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index f2f3676d1f..c5043999e9 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1345,25 +1345,22 @@ socket_sockaddr_to_address_unix(struct sockaddr_storage *sa,
     SocketAddress *addr;
     struct sockaddr_un *su = (struct sockaddr_un *)sa;
 
-    assert(salen >= sizeof(su->sun_family) + 1 &&
-           salen <= sizeof(struct sockaddr_un));
-
     addr = g_new0(SocketAddress, 1);
     addr->type = SOCKET_ADDRESS_TYPE_UNIX;
+    salen -= offsetof(struct sockaddr_un, sun_path);
 #ifdef CONFIG_LINUX
-    if (!su->sun_path[0]) {
+    if (salen > 0 && !su->sun_path[0]) {
         /* Linux abstract socket */
-        addr->u.q_unix.path = g_strndup(su->sun_path + 1,
-                                        salen - sizeof(su->sun_family) - 1);
+        addr->u.q_unix.path = g_strndup(su->sun_path + 1, salen - 1);
         addr->u.q_unix.has_abstract = true;
         addr->u.q_unix.abstract = true;
         addr->u.q_unix.has_tight = true;
-        addr->u.q_unix.tight = salen < sizeof(*su);
+        addr->u.q_unix.tight = salen < sizeof(su->sun_path);
         return addr;
     }
 #endif
 
-    addr->u.q_unix.path = g_strndup(su->sun_path, sizeof(su->sun_path));
+    addr->u.q_unix.path = g_strndup(su->sun_path, salen);
     return addr;
 }
 #endif /* WIN32 */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:57:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:57:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257474.442402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AuO-0003ZT-Dl; Fri, 14 Jan 2022 00:57:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257474.442402; Fri, 14 Jan 2022 00:57: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 1n8AuO-0003ZL-Ae; Fri, 14 Jan 2022 00:57:36 +0000
Received: by outflank-mailman (input) for mailman id 257474;
 Fri, 14 Jan 2022 00:57: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 1n8AuM-0003ZC-Pv
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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 1n8AuM-0002Jf-P4
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AuM-0005m9-OT
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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=2qu5h8ypsvyCzppRW5jwcjTmWW0vpTOXxTYKeS1U11w=; b=Lr56bHHG44rPzBBZzP50KIJM++
	d6ZruM0HaA7sVcrCsiQs+DQcyrs0v3XkzWifiyp02YHYYv5ix9NFpnkq42TA/sYmbM6Ifh78FAXtB
	kdGuIxGgwj8331APLdqpthVivN3enTNKqxwSjVNLEbZQIcCxc9AKgzNAPQvraYXHgwbE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] vhost-vsock: fix migration issue when seqpacket is supported
Message-Id: <E1n8AuM-0005m9-OT@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:57:34 +0000

commit 246ccfbf44a0ff5967393adb7b7a79dc7c353eb6
Author:     Stefano Garzarella <sgarzare@redhat.com>
AuthorDate: Tue Sep 21 18:16:41 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:04:13 2021 -0600

    vhost-vsock: fix migration issue when seqpacket is supported
    
    Commit 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support")
    enabled the SEQPACKET feature bit.
    This commit is released with QEMU 6.1, so if we try to migrate a VM where
    the host kernel supports SEQPACKET but machine type version is less than
    6.1, we get the following errors:
    
        Features 0x130000002 unsupported. Allowed features: 0x179000000
        Failed to load virtio-vhost_vsock:virtio
        error while loading state for instance 0x0 of device '0000:00:05.0/virtio-vhost_vsock'
        load of migration failed: Operation not permitted
    
    Let's disable the feature bit for machine types < 6.1.
    We add a new OnOffAuto property for this, called `seqpacket`.
    When it is `auto` (default), QEMU behaves as before, trying to enable the
    feature, when it is `on` QEMU will fail if the backend (vhost-vsock
    kernel module) doesn't support it.
    
    Fixes: 1e08fd0a46 ("vhost-vsock: SOCK_SEQPACKET feature bit support")
    Cc: qemu-stable@nongnu.org
    Reported-by: Jiang Wang <jiang.wang@bytedance.com>
    Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
    Message-Id: <20210921161642.206461-2-sgarzare@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d6a9378f47515c6d70dbff4912c5740c98709880)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/core/machine.c               |  1 +
 hw/virtio/vhost-vsock.c         | 19 ++++++++++++++++---
 include/hw/virtio/vhost-vsock.h |  3 +++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 54e040587d..2cf2f321f9 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -43,6 +43,7 @@ GlobalProperty hw_compat_6_0[] = {
     { "nvme-ns", "eui64-default", "off"},
     { "e1000", "init-vet", "off" },
     { "e1000e", "init-vet", "off" },
+    { "vhost-vsock-device", "seqpacket", "off" },
 };
 const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0);
 
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 1b1a5c70ed..dade0da031 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -114,10 +114,21 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
                                          Error **errp)
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
+    VHostVSock *vsock = VHOST_VSOCK(vdev);
+
+    if (vsock->seqpacket != ON_OFF_AUTO_OFF) {
+        virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
+    }
+
+    requested_features = vhost_get_features(&vvc->vhost_dev, feature_bits,
+                                            requested_features);
+
+    if (vsock->seqpacket == ON_OFF_AUTO_ON &&
+        !virtio_has_feature(requested_features, VIRTIO_VSOCK_F_SEQPACKET)) {
+        error_setg(errp, "vhost-vsock backend doesn't support seqpacket");
+    }
 
-    virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
-    return vhost_get_features(&vvc->vhost_dev, feature_bits,
-                                requested_features);
+    return requested_features;
 }
 
 static const VMStateDescription vmstate_virtio_vhost_vsock = {
@@ -218,6 +229,8 @@ static void vhost_vsock_device_unrealize(DeviceState *dev)
 static Property vhost_vsock_properties[] = {
     DEFINE_PROP_UINT64("guest-cid", VHostVSock, conf.guest_cid, 0),
     DEFINE_PROP_STRING("vhostfd", VHostVSock, conf.vhostfd),
+    DEFINE_PROP_ON_OFF_AUTO("seqpacket", VHostVSock, seqpacket,
+                            ON_OFF_AUTO_AUTO),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsock.h
index 84f4e727c7..3f121a624f 100644
--- a/include/hw/virtio/vhost-vsock.h
+++ b/include/hw/virtio/vhost-vsock.h
@@ -30,6 +30,9 @@ struct VHostVSock {
     VHostVSockCommon parent;
     VHostVSockConf conf;
 
+    /* features */
+    OnOffAuto seqpacket;
+
     /*< public >*/
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:57:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:57:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257475.442406 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AuY-0003cV-FQ; Fri, 14 Jan 2022 00:57:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257475.442406; Fri, 14 Jan 2022 00:57: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 1n8AuY-0003cN-CH; Fri, 14 Jan 2022 00:57:46 +0000
Received: by outflank-mailman (input) for mailman id 257475;
 Fri, 14 Jan 2022 00:57: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 1n8AuW-0003c9-Sw
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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 1n8AuW-0002Jt-SE
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AuW-0005mg-RY
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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=z/tQcR70DStwyPwVDWuonnhMHsnW6q0AuH79VX8Zopk=; b=O+tG8joVWuRi4Sv++S7lbrq5Zh
	vjhCxJ2AFr8PSDuibzNj5fvi33LZPJUI4KbqD1YOOLliS96ZXkj1g/Z4IsZ230PzPdnnr8pSrscBM
	cXxON+GLRVJUx6P554fQs+kSL15Vbx6befIM7qvO7cPa+ZWCXXgwWjJPwIXuYQsRpkb4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw/arm/virt: Rename default_bus_bypass_iommu
Message-Id: <E1n8AuW-0005mg-RY@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:57:44 +0000

commit 36cfd11a867ebcf015db24b666ec28deb05c101f
Author:     Jean-Philippe Brucker <jean-philippe@linaro.org>
AuthorDate: Tue Oct 26 10:37:34 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:07:27 2021 -0600

    hw/arm/virt: Rename default_bus_bypass_iommu
    
    Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine
    parameter definitions cannot use underscores, because keyval_dashify()
    transforms them to dashes and the parser doesn't find the parameter.
    
    This affects option default_bus_bypass_iommu which was introduced in the
    same release:
    
    $ qemu-system-aarch64 -M virt,default_bus_bypass_iommu=on
    qemu-system-aarch64: Property 'virt-6.1-machine.default-bus-bypass-iommu' not found
    
    Rename the parameter to "default-bus-bypass-iommu". Passing
    "default_bus_bypass_iommu" is still valid since the underscore are
    transformed automatically.
    
    Fixes: 6d7a85483a06 ("hw/arm/virt: Add default_bus_bypass_iommu machine option")
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Tested-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20211026093733.2144161-1-jean-philippe@linaro.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit 9dad363a223df8269175d218413aa8cd265e078e)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/arm/virt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 81eda46b0b..106be60fd4 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2677,10 +2677,10 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
                                           "Set the IOMMU type. "
                                           "Valid values are none and smmuv3");
 
-    object_class_property_add_bool(oc, "default_bus_bypass_iommu",
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
                                    virt_get_default_bus_bypass_iommu,
                                    virt_set_default_bus_bypass_iommu);
-    object_class_property_set_description(oc, "default_bus_bypass_iommu",
+    object_class_property_set_description(oc, "default-bus-bypass-iommu",
                                           "Set on/off to enable/disable "
                                           "bypass_iommu for default root bus");
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:57:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:57:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257476.442410 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Aui-0003g3-Gf; Fri, 14 Jan 2022 00:57:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257476.442410; Fri, 14 Jan 2022 00:57: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 1n8Aui-0003fv-Ds; Fri, 14 Jan 2022 00:57:56 +0000
Received: by outflank-mailman (input) for mailman id 257476;
 Fri, 14 Jan 2022 00:57: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 1n8Auh-0003fc-01
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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 1n8Aug-0002K4-Vc
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Aug-0005nW-Up
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:57: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=SWN2sOrqvMGYerjuz6wJtQU7TYEsA+LwZ6kCDxFiSs8=; b=E+wvAGDmCmjUBmtA9d1UAY0HM3
	P0NOxqWur4ZaEM5EAPTSZy0NggDOU8kYdY6APgDEAe9d2dD8hQn5CRi1pc+Lgbxv7aDkGpxyxJCfz
	YFn/b+FQzXiKVpwNdxZBJhPQFfpDTyiMfJAforhiUQUoR/f3zSNlxDnkAvsFMcBx6G68=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw/i386: Rename default_bus_bypass_iommu
Message-Id: <E1n8Aug-0005nW-Up@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:57:54 +0000

commit 5cf977a2a18a0f6c92b36e852639f26b993d76e5
Author:     Jean-Philippe Brucker <jean-philippe@linaro.org>
AuthorDate: Mon Oct 25 11:47:38 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:07:48 2021 -0600

    hw/i386: Rename default_bus_bypass_iommu
    
    Since commit d8fb7d0969d5 ("vl: switch -M parsing to keyval"), machine
    parameter definitions cannot use underscores, because keyval_dashify()
    transforms them to dashes and the parser doesn't find the parameter.
    
    This affects option default_bus_bypass_iommu which was introduced in the
    same release:
    
    $ qemu-system-x86_64 -M q35,default_bus_bypass_iommu=on
    qemu-system-x86_64: Property 'pc-q35-6.1-machine.default-bus-bypass-iommu' not found
    
    Rename the parameter to "default-bus-bypass-iommu". Passing
    "default_bus_bypass_iommu" is still valid since the underscore are
    transformed automatically.
    
    Fixes: c9e96b04fc19 ("hw/i386: Add a default_bus_bypass_iommu pc machine option")
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Tested-by: Eric Auger <eric.auger@redhat.com>
    Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
    Message-Id: <20211025104737.1560274-1-jean-philippe@linaro.org>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 739b38630c45585cd9d372d44537f69c0b2b4346)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/i386/pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c2b9d62a35..1d421ae2f8 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1763,7 +1763,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     object_class_property_add_bool(oc, "hpet",
         pc_machine_get_hpet, pc_machine_set_hpet);
 
-    object_class_property_add_bool(oc, "default_bus_bypass_iommu",
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
         pc_machine_get_default_bus_bypass_iommu,
         pc_machine_set_default_bus_bypass_iommu);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:58:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:58:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257477.442415 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Aus-0003jQ-JH; Fri, 14 Jan 2022 00:58:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257477.442415; Fri, 14 Jan 2022 00:58: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 1n8Aus-0003jH-FN; Fri, 14 Jan 2022 00:58:06 +0000
Received: by outflank-mailman (input) for mailman id 257477;
 Fri, 14 Jan 2022 00:58: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 1n8Aur-0003j3-3O
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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 1n8Aur-0002KR-2j
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Aur-0005q0-1y
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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=z4zglX67Y03jqw/leweXnTdD2b6HBdCU3RDsj/ED0Nw=; b=XwvrkjdCMSqHgxMFHjnkcvvdjV
	4ZGUN04UCJpcrUu6iwC6kc4ZcsDfMJis6eDdAM5ILnbAhNzA9v441YVV6ySs7jDPqleSZ/BUfA8aN
	bcPKjH9FzbjOZKLClOBknrEhTIkJRphxpfh8fta1y9/1J95hVWqyXQWadSeZthd4pj8Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] bios-tables-test: allow changes in DSDT ACPI tables for q35
Message-Id: <E1n8Aur-0005q0-1y@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:58:05 +0000

commit c66f5dfc127adaadb67a2d95e5e58e6542aaa9eb
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:36 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:12:31 2021 -0600

    bios-tables-test: allow changes in DSDT ACPI tables for q35
    
    We are going to commit a change to fix IO address range allocated for acpi pci
    hotplug in q35. This affects DSDT tables. This change allows DSDT table
    modification so that unit tests are not broken.
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20210916132838.3469580-2-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 9f29e872d5b3973003701401cf659cfb71c95013)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..c06da38af3 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,13 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT",
+"tests/data/acpi/q35/DSDT.tis.tpm12",
+"tests/data/acpi/q35/DSDT.tis.tpm2",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.mmio64",
+"tests/data/acpi/q35/DSDT.ipmibt",
+"tests/data/acpi/q35/DSDT.cphp",
+"tests/data/acpi/q35/DSDT.memhp",
+"tests/data/acpi/q35/DSDT.numamem",
+"tests/data/acpi/q35/DSDT.nohpet",
+"tests/data/acpi/q35/DSDT.dimmpxm",
+"tests/data/acpi/q35/DSDT.acpihmat",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:58:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:58:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257478.442418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Av2-0003n3-LG; Fri, 14 Jan 2022 00:58:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257478.442418; Fri, 14 Jan 2022 00:58: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 1n8Av2-0003mv-IK; Fri, 14 Jan 2022 00:58:16 +0000
Received: by outflank-mailman (input) for mailman id 257478;
 Fri, 14 Jan 2022 00:58: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 1n8Av1-0003mk-6c
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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 1n8Av1-0002Kf-5x
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Av1-0005qb-5C
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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=1wlSHMpZr/oNVETbAqqy8xntpNuR/7YMgzefV3W7LLo=; b=6pbN7xzx34ze/XfN99jmA45B4k
	XPcxIzhquM+M3PtX1hnRbmIOWNfasC9dHWvnWlz2NV0//ueDpffmCzA8FIc7vEj8qa6Xwk8i8gGmf
	3C0a44Po1Qqfgq1+VaHHanA2D4thh25vb2v8S4iNEBUk6jiAa0fqGEE3uTZm68wsoIaA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
Message-Id: <E1n8Av1-0005qb-5C@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:58:15 +0000

commit 9e80a430ed5996734ef35c457d793b8106f16d15
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:37 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:12:38 2021 -0600

    hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35
    
    Change caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
    selects an IO address range for acpi based PCI hotplug for q35 arbitrarily. It
    starts at address 0x0cc4 and ends at 0x0cdb. At the time when the patch was
    written but the final version of the patch was not yet pushed upstream, this
    address range was free and did not conflict with any other IO address ranges.
    However, with the following change, this address range was no
    longer conflict free as in this change, the IO address range
    (value of ACPI_PCIHP_SIZE) was incremented by four bytes:
    
    b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
    
    This can be seen from the output of QMP command 'info mtree' :
    
    0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
    0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
    0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
    0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
    0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
    0000000000000cc4-0000000000000cdb (prio 0, i/o): acpi-pci-hotplug
    0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
    
    It shows that there is a region of conflict between IO regions of acpi
    pci hotplug and acpi cpu hotplug.
    
    Unfortunately, the change caf108bc58790 did not update the IO address range
    appropriately before it was pushed upstream to accommodate the increased
    length of the IO address space introduced in change b32bd763a1ca92.
    
    Due to this bug, windows guests complain 'This device cannot find
    enough free resources it can use' in the device manager panel for extended
    IO buses. This issue also breaks the correct functioning of pci hotplug as the
    following shows that the IO space for pci hotplug has been truncated:
    
    (qemu) info mtree -f
    FlatView #0
     AS "I/O", root: io
     Root memory region: io
      0000000000000cc4-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
      0000000000000cd8-0000000000000cf7 (prio 0, i/o): acpi-cpu-hotplug
    
    Therefore, in this fix, we adjust the IO address range for the acpi pci
    hotplug so that it does not conflict with cpu hotplug and there is no
    truncation of IO spaces. The starting IO address of PCI hotplug region
    has been decremented by four bytes in order to accommodate four byte
    increment in the IO address space introduced by change
    b32bd763a1ca92 ("pci: introduce acpi-index property for PCI device")
    
    After fixing, the following are the corrected IO ranges:
    
    0000000000000600-0000000000000603 (prio 0, i/o): acpi-evt
    0000000000000604-0000000000000605 (prio 0, i/o): acpi-cnt
    0000000000000608-000000000000060b (prio 0, i/o): acpi-tmr
    0000000000000620-000000000000062f (prio 0, i/o): acpi-gpe0
    0000000000000630-0000000000000637 (prio 0, i/o): acpi-smi
    0000000000000cc0-0000000000000cd7 (prio 0, i/o): acpi-pci-hotplug
    0000000000000cd8-0000000000000ce3 (prio 0, i/o): acpi-cpu-hotplug
    
    This change has been tested using a Windows Server 2019 guest VM. Windows
    no longer complains after this change.
    
    Fixes: caf108bc58790 ("hw/i386/acpi-build: Add ACPI PCI hot-plug methods to Q35")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/561
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Julia Suvorova <jusual@redhat.com>
    Message-Id: <20210916132838.3469580-3-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 0e780da76a6fe283a20283856718bca3986c104f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 include/hw/acpi/ich9.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index a329ce43ab..f04f1791bd 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -29,7 +29,7 @@
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/acpi/tco.h"
 
-#define ACPI_PCIHP_ADDR_ICH9 0x0cc4
+#define ACPI_PCIHP_ADDR_ICH9 0x0cc0
 
 typedef struct ICH9LPCPMRegs {
     /*
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:58:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:58:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257482.442423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AvC-0003r7-Qc; Fri, 14 Jan 2022 00:58:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257482.442423; Fri, 14 Jan 2022 00:58: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 1n8AvC-0003qz-N5; Fri, 14 Jan 2022 00:58:26 +0000
Received: by outflank-mailman (input) for mailman id 257482;
 Fri, 14 Jan 2022 00:58: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 1n8AvB-0003qm-AH
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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 1n8AvB-0002L4-9U
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AvB-0005rQ-8i
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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=XEsWDZWKcLrCYQ7paCktXy2XDzE5iZ1WEPdFGKT2nig=; b=KdvwLevLCcHbbFu/8TH+3ZZC9L
	4XA1e4mvyY3XOLN/y08i5hwkT700YqWcIsty96/IqOZ+VIoQcvZUjX2l8HNtXwqZDfeeJaC/MHDDm
	dHSzCw8FxR6tTB62jbP9ckTpomgX8Z8L6m9vRZjKy1uZswBRdvdAoIac2wsajbLdeH6Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] bios-tables-test: Update ACPI DSDT table golden blobs for q35
Message-Id: <E1n8AvB-0005rQ-8i@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:58:25 +0000

commit 3aa2c2cd679dcf86e67f8c466c2e3c0bc5e1155f
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Sep 16 18:58:38 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:27:44 2021 -0600

    bios-tables-test: Update ACPI DSDT table golden blobs for q35
    
    We have modified the IO address range for ACPI pci hotplug in q35. See change:
    
    5adcc9e39e6a5 ("hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35")
    
    The ACPI DSDT table golden blobs must be regenrated in order to make the unit tests
    pass. This change updates the golden ACPI DSDT table blobs.
    
    Following is the ASL diff between the blobs:
    
    @@ -1,30 +1,30 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT, Tue Sep 14 09:04:06 2021
    + * Disassembly of /tmp/aml-52DP90, Tue Sep 14 09:04:06 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
      *     Length           0x00002061 (8289)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xE5
    + *     Checksum         0xF9
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
    @@ -226,46 +226,46 @@
                 Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                 {
                     IO (Decode16,
                         0x0070,             // Range Minimum
                         0x0070,             // Range Maximum
                         0x01,               // Alignment
                         0x08,               // Length
                         )
                     IRQNoFlags ()
                         {8}
                 })
             }
         }
    
         Scope (_SB.PCI0)
         {
    -        OperationRegion (PCST, SystemIO, 0x0CC4, 0x08)
    +        OperationRegion (PCST, SystemIO, 0x0CC0, 0x08)
             Field (PCST, DWordAcc, NoLock, WriteAsZeros)
             {
                 PCIU,   32,
                 PCID,   32
             }
    
    -        OperationRegion (SEJ, SystemIO, 0x0CCC, 0x04)
    +        OperationRegion (SEJ, SystemIO, 0x0CC8, 0x04)
             Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
             {
                 B0EJ,   32
             }
    
    -        OperationRegion (BNMR, SystemIO, 0x0CD4, 0x08)
    +        OperationRegion (BNMR, SystemIO, 0x0CD0, 0x08)
             Field (BNMR, DWordAcc, NoLock, WriteAsZeros)
             {
                 BNUM,   32,
                 PIDX,   32
             }
    
             Mutex (BLCK, 0x00)
             Method (PCEJ, 2, NotSerialized)
             {
                 Acquire (BLCK, 0xFFFF)
                 BNUM = Arg0
                 B0EJ = (One << Arg1)
                 Release (BLCK)
                 Return (Zero)
             }
    
    @@ -3185,34 +3185,34 @@
                         0x0620,             // Range Minimum
                         0x0620,             // Range Maximum
                         0x01,               // Alignment
                         0x10,               // Length
                         )
                 })
             }
    
             Device (PHPR)
             {
                 Name (_HID, "PNP0A06" /* Generic Container Device */)  // _HID: Hardware ID
                 Name (_UID, "PCI Hotplug resources")  // _UID: Unique ID
                 Name (_STA, 0x0B)  // _STA: Status
                 Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                 {
                     IO (Decode16,
    -                    0x0CC4,             // Range Minimum
    -                    0x0CC4,             // Range Maximum
    +                    0x0CC0,             // Range Minimum
    +                    0x0CC0,             // Range Maximum
                         0x01,               // Alignment
                         0x18,               // Length
                         )
                 })
             }
         }
    
         Scope (\)
         {
             Name (_S3, Package (0x04)  // _S3_: S3 System State
             {
                 One,
                 One,
                 Zero,
                 Zero
             })
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    Message-Id: <20210916132838.3469580-4-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 500eb21cff08dfb0478db9b34f2fdba69eb31496)
    *drop dependency on 75539b886a ("tests: acpi: tpm1.2: Add expected TPM 1.2 ACPI blobs")
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT                    | Bin 8289 -> 8289 bytes
 tests/data/acpi/q35/DSDT.acpihmat           | Bin 9614 -> 9614 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 11003 -> 11003 bytes
 tests/data/acpi/q35/DSDT.cphp               | Bin 8753 -> 8753 bytes
 tests/data/acpi/q35/DSDT.dimmpxm            | Bin 9943 -> 9943 bytes
 tests/data/acpi/q35/DSDT.ipmibt             | Bin 8364 -> 8364 bytes
 tests/data/acpi/q35/DSDT.memhp              | Bin 9648 -> 9648 bytes
 tests/data/acpi/q35/DSDT.mmio64             | Bin 9419 -> 9419 bytes
 tests/data/acpi/q35/DSDT.nohpet             | Bin 8147 -> 8147 bytes
 tests/data/acpi/q35/DSDT.numamem            | Bin 8295 -> 8295 bytes
 tests/data/acpi/q35/DSDT.tis                | Bin 8894 -> 8894 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |  12 ------------
 12 files changed, 12 deletions(-)

diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT
index 842533f53e..281fc82c03 100644
Binary files a/tests/data/acpi/q35/DSDT and b/tests/data/acpi/q35/DSDT differ
diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.acpihmat
index 8d00f2ea0d..8c1e05a11a 100644
Binary files a/tests/data/acpi/q35/DSDT.acpihmat and b/tests/data/acpi/q35/DSDT.acpihmat differ
diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge
index 55ad4bd7ab..6f1464b6c7 100644
Binary files a/tests/data/acpi/q35/DSDT.bridge and b/tests/data/acpi/q35/DSDT.bridge differ
diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp
index ccde2add9f..f8337ff519 100644
Binary files a/tests/data/acpi/q35/DSDT.cphp and b/tests/data/acpi/q35/DSDT.cphp differ
diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.dimmpxm
index b062e30117..fe5820d93d 100644
Binary files a/tests/data/acpi/q35/DSDT.dimmpxm and b/tests/data/acpi/q35/DSDT.dimmpxm differ
diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt
index 1c5737692f..6317410658 100644
Binary files a/tests/data/acpi/q35/DSDT.ipmibt and b/tests/data/acpi/q35/DSDT.ipmibt differ
diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp
index 7b6f6487b2..9bc11518fc 100644
Binary files a/tests/data/acpi/q35/DSDT.memhp and b/tests/data/acpi/q35/DSDT.memhp differ
diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/q35/DSDT.mmio64
index 2e0a772a85..713288a12e 100644
Binary files a/tests/data/acpi/q35/DSDT.mmio64 and b/tests/data/acpi/q35/DSDT.mmio64 differ
diff --git a/tests/data/acpi/q35/DSDT.nohpet b/tests/data/acpi/q35/DSDT.nohpet
index ceb61f4115..e8202e6ddf 100644
Binary files a/tests/data/acpi/q35/DSDT.nohpet and b/tests/data/acpi/q35/DSDT.nohpet differ
diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem
index a3f846df54..151e7cf429 100644
Binary files a/tests/data/acpi/q35/DSDT.numamem and b/tests/data/acpi/q35/DSDT.numamem differ
diff --git a/tests/data/acpi/q35/DSDT.tis b/tests/data/acpi/q35/DSDT.tis
index d1433e3c14..c92d4d29c7 100644
Binary files a/tests/data/acpi/q35/DSDT.tis and b/tests/data/acpi/q35/DSDT.tis differ
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index c06da38af3..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,13 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT",
-"tests/data/acpi/q35/DSDT.tis.tpm12",
-"tests/data/acpi/q35/DSDT.tis.tpm2",
-"tests/data/acpi/q35/DSDT.bridge",
-"tests/data/acpi/q35/DSDT.mmio64",
-"tests/data/acpi/q35/DSDT.ipmibt",
-"tests/data/acpi/q35/DSDT.cphp",
-"tests/data/acpi/q35/DSDT.memhp",
-"tests/data/acpi/q35/DSDT.numamem",
-"tests/data/acpi/q35/DSDT.nohpet",
-"tests/data/acpi/q35/DSDT.dimmpxm",
-"tests/data/acpi/q35/DSDT.acpihmat",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:58:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:58:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257483.442426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AvM-0003u6-RL; Fri, 14 Jan 2022 00:58:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257483.442426; Fri, 14 Jan 2022 00:58: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 1n8AvM-0003ty-OU; Fri, 14 Jan 2022 00:58:36 +0000
Received: by outflank-mailman (input) for mailman id 257483;
 Fri, 14 Jan 2022 00:58: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 1n8AvL-0003tm-EI
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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 1n8AvL-0002LE-Da
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AvL-0005s5-Co
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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=piGb9s6UAdK7qK9+zulnaLw8nVbGon3i0yvxyFbPOck=; b=DNtU+62kBB3BnHnIm7MIQOQTJ8
	H2fiNrMLLBAnwNd9HBgKxcitEf6DbZEjZEi70L/XvQjXB9zJeiU8I4ine1M5w1L/qdCRhlHD5IAWy
	zjMEa+nTQzHomJYLxTGkScSsfYGN1pfTcLLZjGnk86QSV5omDMAzpEMMRvY7Aou6P+qU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] block: introduce max_hw_iov for use in scsi-generic
Message-Id: <E1n8AvL-0005s5-Co@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:58:35 +0000

commit a43e057bd6095108fbe99b6a21d4857186aa3df3
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Sep 23 09:04:36 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 13:53:15 2021 -0600

    block: introduce max_hw_iov for use in scsi-generic
    
    Linux limits the size of iovecs to 1024 (UIO_MAXIOV in the kernel
    sources, IOV_MAX in POSIX).  Because of this, on some host adapters
    requests with many iovecs are rejected with -EINVAL by the
    io_submit() or readv()/writev() system calls.
    
    In fact, the same limit applies to SG_IO as well.  To fix both the
    EINVAL and the possible performance issues from using fewer iovecs
    than allowed by Linux (some HBAs have max_segments as low as 128),
    introduce a separate entry in BlockLimits to hold the max_segments
    value from sysfs.  This new limit is used only for SG_IO and clamped
    to bs->bl.max_iov anyway, just like max_hw_transfer is clamped to
    bs->bl.max_transfer.
    
    Reported-by: Halil Pasic <pasic@linux.ibm.com>
    Cc: Hanna Reitz <hreitz@redhat.com>
    Cc: Kevin Wolf <kwolf@redhat.com>
    Cc: qemu-block@nongnu.org
    Cc: qemu-stable@nongnu.org
    Fixes: 18473467d5 ("file-posix: try BLKSECTGET on block devices too, do not round to power of 2", 2021-06-25)
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20210923130436.1187591-1-pbonzini@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit cc071629539dc1f303175a7e2d4ab854c0a8b20f)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 block/block-backend.c          | 6 ++++++
 block/file-posix.c             | 2 +-
 block/io.c                     | 1 +
 hw/scsi/scsi-generic.c         | 2 +-
 include/block/block_int.h      | 7 +++++++
 include/sysemu/block-backend.h | 1 +
 6 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index deb55c272e..6320752aa2 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1978,6 +1978,12 @@ uint32_t blk_get_max_transfer(BlockBackend *blk)
     return ROUND_DOWN(max, blk_get_request_alignment(blk));
 }
 
+int blk_get_max_hw_iov(BlockBackend *blk)
+{
+    return MIN_NON_ZERO(blk->root->bs->bl.max_hw_iov,
+                        blk->root->bs->bl.max_iov);
+}
+
 int blk_get_max_iov(BlockBackend *blk)
 {
     return blk->root->bs->bl.max_iov;
diff --git a/block/file-posix.c b/block/file-posix.c
index cb9bffe047..1567edb3d5 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1273,7 +1273,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
 
         ret = hdev_get_max_segments(s->fd, &st);
         if (ret > 0) {
-            bs->bl.max_iov = ret;
+            bs->bl.max_hw_iov = ret;
         }
     }
 }
diff --git a/block/io.c b/block/io.c
index a19942718b..f38e7f81d8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -136,6 +136,7 @@ static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src)
     dst->min_mem_alignment = MAX(dst->min_mem_alignment,
                                  src->min_mem_alignment);
     dst->max_iov = MIN_NON_ZERO(dst->max_iov, src->max_iov);
+    dst->max_hw_iov = MIN_NON_ZERO(dst->max_hw_iov, src->max_hw_iov);
 }
 
 typedef struct BdrvRefreshLimitsState {
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 665baf900e..0306ccc7b1 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -180,7 +180,7 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
         page = r->req.cmd.buf[2];
         if (page == 0xb0) {
             uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
-            uint32_t max_iov = blk_get_max_iov(s->conf.blk);
+            uint32_t max_iov = blk_get_max_hw_iov(s->conf.blk);
 
             assert(max_transfer);
             max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index f1a54db0f8..c31cbd034a 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -702,6 +702,13 @@ typedef struct BlockLimits {
      */
     uint64_t max_hw_transfer;
 
+    /* Maximal number of scatter/gather elements allowed by the hardware.
+     * Applies whenever transfers to the device bypass the kernel I/O
+     * scheduler, for example with SG_IO.  If larger than max_iov
+     * or if zero, blk_get_max_hw_iov will fall back to max_iov.
+     */
+    int max_hw_iov;
+
     /* memory alignment, in bytes so that no bounce buffer is needed */
     size_t min_mem_alignment;
 
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 9ac5f7bbd3..5daec61f6e 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -210,6 +210,7 @@ uint32_t blk_get_request_alignment(BlockBackend *blk);
 uint32_t blk_get_max_transfer(BlockBackend *blk);
 uint64_t blk_get_max_hw_transfer(BlockBackend *blk);
 int blk_get_max_iov(BlockBackend *blk);
+int blk_get_max_hw_iov(BlockBackend *blk);
 void blk_set_guest_block_size(BlockBackend *blk, int align);
 void *blk_try_blockalign(BlockBackend *blk, size_t size);
 void *blk_blockalign(BlockBackend *blk, size_t size);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:58:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:58:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257484.442430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AvW-0003xA-Sx; Fri, 14 Jan 2022 00:58:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257484.442430; Fri, 14 Jan 2022 00:58: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 1n8AvW-0003x2-Q8; Fri, 14 Jan 2022 00:58:46 +0000
Received: by outflank-mailman (input) for mailman id 257484;
 Fri, 14 Jan 2022 00:58: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 1n8AvV-0003wn-HU
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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 1n8AvV-0002LI-Gp
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AvV-0005sf-G4
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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=uzpkKFriG1x9a5CAM7aM7H7XhYiX6JKY3sW0fFvuiWo=; b=D6OxNbrCtneuT8Eyuhm0DQpgSQ
	jCTi5DMmXBT6oe54WvVfxfGXlY1ULLF08cav8WPxthpGvtSKYG1PwaeG/cIAvSPXkXc1FqDGvDQXa
	4dqEX9csKdnUfogQDhXU1jZjRfGDqc5jZPOYza3BfcryUyqjlG8t1yLcB/unWCucQXxM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] pci: fix PCI resource reserve capability on BE
Message-Id: <E1n8AvV-0005sf-G4@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:58:45 +0000

commit 24101e36f1c2c782c8c2d055b477e0e0beaf4c68
Author:     Michael S. Tsirkin <mst@redhat.com>
AuthorDate: Wed Oct 20 05:48:54 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:01:41 2021 -0600

    pci: fix PCI resource reserve capability on BE
    
    PCI resource reserve capability should use LE format as all other PCI
    things. If we don't then seabios won't boot:
    
    === PCI new allocation pass #1 ===
    PCI: check devices
    PCI: QEMU resource reserve cap: size 10000000000000 type io
    PCI: secondary bus 1 size 10000000000000 type io
    PCI: secondary bus 1 size 00200000 type mem
    PCI: secondary bus 1 size 00200000 type prefmem
    === PCI new allocation pass #2 ===
    PCI: out of I/O address space
    
    This became more important since we started reserving IO by default,
    previously no one noticed.
    
    Fixes: e2a6290aab ("hw/pcie-root-port: Fix hotplug for PCI devices requiring IO")
    Cc: marcel.apfelbaum@gmail.com
    Fixes: 226263fb5c ("hw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port")
    Cc: zuban32s@gmail.com
    Fixes: 6755e618d0 ("hw/pci: add PCI resource reserve capability to legacy PCI bridge")
    Cc: jing2.liu@linux.intel.com
    Tested-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    (cherry picked from commit 0e464f7d993113119f0fd17b890831440734ce15)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/pci/pci_bridge.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 3789c17edc..6a1e8e433c 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
     PCIBridgeQemuCap cap = {
             .len = cap_len,
             .type = REDHAT_PCI_CAP_RESOURCE_RESERVE,
-            .bus_res = res_reserve.bus,
-            .io = res_reserve.io,
-            .mem = res_reserve.mem_non_pref,
-            .mem_pref_32 = res_reserve.mem_pref_32,
-            .mem_pref_64 = res_reserve.mem_pref_64
+            .bus_res = cpu_to_le32(res_reserve.bus),
+            .io = cpu_to_le64(res_reserve.io),
+            .mem = cpu_to_le32(res_reserve.mem_non_pref),
+            .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32),
+            .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64)
     };
 
     int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:58:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:58:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257485.442434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Avf-00040L-Un; Fri, 14 Jan 2022 00:58:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257485.442434; Fri, 14 Jan 2022 00:58:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Avf-00040C-Rg; Fri, 14 Jan 2022 00:58:55 +0000
Received: by outflank-mailman (input) for mailman id 257485;
 Fri, 14 Jan 2022 00:58: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 1n8Avf-000404-Kc
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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 1n8Avf-0002LM-Js
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Avf-0005t8-JC
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:58: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=rCT9PGXpqNiFEZjRpvh7qEJFBck0qyug7/EzeEv/xPk=; b=Vr9VvmU62t9eruithZ52+Mkm8x
	Puzxdzia4eIaaHTZXP/efp6bdN4pe0AY1OsnKp4thSFebKsiRp5CsTUm5Y0tCCgjZ2DOdHCYXA5A0
	vNr3tOFIjxg6MMSsleZrmCvFP88fTfGJoi1Wm+JMpQcdHc7U3XVQDCP0WPM8x9cZkjmY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
Message-Id: <E1n8Avf-0005t8-JC@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:58:55 +0000

commit a759dc19ecf11410593db40e2ce7dba3c06f16ac
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:48 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:15 2021 -0600

    tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob
    
    We are adding a new unit test to cover the acpi hotplug support in q35 for
    multi-function bridges. This test uses a new table DSDT.multi-bridge.
    We need to allow changes in DSDT acpi table for addition of this new
    unit test.
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-2-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit 6dcb1cc9512c6b4cd8f85abc537abaf6f6c0738b)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT.multi-bridge       | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 1 +
 2 files changed, 1 insertion(+)

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..dabc024f53 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/q35/DSDT.multi-bridge",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:59:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:59:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257486.442438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Avr-00043u-1f; Fri, 14 Jan 2022 00:59:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257486.442438; Fri, 14 Jan 2022 00:59: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 1n8Avq-00043n-Un; Fri, 14 Jan 2022 00:59:06 +0000
Received: by outflank-mailman (input) for mailman id 257486;
 Fri, 14 Jan 2022 00:59: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 1n8Avp-00043b-Nw
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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 1n8Avp-0002Ld-NF
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Avp-0005to-MW
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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=DRF/FyxjnXPcEih1Tm2xHSrpXyP7ND7Dbq/a3Q1NsKg=; b=eZfb1Y86K94CHhXZJvQsU3QeHC
	PglYtYqdCG3cLibAHDNyqwZgfpCH3z2bCvlNkx5XGsY3Lb7qaqXm8BiGAgzODw5vSY6PRMNwcZ4Q9
	i9SgOn3BtQQzbyOOcUqcYa/rVUJJFsWIdNuchcYFUhlwrmgBo8JSz9xwjw1W8f5WoVvg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
Message-Id: <E1n8Avp-0005to-MW@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:59:05 +0000

commit 8319de607faa33113ec9b47778da77e7ad4d9c8b
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:49 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:20 2021 -0600

    tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35
    
    commit d7346e614f4ec ("acpi: x86: pcihp: add support hotplug on multifunction bridges")
    added ACPI hotplug descriptions for cold plugged bridges for functions other
    than 0. For all other devices, the ACPI hotplug descriptions are limited to
    function 0 only. This change adds unit tests for this feature.
    
    This test adds the following devices to qemu and then checks the changes
    introduced in the DSDT table due to the addition of the following devices:
    
    (a) a multifunction bridge device
    (b) a bridge device with function 1
    (c) a non-bridge device with function 2
    
    In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
    For (a) we should find a hotplug AML description for function 0.
    
    The following diff compares the DSDT table AML with the new unit test before
    and after the change d7346e614f4ec is introduced. In other words,
    this diff reflects the changes that occurs in the DSDT table due to the change
    d7346e614f4ec .
    
    @@ -1,60 +1,38 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT.multi-bridge, Thu Oct  7 18:56:05 2021
    + * Disassembly of /tmp/aml-AN0DA1, Thu Oct  7 18:56:05 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
    - *     Length           0x000020FE (8446)
    + *     Length           0x00002187 (8583)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xDE
    + *     Checksum         0x8D
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
    -    /*
    -     * iASL Warning: There was 1 external control method found during
    -     * disassembly, but only 0 were resolved (1 unresolved). Additional
    -     * ACPI tables may be required to properly disassemble the code. This
    -     * resulting disassembler output file may not compile because the
    -     * disassembler did not know how many arguments to assign to the
    -     * unresolved methods. Note: SSDTs can be dynamically loaded at
    -     * runtime and may or may not be available via the host OS.
    -     *
    -     * In addition, the -fe option can be used to specify a file containing
    -     * control method external declarations with the associated method
    -     * argument counts. Each line of the file must be of the form:
    -     *     External (<method pathname>, MethodObj, <argument count>)
    -     * Invocation:
    -     *     iasl -fe refs.txt -d dsdt.aml
    -     *
    -     * The following methods were unresolved and many not compile properly
    -     * because the disassembler had to guess at the number of arguments
    -     * required for each:
    -     */
    -    External (_SB_.PCI0.S19_.PCNT, MethodObj)    // Warning: Unknown method, guessing 1 arguments
    -
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
             Method (DBUG, 1, NotSerialized)
             {
                 ToHexString (Arg0, Local0)
                 ToBuffer (Local0, Local0)
                 Local1 = (SizeOf (Local0) - One)
                 Local2 = Zero
                 While ((Local2 < Local1))
                 {
    @@ -3322,24 +3300,60 @@
                     Method (DVNT, 2, NotSerialized)
                     {
                         If ((Arg0 & One))
                         {
                             Notify (S00, Arg1)
                         }
                     }
    
                     Method (PCNT, 0, NotSerialized)
                     {
                         BNUM = One
                         DVNT (PCIU, One)
                         DVNT (PCID, 0x03)
                     }
                 }
    
    +            Device (S19)
    +            {
    +                Name (_ADR, 0x00030001)  // _ADR: Address
    +                Name (BSEL, Zero)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = Zero
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
                 Method (PCNT, 0, NotSerialized)
                 {
    -                ^S19.PCNT (^S10.PCNT ())
    +                ^S19.PCNT ()
    +                ^S10.PCNT ()
                 }
             }
         }
     }
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-3-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit 04dd78b9e85720226a148eef54b45cb02b463034)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/bios-tables-test.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 51d3a4e239..921f676e4c 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -859,6 +859,23 @@ static void test_acpi_q35_tcg_bridge(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_multif_bridge(void)
+{
+    test_data data = {
+        .machine = MACHINE_Q35,
+        .variant = ".multi-bridge",
+    };
+    test_acpi_one("-device pcie-root-port,id=pcie-root-port-0,"
+                  "multifunction=on,"
+                  "port=0x0,chassis=1,addr=0x2,bus=pcie.0 "
+                  "-device pcie-root-port,id=pcie-root-port-1,"
+                  "port=0x1,chassis=2,addr=0x3.0x1,bus=pcie.0 "
+                  "-device virtio-balloon,id=balloon0,"
+                  "bus=pcie.0,addr=0x4.0x2",
+                  &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_mmio64(void)
 {
     test_data data = {
@@ -1528,6 +1545,7 @@ int main(int argc, char *argv[])
                        test_acpi_piix4_no_acpi_pci_hotplug);
         qtest_add_func("acpi/q35", test_acpi_q35_tcg);
         qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
+        qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge);
         qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64);
         qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
         qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:59:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:59:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257487.442442 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Aw1-00046o-3J; Fri, 14 Jan 2022 00:59:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257487.442442; Fri, 14 Jan 2022 00:59: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 1n8Aw1-00046g-0E; Fri, 14 Jan 2022 00:59:17 +0000
Received: by outflank-mailman (input) for mailman id 257487;
 Fri, 14 Jan 2022 00:59: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 1n8Avz-00046W-R8
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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 1n8Avz-0002Lh-QU
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Avz-0005uO-Pk
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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=p9UYo61Ek9d9W5f7tLx3PkLL4m2+/Mz7V6ub0p+5o4k=; b=WUbnxKGgNclTTpOPX68HMGzhoX
	HCo8UfnL8FxAPwzzsmYN4HAdG7ZrJeejuFBwdJf9qk3FOYv7OLksFzKtR07GCkNpcLBOC3ZI6BuEO
	afkWuv1M+l/mW/txaImiPrA8fHRlUZ8ExyJo5rRdbZ+B/O6KpISHjRIvjzPj40vuWzNU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
Message-Id: <E1n8Avz-0005uO-Pk@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:59:15 +0000

commit bbbdedb38692dc1005a17b465f6b92474356c1c0
Author:     Ani Sinha <ani@anisinha.ca>
AuthorDate: Thu Oct 7 19:27:50 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:05:24 2021 -0600

    tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test
    
    We added a new unit test for testing acpi hotplug on multifunction bridges in
    q35 machines. Here, we update the DSDT table gloden master blob for this unit
    test.
    
    The test adds the following devices to qemu and then checks the changes
    introduced in the DSDT table due to the addition of the following devices:
    
    (a) a multifunction bridge device
    (b) a bridge device with function 1
    (c) a non-bridge device with function 2
    
    In the DSDT table, we should see AML hotplug descriptions for (a) and (b).
    For (a) we should find a hotplug AML description for function 0.
    
    Following is the ASL diff between the original DSDT table and the modified DSDT
    table due to the unit test. We see that multifunction bridge on bus 2 and single
    function bridge on bus 3 function 1 are described, not the non-bridge balloon
    device on bus 4, function 2.
    
    @@ -1,30 +1,30 @@
     /*
      * Intel ACPI Component Architecture
      * AML/ASL+ Disassembler version 20190509 (64-bit version)
      * Copyright (c) 2000 - 2019 Intel Corporation
      *
      * Disassembling to symbolic ASL+ operators
      *
    - * Disassembly of tests/data/acpi/q35/DSDT, Thu Oct  7 18:29:19 2021
    + * Disassembly of /tmp/aml-C7JCA1, Thu Oct  7 18:29:19 2021
      *
      * Original Table Header:
      *     Signature        "DSDT"
    - *     Length           0x00002061 (8289)
    + *     Length           0x00002187 (8583)
      *     Revision         0x01 **** 32-bit table (V1), no 64-bit math support
    - *     Checksum         0xF9
    + *     Checksum         0x8D
      *     OEM ID           "BOCHS "
      *     OEM Table ID     "BXPC    "
      *     OEM Revision     0x00000001 (1)
      *     Compiler ID      "BXPC"
      *     Compiler Version 0x00000001 (1)
      */
     DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC    ", 0x00000001)
     {
         Scope (\)
         {
             OperationRegion (DBG, SystemIO, 0x0402, One)
             Field (DBG, ByteAcc, NoLock, Preserve)
             {
                 DBGB,   8
             }
    
    @@ -3265,23 +3265,95 @@
                     Method (_S1D, 0, NotSerialized)  // _S1D: S1 Device State
                     {
                         Return (Zero)
                     }
    
                     Method (_S2D, 0, NotSerialized)  // _S2D: S2 Device State
                     {
                         Return (Zero)
                     }
    
                     Method (_S3D, 0, NotSerialized)  // _S3D: S3 Device State
                     {
                         Return (Zero)
                     }
                 }
    
    +            Device (S10)
    +            {
    +                Name (_ADR, 0x00020000)  // _ADR: Address
    +                Name (BSEL, One)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = One
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
    +            Device (S19)
    +            {
    +                Name (_ADR, 0x00030001)  // _ADR: Address
    +                Name (BSEL, Zero)
    +                Device (S00)
    +                {
    +                    Name (_SUN, Zero)  // _SUN: Slot User Number
    +                    Name (_ADR, Zero)  // _ADR: Address
    +                    Method (_EJ0, 1, NotSerialized)  // _EJx: Eject Device, x=0-9
    +                    {
    +                        PCEJ (BSEL, _SUN)
    +                    }
    +
    +                    Method (_DSM, 4, Serialized)  // _DSM: Device-Specific Method
    +                    {
    +                        Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN))
    +                    }
    +                }
    +
    +                Method (DVNT, 2, NotSerialized)
    +                {
    +                    If ((Arg0 & One))
    +                    {
    +                        Notify (S00, Arg1)
    +                    }
    +                }
    +
    +                Method (PCNT, 0, NotSerialized)
    +                {
    +                    BNUM = Zero
    +                    DVNT (PCIU, One)
    +                    DVNT (PCID, 0x03)
    +                }
    +            }
    +
                 Method (PCNT, 0, NotSerialized)
                 {
    +                ^S19.PCNT ()
    +                ^S10.PCNT ()
                 }
             }
         }
     }
    
    Signed-off-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211007135750.1277213-4-ani@anisinha.ca>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Acked-by: Igor Mammedov <imammedo@redhat.com>
    (cherry picked from commit a8339e07f94a47f99560baef59d65a9e039aaf45)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/data/acpi/q35/DSDT.multi-bridge       | Bin 0 -> 8583 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   1 -
 2 files changed, 1 deletion(-)

diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge
index e69de29bb2..a24c713d22 100644
Binary files a/tests/data/acpi/q35/DSDT.multi-bridge and b/tests/data/acpi/q35/DSDT.multi-bridge differ
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dabc024f53..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/q35/DSDT.multi-bridge",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:59:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:59:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257488.442445 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AwB-00049g-4W; Fri, 14 Jan 2022 00:59:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257488.442445; Fri, 14 Jan 2022 00:59: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 1n8AwB-00049Y-1o; Fri, 14 Jan 2022 00:59:27 +0000
Received: by outflank-mailman (input) for mailman id 257488;
 Fri, 14 Jan 2022 00:59: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 1n8Aw9-00049K-Ub
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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 1n8Aw9-0002M1-Ts
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Aw9-0005v6-TE
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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=qe3vVVprmUkmzxIfZzSpZRQV0K5QVNMyz2Zo9eMkzfo=; b=B0TXVXPv47ip6vekUjUH/RBTGs
	dR5ay4rjiMHBAjSOtcxFVr0JV83jLvaXcxwTccyIPej6sC8zbyHMESn+DANb2Enkb6j5PQKuwRSsO
	fN+NoxBu0wffCPhcVhEu4NE/tB0xae2lDhsm/mkB5YiX06Asl3HU+XbCvWT9AbFrgMgM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] block/file-posix: Fix return value translation for AIO discards
Message-Id: <E1n8Aw9-0005v6-TE@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:59:25 +0000

commit ebf660beb171d40af179f84a967b710199f81511
Author:     Ari Sundholm <ari@tuxera.com>
AuthorDate: Tue Oct 19 14:09:55 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:12:50 2021 -0600

    block/file-posix: Fix return value translation for AIO discards
    
    AIO discards regressed as a result of the following commit:
            0dfc7af2 block/file-posix: Optimize for macOS
    
    When trying to run blkdiscard within a Linux guest, the request would
    fail, with some errors in dmesg:
    
    ---- [ snip ] ----
    [    4.010070] sd 2:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK
    driverbyte=DRIVER_SENSE
    [    4.011061] sd 2:0:0:0: [sda] tag#0 Sense Key : Aborted Command
    [current]
    [    4.011061] sd 2:0:0:0: [sda] tag#0 Add. Sense: I/O process
    terminated
    [    4.011061] sd 2:0:0:0: [sda] tag#0 CDB: Unmap/Read sub-channel 42
    00 00 00 00 00 00 00 18 00
    [    4.011061] blk_update_request: I/O error, dev sda, sector 0
    ---- [ snip ] ----
    
    This turns out to be a result of a flaw in changes to the error value
    translation logic in handle_aiocb_discard(). The default return value
    may be left untranslated in some configurations, and the wrong variable
    is used in one translation.
    
    Fix both issues.
    
    Fixes: 0dfc7af2b28 ("block/file-posix: Optimize for macOS")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Ari Sundholm <ari@tuxera.com>
    Signed-off-by: Emil Karlson <jkarlson@tuxera.com>
    Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-Id: <20211019110954.4170931-1-ari@tuxera.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 13a028336f2c05e7ff47dfdaf30dfac7f4883e80)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 block/file-posix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index 1567edb3d5..dd295cfc6d 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1807,7 +1807,7 @@ static int handle_aiocb_copy_range(void *opaque)
 static int handle_aiocb_discard(void *opaque)
 {
     RawPosixAIOData *aiocb = opaque;
-    int ret = -EOPNOTSUPP;
+    int ret = -ENOTSUP;
     BDRVRawState *s = aiocb->bs->opaque;
 
     if (!s->has_discard) {
@@ -1829,7 +1829,7 @@ static int handle_aiocb_discard(void *opaque)
 #ifdef CONFIG_FALLOCATE_PUNCH_HOLE
         ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                            aiocb->aio_offset, aiocb->aio_nbytes);
-        ret = translate_err(-errno);
+        ret = translate_err(ret);
 #elif defined(__APPLE__) && (__MACH__)
         fpunchhole_t fpunchhole;
         fpunchhole.fp_flags = 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:59:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:59:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257489.442450 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AwL-0004CV-6F; Fri, 14 Jan 2022 00:59:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257489.442450; Fri, 14 Jan 2022 00:59: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 1n8AwL-0004CN-3K; Fri, 14 Jan 2022 00:59:37 +0000
Received: by outflank-mailman (input) for mailman id 257489;
 Fri, 14 Jan 2022 00:59: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 1n8AwK-0004C3-1v
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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 1n8AwK-0002M5-1H
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AwK-0005vn-0U
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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=kGZtHsXlneWzN/JBIEp/A+lRBoIusDPl0LCo6McmJZU=; b=DKDreZG5zkf+c9LoDvpRz3Sbh5
	4LpUkBDKhIf7hSimxM6gGNxM0+DKkMwKfW/2nse9I2F+ROtKVcHEoHVZwI1beZ0FI9AL+byGZ4wTw
	CWyWuGzwdW0CvyApOi8ViAttTE7gzRFAunMr51m+ik25pwwGge1kB9iSGhCgk1H+lRPg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] Partially revert "build: -no-pie is no functional linker flag"
Message-Id: <E1n8AwK-0005vn-0U@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:59:36 +0000

commit 43a457841f8c61dd4677ec018c3da4b0323ffb4b
Author:     Jessica Clarke <jrtc27@jrtc27.com>
AuthorDate: Thu Aug 5 20:25:45 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:13:38 2021 -0600

    Partially revert "build: -no-pie is no functional linker flag"
    
    This partially reverts commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53.
    
    This commit was misguided and broke using --disable-pie on any distro
    that enables PIE by default in their compiler driver, including Debian
    and its derivatives. Whilst -no-pie is not a linker flag, it is a
    compiler driver flag that ensures -pie is not automatically passed by it
    to the linker. Without it, all compile_prog checks will fail as any code
    built with the explicit -fno-pie will fail to link with the implicit
    default -pie due to trying to use position-dependent relocations. The
    only bug that needed fixing was LDFLAGS_NOPIE being used as a flag for
    the linker itself in pc-bios/optionrom/Makefile.
    
    Note this does not reinstate exporting LDFLAGS_NOPIE, as it is unused,
    since the only previous use was the one that should not have existed. I
    have also updated the comment for the -fno-pie and -no-pie checks to
    reflect what they're actually needed for.
    
    Fixes: bbd2d5a8120771ec59b86a80a1f51884e0a26e53
    Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
    Message-Id: <20210805192545.38279-1-jrtc27@jrtc27.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit ffd205ef2901bd65fcfbd09a98c0ff7cfcec5e4d)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 configure | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 7659870810..6e308ed77f 100755
--- a/configure
+++ b/configure
@@ -2246,9 +2246,11 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-# Check we support --no-pie first; we will need this for building ROMs.
+# Check we support -fno-pie and -no-pie first; we will need the former for
+# building ROMs, and both for everything if --disable-pie is passed.
 if compile_prog "-Werror -fno-pie" "-no-pie"; then
   CFLAGS_NOPIE="-fno-pie"
+  LDFLAGS_NOPIE="-no-pie"
 fi
 
 if test "$static" = "yes"; then
@@ -2264,6 +2266,7 @@ if test "$static" = "yes"; then
   fi
 elif test "$pie" = "no"; then
   CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
+  CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
   CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:59:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:59:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257490.442454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AwV-0004FS-7r; Fri, 14 Jan 2022 00:59:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257490.442454; Fri, 14 Jan 2022 00:59: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 1n8AwV-0004FK-4u; Fri, 14 Jan 2022 00:59:47 +0000
Received: by outflank-mailman (input) for mailman id 257490;
 Fri, 14 Jan 2022 00:59: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 1n8AwU-0004FB-5A
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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 1n8AwU-0002MC-4U
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AwU-0005wM-3g
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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=dz8fohkpHbLxo2I29PkNYDa6RbTcOpzbH+sJMX9F/z8=; b=6R4iOIZsUGom4ax5oVi/1Lp3Eo
	2nd6EUV6CL+bNj+xnu/909ziIf+eRXNGDqIePqcmPIZ0efflLRU86/HPFc9/2qGnO5XhUn2W88HU2
	uJgVBLXdWLXieqnn2jqXgOj13kUgbF4l5Sf9Ia7u1Rh9aCH7XOnFI781vFYX1c28kYdk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] target-i386: mmu: use pg_mode instead of HF_LMA_MASK
Message-Id: <E1n8AwU-0005wM-3g@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:59:46 +0000

commit cddfaf96ab2a6772dd87998af699f91ca15facfd
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Nov 4 14:45:20 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:18:25 2021 -0600

    target-i386: mmu: use pg_mode instead of HF_LMA_MASK
    
    Correctly look up the paging mode of the hypervisor when it is using 64-bit
    mode but the guest is not.
    
    Fixes: 68746930ae ("target/i386: use mmu_translate for NPT walk", 2021-05-11)
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 93eae3583256896dd91a4c2ca38dcbb8d4051cff)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index b6d940e04e..2dea4a248e 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -90,7 +90,7 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f
         target_ulong pdpe_addr;
 
 #ifdef TARGET_X86_64
-        if (env->hflags & HF_LMA_MASK) {
+        if (pg_mode & PG_MODE_LMA) {
             bool la57 = pg_mode & PG_MODE_LA57;
             uint64_t pml5e_addr, pml5e;
             uint64_t pml4e_addr, pml4e;
@@ -287,7 +287,7 @@ do_check_protect_pse36:
         *prot |= PAGE_EXEC;
     }
 
-    if (!(env->hflags & HF_LMA_MASK)) {
+    if (!(pg_mode & PG_MODE_LMA)) {
         pkr = 0;
     } else if (ptep & PG_USER_MASK) {
         pkr = pg_mode & PG_MODE_PKE ? env->pkru : 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 00:59:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 00:59:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257491.442458 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Awf-0004J7-Af; Fri, 14 Jan 2022 00:59:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257491.442458; Fri, 14 Jan 2022 00:59:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Awf-0004J0-7d; Fri, 14 Jan 2022 00:59:57 +0000
Received: by outflank-mailman (input) for mailman id 257491;
 Fri, 14 Jan 2022 00:59: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 1n8Awe-0004Iu-8M
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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 1n8Awe-0002MI-7g
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Awe-0005wz-6z
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 00:59: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=cT2RJfp8R+cGeOP0j5RljYz5ri+/Y+Oo5cJzdU75Mto=; b=eunY9undn9GqoZ6d3xa8P+mS7K
	zD4guOsqcDwUQJkS4wMc2NMrRPnnmgYEtY5CRZFgP3uw2/lhJLo4a3/VVzvUwCwynDXdvqXceJWn4
	chOw1OnKMPxE4rOXUT3XM/nEwxm0tirkMpC7MAsJZCmDSL916QHfyhURFXl9p1sEQFcA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] target-i386: mmu: fix handling of noncanonical virtual addresses
Message-Id: <E1n8Awe-0005wz-6z@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 00:59:56 +0000

commit 3488bb205de0537ba5364ee1ee09cb07a26a4bb0
Author:     Paolo Bonzini <pbonzini@redhat.com>
AuthorDate: Thu Nov 4 14:47:46 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:19:00 2021 -0600

    target-i386: mmu: fix handling of noncanonical virtual addresses
    
    mmu_translate is supposed to return an error code for page faults; it is
    not able to handle other exceptions.  The #GP case for noncanonical
    virtual addresses is not handled correctly, and incorrectly raised as
    a page fault with error code 1.  Since it cannot happen for nested
    page tables, move it directly to handle_mmu_fault, even before the
    invocation of mmu_translate.
    
    Fixes: #676
    Fixes: 661ff4879e ("target/i386: extract mmu_translate", 2021-05-11)
    Cc: qemu-stable@nongnu.org
    Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b04dc92e013d55c9ac8082caefff45dcfb1310e7)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index 2dea4a248e..9fb59058ef 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -94,15 +94,6 @@ static int mmu_translate(CPUState *cs, hwaddr addr, MMUTranslateFunc get_hphys_f
             bool la57 = pg_mode & PG_MODE_LA57;
             uint64_t pml5e_addr, pml5e;
             uint64_t pml4e_addr, pml4e;
-            int32_t sext;
-
-            /* test virtual address sign extension */
-            sext = la57 ? (int64_t)addr >> 56 : (int64_t)addr >> 47;
-            if (get_hphys_func && sext != 0 && sext != -1) {
-                env->error_code = 0;
-                cs->exception_index = EXCP0D_GPF;
-                return 1;
-            }
 
             if (la57) {
                 pml5e_addr = ((cr3 & ~0xfff) +
@@ -423,6 +414,18 @@ static int handle_mmu_fault(CPUState *cs, vaddr addr, int size,
         page_size = 4096;
     } else {
         pg_mode = get_pg_mode(env);
+        if (pg_mode & PG_MODE_LMA) {
+            int32_t sext;
+
+            /* test virtual address sign extension */
+            sext = (int64_t)addr >> (pg_mode & PG_MODE_LA57 ? 56 : 47);
+            if (sext != 0 && sext != -1) {
+                env->error_code = 0;
+                cs->exception_index = EXCP0D_GPF;
+                return 1;
+            }
+        }
+
         error_code = mmu_translate(cs, addr, get_hphys, env->cr[3], is_write1,
                                    mmu_idx, pg_mode,
                                    &paddr, &page_size, &prot);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:00:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257492.442462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Awp-0006hR-D8; Fri, 14 Jan 2022 01:00:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257492.442462; Fri, 14 Jan 2022 01:00: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 1n8Awp-0006h1-9J; Fri, 14 Jan 2022 01:00:07 +0000
Received: by outflank-mailman (input) for mailman id 257492;
 Fri, 14 Jan 2022 01:00: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 1n8Awo-0006Iw-CU
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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 1n8Awo-0004AG-B2
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Awo-0005yZ-AI
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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=tKehOcS904/EZmK+hIClHMejdiitq00Wa4RihmXVq0A=; b=VIU2g3+KGqYuS5hbWy4gLaOJy/
	NYkZ4F0bD0gyqoTYxJhGKfnlR5GuCoMzr9kym7bGHXT7EaKupkX6eyA+3xhKNvZeQh1FxILEMAoMn
	bze+QyJRrKAQYD3HDfH53kq3jxMaeGDRV+Dvb8kv4wzl1y8qjx3oLBqUTYbieFnYGl6Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands
Message-Id: <E1n8Awo-0005yZ-AI@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:00:06 +0000

commit c2c7f108b8228091d7ad4bd488c3abb9adc632e7
Author:     Mauro Matteo Cascella <mcascell@redhat.com>
AuthorDate: Thu Nov 4 17:31:38 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:22:44 2021 -0600

    hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT commands
    
    This avoids an off-by-one read of 'mode_sense_valid' buffer in
    hw/scsi/scsi-disk.c:mode_sense_page().
    
    Fixes: CVE-2021-3930
    Cc: qemu-stable@nongnu.org
    Reported-by: Alexander Bulekov <alxndr@bu.edu>
    Fixes: a8f4bbe2900 ("scsi-disk: store valid mode pages in a table")
    Fixes: #546
    Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
    Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/scsi/scsi-disk.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index e8a547dbb7..d4914178ea 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1087,6 +1087,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
     uint8_t *p = *p_outbuf + 2;
     int length;
 
+    assert(page < ARRAY_SIZE(mode_sense_valid));
     if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) {
         return -1;
     }
@@ -1428,6 +1429,11 @@ static int scsi_disk_check_mode_select(SCSIDiskState *s, int page,
         return -1;
     }
 
+    /* MODE_PAGE_ALLS is only valid for MODE SENSE commands */
+    if (page == MODE_PAGE_ALLS) {
+        return -1;
+    }
+
     p = mode_current;
     memset(mode_current, 0, inlen + 2);
     len = mode_sense_page(s, page, &p, 0);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:00:19 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:00:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257493.442466 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Awz-0001g6-Ds; Fri, 14 Jan 2022 01:00:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257493.442466; Fri, 14 Jan 2022 01:00: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 1n8Awz-0001fa-An; Fri, 14 Jan 2022 01:00:17 +0000
Received: by outflank-mailman (input) for mailman id 257493;
 Fri, 14 Jan 2022 01:00: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 1n8Awy-0001Pa-Ex
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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 1n8Awy-00006H-EK
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Awy-0005zV-DW
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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=o3AzSv6gTRuyhUlVh73s7T+cQwyTZOjUSAz8zZ1ytM8=; b=GNRaanBjMcPBCq7z9PdGLf9+6C
	sNhg0zl9zcyl/UH6kM8ks2l469RGECOaxPi4LPeY2St2NhYjyt0uAtkLXD3QRF0SkwTMTGagkeURp
	x/t3EeNY2xteqKQ7mGJ3IC2137dOy7MNUwgO6Txb4SuDb4n0v0IcpjVF01sVlF0L73bc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw: m68k: virt: Add compat machine for 6.1
Message-Id: <E1n8Awy-0005zV-DW@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:00:16 +0000

commit 7d71e6bfb0a2f03bd35165d4fc11da64b7ccc0d7
Author:     Laurent Vivier <laurent@vivier.eu>
AuthorDate: Sat Nov 6 20:41:57 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:23:21 2021 -0600

    hw: m68k: virt: Add compat machine for 6.1
    
    Add the missing machine type for m68k/virt
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    Message-Id: <20211106194158.4068596-2-laurent@vivier.eu>
    Signed-off-by: Laurent Vivier <laurent@vivier.eu>
    (cherry picked from commit 6837f299762679429924242a63f16490862578e3)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/m68k/virt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 4e8bce5aa6..0d9e3f83c1 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -304,7 +304,14 @@ type_init(virt_machine_register_types)
     } \
     type_init(machvirt_machine_##major##_##minor##_init);
 
+static void virt_machine_6_1_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE(6, 1, true)
+
 static void virt_machine_6_0_options(MachineClass *mc)
 {
+    virt_machine_6_1_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len);
 }
-DEFINE_VIRT_MACHINE(6, 0, true)
+DEFINE_VIRT_MACHINE(6, 0, false)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:00:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:00:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257494.442470 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Ax9-0005PT-FN; Fri, 14 Jan 2022 01:00:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257494.442470; Fri, 14 Jan 2022 01:00: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 1n8Ax9-0005Ox-CD; Fri, 14 Jan 2022 01:00:27 +0000
Received: by outflank-mailman (input) for mailman id 257494;
 Fri, 14 Jan 2022 01:00: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 1n8Ax8-00056s-Hu
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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 1n8Ax8-0004Mo-HH
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ax8-000604-Ge
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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=Dha+Dty1XIhhUxpjhRZyzIhVGdbBYSZuVt7skJo+xMM=; b=iwufVcpnEQvmTMdZWZtUJdJI8/
	u6OPey+zLvrk9xDYwxa9OwdIYzcL6Tpg4OsZhCV056flld499KK7psDZqJChXF/LtVp3lVD2F+Rlt
	HfDayW2ZxsQIFFCict9VKpv7JVkwvZCJ6ktArkC5RyCw7pSD2zDDypARZJkahaSkYvJs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] rcu: Introduce force_rcu notifier
Message-Id: <E1n8Ax8-000604-Ge@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:00:26 +0000

commit fceaefb43f059428cbedd81810c57b460cc80a79
Author:     Greg Kurz <groug@kaod.org>
AuthorDate: Tue Nov 9 19:35:22 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:25:55 2021 -0600

    rcu: Introduce force_rcu notifier
    
    The drain_rcu_call() function can be blocked as long as an RCU reader
    stays in a read-side critical section. This is typically what happens
    when a TCG vCPU is executing a busy loop. It can deadlock the QEMU
    monitor as reported in https://gitlab.com/qemu-project/qemu/-/issues/650 .
    
    This can be avoided by allowing drain_rcu_call() to enforce an RCU grace
    period. Since each reader might need to do specific actions to end a
    read-side critical section, do it with notifiers.
    
    Prepare ground for this by adding a notifier list to the RCU reader
    struct and use it in wait_for_readers() if drain_rcu_call() is in
    progress. An API is added for readers to register their notifiers.
    
    This is largely based on a draft from Paolo Bonzini.
    
    Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20211109183523.47726-2-groug@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit ef149763a8fcce70b85dfda27cc1222ecf765750)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 include/qemu/rcu.h | 15 +++++++++++++++
 util/rcu.c         | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index 515d327cf1..e69efbd47f 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -27,6 +27,7 @@
 #include "qemu/thread.h"
 #include "qemu/queue.h"
 #include "qemu/atomic.h"
+#include "qemu/notify.h"
 #include "qemu/sys_membarrier.h"
 
 #ifdef __cplusplus
@@ -66,6 +67,13 @@ struct rcu_reader_data {
 
     /* Data used for registry, protected by rcu_registry_lock */
     QLIST_ENTRY(rcu_reader_data) node;
+
+    /*
+     * NotifierList used to force an RCU grace period.  Accessed under
+     * rcu_registry_lock.  Note that the notifier is called _outside_
+     * the thread!
+     */
+    NotifierList force_rcu;
 };
 
 extern __thread struct rcu_reader_data rcu_reader;
@@ -180,6 +188,13 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(RCUReadAuto, rcu_read_auto_unlock)
 #define RCU_READ_LOCK_GUARD() \
     g_autoptr(RCUReadAuto) _rcu_read_auto __attribute__((unused)) = rcu_read_auto_lock()
 
+/*
+ * Force-RCU notifiers tell readers that they should exit their
+ * read-side critical section.
+ */
+void rcu_add_force_rcu_notifier(Notifier *n);
+void rcu_remove_force_rcu_notifier(Notifier *n);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/util/rcu.c b/util/rcu.c
index 13ac0f75cb..c91da9f137 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -46,6 +46,7 @@
 unsigned long rcu_gp_ctr = RCU_GP_LOCKED;
 
 QemuEvent rcu_gp_event;
+static int in_drain_call_rcu;
 static QemuMutex rcu_registry_lock;
 static QemuMutex rcu_sync_lock;
 
@@ -107,6 +108,8 @@ static void wait_for_readers(void)
                  * get some extra futex wakeups.
                  */
                 qatomic_set(&index->waiting, false);
+            } else if (qatomic_read(&in_drain_call_rcu)) {
+                notifier_list_notify(&index->force_rcu, NULL);
             }
         }
 
@@ -339,8 +342,10 @@ void drain_call_rcu(void)
      * assumed.
      */
 
+    qatomic_inc(&in_drain_call_rcu);
     call_rcu1(&rcu_drain.rcu, drain_rcu_callback);
     qemu_event_wait(&rcu_drain.drain_complete_event);
+    qatomic_dec(&in_drain_call_rcu);
 
     if (locked) {
         qemu_mutex_lock_iothread();
@@ -363,6 +368,20 @@ void rcu_unregister_thread(void)
     qemu_mutex_unlock(&rcu_registry_lock);
 }
 
+void rcu_add_force_rcu_notifier(Notifier *n)
+{
+    qemu_mutex_lock(&rcu_registry_lock);
+    notifier_list_add(&rcu_reader.force_rcu, n);
+    qemu_mutex_unlock(&rcu_registry_lock);
+}
+
+void rcu_remove_force_rcu_notifier(Notifier *n)
+{
+    qemu_mutex_lock(&rcu_registry_lock);
+    notifier_remove(n);
+    qemu_mutex_unlock(&rcu_registry_lock);
+}
+
 static void rcu_init_complete(void)
 {
     QemuThread thread;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:00:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:00:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257495.442474 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AxJ-0000Xx-Gk; Fri, 14 Jan 2022 01:00:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257495.442474; Fri, 14 Jan 2022 01:00: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 1n8AxJ-0000XR-De; Fri, 14 Jan 2022 01:00:37 +0000
Received: by outflank-mailman (input) for mailman id 257495;
 Fri, 14 Jan 2022 01:00: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 1n8AxI-0000Fr-Kw
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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 1n8AxI-0000BK-KG
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AxI-00060i-JY
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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=cE9cmDmE1fwUeNhBPveQAD17D+xAL8Fp6K1MY05iXOI=; b=IsQpzf+TtPMvJr3mt7uDrMGHXL
	ilqL22bHB/f/hUPfOKcr2dqxD1n3p/9/g704F/9vaTFF2dnM/mVfPguxFOzTJglTG2maI9yJ5Prq8
	6QJT45//9SchLmny9nCRDL5/77JXlLovAutUg71/8Co9dZmwmTqG6HiQCky1LRoZcGJQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] accel/tcg: Register a force_rcu notifier
Message-Id: <E1n8AxI-00060i-JY@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:00:36 +0000

commit 36c651c2264da6984c62173e2e0df77d76f064f5
Author:     Greg Kurz <groug@kaod.org>
AuthorDate: Tue Nov 9 19:35:23 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:26:01 2021 -0600

    accel/tcg: Register a force_rcu notifier
    
    A TCG vCPU doing a busy loop systematicaly hangs the QEMU monitor
    if the user passes 'device_add' without argument. This is because
    drain_cpu_all() which is called from qmp_device_add() cannot return
    if readers don't exit read-side critical sections. That is typically
    what busy-looping TCG vCPUs do:
    
    int cpu_exec(CPUState *cpu)
    {
    [...]
        rcu_read_lock();
    [...]
        while (!cpu_handle_exception(cpu, &ret)) {
            // Busy loop keeps vCPU here
        }
    [...]
        rcu_read_unlock();
    
        return ret;
    }
    
    For MTTCG, have all vCPU threads register a force_rcu notifier that will
    kick them out of the loop using async_run_on_cpu(). The notifier is called
    with the rcu_registry_lock mutex held, using async_run_on_cpu() ensures
    there are no deadlocks.
    
    For RR, a single thread runs all vCPUs. Just register a single notifier
    that kicks the current vCPU to the next one.
    
    For MTTCG:
    Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
    
    For RR:
    Suggested-by: Richard Henderson <richard.henderson@linaro.org>
    
    Fixes: 7bed89958bfb ("device_core: use drain_call_rcu in in qmp_device_add")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/650
    Signed-off-by: Greg Kurz <groug@kaod.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20211109183523.47726-3-groug@kaod.org>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit dd47a8f654d84f666b235ce8891e17ee76f9be8b)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 accel/tcg/tcg-accel-ops-mttcg.c | 26 ++++++++++++++++++++++++++
 accel/tcg/tcg-accel-ops-rr.c    | 10 ++++++++++
 2 files changed, 36 insertions(+)

diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c
index 847d2079d2..29632bd4c0 100644
--- a/accel/tcg/tcg-accel-ops-mttcg.c
+++ b/accel/tcg/tcg-accel-ops-mttcg.c
@@ -28,6 +28,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/replay.h"
 #include "qemu/main-loop.h"
+#include "qemu/notify.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
 #include "hw/boards.h"
@@ -35,6 +36,26 @@
 #include "tcg-accel-ops.h"
 #include "tcg-accel-ops-mttcg.h"
 
+typedef struct MttcgForceRcuNotifier {
+    Notifier notifier;
+    CPUState *cpu;
+} MttcgForceRcuNotifier;
+
+static void do_nothing(CPUState *cpu, run_on_cpu_data d)
+{
+}
+
+static void mttcg_force_rcu(Notifier *notify, void *data)
+{
+    CPUState *cpu = container_of(notify, MttcgForceRcuNotifier, notifier)->cpu;
+
+    /*
+     * Called with rcu_registry_lock held, using async_run_on_cpu() ensures
+     * that there are no deadlocks.
+     */
+    async_run_on_cpu(cpu, do_nothing, RUN_ON_CPU_NULL);
+}
+
 /*
  * In the multi-threaded case each vCPU has its own thread. The TLS
  * variable current_cpu can be used deep in the code to find the
@@ -43,12 +64,16 @@
 
 static void *mttcg_cpu_thread_fn(void *arg)
 {
+    MttcgForceRcuNotifier force_rcu;
     CPUState *cpu = arg;
 
     assert(tcg_enabled());
     g_assert(!icount_enabled());
 
     rcu_register_thread();
+    force_rcu.notifier.notify = mttcg_force_rcu;
+    force_rcu.cpu = cpu;
+    rcu_add_force_rcu_notifier(&force_rcu.notifier);
     tcg_register_thread();
 
     qemu_mutex_lock_iothread();
@@ -100,6 +125,7 @@ static void *mttcg_cpu_thread_fn(void *arg)
 
     tcg_cpus_destroy(cpu);
     qemu_mutex_unlock_iothread();
+    rcu_remove_force_rcu_notifier(&force_rcu.notifier);
     rcu_unregister_thread();
     return NULL;
 }
diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c
index c02c061ecb..aa5b4ac247 100644
--- a/accel/tcg/tcg-accel-ops-rr.c
+++ b/accel/tcg/tcg-accel-ops-rr.c
@@ -28,6 +28,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/replay.h"
 #include "qemu/main-loop.h"
+#include "qemu/notify.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
 
@@ -135,6 +136,11 @@ static void rr_deal_with_unplugged_cpus(void)
     }
 }
 
+static void rr_force_rcu(Notifier *notify, void *data)
+{
+    rr_kick_next_cpu();
+}
+
 /*
  * In the single-threaded case each vCPU is simulated in turn. If
  * there is more than a single vCPU we create a simple timer to kick
@@ -145,10 +151,13 @@ static void rr_deal_with_unplugged_cpus(void)
 
 static void *rr_cpu_thread_fn(void *arg)
 {
+    Notifier force_rcu;
     CPUState *cpu = arg;
 
     assert(tcg_enabled());
     rcu_register_thread();
+    force_rcu.notify = rr_force_rcu;
+    rcu_add_force_rcu_notifier(&force_rcu);
     tcg_register_thread();
 
     qemu_mutex_lock_iothread();
@@ -257,6 +266,7 @@ static void *rr_cpu_thread_fn(void *arg)
         rr_deal_with_unplugged_cpus();
     }
 
+    rcu_remove_force_rcu_notifier(&force_rcu);
     rcu_unregister_thread();
     return NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:00:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:00:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257496.442478 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AxT-0004FL-IL; Fri, 14 Jan 2022 01:00:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257496.442478; Fri, 14 Jan 2022 01:00: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 1n8AxT-0004Et-FB; Fri, 14 Jan 2022 01:00:47 +0000
Received: by outflank-mailman (input) for mailman id 257496;
 Fri, 14 Jan 2022 01:00: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 1n8AxS-0003zL-OR
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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 1n8AxS-0004B3-Nc
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AxS-00061I-Mq
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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=KT4/BNM9yauTPmCTN4qfr/Ji0AYj2xC+vXVLkq/QpE0=; b=p/qggCh5fnLmZSLlyYUXmWFgWd
	61ag2xgN7JZqNCbJefCthAAxhmhzlcGrxmTKiTJpiW4rKvBtZR79kMF8IH/QIG9yySgqmoz8oPZH8
	i6iARQ0jvHCh+AZg3ql0ah2oC/KfXvmsqWhBh//HDpUh2QFoes00EI/ff/XWeDloZ2ZI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] pcie: rename 'native-hotplug' to 'x-native-hotplug'
Message-Id: <E1n8AxS-00061I-Mq@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:00:46 +0000

commit 7204b8f3c61cb2f0d6f81a4261a2ba7298a007ba
Author:     Igor Mammedov <imammedo@redhat.com>
AuthorDate: Fri Nov 12 06:08:53 2021 -0500
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:38:08 2021 -0600

    pcie: rename 'native-hotplug' to 'x-native-hotplug'
    
    Mark property as experimental/internal adding 'x-' prefix.
    
    Property was introduced in 6.1 and it should have provided
    ability to turn on native PCIE hotplug on port even when
    ACPI PCI hotplug is in use is user explicitly sets property
    on CLI. However that never worked since slot is wired to
    ACPI hotplug controller.
    Another non-intended usecase: disable native hotplug on slot
    when APCI based hotplug is disabled, which works but slot has
    'hotplug' property for this taks.
    
    It should be relatively safe to rename it to experimental
    as no users should exist for it and given that the property
    is broken we don't really want to leave it around for much
    longer lest users start using it.
    
    Signed-off-by: Igor Mammedov <imammedo@redhat.com>
    Reviewed-by: Ani Sinha <ani@anisinha.ca>
    Message-Id: <20211112110857.3116853-2-imammedo@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 2aa1842d6d79dcd1b84c58eeb44591a99a9e56df)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/i386/pc_q35.c   | 2 +-
 hw/pci/pcie_port.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 04b4a4788d..9070544a90 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -243,7 +243,7 @@ static void pc_q35_init(MachineState *machine)
                                           NULL);
 
     if (acpi_pcihp) {
-        object_register_sugar_prop(TYPE_PCIE_SLOT, "native-hotplug",
+        object_register_sugar_prop(TYPE_PCIE_SLOT, "x-native-hotplug",
                                    "false", true);
     }
 
diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c
index da850e8dde..e95c1e5519 100644
--- a/hw/pci/pcie_port.c
+++ b/hw/pci/pcie_port.c
@@ -148,7 +148,7 @@ static Property pcie_slot_props[] = {
     DEFINE_PROP_UINT8("chassis", PCIESlot, chassis, 0),
     DEFINE_PROP_UINT16("slot", PCIESlot, slot, 0),
     DEFINE_PROP_BOOL("hotplug", PCIESlot, hotplug, true),
-    DEFINE_PROP_BOOL("native-hotplug", PCIESlot, native_hotplug, true),
+    DEFINE_PROP_BOOL("x-native-hotplug", PCIESlot, native_hotplug, true),
     DEFINE_PROP_END_OF_LIST()
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:00:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:00:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257497.442482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Axd-00089V-L5; Fri, 14 Jan 2022 01:00:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257497.442482; Fri, 14 Jan 2022 01:00:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Axd-00088y-IF; Fri, 14 Jan 2022 01:00:57 +0000
Received: by outflank-mailman (input) for mailman id 257497;
 Fri, 14 Jan 2022 01:00: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 1n8Axc-0007rT-Rk
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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 1n8Axc-00085a-R1
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Axc-000624-Q8
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:00: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=3pNegaTojiGjtFRZBSlhcjgVFB9wVVnoql2bz7LXIcQ=; b=1MT6wkpFBy0XBEEKwJDT20k0mY
	2Zvu3jw83c6v8raxZHcZuew+U/xG24LGg/Jqh/ajsiVsTXBexn3JXUZtoqpjV51YxFkbzs+cXyunI
	Wan4/LIi1SEWXH+DxTdFwuGen/KQhR3CGnKrGlJrNh94Axjegpu09uLjKZUPwtm/6USA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] virtio: use virtio accessor to access packed descriptor flags
Message-Id: <E1n8Axc-000624-Q8@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:00:56 +0000

commit df1c9c3039e5ded39ae6b37b62b8d064acfe7dd5
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Nov 11 14:38:53 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:43:18 2021 -0600

    virtio: use virtio accessor to access packed descriptor flags
    
    We used to access packed descriptor flags via
    address_space_{write|read}_cached(). When we hit the cache, memcpy()
    is used which is not an atomic operation which may lead a wrong value
    is read or wrote.
    
    So this patch switches to use virito_{stw|lduw}_phys_cached() to make
    sure the aceess is atomic.
    
    Fixes: 86044b24e865f ("virtio: basic packed virtqueue support")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20211111063854.29060-1-jasowang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit f463e761a41ee71e59892121e1c74d9c25c985d2)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 874377f37a..2dbccb6b3f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -509,11 +509,9 @@ static void vring_packed_desc_read_flags(VirtIODevice *vdev,
                                          MemoryRegionCache *cache,
                                          int i)
 {
-    address_space_read_cached(cache,
-                              i * sizeof(VRingPackedDesc) +
-                              offsetof(VRingPackedDesc, flags),
-                              flags, sizeof(*flags));
-    virtio_tswap16s(vdev, flags);
+    hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags);
+
+    *flags = virtio_lduw_phys_cached(vdev, cache, off);
 }
 
 static void vring_packed_desc_read(VirtIODevice *vdev,
@@ -566,8 +564,7 @@ static void vring_packed_desc_write_flags(VirtIODevice *vdev,
 {
     hwaddr off = i * sizeof(VRingPackedDesc) + offsetof(VRingPackedDesc, flags);
 
-    virtio_tswap16s(vdev, &desc->flags);
-    address_space_write_cached(cache, off, &desc->flags, sizeof(desc->flags));
+    virtio_stw_phys_cached(vdev, cache, off, desc->flags);
     address_space_cache_invalidate(cache, off, sizeof(desc->flags));
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:01:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:01:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257498.442485 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Axo-00047r-Ml; Fri, 14 Jan 2022 01:01:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257498.442485; Fri, 14 Jan 2022 01:01: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 1n8Axo-00047D-Ji; Fri, 14 Jan 2022 01:01:08 +0000
Received: by outflank-mailman (input) for mailman id 257498;
 Fri, 14 Jan 2022 01:01: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 1n8Axm-0003T3-Uz
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01: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 1n8Axm-0003fi-UA
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Axm-000634-TT
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01: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=SUtxWN1WphmKtSnA2WGkO6ziCnf6/m2QZmFQP1XwjW0=; b=K+U9I+hCwiZk5GSWR6fpVg7Q6j
	eGg2OKs+BJm8iG/KW1xQ8K2zzdphFWAudnY298AgLJZ2FqfL8JTMQ9qQYD/AEyKCaB3GPzc2+Wi0k
	g0dq3ZqUinHprMJ02hUFwX/4fc1b9y9KveVpbE9AHVpS+CgUrXWyg5k1xeFylLe7fgmU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] virtio: use virtio accessor to access packed event
Message-Id: <E1n8Axm-000634-TT@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:01:06 +0000

commit 08e46e6d92b979743f4f0fb36e587b5e75a0bde6
Author:     Jason Wang <jasowang@redhat.com>
AuthorDate: Thu Nov 11 14:38:54 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:43:25 2021 -0600

    virtio: use virtio accessor to access packed event
    
    We used to access packed descriptor event and off_wrap via
    address_space_{write|read}_cached(). When we hit the cache, memcpy()
    is used which is not atomic which may lead a wrong value to be read or
    wrote.
    
    This patch fixes this by switching to use
    virito_{stw|lduw}_phys_cached() to make sure the access is atomic.
    
    Fixes: 683f7665679c1 ("virtio: event suppression support for packed ring")
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Message-Id: <20211111063854.29060-2-jasowang@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d152cdd6f6fad381e804c8185f0ba938030ccac9)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/virtio/virtio.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 2dbccb6b3f..c9567f09ed 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -249,13 +249,10 @@ static void vring_packed_event_read(VirtIODevice *vdev,
     hwaddr off_off = offsetof(VRingPackedDescEvent, off_wrap);
     hwaddr off_flags = offsetof(VRingPackedDescEvent, flags);
 
-    address_space_read_cached(cache, off_flags, &e->flags,
-                              sizeof(e->flags));
+    e->flags = virtio_lduw_phys_cached(vdev, cache, off_flags);
     /* Make sure flags is seen before off_wrap */
     smp_rmb();
-    address_space_read_cached(cache, off_off, &e->off_wrap,
-                              sizeof(e->off_wrap));
-    virtio_tswap16s(vdev, &e->off_wrap);
+    e->off_wrap = virtio_lduw_phys_cached(vdev, cache, off_off);
     virtio_tswap16s(vdev, &e->flags);
 }
 
@@ -265,8 +262,7 @@ static void vring_packed_off_wrap_write(VirtIODevice *vdev,
 {
     hwaddr off = offsetof(VRingPackedDescEvent, off_wrap);
 
-    virtio_tswap16s(vdev, &off_wrap);
-    address_space_write_cached(cache, off, &off_wrap, sizeof(off_wrap));
+    virtio_stw_phys_cached(vdev, cache, off, off_wrap);
     address_space_cache_invalidate(cache, off, sizeof(off_wrap));
 }
 
@@ -275,8 +271,7 @@ static void vring_packed_flags_write(VirtIODevice *vdev,
 {
     hwaddr off = offsetof(VRingPackedDescEvent, flags);
 
-    virtio_tswap16s(vdev, &flags);
-    address_space_write_cached(cache, off, &flags, sizeof(flags));
+    virtio_stw_phys_cached(vdev, cache, off, flags);
     address_space_cache_invalidate(cache, off, sizeof(flags));
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:01:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:01:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257499.442490 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Axy-00089m-Oz; Fri, 14 Jan 2022 01:01:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257499.442490; Fri, 14 Jan 2022 01:01: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 1n8Axy-00089H-Ld; Fri, 14 Jan 2022 01:01:18 +0000
Received: by outflank-mailman (input) for mailman id 257499;
 Fri, 14 Jan 2022 01:01: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 1n8Axx-0007VA-24
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01: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 1n8Axx-0007mk-1G
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Axx-00063h-0R
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01: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=WI2KEUwcb1M3tvr6N7ezToZxSD5dvKp0ZJYqaajdGig=; b=jVsYXWC4g/xTt6iEgEIZUsW8y8
	IiD4uh0n6ntTwyBX2fu1p6egrUqfxr6V/TepDyER8xhtkRKfcAdtU0fMqy1g79lDGKsoYXmQLJeyu
	qePSi6jxOIYq4QwrVHIYcoBWiKoyCzsbtoxv+9GZGnMFecfI3wacJJvorKRLS4E0zO+0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] vfio: Fix memory leak of hostwin
Message-Id: <E1n8Axx-00063h-0R@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:01:17 +0000

commit 8c2d5911debfd00a7e8b3d8989c23e892c872043
Author:     Peng Liang <liangpeng10@huawei.com>
AuthorDate: Wed Nov 17 09:47:39 2021 +0800
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:49:55 2021 -0600

    vfio: Fix memory leak of hostwin
    
    hostwin is allocated and added to hostwin_list in vfio_host_win_add, but
    it is only deleted from hostwin_list in vfio_host_win_del, which causes
    a memory leak.  Also, freeing all elements in hostwin_list is missing in
    vfio_disconnect_container.
    
    Fix: 2e4109de8e58 ("vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2)")
    CC: qemu-stable@nongnu.org
    Signed-off-by: Peng Liang <liangpeng10@huawei.com>
    Link: https://lore.kernel.org/r/20211117014739.1839263-1-liangpeng10@huawei.com
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    (cherry picked from commit f3bc3a73c908df15966e66f88d5a633bd42fd029)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/vfio/common.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 8728d4d5c2..af37346aca 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -551,6 +551,7 @@ static int vfio_host_win_del(VFIOContainer *container, hwaddr min_iova,
     QLIST_FOREACH(hostwin, &container->hostwin_list, hostwin_next) {
         if (hostwin->min_iova == min_iova && hostwin->max_iova == max_iova) {
             QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
             return 0;
         }
     }
@@ -2230,6 +2231,7 @@ static void vfio_disconnect_container(VFIOGroup *group)
     if (QLIST_EMPTY(&container->group_list)) {
         VFIOAddressSpace *space = container->space;
         VFIOGuestIOMMU *giommu, *tmp;
+        VFIOHostDMAWindow *hostwin, *next;
 
         QLIST_REMOVE(container, next);
 
@@ -2240,6 +2242,12 @@ static void vfio_disconnect_container(VFIOGroup *group)
             g_free(giommu);
         }
 
+        QLIST_FOREACH_SAFE(hostwin, &container->hostwin_list, hostwin_next,
+                           next) {
+            QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
+        }
+
         trace_vfio_disconnect_container(container->fd);
         close(container->fd);
         g_free(container);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:01:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:01:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257500.442494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Ay8-0003qY-Q4; Fri, 14 Jan 2022 01:01:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257500.442494; Fri, 14 Jan 2022 01:01: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 1n8Ay8-0003q2-N5; Fri, 14 Jan 2022 01:01:28 +0000
Received: by outflank-mailman (input) for mailman id 257500;
 Fri, 14 Jan 2022 01:01: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 1n8Ay7-0003AS-5E
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01: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 1n8Ay7-0003i6-4R
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ay7-00064G-3n
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01: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=4YkmTP6lKwlx8NVayh4jXaszHQ1iEUOR+uFdwFA+oiw=; b=DMouSE0MMSxN+GnvPfq2vnX3A9
	RQ1RzLaI3jbCWYfTzlbB/uaIlIP4+x2T6xGtazsnYGearpztqEluA/dO8p1d/wIpZunhYW3oQJfJb
	h5IfRf6nCE6LiPcQL4/agvupDiFqBMgWwqLTSfMit+c2kJqKHQMd9cFc2yWoGjMZTXy8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] nbd/server: Don't complain on certain client disconnects
Message-Id: <E1n8Ay7-00064G-3n@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:01:27 +0000

commit 932333c5f00ef5697ce4e1f81750bb4dcee958a1
Author:     Eric Blake <eblake@redhat.com>
AuthorDate: Wed Nov 17 11:02:29 2021 -0600
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:51:17 2021 -0600

    nbd/server: Don't complain on certain client disconnects
    
    When a client disconnects abruptly, but did not have any pending
    requests (for example, when using nbdsh without calling h.shutdown),
    we used to output the following message:
    
    $ qemu-nbd -f raw file
    $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)'
    qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
    
    Then in commit f148ae7, we refactored nbd_receive_request() to use
    nbd_read_eof(); when this returns 0, we regressed into tracing
    uninitialized memory (if tracing is enabled) and reporting a
    less-specific:
    
    qemu-nbd: Disconnect client, due to: Request handling failed in intermediate state
    
    Note that with Unix sockets, we have yet another error message,
    unchanged by the 6.0 regression:
    
    $ qemu-nbd -k /tmp/sock -f raw file
    $ nbdsh -u 'nbd+unix:///?socket=/tmp/sock' -c 'h.trim(1,0)'
    qemu-nbd: Disconnect client, due to: Failed to send reply: Unable to write to socket: Broken pipe
    
    But in all cases, the error message goes away if the client performs a
    soft shutdown by using NBD_CMD_DISC, rather than a hard shutdown by
    abrupt disconnect:
    
    $ nbdsh -u 'nbd://localhost:10809' -c 'h.trim(1,0)' -c 'h.shutdown()'
    
    This patch fixes things to avoid uninitialized memory, and in general
    avoids warning about a client that does a hard shutdown when not in
    the middle of a packet.  A client that aborts mid-request, or which
    does not read the full server's reply, can still result in warnings,
    but those are indeed much more unusual situations.
    
    CC: qemu-stable@nongnu.org
    Fixes: f148ae7d36 ("nbd/server: Quiesce coroutines on context switch", v6.0.0)
    Signed-off-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    [eblake: defer unrelated typo fixes to later patch]
    Message-Id: <20211117170230.1128262-2-eblake@redhat.com>
    Signed-off-by: Eric Blake <eblake@redhat.com>
    (cherry picked from commit 1644cccea5c71b02b9cf8f78b780e7069a29b189)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 nbd/server.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nbd/server.c b/nbd/server.c
index 3927f7789d..83aeed51c7 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1413,6 +1413,9 @@ static int nbd_receive_request(NBDClient *client, NBDRequest *request,
     if (ret < 0) {
         return ret;
     }
+    if (ret == 0) {
+        return -EIO;
+    }
 
     /* Request
        [ 0 ..  3]   magic   (NBD_REQUEST_MAGIC)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:01:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:01:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257501.442499 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AyI-0007jl-Rq; Fri, 14 Jan 2022 01:01:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257501.442499; Fri, 14 Jan 2022 01:01:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AyI-0007j9-Oc; Fri, 14 Jan 2022 01:01:38 +0000
Received: by outflank-mailman (input) for mailman id 257501;
 Fri, 14 Jan 2022 01:01:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AyH-00077x-8d
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AyH-00088E-7w
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AyH-00064o-77
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GKofGeAIqP1Ppik5CvhEj2RYMz87qhCW6jNegaDOwQk=; b=KAnIL01ZdRXFA/NpWeARrZe/hK
	lwMACBSrAF1EdJ6e6J3iXNE+iJ+6029j1aqbhOteu4qSGGxGfg9v+on/fXmXRjqepC/BXekkOnYie
	L5XEQT80it1Ygm/+91g1LUzKFkVG4QAVyESqRBdUdqq8xTMEjRrcENxU8qucSP/zUW/s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
Message-Id: <E1n8AyH-00064o-77@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:01:37 +0000

commit 2b2eb343a01bb84a9d988158f706a65b57604d65
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Wed Nov 17 14:12:56 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:52:50 2021 -0600

    hw/nvme: fix buffer overrun in nvme_changed_nslist (CVE-2021-3947)
    
    Fix missing offset verification.
    
    Cc: qemu-stable@nongnu.org
    Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
    Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
    Fixes: f432fdfa121 ("support changed namespace asynchronous event")
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit e2c57529c9306e4c9aac75d9879f6e7699584a22)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/nvme/ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 6baf9e0420..27dddb87bd 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4164,6 +4164,11 @@ static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint8_t rae, uint32_t buf_len,
     int i = 0;
     uint32_t nsid;
 
+    if (off >= sizeof(nslist)) {
+        trace_pci_nvme_err_invalid_log_page_offset(off, sizeof(nslist));
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+
     memset(nslist, 0x0, sizeof(nslist));
     trans_len = MIN(sizeof(nslist) - off, buf_len);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:01:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:01:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257502.442502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AyS-000350-T5; Fri, 14 Jan 2022 01:01:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257502.442502; Fri, 14 Jan 2022 01:01: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 1n8AyS-00034Q-Q7; Fri, 14 Jan 2022 01:01:48 +0000
Received: by outflank-mailman (input) for mailman id 257502;
 Fri, 14 Jan 2022 01:01:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AyR-0002Vq-Bx
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AyR-00046M-BG
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AyR-00065L-AI
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Uv6+Re7tS1fT4NyTnwcFTh78hyTSm/No/9rDhjoA6JE=; b=zheWpMszfTDSc9/FV/oxhbDZbM
	FEOU8PPfTACpygW6EVKUoNFwmcU6q/XgEhPmrSKFY9gA/1/2GvzbXKPY2AqQA9j7CiYWPlUZ6VJdg
	ikugbKfhTeq8EBGyHuuBtCgvnVBrykoUjyjv9fTuTcMROk89iqcNIw3pYL8glGlh9cJo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] chardev/wctable: don't free the instance in wctablet_chr_finalize
Message-Id: <E1n8AyR-00065L-AI@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:01:47 +0000

commit 4658dfcbc09dcc90025604cce64d6fd01952b882
Author:     Daniil Tatianin <d-tatianin@yandex-team.ru>
AuthorDate: Wed Nov 17 17:23:49 2021 +0300
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 14:54:14 2021 -0600

    chardev/wctable: don't free the instance in wctablet_chr_finalize
    
    Object is supposed to be freed by invoking obj->free, and not
    obj->instance_finalize. This would lead to use-after-free followed by
    double free in object_unref/object_finalize.
    
    Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20211117142349.836279-1-d-tatianin@yandex-team.ru>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit fdc6e168181d06391711171b7c409b34f2981ced)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 chardev/wctablet.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/chardev/wctablet.c b/chardev/wctablet.c
index 95e005f5a5..e8b292c43c 100644
--- a/chardev/wctablet.c
+++ b/chardev/wctablet.c
@@ -320,7 +320,6 @@ static void wctablet_chr_finalize(Object *obj)
     TabletChardev *tablet = WCTABLET_CHARDEV(obj);
 
     qemu_input_handler_unregister(tablet->hs);
-    g_free(tablet);
 }
 
 static void wctablet_chr_open(Chardev *chr,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:01:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:01:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257504.442506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Ayc-0006uW-Ui; Fri, 14 Jan 2022 01:01:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257504.442506; Fri, 14 Jan 2022 01:01: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 1n8Ayc-0006uO-RZ; Fri, 14 Jan 2022 01:01:58 +0000
Received: by outflank-mailman (input) for mailman id 257504;
 Fri, 14 Jan 2022 01:01:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ayb-0006Sd-F1
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ayb-00005Z-EO
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ayb-00065x-Di
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:01:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GIsXZES/wC3plN02hnSPrfn+utNvpsU/aiiAvvzTDQI=; b=WGXi/kJ4r2PoeoXXo4Ap2vvzqJ
	3BXUCTVWbEK7HBNSFfLMp5pjgl7fwEfHMvoLB8NOwNzB9g2Wa2XJqfH7cg6bGeOOX6z+DLamuMcsT
	uoYYMsFi+t49W+I3FJLm9p2QbjBNckV6SUWkwR/yX8VadzUFjNy2zTokHLvJ7OKmQTh0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw/block/fdc: Extract blk_create_empty_drive()
Message-Id: <E1n8Ayb-00065x-Di@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:01:57 +0000

commit 7629818574eb67d2a9eb5db313c935bcf1d4e557
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:34 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:04:59 2021 -0600

    hw/block/fdc: Extract blk_create_empty_drive()
    
    We are going to re-use this code in the next commit,
    so extract it as a new blk_create_empty_drive() function.
    
    Inspired-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-2-philmd@redhat.com
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit b154791e7b6d4ca5cdcd54443484d97360bd7ad2)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/fdc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 9014cd30b3..c3e09973ca 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -61,6 +61,12 @@
     } while (0)
 
 
+/* Anonymous BlockBackend for empty drive */
+static BlockBackend *blk_create_empty_drive(void)
+{
+    return blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
+}
+
 /********************************************************/
 /* qdev floppy bus                                      */
 
@@ -486,8 +492,7 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp)
     }
 
     if (!dev->conf.blk) {
-        /* Anonymous BlockBackend for an empty drive */
-        dev->conf.blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
+        dev->conf.blk = blk_create_empty_drive();
         ret = blk_attach_dev(dev->conf.blk, qdev);
         assert(ret == 0);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:02:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:02:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257505.442510 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Ayn-0007j1-0X; Fri, 14 Jan 2022 01:02:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257505.442510; Fri, 14 Jan 2022 01:02: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 1n8Aym-0007iu-T7; Fri, 14 Jan 2022 01:02:08 +0000
Received: by outflank-mailman (input) for mailman id 257505;
 Fri, 14 Jan 2022 01:02: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 1n8Ayl-0007im-I7
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ayl-0003yy-HP
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ayl-00066c-Gm
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=auyOg2EH8Jyq4ulPZJAU6PTS2OgSuyu88A7Kfxil+ZA=; b=s2A4E/YtAJAKAYBkDCo+a6b16a
	t9suMxJ3ZdNKViOKzLkUv+L/tYKzFLdx27nzyP8/lgiCWvRwvAEmmn2f863znBhXyneGkVc4+o+Y5
	rnqo0ivFd7LFi29v75MTKJWktvb0/J8lYkKUgO0KuXGu7+rTcb1if8EzdnnmnSq2EkL4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196
Message-Id: <E1n8Ayl-00066c-Gm@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:02:07 +0000

commit 71ba2adfeb4ca63015d4a51a665e67c46a06e822
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:35 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:05:05 2021 -0600

    hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196
    
    Guest might select another drive on the bus by setting the
    DRIVE_SEL bit of the DIGITAL OUTPUT REGISTER (DOR).
    The current controller model doesn't expect a BlockBackend
    to be NULL. A simple way to fix CVE-2021-20196 is to create
    an empty BlockBackend when it is missing. All further
    accesses will be safely handled, and the controller state
    machines keep behaving correctly.
    
    Cc: qemu-stable@nongnu.org
    Fixes: CVE-2021-20196
    Reported-by: Gaoning Pan (Ant Security Light-Year Lab) <pgn@zju.edu.cn>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-3-philmd@redhat.com
    BugLink: https://bugs.launchpad.net/qemu/+bug/1912780
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/338
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Hanna Reitz <hreitz@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 1ab95af033a419e7a64e2d58e67dd96b20af5233)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/fdc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index c3e09973ca..af398c1116 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -1166,7 +1166,19 @@ static FDrive *get_drv(FDCtrl *fdctrl, int unit)
 
 static FDrive *get_cur_drv(FDCtrl *fdctrl)
 {
-    return get_drv(fdctrl, fdctrl->cur_drv);
+    FDrive *cur_drv = get_drv(fdctrl, fdctrl->cur_drv);
+
+    if (!cur_drv->blk) {
+        /*
+         * Kludge: empty drive line selected. Create an anonymous
+         * BlockBackend to avoid NULL deref with various BlockBackend
+         * API calls within this model (CVE-2021-20196).
+         * Due to the controller QOM model limitations, we don't
+         * attach the created to the controller device.
+         */
+        cur_drv->blk = blk_create_empty_drive();
+    }
+    return cur_drv;
 }
 
 /* Status A register : 0x00 (read-only) */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:02:19 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:02:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257506.442513 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Ayx-0007mD-38; Fri, 14 Jan 2022 01:02:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257506.442513; Fri, 14 Jan 2022 01:02:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Ayx-0007m5-0L; Fri, 14 Jan 2022 01:02:19 +0000
Received: by outflank-mailman (input) for mailman id 257506;
 Fri, 14 Jan 2022 01:02: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 1n8Ayv-0007lt-LA
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02: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 1n8Ayv-00043J-KO
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Ayv-000679-Je
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02: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=0VFmDuLSp5wpJY45Bsm5OneTSLCnrFPFa7hscpEXmcA=; b=dcY+g3iHFSvjDaVi1pE3GpcU4g
	xz7rhiDXixzI+C1so9lYJCuowuEWgxwc0Or1slgmVpKvPMf2uxuHNSuXtsuKeSGdlHifmkPWyHvCM
	YWcaf/PoSdfwKtyftQ1G1LjP+Mwhw2PE3/MzA6GXliZvaKDvRNn5LdW4CAqsPBsL7nYE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196
Message-Id: <E1n8Ayv-000679-Je@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:02:17 +0000

commit ef0cf1887ee9acb21a8d7a06e83bdbbae0fdf9e6
Author:     Philippe Mathieu-Daudé <philmd@redhat.com>
AuthorDate: Wed Nov 24 17:15:36 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:05:11 2021 -0600

    tests/qtest/fdc-test: Add a regression test for CVE-2021-20196
    
    Without the previous commit, when running 'make check-qtest-i386'
    with QEMU configured with '--enable-sanitizers' we get:
    
      AddressSanitizer:DEADLYSIGNAL
      =================================================================
      ==287878==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000344
      ==287878==The signal is caused by a WRITE memory access.
      ==287878==Hint: address points to the zero page.
          #0 0x564b2e5bac27 in blk_inc_in_flight block/block-backend.c:1346:5
          #1 0x564b2e5bb228 in blk_pwritev_part block/block-backend.c:1317:5
          #2 0x564b2e5bcd57 in blk_pwrite block/block-backend.c:1498:11
          #3 0x564b2ca1cdd3 in fdctrl_write_data hw/block/fdc.c:2221:17
          #4 0x564b2ca1b2f7 in fdctrl_write hw/block/fdc.c:829:9
          #5 0x564b2dc49503 in portio_write softmmu/ioport.c:201:9
    
    Add the reproducer for CVE-2021-20196.
    
    Suggested-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20211124161536.631563-4-philmd@redhat.com
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit cc20926e9b8077bff6813efc8dcdeae90d1a3b10)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/qtest/fdc-test.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
index 26b69f7c5c..8f6eee84a4 100644
--- a/tests/qtest/fdc-test.c
+++ b/tests/qtest/fdc-test.c
@@ -32,6 +32,9 @@
 /* TODO actually test the results and get rid of this */
 #define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__))
 
+#define DRIVE_FLOPPY_BLANK \
+    "-drive if=floppy,file=null-co://,file.read-zeroes=on,format=raw,size=1440k"
+
 #define TEST_IMAGE_SIZE 1440 * 1024
 
 #define FLOPPY_BASE 0x3f0
@@ -546,6 +549,40 @@ static void fuzz_registers(void)
     }
 }
 
+static bool qtest_check_clang_sanitizer(void)
+{
+#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
+    return true;
+#else
+    g_test_skip("QEMU not configured using --enable-sanitizers");
+    return false;
+#endif
+}
+static void test_cve_2021_20196(void)
+{
+    QTestState *s;
+
+    if (!qtest_check_clang_sanitizer()) {
+        return;
+    }
+
+    s = qtest_initf("-nographic -m 32M -nodefaults " DRIVE_FLOPPY_BLANK);
+
+    qtest_outw(s, 0x3f4, 0x0500);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outw(s, 0x3f1, 0x0400);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outw(s, 0x3f4, 0x0000);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_outb(s, 0x3f5, 0x01);
+    qtest_outw(s, 0x3f1, 0x0500);
+    qtest_outb(s, 0x3f5, 0x00);
+    qtest_quit(s);
+}
+
 int main(int argc, char **argv)
 {
     int fd;
@@ -576,6 +613,7 @@ int main(int argc, char **argv)
     qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18);
     qtest_add_func("/fdc/read_no_dma_19", test_read_no_dma_19);
     qtest_add_func("/fdc/fuzz-registers", fuzz_registers);
+    qtest_add_func("/fdc/fuzz/cve_2021_20196", test_cve_2021_20196);
 
     ret = g_test_run();
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:02:29 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:02:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257507.442518 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Az7-0007p6-4d; Fri, 14 Jan 2022 01:02:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257507.442518; Fri, 14 Jan 2022 01:02:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Az7-0007ox-1m; Fri, 14 Jan 2022 01:02:29 +0000
Received: by outflank-mailman (input) for mailman id 257507;
 Fri, 14 Jan 2022 01:02: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 1n8Az5-0007oq-OV
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02: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 1n8Az5-00043V-Nj
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Az5-00067j-Mr
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02: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=U0WZqo8FUm11hclDmvfDBN8nkIax0JqFvNHuKnbdKQc=; b=Ns8ZXsd3Pt8i2JZq+ZUAfhV76o
	iW+85khvPIXOZfh2CsB4ttq9HBETRPjQeQ40b7ncJypWE2vatO5Uap/CmZvpHag1jEIiVLFESbbG0
	q4Cb6Ieg2937r5rva/cSZ/pC1fFVVLx2963REWkI3iy2a5Ht4TyabJB0biIhNFw8TXVQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] virtio-blk: Fix clean up of host notifiers for single MR transaction.
Message-Id: <E1n8Az5-00067j-Mr@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:02:27 +0000

commit fec12fc8882b7326e820696ef81da3f1deeca11b
Author:     Mark Mielke <mark.mielke@gmail.com>
AuthorDate: Thu Dec 2 11:26:51 2021 -0500
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 15:10:56 2021 -0600

    virtio-blk: Fix clean up of host notifiers for single MR transaction.
    
    The code that introduced "virtio-blk: Configure all host notifiers in
    a single MR transaction" introduced a second loop variable to perform
    cleanup in second loop, but mistakenly still refers to the first
    loop variable within the second loop body.
    
    Fixes: d0267da61489 ("virtio-blk: Configure all host notifiers in a single MR transaction")
    Signed-off-by: Mark Mielke <mark.mielke@gmail.com>
    Message-id: CALm7yL08qarOu0dnQkTN+pa=BSRC92g31YpQQNDeAiT4yLZWQQ@mail.gmail.com
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit 5b807181c27a940a3a7ad1f221a2e76a132cbdc0)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/block/dataplane/virtio-blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 252c3a7a23..ee5a5352dc 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -222,7 +222,7 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
             memory_region_transaction_commit();
 
             while (j--) {
-                virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
+                virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), j);
             }
             goto fail_host_notifiers;
         }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:02:39 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:02:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257508.442522 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AzH-0007rz-6H; Fri, 14 Jan 2022 01:02:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257508.442522; Fri, 14 Jan 2022 01:02:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AzH-0007rn-3D; Fri, 14 Jan 2022 01:02:39 +0000
Received: by outflank-mailman (input) for mailman id 257508;
 Fri, 14 Jan 2022 01:02:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AzF-0007rM-RO
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AzF-00043f-Qe
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AzF-00068I-Q2
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hG499x8uTDDrKbDOVAC6jn6UEs/Kfy1u9JFyZm7xlWY=; b=Zw6bb1sNgwWwK8yPzC0gPPtXoa
	xeeExgDo/VzFR1kzGVbkTcFQaC7dc8L1V/Cx3gRsY5E6Q9Gb1c5T/wE+JVozQD7OQ6vJyLHjBD/5W
	bSctw2zMvoEhtqvF1CArQ2D3r4g1mO1boftl3RtjuABQOByeFZLRDDPIB3cs+GlseCJo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
Message-Id: <E1n8AzF-00068I-Q2@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:02:37 +0000

commit 1ce084af083b6958c8287ea742a008a105bc960d
Author:     Prasad J Pandit <pjp@fedoraproject.org>
AuthorDate: Sat Jan 30 18:46:52 2021 +0530
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 17:39:20 2021 -0600

    net: vmxnet3: validate configuration values during activate (CVE-2021-20203)
    
    While activating device in vmxnet3_acticate_device(), it does not
    validate guest supplied configuration values against predefined
    minimum - maximum limits. This may lead to integer overflow or
    OOB access issues. Add checks to avoid it.
    
    Fixes: CVE-2021-20203
    Buglink: https://bugs.launchpad.net/qemu/+bug/1913873
    Reported-by: Gaoning Pan <pgn@zju.edu.cn>
    Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit d05dcd94aee88728facafb993c7280547eb4d645)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/vmxnet3.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 41f796a247..f65af4e9ef 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1441,6 +1441,7 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
+    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU);
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
@@ -1486,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* Read rings memory locations for TX queues */
         pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA);
         size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize);
+        if (size > VMXNET3_TX_RING_MAX_SIZE) {
+            size = VMXNET3_TX_RING_MAX_SIZE;
+        }
 
         vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size,
                           sizeof(struct Vmxnet3_TxDesc), false);
@@ -1496,6 +1500,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* TXC ring */
         pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA);
         size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize);
+        if (size > VMXNET3_TC_RING_MAX_SIZE) {
+            size = VMXNET3_TC_RING_MAX_SIZE;
+        }
         vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size,
                           sizeof(struct Vmxnet3_TxCompDesc), true);
         VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring);
@@ -1537,6 +1544,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
             /* RX rings */
             pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]);
             size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]);
+            if (size > VMXNET3_RX_RING_MAX_SIZE) {
+                size = VMXNET3_RX_RING_MAX_SIZE;
+            }
             vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size,
                               sizeof(struct Vmxnet3_RxDesc), false);
             VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d",
@@ -1546,6 +1556,9 @@ static void vmxnet3_activate_device(VMXNET3State *s)
         /* RXC ring */
         pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA);
         size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize);
+        if (size > VMXNET3_RC_RING_MAX_SIZE) {
+            size = VMXNET3_RC_RING_MAX_SIZE;
+        }
         vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size,
                           sizeof(struct Vmxnet3_RxCompDesc), true);
         VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:02:49 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:02:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257509.442526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AzR-0007ul-7l; Fri, 14 Jan 2022 01:02:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257509.442526; Fri, 14 Jan 2022 01:02:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8AzR-0007ud-4i; Fri, 14 Jan 2022 01:02:49 +0000
Received: by outflank-mailman (input) for mailman id 257509;
 Fri, 14 Jan 2022 01:02:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AzP-0007uW-UN
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AzP-00043v-Te
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AzP-00068p-Sz
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/X8nq5xk+onlBQ5rern4wPX6MKUddhYrqT10zrhNNmo=; b=JYhUPLRAWUcDnwUfPM6KEZJxYI
	tVQVOgEHHypLbKCKmeA2dq+Qe56i0/CKR8pj0VROPwmym7YgE3eW+R7OG3GCMr0/b5GlBrGTLiBnS
	yYfDjKhGQRV0fA4l3DmQREPldCSk6D1pXJLBO4cjcOaCCyONcXGcUZZmxG0fSX4ofzZ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] e1000: fix tx re-entrancy problem
Message-Id: <E1n8AzP-00068p-Sz@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:02:47 +0000

commit 43583f0c079b084ada9214c00125e21bbfc6266a
Author:     Jon Maloy <jmaloy@redhat.com>
AuthorDate: Thu Oct 21 12:10:47 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Tue Dec 14 17:40:06 2021 -0600

    e1000: fix tx re-entrancy problem
    
    The fact that the MMIO handler is not re-entrant causes an infinite
    loop under certain conditions:
    
    Guest write to TDT ->  Loopback -> RX (DMA to TDT) -> TX
    
    We now eliminate the effect of this problem locally in e1000, by adding
    a boolean in struct E1000State indicating when the TX side is busy. This
    will cause any entering new call to return early instead of interfering
    with the ongoing work, and eliminates any risk of looping.
    
    This is intended to address CVE-2021-20257.
    
    Signed-off-by: Jon Maloy <jmaloy@redhat.com>
    Signed-off-by: Jason Wang <jasowang@redhat.com>
    (cherry picked from commit 25ddb946e6301f42cff3094ea1c25fb78813e7e9)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/net/e1000.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index a30546c5d5..f5bc81296d 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -107,6 +107,7 @@ struct E1000State_st {
         e1000x_txd_props props;
         e1000x_txd_props tso_props;
         uint16_t tso_frames;
+        bool busy;
     } tx;
 
     struct {
@@ -763,6 +764,11 @@ start_xmit(E1000State *s)
         return;
     }
 
+    if (s->tx.busy) {
+        return;
+    }
+    s->tx.busy = true;
+
     while (s->mac_reg[TDH] != s->mac_reg[TDT]) {
         base = tx_desc_base(s) +
                sizeof(struct e1000_tx_desc) * s->mac_reg[TDH];
@@ -789,6 +795,7 @@ start_xmit(E1000State *s)
             break;
         }
     }
+    s->tx.busy = false;
     set_ics(s, 0, cause);
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:02:59 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:02:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257510.442530 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Azb-0007xl-90; Fri, 14 Jan 2022 01:02:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257510.442530; Fri, 14 Jan 2022 01:02:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Azb-0007xd-69; Fri, 14 Jan 2022 01:02:59 +0000
Received: by outflank-mailman (input) for mailman id 257510;
 Fri, 14 Jan 2022 01:02:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Aza-0007xU-1B
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Aza-000446-0T
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8AzZ-0006At-W7
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:02:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zm0ReB/1toqGDFML0o4yuCPUqD+rXWSYwf7qPo7/3Mw=; b=ndHgoOV0E5jom4Er21sAUggaPL
	ipwVjAUr0daO0l9GTahtABX17TwRdY9RtrcoAD0w7LmjfF2zCOEZsSqwINihEj35VTj7W0EtDFuqS
	T5LLgcz2yuPLU1HGmxP1kzBpbxdlI19ihbK3ZzzuSkOhkdMjwWzDKUHaosDMQSP3IqhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] qxl: fix pre-save logic
Message-Id: <E1n8AzZ-0006At-W7@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:02:57 +0000

commit 34833f361b1407ad7b4f02ed5eb852e76ab032e4
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Fri Sep 10 11:42:03 2021 +0200
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:12 2021 -0600

    qxl: fix pre-save logic
    
    Oops.  Logic is backwards.
    
    Fixes: 39b8a183e2f3 ("qxl: remove assert in qxl_pre_save.")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/610
    Resolves: https://bugzilla.redhat.com//show_bug.cgi?id=2002907
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-Id: <20210910094203.3582378-1-kraxel@redhat.com>
    (cherry picked from commit eb94846280df3f1e2a91b6179fc05f9890b7e384)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 43482d4364..29c80b4289 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2252,7 +2252,7 @@ static int qxl_pre_save(void *opaque)
     } else {
         d->last_release_offset = (uint8_t *)d->last_release - ram_start;
     }
-    if (d->last_release_offset < d->vga.vram_size) {
+    if (d->last_release_offset >= d->vga.vram_size) {
         return 1;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:03:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:03:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257511.442534 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Azl-00080a-Ae; Fri, 14 Jan 2022 01:03:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257511.442534; Fri, 14 Jan 2022 01:03:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Azl-00080S-7i; Fri, 14 Jan 2022 01:03:09 +0000
Received: by outflank-mailman (input) for mailman id 257511;
 Fri, 14 Jan 2022 01:03:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Azk-00080I-4V
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Azk-00044Z-3o
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Azk-0006C2-32
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i7Q3qwJ5pSotx12VjuSWykhjuWvSjxONIx+mqG7dh1s=; b=1lLAEkycwTLKjaTBXZCx6uN6Sp
	8FJlWRyfTPcg8v4XKPwXiqSXMz8eStOPeIPmdtz89triKuLgjXoJrd7V5A84rqXoVFArykx2fHJC/
	5bRaqi9G3NjXHfW9oqby+nYBLvpqNWVxpVDl6XCNZWxHZEZF7IqBbi3CUah3wSWCGd8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] target/i386: add missing bits to CR4_RESERVED_MASK
Message-Id: <E1n8Azk-0006C2-32@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:03:08 +0000

commit e88636b4d46b91e130ae715b8d8b90f62e414428
Author:     Daniel P. Berrangé <berrange@redhat.com>
AuthorDate: Tue Aug 31 18:50:33 2021 +0100
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:18 2021 -0600

    target/i386: add missing bits to CR4_RESERVED_MASK
    
    Booting Fedora kernels with -cpu max hangs very early in boot. Disabling
    the la57 CPUID bit fixes the problem. git bisect traced the regression to
    
      commit 213ff024a2f92020290296cb9dc29c2af3d4a221 (HEAD, refs/bisect/bad)
      Author: Lara Lazier <laramglazier@gmail.com>
      Date:   Wed Jul 21 17:26:50 2021 +0200
    
        target/i386: Added consistency checks for CR4
    
        All MBZ bits in CR4 must be zero. (APM2 15.5)
        Added reserved bitmask and added checks in both
        helper_vmrun and helper_write_crN.
    
        Signed-off-by: Lara Lazier <laramglazier@gmail.com>
        Message-Id: <20210721152651.14683-2-laramglazier@gmail.com>
        Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    
    In this commit CR4_RESERVED_MASK is missing CR4_LA57_MASK and
    two others. Adding this lets Fedora kernels boot once again.
    
    Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
    Tested-by: Richard W.M. Jones <rjones@redhat.com>
    Message-Id: <20210831175033.175584-1-berrange@redhat.com>
    [Removed VMXE/SMXE, matching the commit message. - Paolo]
    Fixes: 213ff024a2 ("target/i386: Added consistency checks for CR4", 2021-07-22)
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 69e3895f9d37ca39536775b13ce63e8c291427ba)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 target/i386/cpu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 6c50d3ab4f..21b33fbe2e 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -257,6 +257,7 @@ typedef enum X86Seg {
                 | CR4_DE_MASK | CR4_PSE_MASK | CR4_PAE_MASK \
                 | CR4_MCE_MASK | CR4_PGE_MASK | CR4_PCE_MASK \
                 | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK |CR4_UMIP_MASK \
+                | CR4_LA57_MASK \
                 | CR4_FSGSBASE_MASK | CR4_PCIDE_MASK | CR4_OSXSAVE_MASK \
                 | CR4_SMEP_MASK | CR4_SMAP_MASK | CR4_PKE_MASK | CR4_PKS_MASK))
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:03:20 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:03:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257512.442537 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Azw-00083Q-Cc; Fri, 14 Jan 2022 01:03:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257512.442537; Fri, 14 Jan 2022 01:03:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8Azw-00083I-9C; Fri, 14 Jan 2022 01:03:20 +0000
Received: by outflank-mailman (input) for mailman id 257512;
 Fri, 14 Jan 2022 01:03:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Azu-000835-85
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Azu-00044z-7P
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8Azu-0006D2-6Y
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ru/iOuz9UBR6spFiyq3tXvCZ+FrVesNDfiH9BeRi+RY=; b=5VWrSawhaLXDiMgm9SLlkecqyd
	u0rTlf717xwF2cVZ88WgXUcpMC8D54UHYp+8Z5c/DUXreoThFAuWJa3sNPKxOzEl6VEPybxJIl5LE
	4i48L4IMgHo8+1OtCuzO/rmxiPlRmO6oST9E3iEslKHu5SupXVzjW0pCiGx828xmcL+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] tcg/arm: Reduce vector alignment requirement for NEON
Message-Id: <E1n8Azu-0006D2-6Y@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:03:18 +0000

commit 711bd602cc432e4ab0c4c59f19d6611302870248
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sun Sep 12 10:49:25 2021 -0700
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:27 2021 -0600

    tcg/arm: Reduce vector alignment requirement for NEON
    
    With arm32, the ABI gives us 8-byte alignment for the stack.
    While it's possible to realign the stack to provide 16-byte alignment,
    it's far easier to simply not encode 16-byte alignment in the
    VLD1 and VST1 instructions that we emit.
    
    Remove the assertion in temp_allocate_frame, limit natural alignment
    to the provided stack alignment, and add a comment.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1999878
    Reported-by: Richard W.M. Jones <rjones@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Message-Id: <20210912174925.200132-1-richard.henderson@linaro.org>
    Message-Id: <20211206191335.230683-2-richard.henderson@linaro.org>
    (cherry picked from commit b9537d5904f6e3df896264a6144883ab07db9608)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tcg/arm/tcg-target.c.inc | 13 +++++++++----
 tcg/tcg.c                |  8 +++++++-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
index 007ceee68e..34acfb522c 100644
--- a/tcg/arm/tcg-target.c.inc
+++ b/tcg/arm/tcg-target.c.inc
@@ -2477,8 +2477,13 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg arg,
         tcg_out_vldst(s, INSN_VLD1 | 0x7d0, arg, arg1, arg2);
         return;
     case TCG_TYPE_V128:
-        /* regs 2; size 8; align 16 */
-        tcg_out_vldst(s, INSN_VLD1 | 0xae0, arg, arg1, arg2);
+        /*
+         * We have only 8-byte alignment for the stack per the ABI.
+         * Rather than dynamically re-align the stack, it's easier
+         * to simply not request alignment beyond that.  So:
+         * regs 2; size 8; align 8
+         */
+        tcg_out_vldst(s, INSN_VLD1 | 0xad0, arg, arg1, arg2);
         return;
     default:
         g_assert_not_reached();
@@ -2497,8 +2502,8 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg,
         tcg_out_vldst(s, INSN_VST1 | 0x7d0, arg, arg1, arg2);
         return;
     case TCG_TYPE_V128:
-        /* regs 2; size 8; align 16 */
-        tcg_out_vldst(s, INSN_VST1 | 0xae0, arg, arg1, arg2);
+        /* See tcg_out_ld re alignment: regs 2; size 8; align 8 */
+        tcg_out_vldst(s, INSN_VST1 | 0xad0, arg, arg1, arg2);
         return;
     default:
         g_assert_not_reached();
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 4142d42d77..ca5bcc4635 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3060,7 +3060,13 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp *ts)
         g_assert_not_reached();
     }
 
-    assert(align <= TCG_TARGET_STACK_ALIGN);
+    /*
+     * Assume the stack is sufficiently aligned.
+     * This affects e.g. ARM NEON, where we have 8 byte stack alignment
+     * and do not require 16 byte vector alignment.  This seems slightly
+     * easier than fully parameterizing the above switch statement.
+     */
+    align = MIN(TCG_TARGET_STACK_ALIGN, align);
     off = ROUND_UP(s->current_frame_offset, align);
 
     /* If we've exhausted the stack frame, restart with a smaller TB. */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:03:30 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:03:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257513.442543 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8B06-00086k-F7; Fri, 14 Jan 2022 01:03:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257513.442543; Fri, 14 Jan 2022 01:03:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8B06-00086a-Bo; Fri, 14 Jan 2022 01:03:30 +0000
Received: by outflank-mailman (input) for mailman id 257513;
 Fri, 14 Jan 2022 01:03:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B04-00086S-BO
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B04-00045E-Af
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B04-0006E9-9m
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mP1W471Ff+0i+OU7taIHONtWxn1yWUccvk3SQ3sa5Q8=; b=EwWddISSmoW1Xp2WCWRT9L7QF1
	iZGnfMqABmZ43JenCH/XmeAvSaRvui6Le5xMHubA7zA92gY0ILgEF+83J/LW8MoPqTmTdM4zZFKRb
	yYh41PpsQV7PjK9MIgOO3n8xNnB9AJZvzjxafCtuDgLe2iEKwqVxUR6tPL/FwJXWZ0/4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] tests: tcg: Fix PVH test with binutils 2.36+
Message-Id: <E1n8B04-0006E9-9m@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:03:28 +0000

commit fddd169de593da46b2ccd316d63c03b416b94437
Author:     Cole Robinson <crobinso@redhat.com>
AuthorDate: Fri Oct 8 12:21:01 2021 -0400
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Wed Dec 15 07:13:37 2021 -0600

    tests: tcg: Fix PVH test with binutils 2.36+
    
    binutils started adding a .note.gnu.property ELF section which
    makes the PVH test fail:
    
      TEST    hello on x86_64
    qemu-system-x86_64: Error loading uncompressed kernel without PVH ELF Note
    
    Discard .note.gnu* while keeping the PVH .note bits intact.
    
    This also strips the build-id note, so drop the related comment.
    
    Signed-off-by: Cole Robinson <crobinso@redhat.com>
    Message-Id: <5ab2a54c262c61f64c22dbb49ade3e2db8a740bb.1633708346.git.crobinso@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 8e751e9c38e324737fd3d3aa0562f886313bba3c)
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 tests/tcg/x86_64/system/kernel.ld | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/tcg/x86_64/system/kernel.ld b/tests/tcg/x86_64/system/kernel.ld
index 49c12b04ae..ca5d6bd850 100644
--- a/tests/tcg/x86_64/system/kernel.ld
+++ b/tests/tcg/x86_64/system/kernel.ld
@@ -16,7 +16,10 @@ SECTIONS {
 		*(.rodata)
 	} :text
 
-        /* Keep build ID and PVH notes in same section */
+        /DISCARD/ : {
+                *(.note.gnu*)
+        }
+
         .notes :  {
                *(.note.*)
         } :note
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:03:40 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:03:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257514.442546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8B0G-00089e-G9; Fri, 14 Jan 2022 01:03:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257514.442546; Fri, 14 Jan 2022 01:03:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8B0G-00089W-DD; Fri, 14 Jan 2022 01:03:40 +0000
Received: by outflank-mailman (input) for mailman id 257514;
 Fri, 14 Jan 2022 01:03:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B0E-00089J-Ed
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B0E-00045O-Dq
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B0E-0006F7-D5
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KZaelIhavltra3Nuk8IlcONV1gCxtLyMCIzb5LPL7U4=; b=1HoaQsNbaFUPqG3phA0hlnspcD
	el0DAvCDAZtvfsXWC3qW73+WwCjaBrKDYf6v27mWqru9fcKQct/GkP2QJo2fihONJeT+iYB+AycPq
	/QczdCLooxobv/JB1yZLji+aNPHWGMUAkEUHaMpMCmY2AHfOGj2FyZjexML/cGKSjZHY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] Update version for v6.1.1 release
Message-Id: <E1n8B0E-0006F7-D5@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:03:38 +0000

commit 54e1f5be86dd11744e45da8be6afad01d01d59e7
Author:     Michael Roth <michael.roth@amd.com>
AuthorDate: Thu Dec 23 09:52:09 2021 -0600
Commit:     Michael Roth <michael.roth@amd.com>
CommitDate: Thu Dec 23 09:52:09 2021 -0600

    Update version for v6.1.1 release
    
    Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index dfda3e0b4f..f3b5af39e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-6.1.0
+6.1.1
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 01:03:50 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 01:03:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257515.442550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8B0Q-0008CU-Hm; Fri, 14 Jan 2022 01:03:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257515.442550; Fri, 14 Jan 2022 01:03:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8B0Q-0008CM-En; Fri, 14 Jan 2022 01:03:50 +0000
Received: by outflank-mailman (input) for mailman id 257515;
 Fri, 14 Jan 2022 01:03:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B0O-0008C3-KN
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B0O-00045S-Je
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8B0O-0006G4-Iv
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 01:03:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tewEo7SE6GJo/mp2/CEfICZzM8P/SxMeQI/D9pSeagM=; b=uJ37y8uaS/FzrKjJmJ5RLvdkvu
	XuaLOlBlFjmXpQ4WP0NkzAXcJQ6KYF6xutLrvTZMQGdVBGIQrpDz4d+poUF9L3qgwYqWeN8U/VkR9
	0GRMFtX2EiRZnTq0LgViZvAOt/8+gpHvLYms6aB5TqVYCVqN/N2GqZ8fbr+MPYq1O5WY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.16] Merge tag 'v6.1.1' into staging-4.16
Message-Id: <E1n8B0O-0006G4-Iv@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 01:03:48 +0000

commit 29a2f95d36d2a01bcacc0f3136801b2d9197f4d7
Merge: b6e539830bf45e2d7a6bd86ddfdf003088b173b0 54e1f5be86dd11744e45da8be6afad01d01d59e7
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Jan 12 09:53:56 2022 +0000
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Jan 12 09:53:56 2022 +0000

    Merge tag 'v6.1.1' into staging-4.16
    
    v6.1.1 release

 VERSION                                   |   2 +-
 accel/tcg/tcg-accel-ops-mttcg.c           |  26 ++++++++++++++++++++
 accel/tcg/tcg-accel-ops-rr.c              |  10 ++++++++
 block/block-backend.c                     |   6 +++++
 block/file-posix.c                        |   6 ++---
 block/io.c                                |   1 +
 chardev/wctablet.c                        |   1 -
 configure                                 |  10 +++++---
 contrib/plugins/execlog.c                 |   2 +-
 docs/tools/qemu-nbd.rst                   |   6 +++--
 hw/9pfs/coth.h                            |   4 ++-
 hw/arm/virt.c                             |   4 +--
 hw/block/dataplane/virtio-blk.c           |   2 +-
 hw/block/fdc.c                            |  23 +++++++++++++++---
 hw/core/machine.c                         |   1 +
 hw/display/artist.c                       |   8 +++---
 hw/display/qxl.c                          |   2 +-
 hw/i386/pc.c                              |   2 +-
 hw/i386/pc_q35.c                          |   2 +-
 hw/m68k/virt.c                            |   9 ++++++-
 hw/net/e1000.c                            |   7 ++++++
 hw/net/virtio-net.c                       |  39 ++++++++++++++++++++++++------
 hw/net/vmxnet3.c                          |  13 ++++++++++
 hw/nvme/ctrl.c                            |   5 ++++
 hw/pci/pci_bridge.c                       |  10 ++++----
 hw/pci/pcie_port.c                        |   2 +-
 hw/scsi/scsi-disk.c                       |   6 +++++
 hw/scsi/scsi-generic.c                    |   2 +-
 hw/usb/dev-uas.c                          |  11 +++++++++
 hw/vfio/common.c                          |   8 ++++++
 hw/virtio/vhost-user.c                    |   5 ++--
 hw/virtio/vhost-vsock.c                   |  19 ++++++++++++---
 hw/virtio/virtio-balloon.c                |  13 ++++++++++
 hw/virtio/virtio-mem-pci.c                |   7 +-----
 hw/virtio/virtio.c                        |  24 ++++++------------
 include/block/block_int.h                 |   7 ++++++
 include/hw/acpi/ich9.h                    |   2 +-
 include/hw/virtio/vhost-vsock.h           |   3 +++
 include/qemu/rcu.h                        |  15 ++++++++++++
 include/sysemu/block-backend.h            |   1 +
 monitor/hmp-cmds.c                        |   2 +-
 nbd/server.c                              |   3 +++
 plugins/meson.build                       |  14 ++++++-----
 qemu-nbd.c                                |   6 +++--
 subprojects/libvhost-user/libvhost-user.c |   1 +
 target/arm/cpu.c                          |  19 +++++++++++++++
 target/i386/cpu.c                         |   2 +-
 target/i386/cpu.h                         |   1 +
 target/i386/tcg/sysemu/excp_helper.c      |  25 ++++++++++---------
 tcg/arm/tcg-target.c.inc                  |  13 +++++++---
 tcg/tcg.c                                 |   8 +++++-
 tests/data/acpi/q35/DSDT                  | Bin 8289 -> 8289 bytes
 tests/data/acpi/q35/DSDT.acpihmat         | Bin 9614 -> 9614 bytes
 tests/data/acpi/q35/DSDT.bridge           | Bin 11003 -> 11003 bytes
 tests/data/acpi/q35/DSDT.cphp             | Bin 8753 -> 8753 bytes
 tests/data/acpi/q35/DSDT.dimmpxm          | Bin 9943 -> 9943 bytes
 tests/data/acpi/q35/DSDT.ipmibt           | Bin 8364 -> 8364 bytes
 tests/data/acpi/q35/DSDT.memhp            | Bin 9648 -> 9648 bytes
 tests/data/acpi/q35/DSDT.mmio64           | Bin 9419 -> 9419 bytes
 tests/data/acpi/q35/DSDT.multi-bridge     | Bin 0 -> 8583 bytes
 tests/data/acpi/q35/DSDT.nohpet           | Bin 8147 -> 8147 bytes
 tests/data/acpi/q35/DSDT.numamem          | Bin 8295 -> 8295 bytes
 tests/data/acpi/q35/DSDT.tis              | Bin 8894 -> 8894 bytes
 tests/qtest/bios-tables-test.c            |  18 ++++++++++++++
 tests/qtest/fdc-test.c                    |  38 +++++++++++++++++++++++++++++
 tests/tcg/x86_64/system/kernel.ld         |   5 +++-
 util/qemu-sockets.c                       |  13 ++++------
 util/rcu.c                                |  19 +++++++++++++++
 68 files changed, 409 insertions(+), 104 deletions(-)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 06:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 06:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257537.442609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GJf-0000S5-FA; Fri, 14 Jan 2022 06:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257537.442609; Fri, 14 Jan 2022 06:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GJf-0000Rx-Bp; Fri, 14 Jan 2022 06:44:03 +0000
Received: by outflank-mailman (input) for mailman id 257537;
 Fri, 14 Jan 2022 06: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 1n8GJd-0000R5-Nl
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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 1n8GJd-0002Fx-Mv
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8GJd-00042f-Lx
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S9ak8M4ab+VD8zm+u9PYLR0fKOXVI1L9D469GFUey9I=; b=s2Amez+24EQkZynXUTs6HWvl5R
	1F6nDFgNMWISiLeZ0tRmm0Zmiiu8a2y2NfKXTGtYn/kBXSJLKH18nXGgu/qK1yCP1xkk1F1eSNi3B
	20b4HnTQMPTccmUnIfgdy4Zr7IDmt3WQptayzgIBdvd8/OPXC5VTcpgqNzlEM7no6zcI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: use relative counts in calibration loops
Message-Id: <E1n8GJd-00042f-Lx@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 06:44:01 +0000

commit 467191641d2a2fd2e43b3ae7b80399f89d339980
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 13 14:30:18 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 13 14:30:18 2022 +0100

    x86/time: use relative counts in calibration loops
    
    Looping until reaching/exceeding a certain value is error prone: If the
    target value is close enough to the wrapping point, the loop may not
    terminate at all. Switch to using delta values, which then allows to
    fold the two loops each into just one.
    
    Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a290aba3e8..84b62f2024 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -378,7 +378,7 @@ static u64 read_hpet_count(void)
 static int64_t __init init_hpet(struct platform_timesource *pts)
 {
     uint64_t hpet_rate, start;
-    uint32_t count, target;
+    uint32_t count, target, elapsed;
     /*
      * Allow HPET to be setup, but report a frequency of 0 so it's not selected
      * as a timer source. This is required so it can be used in legacy
@@ -451,11 +451,8 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
 
     count = hpet_read32(HPET_COUNTER);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(hpet_rate);
-    if ( target < count )
-        while ( hpet_read32(HPET_COUNTER) >= count )
-            continue;
-    while ( hpet_read32(HPET_COUNTER) < target )
+    target = CALIBRATE_VALUE(hpet_rate);
+    while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
@@ -493,8 +490,8 @@ static u64 read_pmtimer_count(void)
 
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
-    u64 start;
-    u32 count, target, mask;
+    uint64_t start;
+    uint32_t count, target, mask, elapsed;
 
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -502,13 +499,10 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     pts->counter_bits = pmtmr_width;
     mask = 0xffffffff >> (32 - pmtmr_width);
 
-    count = inl(pmtmr_ioport) & mask;
+    count = inl(pmtmr_ioport);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
-    if ( target < count )
-        while ( (inl(pmtmr_ioport) & mask) >= count )
-            continue;
-    while ( (inl(pmtmr_ioport) & mask) < target )
+    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
+    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 06:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 06:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257540.442612 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GJp-0000YW-G9; Fri, 14 Jan 2022 06:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257540.442612; Fri, 14 Jan 2022 06:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GJp-0000YO-DN; Fri, 14 Jan 2022 06:44:13 +0000
Received: by outflank-mailman (input) for mailman id 257540;
 Fri, 14 Jan 2022 06: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 1n8GJn-0000Y3-RE
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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 1n8GJn-0002GE-QL
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8GJn-00043q-PL
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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=VhpSaKbrN8KKk0IEsU8qvIIQ2I/sSRnh9nE4rYEy4w0=; b=VMtIJ7+9cnIoEGKxyzxhS9ViUD
	uZCVEL6OJNDizpK4fT1eLtNgryu7h9A50jUqXndlqqCjoBRitjAuysL9I9/DfL3KFDiyJLIHIN0aF
	zYkWV96xpfPYRts8kRdihVhZF0WnPUNC9WaVKeY3GSqqvW8b7Uaodu6YE/dl/jlCCC7c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: improve TSC / CPU freq calibration accuracy
Message-Id: <E1n8GJn-00043q-PL@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 06:44:11 +0000

commit a5c9a80af34eefcd6e31d0ed2b083f452cd9076d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 13 14:31:52 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 13 14:31:52 2022 +0100

    x86/time: improve TSC / CPU freq calibration accuracy
    
    While the problem report was for extreme errors, even smaller ones would
    better be avoided: The calculated period to run calibration loops over
    can (and usually will) be shorter than the actual time elapsed between
    first and last platform timer and TSC reads. Adjust values returned from
    the init functions accordingly.
    
    On a Skylake system I've tested this on accuracy (using HPET) went from
    detecting in some cases more than 220kHz too high a value to about
    ±2kHz. On other systems (or on this system, but with PMTMR) the original
    error range was much smaller, with less (in some cases only very little)
    improvement.
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 84b62f2024..1daff92dca 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -287,6 +287,23 @@ static char *freq_string(u64 freq)
     return s;
 }
 
+static uint64_t adjust_elapsed(uint64_t elapsed, uint32_t actual,
+                               uint32_t target)
+{
+    if ( likely(actual > target) )
+    {
+        /*
+         * A (perhaps significant) delay before the last timer read (e.g. due
+         * to a SMI or NMI) can lead to (perhaps severe) inaccuracy if not
+         * accounting for the time elapsed beyond the originally calculated
+         * duration of the calibration interval.
+         */
+        elapsed = muldiv64(elapsed, target, actual);
+    }
+
+    return elapsed * CALIBRATE_FRAC;
+}
+
 /************************************************************
  * PLATFORM TIMER 1: PROGRAMMABLE INTERVAL TIMER (LEGACY PIT)
  */
@@ -455,7 +472,7 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
     while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static void resume_hpet(struct platform_timesource *pts)
@@ -505,7 +522,7 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static struct platform_timesource __initdata plt_pmtimer =
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 06:44:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 06:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257541.442616 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GJz-0000fv-Hr; Fri, 14 Jan 2022 06:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257541.442616; Fri, 14 Jan 2022 06:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GJz-0000fo-F1; Fri, 14 Jan 2022 06:44:23 +0000
Received: by outflank-mailman (input) for mailman id 257541;
 Fri, 14 Jan 2022 06:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8GJx-0000fT-UQ
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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 1n8GJx-0002Gw-Tc
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8GJx-00044u-SR
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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=8m74/WI+Z80ZeOXtmDESwDRx4Jg7nZ9ooqa5uu5f6do=; b=tQkzxHxto2siTfwk3qqhm5WG84
	lI5OhMTVhc3DZq8tE0dN/SX5rYK5vn/6ABogf7nH7Uz39xpoNAURfwb0jkYA058D1zqbBWW/aaboZ
	QBG/9xn97bANGEUOHbhYzB0xs6vtnCZt4UGDP15E4E2zTnXGJw36fMrETVZbrgTOENo4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: correct usage comments in Kbuild.include
Message-Id: <E1n8GJx-00044u-SR@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 06:44:21 +0000

commit 6bce8cc00594f41830739b76e367423fd4e7444d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 13 14:32:34 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 13 14:32:34 2022 +0100

    build: correct usage comments in Kbuild.include
    
    Macros with arguments need to be invoked via $(call ...); don't misguide
    people looking up usage of such macros.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/scripts/Kbuild.include | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
index 83c7e1457b..f75d724ed7 100644
--- a/xen/scripts/Kbuild.include
+++ b/xen/scripts/Kbuild.include
@@ -43,15 +43,15 @@ define as-option-add-closure
     endif
 endef
 
-# $(if-success,<command>,<then>,<else>)
+# $(call if-success,<command>,<then>,<else>)
 # Return <then> if <command> exits with 0, <else> otherwise.
 if-success = $(shell { $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
 
-# $(success,<command>)
+# $(call success,<command>)
 # Return y if <command> exits with 0, n otherwise
 success = $(call if-success,$(1),y,n)
 
-# $(ld-option,<flag>)
+# $(call ld-option,<flag>)
 # Return y if the linker supports <flag>, n otherwise
 ld-option = $(call success,$(LD) -v $(1))
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 06:44:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 06:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257543.442621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GK9-0000jQ-KQ; Fri, 14 Jan 2022 06:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257543.442621; Fri, 14 Jan 2022 06: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 1n8GK9-0000jI-Gb; Fri, 14 Jan 2022 06:44:33 +0000
Received: by outflank-mailman (input) for mailman id 257543;
 Fri, 14 Jan 2022 06: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 1n8GK8-0000iz-1O
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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 1n8GK8-0002H6-0Y
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8GK7-000463-Vx
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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=xDsRUnS291i3J1yDprrAq5P2mOE3P4zCoWGooC1nADU=; b=XVU3nvzrQeyQohw3VjHxpdW2Vo
	m7UhLfHKT7q7mAyHzVE2FTZkrmX95XQJAv+Txia7n7nrKG3gB4q4m3MItkg9r/KrOoO+OpNmoAOvB
	eK8Nf/Mdplt13tPivWCtcFr/LwKQMYPwe2WtBQuoXLz4IEY/3wmiMY80T/R2Y1XxrEWw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl/PCI: Fix PV hotplug & stubdom coldplug
Message-Id: <E1n8GK7-000463-Vx@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 06:44:31 +0000

commit 73ee2795aaef2cb086ac078bffe1c6b33c0ea91b
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu Jan 13 14:33:16 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 13 14:33:16 2022 +0100

    libxl/PCI: Fix PV hotplug & stubdom coldplug
    
    commit 0fdb48ffe7a1 "libxl: Make sure devices added by pci-attach are
    reflected in the config" broken PCI hotplug (xl pci-attach) for PV
    domains when it moved libxl__create_pci_backend() later in the function.
    
    This also broke HVM + stubdom PCI passthrough coldplug.  For that, the
    PCI devices are hotplugged to a running PV stubdom, and then the QEMU
    QMP device_add commands are made to QEMU inside the stubdom.
    
    A running PV domain calls libxl__wait_for_backend().  With the current
    placement of libxl__create_pci_backend(), the path does not exist and
    the call immediately fails:
    libxl: error: libxl_device.c:1388:libxl__wait_for_backend: Backend /local/domain/0/backend/pci/43/0 does not exist
    libxl: error: libxl_pci.c:1764:device_pci_add_done: Domain 42:libxl__device_pci_add failed for PCI device 0:2:0.0 (rc -3)
    libxl: error: libxl_create.c:1857:domcreate_attach_devices: Domain 42:unable to add pci devices
    
    The wait is only relevant when:
    1) The domain is PV
    2) The domain is running
    3) The backend is already present
    
    This is because:
    
    1) xen-pcifront is only used for PV.  It does not load for HVM domains
       where QEMU is used.
    
    2) If the domain is not running (starting), then the frontend state will
       be Initialising.  xen-pciback waits for the frontend to transition to
       at Initialised before attempting to connect.  So a wait for a
       non-running domain is not applicable as the backend will not
       transition to Connected.
    
    3) For presence, num_devs is already used to determine if the backend
       needs to be created.  Re-use num_devs to determine if the backend
       wait is necessary.  The wait is necessary to avoid racing with
       another PCI attachment reconfiguring the front/back or changing to
       some other state like closing.  If we are creating the backend, then
       we don't have to worry about the state since it is being created.
    
    Fixes: 0fdb48ffe7a1 ("libxl: Make sure devices added by pci-attach are
    reflected in the config")
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 4c2d7aeefb..4bbbfe9f16 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -157,9 +157,11 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc,
     if (domtype == LIBXL_DOMAIN_TYPE_INVALID)
         return ERROR_FAIL;
 
-    if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", XenbusStateConnected)) < 0)
-            return ERROR_FAIL;
+    /* Wait is only needed if the backend already exists (num_devs != NULL) */
+    if (num_devs && !starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
+        rc = libxl__wait_for_backend(gc, be_path,
+                                     GCSPRINTF("%d", XenbusStateConnected));
+        if (rc) return rc;
     }
 
     back = flexarray_make(gc, 16, 1);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 06:44:42 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 06:44:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257544.442626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GKI-0000o6-NR; Fri, 14 Jan 2022 06:44:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257544.442626; Fri, 14 Jan 2022 06:44: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 1n8GKI-0000ny-Ji; Fri, 14 Jan 2022 06:44:42 +0000
Received: by outflank-mailman (input) for mailman id 257544;
 Fri, 14 Jan 2022 06: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 1n8GKI-0000no-4R
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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 1n8GKI-0002HJ-3b
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8GKI-000475-2i
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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=qszv1UWdMtP0YAor1ue9btk54A8ZF5NeuEkiUF2t5mA=; b=ZWR9mzN1msivDjXBk9At8WkWNl
	9aiqYQYaqB+Cq7WpN+uNQ84DHNWlf8Qz7G4lHW45r6w+xNwJTPfkEZI26dUSQv0zIkadVzXPUhCW2
	aVwUaUzlZw0H3QSsv/s6r467CtdRHbp/yf7W8APQkwBFq6jLEf+GeecesC5HcuD/S7Lc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Simplify hvm_enable_msr_interception()
Message-Id: <E1n8GKI-000475-2i@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 06:44:42 +0000

commit 32a971bfa6760d8fb260d9d721c5ecdd894deafd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Nov 30 14:37:59 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 13 15:19:43 2022 +0000

    x86/hvm: Simplify hvm_enable_msr_interception()
    
    The sole caller doesn't check the return value, and both vendors implement the
    hook.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/hvm.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index bd2cbb0e7b..2767427aa9 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -631,15 +631,9 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
     return hvm_funcs.nhvm_intr_blocked(v);
 }
 
-static inline bool_t hvm_enable_msr_interception(struct domain *d, uint32_t msr)
+static inline void hvm_enable_msr_interception(struct domain *d, uint32_t msr)
 {
-    if ( hvm_funcs.enable_msr_interception )
-    {
-        hvm_funcs.enable_msr_interception(d, msr);
-        return 1;
-    }
-
-    return 0;
+    hvm_funcs.enable_msr_interception(d, msr);
 }
 
 static inline bool_t hvm_is_singlestep_supported(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 06:44:52 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 06:44:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257545.442629 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GKS-0000sQ-OQ; Fri, 14 Jan 2022 06:44:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257545.442629; Fri, 14 Jan 2022 06:44: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 1n8GKS-0000sI-LL; Fri, 14 Jan 2022 06:44:52 +0000
Received: by outflank-mailman (input) for mailman id 257545;
 Fri, 14 Jan 2022 06: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 1n8GKS-0000sC-8I
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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 1n8GKS-0002Hc-7P
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8GKS-00047f-6T
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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=Fla4RbEgcK0JcSEwpOkZGSzegmSJE7+GMAeIQRLmnHk=; b=g3oSXm+N0t4daoEDopV6ij+jKH
	YXYs4iCat5vTxq8X3RhnihGOf4f87YvL+Pbocuh55JaghIdZWk+jx5p/gBCRBf5YQCDuJcRlv4OCf
	+5zaZAVSwPUgBIZFMRPQ1aZBXmAwPoJ7Q0tsGkJNhnrLEGmvWxDiCjPcm+7cSrRGU0go=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Rework nested hap functions to reduce parameters
Message-Id: <E1n8GKS-00047f-6T@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 06:44:52 +0000

commit ddf820e1d6e82051be95eeb30a570426423e4f9f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Nov 30 17:05:09 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 13 15:19:43 2022 +0000

    x86/hvm: Rework nested hap functions to reduce parameters
    
    Most functions in this call chain have 8 parameters, meaning that the final
    two booleans are spilled to the stack for calls.
    
    First, delete nestedhap_walk_L1_p2m and introduce nhvm_hap_walk_L1_p2m() as a
    thin wrapper around hvm_funcs, just like all the other nhvm_*() hooks.  This
    involves including xen/mm.h as the forward declaration of struct npfec is no
    longer enough.
    
    Next, replace the triple of booleans with struct npfec, which contains the
    same information in the bottom 3 bits.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c                       |  5 +---
 xen/arch/x86/hvm/svm/nestedsvm.c             | 11 ++++----
 xen/arch/x86/hvm/vmx/vvmx.c                  | 10 +++----
 xen/arch/x86/include/asm/hvm/hvm.h           | 14 +++++++---
 xen/arch/x86/include/asm/hvm/nestedhvm.h     |  6 +----
 xen/arch/x86/include/asm/hvm/svm/nestedsvm.h |  6 ++---
 xen/arch/x86/include/asm/hvm/vmx/vvmx.h      |  8 +++---
 xen/arch/x86/mm/hap/nested_hap.c             | 40 +++++++---------------------
 xen/arch/x86/mm/p2m.c                        | 12 +++++----
 9 files changed, 47 insertions(+), 65 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index d233550ae4..b0ee49a61a 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1775,10 +1775,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
          * the same as for shadow paging.
          */
 
-         rv = nestedhvm_hap_nested_page_fault(curr, &gpa,
-                                              npfec.read_access,
-                                              npfec.write_access,
-                                              npfec.insn_fetch);
+        rv = nestedhvm_hap_nested_page_fault(curr, &gpa, npfec);
         switch (rv) {
         case NESTEDHVM_PAGEFAULT_DONE:
         case NESTEDHVM_PAGEFAULT_RETRY:
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 6d90630040..abc178d8d4 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -1216,10 +1216,9 @@ nsvm_vmcb_hap_enabled(struct vcpu *v)
  * walk is successful, the translated value is returned in
  * L1_gpa. The result value tells what to do next.
  */
-int
-nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                     unsigned int *page_order, uint8_t *p2m_acc,
-                     bool_t access_r, bool_t access_w, bool_t access_x)
+int nsvm_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec)
 {
     uint32_t pfec;
     unsigned long nested_cr3, gfn;
@@ -1227,9 +1226,9 @@ nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
     nested_cr3 = nhvm_vcpu_p2m_base(v);
 
     pfec = PFEC_user_mode | PFEC_page_present;
-    if ( access_w )
+    if ( npfec.write_access )
         pfec |= PFEC_write_access;
-    if ( access_x )
+    if ( npfec.insn_fetch )
         pfec |= PFEC_insn_fetch;
 
     /* Walk the guest-supplied NPT table, just as if it were a pagetable */
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index e9f94daf64..7419ee9dd0 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2346,16 +2346,16 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
  * walk is successful, the translated value is returned in
  * L1_gpa. The result value tells what to do next.
  */
-int
-nvmx_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                     unsigned int *page_order, uint8_t *p2m_acc,
-                     bool_t access_r, bool_t access_w, bool_t access_x)
+int nvmx_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec)
 {
     int rc;
     unsigned long gfn;
     uint64_t exit_qual;
     uint32_t exit_reason = EXIT_REASON_EPT_VIOLATION;
-    uint32_t rwx_rights = (access_x << 2) | (access_w << 1) | access_r;
+    uint32_t rwx_rights =
+        (npfec.insn_fetch << 2) | (npfec.write_access << 1) | npfec.read_access;
     struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
 
     vmx_vmcs_enter(v);
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 2767427aa9..cd9e73e266 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -20,6 +20,8 @@
 #ifndef __ASM_X86_HVM_HVM_H__
 #define __ASM_X86_HVM_HVM_H__
 
+#include <xen/mm.h>
+
 #include <asm/alternative.h>
 #include <asm/asm_defns.h>
 #include <asm/current.h>
@@ -203,8 +205,7 @@ struct hvm_function_table {
     /*Walk nested p2m  */
     int (*nhvm_hap_walk_L1_p2m)(struct vcpu *v, paddr_t L2_gpa,
                                 paddr_t *L1_gpa, unsigned int *page_order,
-                                uint8_t *p2m_acc, bool_t access_r,
-                                bool_t access_w, bool_t access_x);
+                                uint8_t *p2m_acc, struct npfec npfec);
 
     void (*enable_msr_interception)(struct domain *d, uint32_t msr);
     bool_t (*is_singlestep_supported)(void);
@@ -350,7 +351,6 @@ int hvm_debug_op(struct vcpu *v, int32_t op);
 void hvm_toggle_singlestep(struct vcpu *v);
 void hvm_fast_singlestep(struct vcpu *v, uint16_t p2midx);
 
-struct npfec;
 int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
                               struct npfec npfec);
 
@@ -631,6 +631,14 @@ static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
     return hvm_funcs.nhvm_intr_blocked(v);
 }
 
+static inline int nhvm_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec)
+{
+    return hvm_funcs.nhvm_hap_walk_L1_p2m(
+        v, L2_gpa, L1_gpa, page_order, p2m_acc, npfec);
+}
+
 static inline void hvm_enable_msr_interception(struct domain *d, uint32_t msr)
 {
     hvm_funcs.enable_msr_interception(d, msr);
diff --git a/xen/arch/x86/include/asm/hvm/nestedhvm.h b/xen/arch/x86/include/asm/hvm/nestedhvm.h
index d263925786..7184928c2b 100644
--- a/xen/arch/x86/include/asm/hvm/nestedhvm.h
+++ b/xen/arch/x86/include/asm/hvm/nestedhvm.h
@@ -58,11 +58,7 @@ bool_t nestedhvm_vcpu_in_guestmode(struct vcpu *v);
 #define NESTEDHVM_PAGEFAULT_RETRY      5
 #define NESTEDHVM_PAGEFAULT_DIRECT_MMIO 6
 int nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa,
-    bool_t access_r, bool_t access_w, bool_t access_x);
-
-int nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                          unsigned int *page_order, uint8_t *p2m_acc,
-                          bool_t access_r, bool_t access_w, bool_t access_x);
+                                    struct npfec npfec);
 
 /* IO permission map */
 unsigned long *nestedhvm_vcpu_iomap_get(bool_t ioport_80, bool_t ioport_ed);
diff --git a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
index 0873698457..c3ef235414 100644
--- a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
+++ b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
@@ -122,9 +122,9 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v);
 void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v);
 void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v);
 bool_t nestedsvm_gif_isset(struct vcpu *v);
-int nsvm_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                         unsigned int *page_order, uint8_t *p2m_acc,
-                         bool_t access_r, bool_t access_w, bool_t access_x);
+int nsvm_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec);
 
 #define NSVM_INTR_NOTHANDLED     3
 #define NSVM_INTR_NOTINTERCEPTED 2
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vvmx.h b/xen/arch/x86/include/asm/hvm/vmx/vvmx.h
index d5f68f30b1..e4ca3bc6ee 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vvmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vvmx.h
@@ -100,10 +100,10 @@ bool_t nvmx_ept_enabled(struct vcpu *v);
 #define EPT_TRANSLATE_MISCONFIG     2
 #define EPT_TRANSLATE_RETRY         3
 
-int
-nvmx_hap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                     unsigned int *page_order, uint8_t *p2m_acc,
-                     bool_t access_r, bool_t access_w, bool_t access_x);
+int nvmx_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec);
+
 /*
  * Virtual VMCS layout
  *
diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c
index 50fa2dd9f4..d8a7b3b401 100644
--- a/xen/arch/x86/mm/hap/nested_hap.c
+++ b/xen/arch/x86/mm/hap/nested_hap.c
@@ -113,31 +113,13 @@ nestedhap_fix_p2m(struct vcpu *v, struct p2m_domain *p2m,
     }
 }
 
-/* This function uses L2_gpa to walk the P2M page table in L1. If the
- * walk is successful, the translated value is returned in
- * L1_gpa. The result value tells what to do next.
- */
-int
-nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
-                      unsigned int *page_order, uint8_t *p2m_acc,
-                      bool_t access_r, bool_t access_w, bool_t access_x)
-{
-    ASSERT(hvm_funcs.nhvm_hap_walk_L1_p2m);
-
-    return hvm_funcs.nhvm_hap_walk_L1_p2m(v, L2_gpa, L1_gpa, page_order,
-        p2m_acc, access_r, access_w, access_x);
-}
-
-
 /* This function uses L1_gpa to walk the P2M table in L0 hypervisor. If the
  * walk is successful, the translated value is returned in L0_gpa. The return 
  * value tells the upper level what to do.
  */
-static int
-nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa,
-                      p2m_type_t *p2mt, p2m_access_t *p2ma,
-                      unsigned int *page_order,
-                      bool_t access_r, bool_t access_w, bool_t access_x)
+static int nestedhap_walk_L0_p2m(
+    struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa, p2m_type_t *p2mt,
+    p2m_access_t *p2ma, unsigned int *page_order, struct npfec npfec)
 {
     mfn_t mfn;
     int rc;
@@ -154,7 +136,7 @@ nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa,
         goto out;
 
     rc = NESTEDHVM_PAGEFAULT_L0_ERROR;
-    if ( access_w && p2m_is_readonly(*p2mt) )
+    if ( npfec.write_access && p2m_is_readonly(*p2mt) )
         goto out;
 
     if ( p2m_is_paging(*p2mt) || p2m_is_shared(*p2mt) || !p2m_is_ram(*p2mt) )
@@ -176,9 +158,8 @@ out:
  *
  * Returns:
  */
-int
-nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa,
-    bool_t access_r, bool_t access_w, bool_t access_x)
+int nestedhvm_hap_nested_page_fault(
+    struct vcpu *v, paddr_t *L2_gpa, struct npfec npfec)
 {
     int rv;
     paddr_t L1_gpa, L0_gpa;
@@ -192,8 +173,8 @@ nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa,
     p2m = p2m_get_hostp2m(d); /* L0 p2m */
 
     /* walk the L1 P2M table */
-    rv = nestedhap_walk_L1_p2m(v, *L2_gpa, &L1_gpa, &page_order_21, &p2ma_21,
-        access_r, access_w, access_x);
+    rv = nhvm_hap_walk_L1_p2m(v, *L2_gpa, &L1_gpa, &page_order_21, &p2ma_21,
+                              npfec);
 
     /* let caller to handle these two cases */
     switch (rv) {
@@ -209,9 +190,8 @@ nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t *L2_gpa,
     }
 
     /* ==> we have to walk L0 P2M */
-    rv = nestedhap_walk_L0_p2m(p2m, L1_gpa, &L0_gpa,
-        &p2mt_10, &p2ma_10, &page_order_10,
-        access_r, access_w, access_x);
+    rv = nestedhap_walk_L0_p2m(p2m, L1_gpa, &L0_gpa, &p2mt_10, &p2ma_10,
+                               &page_order_10, npfec);
 
     /* let upper level caller to handle these two cases */
     switch (rv) {
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 98c8201f92..3f81e99fd6 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1930,6 +1930,11 @@ unsigned long paging_gva_to_gfn(struct vcpu *v,
         const struct paging_mode *mode;
         uint8_t l1_p2ma;
         unsigned int l1_page_order;
+        struct npfec npfec = {
+            .read_access  = 1,
+            .write_access = *pfec & PFEC_write_access,
+            .insn_fetch   = *pfec & PFEC_insn_fetch,
+        };
         int rv;
 
         /* translate l2 guest va into l2 guest gfn */
@@ -1940,11 +1945,8 @@ unsigned long paging_gva_to_gfn(struct vcpu *v,
         if ( l2_gfn == gfn_x(INVALID_GFN) )
             return gfn_x(INVALID_GFN);
 
-        rv = nestedhap_walk_L1_p2m(v, pfn_to_paddr(l2_gfn), &l1_gpa,
-                                   &l1_page_order, &l1_p2ma,
-                                   1,
-                                   !!(*pfec & PFEC_write_access),
-                                   !!(*pfec & PFEC_insn_fetch));
+        rv = nhvm_hap_walk_L1_p2m(
+            v, pfn_to_paddr(l2_gfn), &l1_gpa, &l1_page_order, &l1_p2ma, npfec);
 
         if ( rv != NESTEDHVM_PAGEFAULT_DONE )
             return gfn_x(INVALID_GFN);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 14 06:45:02 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Jan 2022 06:45:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.257546.442633 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n8GKc-0000vL-Q5; Fri, 14 Jan 2022 06:45:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 257546.442633; Fri, 14 Jan 2022 06:45: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 1n8GKc-0000vC-Mv; Fri, 14 Jan 2022 06:45:02 +0000
Received: by outflank-mailman (input) for mailman id 257546;
 Fri, 14 Jan 2022 06: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 1n8GKc-0000v3-BL
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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 1n8GKc-0002IH-AY
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n8GKc-00048X-9m
 for xen-changelog@lists.xenproject.org; Fri, 14 Jan 2022 06: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=6P3bd/HDsK3kmsbE0GcUimvDiEtchpmOQVbph4hEDLU=; b=HdLqNlqy3Enbj6EOEiJWzYJF1Z
	UA9vPyPMKD8YCR5giLrhtoZ6S/E6xNj+xdL9IkmUy64RrsOAUvS9g9eF6T/gRGipbGpG8qNeJiKUl
	Uufptdpdkdlc2sjArAtTsOGKtx70a5eP6xLEHPQP+QAclnROrmcTmXUK3ZTYu2S3UFIE=;
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
Message-Id: <E1n8GKc-00048X-9m@xenbits.xenproject.org>
Date: Fri, 14 Jan 2022 06:45:02 +0000

commit 9ce0a5e207f3968e65d0af33a15bee5bdf5c8a7f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 12 13:54:12 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 13 15:19:43 2022 +0000

    x86/hvm: Improve hvm_set_guest_pat() code generation
    
    This is a fastpath on virtual vmentry/exit, and forcing guest_pat to be
    spilled to the stack is bad.  Performing the shift in a register is far more
    efficient.
    
    Drop the (IMO useless) log message.  MSR_PAT only gets altered on boot, and a
    bad value will be entirely evident in the ensuing #GP backtrace.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b0ee49a61a..10ee4e9570 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -299,13 +299,13 @@ 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, u64 guest_pat)
+int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
 {
-    int i;
-    uint8_t *value = (uint8_t *)&guest_pat;
+    unsigned int i;
+    uint64_t tmp;
 
-    for ( i = 0; i < 8; i++ )
-        switch ( value[i] )
+    for ( i = 0, tmp = guest_pat; i < 8; i++, tmp >>= 8 )
+        switch ( tmp & 0xff )
         {
         case PAT_TYPE_UC_MINUS:
         case PAT_TYPE_UNCACHABLE:
@@ -315,8 +315,6 @@ int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat)
         case PAT_TYPE_WRTHROUGH:
             break;
         default:
-            HVM_DBG_LOG(DBG_LEVEL_MSR, "invalid guest PAT: %"PRIx64"\n",
-                        guest_pat); 
             return 0;
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 17 08:55:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Jan 2022 08:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258028.443857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9Nn8-0004iC-3W; Mon, 17 Jan 2022 08:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258028.443857; Mon, 17 Jan 2022 08:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9Nn8-0004i4-0V; Mon, 17 Jan 2022 08:55:06 +0000
Received: by outflank-mailman (input) for mailman id 258028;
 Mon, 17 Jan 2022 08:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9Nn7-0004hy-1y
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 08:55: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 1n9Nn6-0007e5-SJ
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 08:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9Nn6-0006D2-R5
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 08:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=putgF2xP1h44CgjRA6LUBYibH6ijxFtl+TumeR/71I0=; b=4Xx76+Ff/ASqelcl8C371t6XG/
	ih4Y1c9OVzfrGYSA6BhOiK07nolVVPEXszY0udouFERgB0U9D6FL+2hxe6MHKWZNu3TurcutmIET3
	VgOHhhZkDXg7zvrgikGCCY++D09kXclJYgQkDGX4jiywU+Bh899LwWQZdVxgAmhz/CA4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: adjust include/xen/compile.h generation
Message-Id: <E1n9Nn6-0006D2-R5@xenbits.xenproject.org>
Date: Mon, 17 Jan 2022 08:55:04 +0000

commit 299deb9dd93e5aae2f3b24ec001214458077a185
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 14 11:03:03 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 14 11:03:03 2022 +0100

    build: adjust include/xen/compile.h generation
    
    Prior to 19427e439e01 ("build: generate "include/xen/compile.h" with
    if_changed") running "make install-xen" as root would not have printed
    the banner under normal circumstances. Its printing would instead have
    indicated that something was wrong (or during a normal build the lack
    of printing would do so).
    
    Further aforementioned change had another undesirable effect, which I
    didn't notice during review: Originally compile.h would have been
    re-generated (and final binaries re-linked) when its dependencies were
    updated after an earlier build. This is no longer the case now, which
    means that if some other file also was updated, then the re-build done
    during "make install-xen" would happen with a stale compile.h (as its
    updating is suppressed in this case).
    
    Restore the earlier behavior for both aspects.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index dc6bdc44c7..1e10d9f680 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -424,6 +424,7 @@ targets += .banner
 quiet_cmd_compile.h = UPD     $@
 define cmd_compile.h
     if [ ! -r $@ -o -O $@ ]; then \
+	cat .banner; \
 	sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
 	    -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
 	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
@@ -441,7 +442,7 @@ define cmd_compile.h
 endef
 
 include/xen/compile.h: include/xen/compile.h.in .banner FORCE
-	@cat .banner
+	$(if $(filter-out FORCE,$?),$(Q)rm -fv $@)
 	$(call if_changed,compile.h)
 
 targets += include/xen/compile.h
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 17 08:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Jan 2022 08:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258029.443862 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9NnI-0004kA-6R; Mon, 17 Jan 2022 08:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258029.443862; Mon, 17 Jan 2022 08:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9NnI-0004k0-2A; Mon, 17 Jan 2022 08:55:16 +0000
Received: by outflank-mailman (input) for mailman id 258029;
 Mon, 17 Jan 2022 08:55: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 1n9NnH-0004jl-0b
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 08:55: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 1n9NnG-0007ea-W0
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 08:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9NnG-0006Do-Uv
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 08:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TlHSECvswT/SpjiyfZp6eDCSAjRU+d/QVuYSeGWTms8=; b=ywUk93HsZUKYsT+DZIYwOzLO9u
	DN5+gLrwg0w+fdAiLArBif03DLtqOIXaoZTOr0POjhDmYiWIYmEYBj7joDP84YqyPzwpFfQpjkt3E
	fGanQvWJGFih9l1CLc8FDvD7idT51XdfZNrvE5aKLSmCw0TkiMYq8FW99mZyhCA7wRnk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: convert remaining hvm_funcs hook invocations to alt-call
Message-Id: <E1n9NnG-0006Do-Uv@xenbits.xenproject.org>
Date: Mon, 17 Jan 2022 08:55:14 +0000

commit 27a63cdac3880c918848430eb25181437d5795e9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 17 09:45:04 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 17 09:45:04 2022 +0100

    x86/HVM: convert remaining hvm_funcs hook invocations to alt-call
    
    The aim being to have as few indirect calls as possible (see [1]),
    whereas during initial conversion performance was the main aspect and
    hence rarely used hooks didn't get converted. Apparently one use of
    get_interrupt_shadow() was missed at the time.
    
    While doing this, drop NULL checks ahead of CPU management and .nhvm_*()
    calls when the hook is always present. Also convert the
    .nhvm_vcpu_reset() call to alternative_vcall(), as the return value is
    unused and the caller has currently no way of propagating it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Tamas K Lengyel <tamas@tklengyel.com>
    
    [1] https://lists.xen.org/archives/html/xen-devel/2021-11/msg01822.html
---
 xen/arch/x86/hvm/emulate.c         |  2 +-
 xen/arch/x86/hvm/hvm.c             | 25 +++++++++++++------------
 xen/arch/x86/hvm/nestedhvm.c       | 14 ++++++--------
 xen/arch/x86/include/asm/hvm/hvm.h | 38 +++++++++++++++++++-------------------
 xen/arch/x86/monitor.c             |  3 ++-
 xen/arch/x86/vm_event.c            |  2 +-
 6 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index dd59ad89be..2b3fb4d6ba 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2549,7 +2549,7 @@ static int hvmemul_vmfunc(
 
     if ( !hvm_funcs.altp2m_vcpu_emulate_vmfunc )
         return X86EMUL_UNHANDLEABLE;
-    rc = hvm_funcs.altp2m_vcpu_emulate_vmfunc(ctxt->regs);
+    rc = alternative_call(hvm_funcs.altp2m_vcpu_emulate_vmfunc, ctxt->regs);
     if ( rc == X86EMUL_EXCEPTION )
         x86_emul_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC, ctxt);
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 10ee4e9570..3b87506ac4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -126,14 +126,14 @@ static int cpu_callback(
     switch ( action )
     {
     case CPU_UP_PREPARE:
-        rc = hvm_funcs.cpu_up_prepare(cpu);
+        rc = alternative_call(hvm_funcs.cpu_up_prepare, cpu);
         break;
     case CPU_DYING:
         hvm_cpu_down();
         break;
     case CPU_UP_CANCELED:
     case CPU_DEAD:
-        hvm_funcs.cpu_dead(cpu);
+        alternative_vcall(hvm_funcs.cpu_dead, cpu);
         break;
     default:
         break;
@@ -707,7 +707,7 @@ int hvm_domain_initialise(struct domain *d)
     if ( rc )
         goto fail2;
 
-    rc = hvm_funcs.domain_initialise(d);
+    rc = alternative_call(hvm_funcs.domain_initialise, d);
     if ( rc != 0 )
         goto fail2;
 
@@ -740,7 +740,7 @@ void hvm_domain_relinquish_resources(struct domain *d)
         alternative_vcall(hvm_funcs.domain_relinquish_resources, d);
 
     if ( hvm_funcs.nhvm_domain_relinquish_resources )
-        hvm_funcs.nhvm_domain_relinquish_resources(d);
+        alternative_vcall(hvm_funcs.nhvm_domain_relinquish_resources, d);
 
     viridian_domain_deinit(d);
 
@@ -870,7 +870,7 @@ static int hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
         return 0;
 
     /* Architecture-specific vmcs/vmcb bits */
-    hvm_funcs.save_cpu_ctxt(v, &ctxt);
+    alternative_vcall(hvm_funcs.save_cpu_ctxt, v, &ctxt);
 
     hvm_get_segment_register(v, x86_seg_idtr, &seg);
     ctxt.idtr_limit = seg.limit;
@@ -1093,14 +1093,14 @@ static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
 #undef UNFOLD_ARBYTES
 
     /* Architecture-specific vmcs/vmcb bits */
-    if ( hvm_funcs.load_cpu_ctxt(v, &ctxt) < 0 )
+    if ( alternative_call(hvm_funcs.load_cpu_ctxt, v, &ctxt) < 0 )
         return -EINVAL;
 
     v->arch.hvm.guest_cr[2] = ctxt.cr2;
     hvm_update_guest_cr(v, 2);
 
     if ( hvm_funcs.tsc_scaling.setup )
-        hvm_funcs.tsc_scaling.setup(v);
+        alternative_vcall(hvm_funcs.tsc_scaling.setup, v);
 
     v->arch.msrs->tsc_aux = ctxt.msr_tsc_aux;
 
@@ -1563,7 +1563,8 @@ int hvm_vcpu_initialise(struct vcpu *v)
     if ( rc != 0 ) /* teardown: vlapic_destroy */
         goto fail2;
 
-    if ( (rc = hvm_funcs.vcpu_initialise(v)) != 0 ) /* teardown: hvm_funcs.vcpu_destroy */
+    rc = alternative_call(hvm_funcs.vcpu_initialise, v);
+    if ( rc != 0 ) /* teardown: hvm_funcs.vcpu_destroy */
         goto fail3;
 
     softirq_tasklet_init(&v->arch.hvm.assert_evtchn_irq_tasklet,
@@ -1611,7 +1612,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
     free_compat_arg_xlat(v);
  fail4:
     hvmemul_cache_destroy(v);
-    hvm_funcs.vcpu_destroy(v);
+    alternative_vcall(hvm_funcs.vcpu_destroy, v);
  fail3:
     vlapic_destroy(v);
  fail2:
@@ -1635,7 +1636,7 @@ void hvm_vcpu_destroy(struct vcpu *v)
     free_compat_arg_xlat(v);
 
     tasklet_kill(&v->arch.hvm.assert_evtchn_irq_tasklet);
-    hvm_funcs.vcpu_destroy(v);
+    alternative_vcall(hvm_funcs.vcpu_destroy, v);
 
     vlapic_destroy(v);
 
@@ -3874,7 +3875,7 @@ enum hvm_intblk hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack)
          !(guest_cpu_user_regs()->eflags & X86_EFLAGS_IF) )
         return hvm_intblk_rflags_ie;
 
-    intr_shadow = hvm_funcs.get_interrupt_shadow(v);
+    intr_shadow = alternative_call(hvm_funcs.get_interrupt_shadow, v);
 
     if ( intr_shadow & (HVM_INTR_SHADOW_STI|HVM_INTR_SHADOW_MOV_SS) )
         return hvm_intblk_shadow;
@@ -3990,7 +3991,7 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
     hvm_set_segment_register(v, x86_seg_idtr, &reg);
 
     if ( hvm_funcs.tsc_scaling.setup )
-        hvm_funcs.tsc_scaling.setup(v);
+        alternative_vcall(hvm_funcs.tsc_scaling.setup, v);
 
     /* Sync AP's TSC with BSP's. */
     v->arch.hvm.cache_tsc_offset =
diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
index bd1101987d..5021da667a 100644
--- a/xen/arch/x86/hvm/nestedhvm.c
+++ b/xen/arch/x86/hvm/nestedhvm.c
@@ -54,8 +54,7 @@ nestedhvm_vcpu_reset(struct vcpu *v)
 
     hvm_asid_flush_vcpu_asid(&nv->nv_n2asid);
 
-    if ( hvm_funcs.nhvm_vcpu_reset )
-        hvm_funcs.nhvm_vcpu_reset(v);
+    alternative_vcall(hvm_funcs.nhvm_vcpu_reset, v);
 
     /* vcpu is in host mode */
     nestedhvm_vcpu_exit_guestmode(v);
@@ -64,14 +63,14 @@ nestedhvm_vcpu_reset(struct vcpu *v)
 int
 nestedhvm_vcpu_initialise(struct vcpu *v)
 {
-    int rc = -EOPNOTSUPP;
+    int rc;
 
     if ( !shadow_io_bitmap[0] )
         return -ENOMEM;
 
-    if ( !hvm_funcs.nhvm_vcpu_initialise ||
-         ((rc = hvm_funcs.nhvm_vcpu_initialise(v)) != 0) )
-         return rc;
+    rc = alternative_call(hvm_funcs.nhvm_vcpu_initialise, v);
+    if ( rc )
+        return rc;
 
     nestedhvm_vcpu_reset(v);
     return 0;
@@ -80,8 +79,7 @@ nestedhvm_vcpu_initialise(struct vcpu *v)
 void
 nestedhvm_vcpu_destroy(struct vcpu *v)
 {
-    if ( hvm_funcs.nhvm_vcpu_destroy )
-        hvm_funcs.nhvm_vcpu_destroy(v);
+    alternative_vcall(hvm_funcs.nhvm_vcpu_destroy, v);
 }
 
 static void
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index cd9e73e266..b26302d9e7 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -561,13 +561,12 @@ static inline void hvm_invlpg(struct vcpu *v, unsigned long linear)
 
 static inline int hvm_cpu_up(void)
 {
-    return (hvm_funcs.cpu_up ? hvm_funcs.cpu_up() : 0);
+    return alternative_call(hvm_funcs.cpu_up);
 }
 
 static inline void hvm_cpu_down(void)
 {
-    if ( hvm_funcs.cpu_down )
-        hvm_funcs.cpu_down();
+    alternative_vcall(hvm_funcs.cpu_down);
 }
 
 static inline unsigned int hvm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
@@ -601,7 +600,7 @@ static inline void hvm_invalidate_regs_fields(struct cpu_user_regs *regs)
 static inline int nhvm_vcpu_vmexit_event(
     struct vcpu *v, const struct x86_event *event)
 {
-    return hvm_funcs.nhvm_vcpu_vmexit_event(v, event);
+    return alternative_call(hvm_funcs.nhvm_vcpu_vmexit_event, v, event);
 }
 
 /* returns l1 guest's cr3 that points to the page table used to
@@ -609,45 +608,46 @@ static inline int nhvm_vcpu_vmexit_event(
  */
 static inline uint64_t nhvm_vcpu_p2m_base(struct vcpu *v)
 {
-    return hvm_funcs.nhvm_vcpu_p2m_base(v);
+    return alternative_call(hvm_funcs.nhvm_vcpu_p2m_base, v);
 }
 
 /* returns true, when l1 guest intercepts the specified trap */
 static inline bool_t nhvm_vmcx_guest_intercepts_event(
     struct vcpu *v, unsigned int vector, int errcode)
 {
-    return hvm_funcs.nhvm_vmcx_guest_intercepts_event(v, vector, errcode);
+    return alternative_call(hvm_funcs.nhvm_vmcx_guest_intercepts_event, v,
+                            vector, errcode);
 }
 
 /* returns true when l1 guest wants to use hap to run l2 guest */
 static inline bool_t nhvm_vmcx_hap_enabled(struct vcpu *v)
 {
-    return hvm_funcs.nhvm_vmcx_hap_enabled(v);
+    return alternative_call(hvm_funcs.nhvm_vmcx_hap_enabled, v);
 }
 
 /* interrupt */
 static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
 {
-    return hvm_funcs.nhvm_intr_blocked(v);
+    return alternative_call(hvm_funcs.nhvm_intr_blocked, v);
 }
 
 static inline int nhvm_hap_walk_L1_p2m(
     struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
     uint8_t *p2m_acc, struct npfec npfec)
 {
-    return hvm_funcs.nhvm_hap_walk_L1_p2m(
+    return alternative_call(hvm_funcs.nhvm_hap_walk_L1_p2m,
         v, L2_gpa, L1_gpa, page_order, p2m_acc, npfec);
 }
 
 static inline void hvm_enable_msr_interception(struct domain *d, uint32_t msr)
 {
-    hvm_funcs.enable_msr_interception(d, msr);
+    alternative_vcall(hvm_funcs.enable_msr_interception, d, msr);
 }
 
 static inline bool_t hvm_is_singlestep_supported(void)
 {
     return (hvm_funcs.is_singlestep_supported &&
-            hvm_funcs.is_singlestep_supported());
+            alternative_call(hvm_funcs.is_singlestep_supported));
 }
 
 static inline bool hvm_hap_supported(void)
@@ -665,14 +665,14 @@ static inline bool hvm_altp2m_supported(void)
 static inline void altp2m_vcpu_update_p2m(struct vcpu *v)
 {
     if ( hvm_funcs.altp2m_vcpu_update_p2m )
-        hvm_funcs.altp2m_vcpu_update_p2m(v);
+        alternative_vcall(hvm_funcs.altp2m_vcpu_update_p2m, v);
 }
 
 /* updates VMCS fields related to VMFUNC and #VE */
 static inline void altp2m_vcpu_update_vmfunc_ve(struct vcpu *v)
 {
     if ( hvm_funcs.altp2m_vcpu_update_vmfunc_ve )
-        hvm_funcs.altp2m_vcpu_update_vmfunc_ve(v);
+        alternative_vcall(hvm_funcs.altp2m_vcpu_update_vmfunc_ve, v);
 }
 
 /* emulates #VE */
@@ -680,7 +680,7 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
 {
     if ( hvm_funcs.altp2m_vcpu_emulate_ve )
     {
-        hvm_funcs.altp2m_vcpu_emulate_ve(v);
+        alternative_vcall(hvm_funcs.altp2m_vcpu_emulate_ve, v);
         return true;
     }
     return false;
@@ -689,7 +689,7 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
 static inline int hvm_vmtrace_control(struct vcpu *v, bool enable, bool reset)
 {
     if ( hvm_funcs.vmtrace_control )
-        return hvm_funcs.vmtrace_control(v, enable, reset);
+        return alternative_call(hvm_funcs.vmtrace_control, v, enable, reset);
 
     return -EOPNOTSUPP;
 }
@@ -698,7 +698,7 @@ static inline int hvm_vmtrace_control(struct vcpu *v, bool enable, bool reset)
 static inline int hvm_vmtrace_output_position(struct vcpu *v, uint64_t *pos)
 {
     if ( hvm_funcs.vmtrace_output_position )
-        return hvm_funcs.vmtrace_output_position(v, pos);
+        return alternative_call(hvm_funcs.vmtrace_output_position, v, pos);
 
     return -EOPNOTSUPP;
 }
@@ -707,7 +707,7 @@ static inline int hvm_vmtrace_set_option(
     struct vcpu *v, uint64_t key, uint64_t value)
 {
     if ( hvm_funcs.vmtrace_set_option )
-        return hvm_funcs.vmtrace_set_option(v, key, value);
+        return alternative_call(hvm_funcs.vmtrace_set_option, v, key, value);
 
     return -EOPNOTSUPP;
 }
@@ -716,7 +716,7 @@ static inline int hvm_vmtrace_get_option(
     struct vcpu *v, uint64_t key, uint64_t *value)
 {
     if ( hvm_funcs.vmtrace_get_option )
-        return hvm_funcs.vmtrace_get_option(v, key, value);
+        return alternative_call(hvm_funcs.vmtrace_get_option, v, key, value);
 
     return -EOPNOTSUPP;
 }
@@ -724,7 +724,7 @@ static inline int hvm_vmtrace_get_option(
 static inline int hvm_vmtrace_reset(struct vcpu *v)
 {
     if ( hvm_funcs.vmtrace_reset )
-        return hvm_funcs.vmtrace_reset(v);
+        return alternative_call(hvm_funcs.vmtrace_reset, v);
 
     return -EOPNOTSUPP;
 }
diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
index 40d2673707..3079726a8b 100644
--- a/xen/arch/x86/monitor.c
+++ b/xen/arch/x86/monitor.c
@@ -270,7 +270,8 @@ int arch_monitor_domctl_event(struct domain *d,
         ad->monitor.descriptor_access_enabled = requested_status;
 
         for_each_vcpu ( d, v )
-            hvm_funcs.set_descriptor_access_exiting(v, requested_status);
+            alternative_vcall(hvm_funcs.set_descriptor_access_exiting, v,
+                              requested_status);
 
         domain_unpause(d);
         break;
diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index ffcc64c40b..7027c08a92 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -204,7 +204,7 @@ void vm_event_fill_regs(vm_event_request_t *req)
     ASSERT(is_hvm_vcpu(curr));
 
     /* Architecture-specific vmcs/vmcb bits */
-    hvm_funcs.save_cpu_ctxt(curr, &ctxt);
+    alternative_vcall(hvm_funcs.save_cpu_ctxt, curr, &ctxt);
 
     req->data.regs.x86.rax = regs->rax;
     req->data.regs.x86.rcx = regs->rcx;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 17 16:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Jan 2022 16:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258207.444426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9UwM-00017K-LA; Mon, 17 Jan 2022 16:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258207.444426; Mon, 17 Jan 2022 16:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9UwM-00017C-I2; Mon, 17 Jan 2022 16:33:06 +0000
Received: by outflank-mailman (input) for mailman id 258207;
 Mon, 17 Jan 2022 16:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9UwL-000176-Fn
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33: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 1n9UwL-00089I-E0
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9UwL-0005Ak-C9
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PA8yPm2ZRBUb4vEO6xuHGYiqBuykdAeNIs7iegauPZc=; b=1BJRldu7yB+5cBeT48keLow9JM
	GS+wmsAPhXHorVdy5M1wO51EmCtBHkWFCNteyGwLBlwweJZXVsxq/EfS/ZfvyT4bBKoYs7PdAU3pN
	uSrPVOCJVnUtAtUJIB0ZZnYs3BE7aw/4ap812Y/UdC2Zi54R9yjewdBVaIhfxijYmgmg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: update my email address
Message-Id: <E1n9UwL-0005Ak-C9@xenbits.xenproject.org>
Date: Mon, 17 Jan 2022 16:33:05 +0000

commit 5fdd3a45bd0181a3748f39b84357a6cf0d6e0845
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Mon Jan 17 17:28:36 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 17 17:28:36 2022 +0100

    MAINTAINERS: update my email address
    
    I am no longer an employee at AIS. Use my personal email address
    instead.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@gmail.com>
    Reviewed-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4a2884dfa7..feea7d14cf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -302,7 +302,7 @@ F:	tools/debugger/gdbsx/
 
 GOLANG BINDINGS
 M:	George Dunlap <george.dunlap@citrix.com>
-M:     Nick Rosbrook <rosbrookn@ainfosec.com>
+M:	Nick Rosbrook <rosbrookn@gmail.com>
 S:	Maintained
 F:	tools/golang
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 17 16:33:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Jan 2022 16:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258208.444430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9UwW-00019J-MK; Mon, 17 Jan 2022 16:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258208.444430; Mon, 17 Jan 2022 16:33: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 1n9UwW-00019B-JU; Mon, 17 Jan 2022 16:33:16 +0000
Received: by outflank-mailman (input) for mailman id 258208;
 Mon, 17 Jan 2022 16:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9UwV-000190-Ig
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33: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 1n9UwV-00089f-Hp
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9UwV-0005Bn-Gg
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e9/K3DjkkWlW2l+BRH/cyC8fw3gaoupU/uSO7mInFgk=; b=e3Kuxe3dM6rcHEs4nrRXhCzQwb
	6uqTbymmQDLSCHlV6AsEpAfTQx2C4NuO5EVIsiMqfZ0v0/cE+MqxlvtoPVZHXrW+pGj2h/Bl40XGh
	hZcZ0DEtEdwHPpTem20zqpwCwHPM6o1GxTYTcs0HLp6wycU1Nzu9IsgIop14LlkVJVrI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: email address update in TXT section
Message-Id: <E1n9UwV-0005Bn-Gg@xenbits.xenproject.org>
Date: Mon, 17 Jan 2022 16:33:15 +0000

commit 369a01ce84f3dbbfdcb79fc178c83bdcf16b2c43
Author:     Lukasz Hawrylko <lukasz@hawrylko.pl>
AuthorDate: Mon Jan 17 17:29:00 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 17 17:29:00 2022 +0100

    MAINTAINERS: email address update in TXT section
    
    As I am not working for Intel anymore, I would like to update my email address
    to my private one.
    
    Signed-off-by: Lukasz Hawrylko <lukasz@hawrylko.pl>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index feea7d14cf..64934cc070 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -316,7 +316,7 @@ F:	xen/common/hypfs.c
 F:	xen/include/xen/hypfs.h
 
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
-R:	Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
+R:	Lukasz Hawrylko <lukasz@hawrylko.pl>
 R:	Daniel P. Smith <dpsmith@apertussolutions.com>
 S:	Odd Fixes
 F:	xen/arch/x86/include/asm/tboot.h
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 17 16:33:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Jan 2022 16:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258209.444434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9Uwg-0001CU-O2; Mon, 17 Jan 2022 16:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258209.444434; Mon, 17 Jan 2022 16:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9Uwg-0001CK-L3; Mon, 17 Jan 2022 16:33:26 +0000
Received: by outflank-mailman (input) for mailman id 258209;
 Mon, 17 Jan 2022 16:33:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9Uwf-0001Bz-Ne
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33: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 1n9Uwf-00089z-Lw
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9Uwf-0005Cj-KN
 for xen-changelog@lists.xenproject.org; Mon, 17 Jan 2022 16:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0NF9bafl66HCz5MS7yAYXv+JssCqfsGOKZYCE+AQaXo=; b=kcnaSZnkmLHEU9yjhTPmT9x1o2
	WqbBxRw9uGGYWcW/xFVgkH+Bhihd24wor0ZjnQmSfBQaXupjkOvjUhsYbkA6JC/D+7/oFWFl5hzih
	r5fmDkQpwOQakyI4Xe+hTn+aC/SCLQYRdsrndSozRvhFSZ3GWUw0I8d97igIAfmpB4LQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: mark wait_tick_pvh() __init
Message-Id: <E1n9Uwf-0005Cj-KN@xenbits.xenproject.org>
Date: Mon, 17 Jan 2022 16:33:25 +0000

commit ad47bc9a9742e73bea97ae791f66adf1caecaa63
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 17 17:29:42 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 17 17:29:42 2022 +0100

    x86/APIC: mark wait_tick_pvh() __init
    
    It should have been that way right from its introduction by 02e0de011555
    ("x86: APIC timer calibration when running as a guest").
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/apic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 55c103aaff..d7d5c15155 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1190,7 +1190,7 @@ static void __init check_deadline_errata(void)
            "please update microcode to version %#x (or later)\n", rev);
 }
 
-static void wait_tick_pvh(void)
+static void __init wait_tick_pvh(void)
 {
     u64 lapse_ns = 1000000000ULL / HZ;
     s_time_t start, curr_time;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 14:22:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 14:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258550.445381 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9pN5-0003yg-QZ; Tue, 18 Jan 2022 14:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258550.445381; Tue, 18 Jan 2022 14:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9pN5-0003yY-Nh; Tue, 18 Jan 2022 14:22:03 +0000
Received: by outflank-mailman (input) for mailman id 258550;
 Tue, 18 Jan 2022 14: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 1n9pN4-0003yO-J7
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14: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 1n9pN4-0001g5-Ga
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9pN4-0002O6-FZ
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T3EgOLly8aFM1GWY6iMHLXGpYnY0UI5GIecDfAxdgFE=; b=syr2y9qwg3fX4y+eeLvf8mdJoO
	TSzt3l5cz1zMwuSg96BhQJrJBxp+Eh2PR2qVAmDw4tI/NWnKJ9iPkkqgPGKcfo+cLVruioV6dMJ4W
	RPSP7FfWty/ayDI8oHsh2nQMGFw6eR6p5bWPekOOB7HYQu8JGxLJc54ZAl7qMpXIczbU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] introduce get_file_from_fd()
Message-Id: <E1n9pN4-0002O6-FZ@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 14:22:02 +0000

commit 0e19f674ab48dfce8be5a43d2fca78293a2e3ad8
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 07:45:23 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jan 17 10:51:21 2022 +0000

    introduce get_file_from_fd()
    
    Exporting the files[] array especially for components outside the
    mini-os source tree is limiting the ability to change any file handling
    in mini-os.
    
    Introduce a new function get_file_from_fd() to return the struct file
    pointer (or NULL) for a given file descriptor.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h | 1 +
 lib/sys.c     | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/lib.h b/include/lib.h
index 91364ba..7a0546b 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -198,6 +198,7 @@ struct file {
 
 extern struct file files[];
 
+struct file *get_file_from_fd(int fd);
 int alloc_fd(enum fd_type type);
 void close_all_files(void);
 extern struct thread *main_thread;
diff --git a/lib/sys.c b/lib/sys.c
index 6f2b026..9a03875 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -98,6 +98,14 @@ struct file files[NOFILE] = {
     { .type = FTYPE_CONSOLE }, /* stderr */
 };
 
+struct file *get_file_from_fd(int fd)
+{
+    if ( fd < 0 || fd >= ARRAY_SIZE(files) )
+        return NULL;
+
+    return (files[fd].type == FTYPE_NONE) ? NULL : files + fd;
+}
+
 DECLARE_WAIT_QUEUE_HEAD(event_queue);
 
 int alloc_fd(enum fd_type type)
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 14:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 14:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258551.445384 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9pNF-00041I-S4; Tue, 18 Jan 2022 14:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258551.445384; Tue, 18 Jan 2022 14: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 1n9pNF-00041A-PA; Tue, 18 Jan 2022 14:22:13 +0000
Received: by outflank-mailman (input) for mailman id 258551;
 Tue, 18 Jan 2022 14:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9pNE-000410-Kr
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9pNE-0001gB-K1
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9pNE-0002P1-Iw
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9CpoHsbIC4bAxeLM0LhNF+NjAuuoQzkRPcIqQzEWgOo=; b=12bsscslKuJl1YlVNZCsXvonmS
	jPWsMG9cxKnMRsbisCPKwiUTM4Yl4gE6KcNTV6W1Yn+vUvzP45Tn9qW7sKs4tRr/ffmFWd5lhHgVp
	qJDFMiywgjuz7GiGQxl+59E6zXX1iaswYxp2gjMTPLoXGH72jECjADMGwdcFUn5pd6EE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] reset file type in close() in one place only
Message-Id: <E1n9pNE-0002P1-Iw@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 14:22:12 +0000

commit 83558bc823b3b0e14d9321f587d6d7bfb990380b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 07:45:24 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jan 17 10:55:46 2022 +0000

    reset file type in close() in one place only
    
    Today the file type in struct file is set to FTYPE_NONE for each
    file type individually. Do that at the end of close() handling for
    all types.
    
    While at it wipe the complete struct file, too, in order to avoid
    old data creeping into a new allocated struct file.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 lib/sys.c | 54 ++++++++++++++++++++++++++++--------------------------
 lib/xs.c  |  1 -
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/lib/sys.c b/lib/sys.c
index 9a03875..333e47c 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -424,84 +424,86 @@ int fsync(int fd) {
 
 int close(int fd)
 {
+    int res = 0;
+
+    if ( fd < 0 || fd >= ARRAY_SIZE(files) )
+        goto error;
+
     printk("close(%d)\n", fd);
     switch (files[fd].type) {
         default:
-	    files[fd].type = FTYPE_NONE;
-	    return 0;
+            break;
 #ifdef CONFIG_XENBUS
 	case FTYPE_XENBUS:
             xs_daemon_close((void*)(intptr_t) fd);
-            return 0;
+            break;
 #endif
 #ifdef HAVE_LWIP
-	case FTYPE_SOCKET: {
-	    int res = lwip_close(files[fd].fd);
-	    files[fd].type = FTYPE_NONE;
-	    return res;
-	}
+	case FTYPE_SOCKET:
+            res = lwip_close(files[fd].fd);
+            break;
 #endif
 #ifdef CONFIG_LIBXENCTRL
 	case FTYPE_XC:
 	    minios_interface_close_fd(fd);
-	    return 0;
+            break;
 #endif
 #ifdef CONFIG_LIBXENEVTCHN
 	case FTYPE_EVTCHN:
 	    minios_evtchn_close_fd(fd);
-            return 0;
+            break;
 #endif
 #ifdef CONFIG_LIBXENGNTTAB
 	case FTYPE_GNTMAP:
 	    minios_gnttab_close_fd(fd);
-	    return 0;
+            break;
 #endif
 #ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
 	    shutdown_netfront(files[fd].dev);
-	    files[fd].type = FTYPE_NONE;
-	    return 0;
+            break;
 #endif
 #ifdef CONFIG_BLKFRONT
 	case FTYPE_BLK:
             shutdown_blkfront(files[fd].dev);
-	    files[fd].type = FTYPE_NONE;
-	    return 0;
+            break;
 #endif
 #ifdef CONFIG_TPMFRONT
 	case FTYPE_TPMFRONT:
             shutdown_tpmfront(files[fd].dev);
-	    files[fd].type = FTYPE_NONE;
-	    return 0;
+            break;
 #endif
 #ifdef CONFIG_TPM_TIS
 	case FTYPE_TPM_TIS:
             shutdown_tpm_tis(files[fd].dev);
-	    files[fd].type = FTYPE_NONE;
-	    return 0;
+            break;
 #endif
 #ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].dev);
-            files[fd].type = FTYPE_NONE;
-            return 0;
+            break;
 #endif
 #ifdef CONFIG_FBFRONT
 	case FTYPE_FB:
             shutdown_fbfront(files[fd].dev);
-            files[fd].type = FTYPE_NONE;
-            return 0;
+            break;
 #endif
 #ifdef CONFIG_CONSFRONT
         case FTYPE_SAVEFILE:
         case FTYPE_CONSOLE:
             fini_consfront(files[fd].dev);
-            files[fd].type = FTYPE_NONE;
-            return 0;
+            break;
 #endif
 	case FTYPE_NONE:
-	    break;
+            goto error;
     }
+
+    memset(files + fd, 0, sizeof(struct file));
+    BUILD_BUG_ON(FTYPE_NONE != 0);
+
+    return res;
+
+ error:
     printk("close(%d): Bad descriptor\n", fd);
     errno = EBADF;
     return -1;
diff --git a/lib/xs.c b/lib/xs.c
index 0459f52..4af0f96 100644
--- a/lib/xs.c
+++ b/lib/xs.c
@@ -35,7 +35,6 @@ void xs_daemon_close(struct xs_handle *h)
         next = event->next;
         free(event);
     }
-    files[fd].type = FTYPE_NONE;
 }
 
 int xs_fileno(struct xs_handle *h)
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 14:22:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 14:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258552.445389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9pNP-000440-Th; Tue, 18 Jan 2022 14:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258552.445389; Tue, 18 Jan 2022 14: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 1n9pNP-00043s-Ql; Tue, 18 Jan 2022 14:22:23 +0000
Received: by outflank-mailman (input) for mailman id 258552;
 Tue, 18 Jan 2022 14: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 1n9pNO-00043f-Nz
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9pNO-0001gX-NA
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9pNO-0002Pj-MH
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q2Oco5nfcaxRd+orZ+KYNgjxWg94EtUuvAFUOnQS8S4=; b=tvFEXSCNQhKtICzQq0nZd6DC+X
	O31Fg+J5KSQRZn6T8Dio4QLSxMGvDEvDuX2EA3JkKHWzHzCYrxVn+XCdhqFOWXB6koOA2M9UbSgvc
	Q72Xr5bEWps7+KNO3D4680zCetcKAPArNJZ6ZFMMnL/kklwji+KaN6h/h/qP4b8jbYBU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] remove file type FTYPE_XC
Message-Id: <E1n9pNO-0002Pj-MH@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 14:22:22 +0000

commit e915aee40cd9520c2a1342e0cdc3a60de5e00547
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 07:45:25 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jan 17 10:55:47 2022 +0000

    remove file type FTYPE_XC
    
    The only reason for the file type FTYPE_XC has been gone long time
    ago: it was needed for xc_map_foreign_bulk(), which has been switched
    to use libxenforeignmemory and doesn't need this special file any
    more.
    
    So remove everything related to FTYPE_XC.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 Config.mk                     |  1 -
 arch/x86/testbuild/all-no     |  1 -
 arch/x86/testbuild/all-yes    |  1 -
 arch/x86/testbuild/newxen-yes |  1 -
 include/lib.h                 |  1 -
 lib/sys.c                     | 13 -------------
 6 files changed, 18 deletions(-)

diff --git a/Config.mk b/Config.mk
index 5e66089..1e08388 100644
--- a/Config.mk
+++ b/Config.mk
@@ -197,7 +197,6 @@ CONFIG-n += CONFIG_PARAVIRT
 endif
 # Support legacy CONFIG_XC value
 CONFIG_XC ?= $(libc)
-CONFIG-$(CONFIG_XC) += CONFIG_LIBXENCTRL
 CONFIG-$(CONFIG_XC) += CONFIG_LIBXENEVTCHN
 CONFIG-$(CONFIG_XC) += CONFIG_LIBXENGNTTAB
 
diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
index 7972ecd..d6fc260 100644
--- a/arch/x86/testbuild/all-no
+++ b/arch/x86/testbuild/all-no
@@ -13,7 +13,6 @@ CONFIG_FBFRONT = n
 CONFIG_KBDFRONT = n
 CONFIG_CONSFRONT = n
 CONFIG_XENBUS = n
-CONFIG_LIBXENCTRL = n
 CONFIG_LIBXENEVTCHN = n
 CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
index bc8eea5..98bbfeb 100644
--- a/arch/x86/testbuild/all-yes
+++ b/arch/x86/testbuild/all-yes
@@ -16,7 +16,6 @@ CONFIG_XENBUS = y
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 # The following are special: they need support from outside
-CONFIG_LIBXENCTRL = n
 CONFIG_LIBXENEVTCHN = n
 CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
index f72123b..0603200 100644
--- a/arch/x86/testbuild/newxen-yes
+++ b/arch/x86/testbuild/newxen-yes
@@ -17,7 +17,6 @@ CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
 # The following are special: they need support from outside
-CONFIG_LIBXENCTRL = n
 CONFIG_LIBXENEVTCHN = n
 CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
diff --git a/include/lib.h b/include/lib.h
index 7a0546b..7ca9076 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -159,7 +159,6 @@ enum fd_type {
     FTYPE_CONSOLE,
     FTYPE_FILE,
     FTYPE_XENBUS,
-    FTYPE_XC,
     FTYPE_EVTCHN,
     FTYPE_GNTMAP,
     FTYPE_SOCKET,
diff --git a/lib/sys.c b/lib/sys.c
index 333e47c..80972c1 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -87,7 +87,6 @@
     }
 
 #define NOFILE 32
-extern void minios_interface_close_fd(int fd);
 extern void minios_evtchn_close_fd(int fd);
 extern void minios_gnttab_close_fd(int fd);
 
@@ -443,11 +442,6 @@ int close(int fd)
             res = lwip_close(files[fd].fd);
             break;
 #endif
-#ifdef CONFIG_LIBXENCTRL
-	case FTYPE_XC:
-	    minios_interface_close_fd(fd);
-            break;
-#endif
 #ifdef CONFIG_LIBXENEVTCHN
 	case FTYPE_EVTCHN:
 	    minios_evtchn_close_fd(fd);
@@ -651,7 +645,6 @@ static const char file_types[] = {
     [FTYPE_NONE]	= 'N',
     [FTYPE_CONSOLE]	= 'C',
     [FTYPE_XENBUS]	= 'S',
-    [FTYPE_XC]		= 'X',
     [FTYPE_EVTCHN]	= 'E',
     [FTYPE_SOCKET]	= 's',
     [FTYPE_TAP]		= 'T',
@@ -1383,12 +1376,6 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset
 
     if (fd == -1)
         return map_zero(n, 1);
-#ifdef CONFIG_LIBXENCTRL
-    else if (files[fd].type == FTYPE_XC) {
-        unsigned long zero = 0;
-        return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, NULL, 0);
-    }
-#endif
     else if (files[fd].type == FTYPE_MEM) {
         unsigned long first_mfn = offset >> PAGE_SHIFT;
         return map_frames_ex(&first_mfn, n, 0, 1, 1, DOMID_IO, NULL, _PAGE_PRESENT|_PAGE_RW);
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 14:22:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 14:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258553.445392 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9pNZ-00047f-Vp; Tue, 18 Jan 2022 14:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258553.445392; Tue, 18 Jan 2022 14: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 1n9pNZ-00047X-ST; Tue, 18 Jan 2022 14:22:33 +0000
Received: by outflank-mailman (input) for mailman id 258553;
 Tue, 18 Jan 2022 14: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 1n9pNY-000478-RJ
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14: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 1n9pNY-0001h1-QN
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9pNY-0002Qh-PU
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14: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=pZXs1tpr3YjnYXwSQKDZaBUl3b8Pn1BFlmg0+Mhu8VM=; b=WXoNqAeR/iFS8pYPbd1qdb2lEB
	Y/WER/o5hp1o6Qz6zrJIqs5tiJtKRKWRzhOYL7FfrlJBvRLZPgRGCsbhSCrfpBYNc816mT6fLzg39
	3xIccUyTKlpJpUt1SuLtgyficHlvp6tz1lH1fNtgpwS6RaMI8sI7Wsdou+CAFljdPsDQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] use function vectors instead of switch for file operations
Message-Id: <E1n9pNY-0002Qh-PU@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 14:22:32 +0000

commit 9d5dc45420954ab675f789ab948f9111151406cf
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 07:45:26 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jan 17 10:55:47 2022 +0000

    use function vectors instead of switch for file operations
    
    Introduce file type specific function vectors for all the needed file
    operations which are file type specific in order to prepare replacing
    the large switch statements in each generic file function.
    
    Add a function to allocate a new file type dynamically in order to
    prepare removing direct dependencies to external components in the
    future. For this reason switch the file type from an enum to an
    unsigned int. Prepare removal of some statically defines file types
    by putting them at the end of the defined list.
    
    Change the debug output for the file type from a single character to
    a string in order to support a future removal of the file_types[]
    array.
    
    Provide some functions useful for file_ops in future patches.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h |  57 ++++++++-----
 lib/sys.c     | 268 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 263 insertions(+), 62 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 7ca9076..4469680 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -66,6 +66,7 @@
 
 #ifdef HAVE_LIBC
 #include <sys/queue.h>
+#include <sys/stat.h>
 #include <stdio.h>
 #include <string.h>
 #else
@@ -154,23 +155,23 @@ do {                                                           \
 void sanity_check(void);
 
 #ifdef HAVE_LIBC
-enum fd_type {
-    FTYPE_NONE = 0,
-    FTYPE_CONSOLE,
-    FTYPE_FILE,
-    FTYPE_XENBUS,
-    FTYPE_EVTCHN,
-    FTYPE_GNTMAP,
-    FTYPE_SOCKET,
-    FTYPE_TAP,
-    FTYPE_BLK,
-    FTYPE_KBD,
-    FTYPE_FB,
-    FTYPE_MEM,
-    FTYPE_SAVEFILE,
-    FTYPE_TPMFRONT,
-    FTYPE_TPM_TIS,
-};
+#define FTYPE_NONE       0
+#define FTYPE_CONSOLE    1
+#define FTYPE_FILE       2
+#define FTYPE_SOCKET     3
+#define FTYPE_MEM        4
+#define FTYPE_SAVEFILE   5
+#define FTYPE_FB         6
+#define FTYPE_KBD        7
+#define FTYPE_TAP        8
+#define FTYPE_BLK        9
+#define FTYPE_TPMFRONT  10
+#define FTYPE_TPM_TIS   11
+#define FTYPE_XENBUS    12
+#define FTYPE_GNTMAP    13
+#define FTYPE_EVTCHN    14
+#define FTYPE_N         15
+#define FTYPE_SPARE     16
 
 LIST_HEAD(evtchn_port_list, evtchn_port_info);
 
@@ -182,7 +183,7 @@ struct evtchn_port_info {
 };
 
 struct file {
-    enum fd_type type;
+    unsigned int type;
     bool read;	/* maybe available for read */
     off_t offset;
     union {
@@ -197,8 +198,26 @@ struct file {
 
 extern struct file files[];
 
+struct file_ops {
+    const char *name;
+    int (*read)(struct file *file, void *buf, size_t nbytes);
+    int (*write)(struct file *file, const void *buf, size_t nbytes);
+    off_t (*lseek)(struct file *file, off_t offset, int whence);
+    int (*close)(struct file *file);
+    int (*fstat)(struct file *file, struct stat *buf);
+    int (*fcntl)(struct file *file, int cmd, va_list args);
+    bool (*select_rd)(struct file *file);
+    bool (*select_wr)(struct file *file);
+};
+
+unsigned int alloc_file_type(const struct file_ops *ops);
+
+off_t lseek_default(struct file *file, off_t offset, int whence);
+bool select_yes(struct file *file);
+bool select_read_flag(struct file *file);
+
 struct file *get_file_from_fd(int fd);
-int alloc_fd(enum fd_type type);
+int alloc_fd(unsigned int type);
 void close_all_files(void);
 extern struct thread *main_thread;
 void sparse(unsigned long data, size_t size);
diff --git a/lib/sys.c b/lib/sys.c
index 80972c1..a66cf73 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -97,6 +97,40 @@ struct file files[NOFILE] = {
     { .type = FTYPE_CONSOLE }, /* stderr */
 };
 
+static const struct file_ops file_ops_none = {
+    .name = "none",
+};
+
+static const struct file_ops *file_ops[FTYPE_N + FTYPE_SPARE] = {
+    [FTYPE_NONE] = &file_ops_none,
+};
+
+unsigned int alloc_file_type(const struct file_ops *ops)
+{
+    static unsigned int i = FTYPE_N;
+    unsigned int ret;
+
+    pthread_mutex_lock(&fd_lock);
+
+    BUG_ON(i == ARRAY_SIZE(file_ops));
+    ret = i++;
+    file_ops[ret] = ops;
+
+    pthread_mutex_unlock(&fd_lock);
+
+    printk("New file type \"%s\"(%u) allocated\n", ops->name, ret);
+
+    return ret;
+}
+
+static const struct file_ops *get_file_ops(unsigned int type)
+{
+    if ( type >= ARRAY_SIZE(file_ops) || !file_ops[type] )
+        return &file_ops_none;
+
+    return file_ops[type];
+}
+
 struct file *get_file_from_fd(int fd)
 {
     if ( fd < 0 || fd >= ARRAY_SIZE(files) )
@@ -107,7 +141,7 @@ struct file *get_file_from_fd(int fd)
 
 DECLARE_WAIT_QUEUE_HEAD(event_queue);
 
-int alloc_fd(enum fd_type type)
+int alloc_fd(unsigned int type)
 {
     int i;
     pthread_mutex_lock(&fd_lock);
@@ -248,7 +282,17 @@ int isatty(int fd)
 
 int read(int fd, void *buf, size_t nbytes)
 {
-    switch (files[fd].type) {
+    struct file *file = get_file_from_fd(fd);
+    const struct file_ops *ops;
+
+    if ( !file )
+        goto error;
+
+    ops = get_file_ops(file->type);
+    if ( ops->read )
+        return ops->read(file, buf, nbytes);
+
+    switch (file->type) {
         case FTYPE_SAVEFILE:
 	case FTYPE_CONSOLE: {
 	    int ret;
@@ -320,6 +364,8 @@ int read(int fd, void *buf, size_t nbytes)
 	default:
 	    break;
     }
+
+ error:
     printk("read(%d): Bad descriptor\n", fd);
     errno = EBADF;
     return -1;
@@ -327,7 +373,17 @@ int read(int fd, void *buf, size_t nbytes)
 
 int write(int fd, const void *buf, size_t nbytes)
 {
-    switch (files[fd].type) {
+    struct file *file = get_file_from_fd(fd);
+    const struct file_ops *ops;
+
+    if ( !file )
+        goto error;
+
+    ops = get_file_ops(file->type);
+    if ( ops->write )
+        return ops->write(file, buf, nbytes);
+
+    switch (file->type) {
         case FTYPE_SAVEFILE: {
                 int ret = 0, tot = nbytes;
                 while (nbytes > 0) {
@@ -364,14 +420,61 @@ int write(int fd, const void *buf, size_t nbytes)
 	default:
 	    break;
     }
+
+ error:
     printk("write(%d): Bad descriptor\n", fd);
     errno = EBADF;
     return -1;
 }
 
+off_t lseek_default(struct file *file, off_t offset, int whence)
+{
+    switch ( whence )
+    {
+    case SEEK_SET:
+        file->offset = offset;
+        break;
+
+    case SEEK_CUR:
+        file->offset += offset;
+        break;
+
+    case SEEK_END:
+    {
+        struct stat st;
+        int ret;
+
+        ret = fstat(file - files, &st);
+        if ( ret )
+            return -1;
+        file->offset = st.st_size + offset;
+        break;
+    }
+
+    default:
+        errno = EINVAL;
+        return -1;
+    }
+
+    return file->offset;
+}
+
 off_t lseek(int fd, off_t offset, int whence)
 {
-    switch(files[fd].type) {
+    struct file *file = get_file_from_fd(fd);
+    const struct file_ops *ops;
+
+    if ( !file )
+    {
+        errno = EBADF;
+        return (off_t)-1;
+    }
+
+    ops = get_file_ops(file->type);
+    if ( ops->lseek )
+        return ops->lseek(file, offset, whence);
+
+    switch(file->type) {
 #ifdef CONFIG_BLKFRONT
        case FTYPE_BLK:
           break;
@@ -392,28 +495,7 @@ off_t lseek(int fd, off_t offset, int whence)
           return (off_t) -1;
     }
 
-    switch (whence) {
-       case SEEK_SET:
-          files[fd].offset = offset;
-          break;
-       case SEEK_CUR:
-          files[fd].offset += offset;
-          break;
-       case SEEK_END:
-          {
-             struct stat st;
-             int ret;
-             ret = fstat(fd, &st);
-             if (ret)
-                return -1;
-             files[fd].offset = st.st_size + offset;
-             break;
-          }
-       default:
-          errno = EINVAL;
-          return -1;
-    }
-    return files[fd].offset;
+    return lseek_default(file, offset, whence);
 }
 
 int fsync(int fd) {
@@ -424,12 +506,21 @@ int fsync(int fd) {
 int close(int fd)
 {
     int res = 0;
+    struct file *file = get_file_from_fd(fd);
+    const struct file_ops *ops;
 
-    if ( fd < 0 || fd >= ARRAY_SIZE(files) )
+    if ( !file )
         goto error;
 
+    ops = get_file_ops(file->type);
     printk("close(%d)\n", fd);
-    switch (files[fd].type) {
+    if ( ops->close )
+    {
+        res = ops->close(file);
+        goto out;
+    }
+
+    switch (file->type) {
         default:
             break;
 #ifdef CONFIG_XENBUS
@@ -492,6 +583,7 @@ int close(int fd)
             goto error;
     }
 
+ out:
     memset(files + fd, 0, sizeof(struct file));
     BUILD_BUG_ON(FTYPE_NONE != 0);
 
@@ -522,8 +614,19 @@ int stat(const char *path, struct stat *buf)
 
 int fstat(int fd, struct stat *buf)
 {
+    struct file *file = get_file_from_fd(fd);
+    const struct file_ops *ops;
+
+    if ( !file )
+        goto error;
+
     init_stat(buf);
-    switch (files[fd].type) {
+
+    ops = get_file_ops(file->type);
+    if ( ops->fstat )
+        return ops->fstat(file, buf);
+
+    switch (file->type) {
 	case FTYPE_SAVEFILE:
 	case FTYPE_CONSOLE:
 	case FTYPE_SOCKET: {
@@ -557,6 +660,7 @@ int fstat(int fd, struct stat *buf)
 	    break;
     }
 
+ error:
     printk("statf(%d): Bad descriptor\n", fd);
     errno = EBADF;
     return -1;
@@ -588,6 +692,27 @@ int fcntl(int fd, int cmd, ...)
 {
     long arg;
     va_list ap;
+    int res;
+    struct file *file = get_file_from_fd(fd);
+    const struct file_ops *ops;
+
+    if ( !file )
+    {
+        errno = EBADF;
+        return -1;
+    }
+
+    ops = get_file_ops(files[fd].type);
+
+    if ( ops->fcntl )
+    {
+        va_start(ap, cmd);
+        res = ops->fcntl(file, cmd, ap);
+        va_end(ap);
+
+        return res;
+    }
+
     va_start(ap, cmd);
     arg = va_arg(ap, long);
     va_end(ap);
@@ -641,17 +766,28 @@ int closedir(DIR *dir)
 /* We assume that only the main thread calls select(). */
 
 #if defined(LIBC_DEBUG) || defined(LIBC_VERBOSE)
-static const char file_types[] = {
-    [FTYPE_NONE]	= 'N',
-    [FTYPE_CONSOLE]	= 'C',
-    [FTYPE_XENBUS]	= 'S',
-    [FTYPE_EVTCHN]	= 'E',
-    [FTYPE_SOCKET]	= 's',
-    [FTYPE_TAP]		= 'T',
-    [FTYPE_BLK]		= 'B',
-    [FTYPE_KBD]		= 'K',
-    [FTYPE_FB]		= 'G',
+static const char *const file_types[] = {
+    [FTYPE_NONE]    = "none",
+    [FTYPE_CONSOLE] = "console",
+    [FTYPE_XENBUS]  = "xenbus",
+    [FTYPE_EVTCHN]  = "evtchn",
+    [FTYPE_SOCKET]  = "socket",
+    [FTYPE_TAP]     = "net",
+    [FTYPE_BLK]     = "blk",
+    [FTYPE_KBD]     = "kbd",
+    [FTYPE_FB]      = "fb",
 };
+
+static const char *get_type_name(unsigned int type)
+{
+    if ( type < ARRAY_SIZE(file_ops) && file_ops[type] )
+        return file_ops[type]->name;
+
+    if ( type < ARRAY_SIZE(file_types) && file_types[type] )
+        return file_types[type];
+
+    return "none";
+}
 #endif
 #ifdef LIBC_DEBUG
 static void dump_set(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
@@ -663,7 +799,7 @@ static void dump_set(int nfds, fd_set *readfds, fd_set *writefds, fd_set *except
 	if (FD_ISSET(i, set)) { \
 	    if (comma) \
 		printk(", "); \
-	    printk("%d(%c)", i, file_types[files[i].type]); \
+            printk("%d(%s)", i, get_type_name(files[i].type)); \
 	    comma = 1; \
 	} \
     } \
@@ -697,7 +833,7 @@ static void dump_pollfds(struct pollfd *pfd, int nfds, int timeout)
         fd = pfd[i].fd;
         if (comma)
             printk(", ");
-        printk("%d(%c)/%02x", fd, file_types[files[fd].type],
+        printk("%d(%s)/%02x", fd, get_type_name(files[fd].type),
             pfd[i].events);
             comma = 1;
     }
@@ -709,6 +845,16 @@ static void dump_pollfds(struct pollfd *pfd, int nfds, int timeout)
 #define dump_pollfds(pfds, nfds, timeout)
 #endif
 
+bool select_yes(struct file *file)
+{
+    return true;
+}
+
+bool select_read_flag(struct file *file)
+{
+    return file->read;
+}
+
 /* Just poll without blocking */
 static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
 {
@@ -760,11 +906,47 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
 
     /* Then see others as well. */
     for (i = 0; i < nfds; i++) {
-	switch(files[i].type) {
+        struct file *file = get_file_from_fd(i);
+
+        if ( !file )
+        {
+            FD_CLR(i, readfds);
+            FD_CLR(i, writefds);
+            FD_CLR(i, exceptfds);
+            continue;
+        }
+
+        switch(file->type) {
 	default:
+        {
+            const struct file_ops *ops = file_ops[file->type];
+
+            if ( ops )
+            {
+                if ( FD_ISSET(i, readfds) )
+                {
+                    if ( ops->select_rd && ops->select_rd(file) )
+                        n++;
+                    else
+                        FD_CLR(i, readfds);
+                }
+                if ( FD_ISSET(i, writefds) )
+                {
+                    if ( ops->select_wr && ops->select_wr(file) )
+                        n++;
+                    else
+                        FD_CLR(i, writefds);
+                }
+                FD_CLR(i, exceptfds);
+
+                break;
+            }
+
 	    if (FD_ISSET(i, readfds) || FD_ISSET(i, writefds) || FD_ISSET(i, exceptfds))
 		printk("bogus fd %d in select\n", i);
 	    /* Fallthrough.  */
+        }
+
 	case FTYPE_CONSOLE:
 	    if (FD_ISSET(i, readfds)) {
                 if (xencons_ring_avail(files[i].dev))
@@ -842,7 +1024,7 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
 	printk("%d(%d): ", nb, sock_n);
 	for (i = 0; i < nfds; i++) {
 	    if (nbread[i] || nbwrite[i] || nbexcept[i])
-		printk(" %d(%c):", i, file_types[files[i].type]);
+                printk(" %d(%c):", i, get_type_name(files[i].type));
 	    if (nbread[i])
 	    	printk(" %dR", nbread[i]);
 	    if (nbwrite[i])
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 14:22:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 14:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258554.445396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9pNk-0004Bx-2V; Tue, 18 Jan 2022 14:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258554.445396; Tue, 18 Jan 2022 14: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 1n9pNj-0004Bp-Vm; Tue, 18 Jan 2022 14:22:43 +0000
Received: by outflank-mailman (input) for mailman id 258554;
 Tue, 18 Jan 2022 14: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 1n9pNi-0004BO-Ub
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14: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 1n9pNi-0001hB-Tj
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9pNi-0002RX-Sn
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 14: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=SxBVbCq9I6m/x5bOTFiKWVQ+utxiftk8lutL8Ix3OhE=; b=xVZuInG0G7Xm+i6meTEkmIoW89
	y1mHkJN9MQCxeghA+6SPekqb5/wSVJ9/Nku/qkTra/8ASeGOOfXJQV6fAo9mzqi7FDPss7o4dp5F3
	EfKf27EOG6DTqdQgPtRAdU6TDzO/HP9c9k3Z52vi1t5RV1VgOuz7YznJcBfYs7y9dpl4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] add CONFIG_LIBXS item
Message-Id: <E1n9pNi-0002RX-Sn@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 14:22:42 +0000

commit a91161eb0f92dac4ad6d41f91117268bc23ef28d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 07:45:27 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jan 17 10:55:47 2022 +0000

    add CONFIG_LIBXS item
    
    Mini-OS contains a stripped down version of libxenstore in lib/xs.c.
    Today it is being built always if CONFIG_XENBUS is set and libc
    support is enabled.
    
    In order to allow a Mini-OS specific build of libxenstore to be used
    instead add a new CONFIG_LIBXS item which per default will have the
    same setting as CONFIG_XENBUS. A user wanting to replace lib/xs.c
    with libxenstore would just need to set CONFIG_XENBUS=y and
    CONFIG_LIBXS=n.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 Config.mk                     | 10 ++++++++--
 Makefile                      |  2 +-
 arch/x86/testbuild/all-no     |  1 +
 arch/x86/testbuild/all-yes    |  1 +
 arch/x86/testbuild/newxen-yes |  1 +
 lib/sys.c                     |  4 ++--
 6 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Config.mk b/Config.mk
index 1e08388..0302303 100644
--- a/Config.mk
+++ b/Config.mk
@@ -171,7 +171,10 @@ endif
 # arch/*/testbuild/*-yes and arch/*/testbuild/*-no should set ALL possible
 # CONFIG_ variables.
 
-# Configuration defaults
+# Configuration defaults:
+# CONFIG-y contains all items defaulting to "y"
+# CONFIG-n contains all items defaulting to "n"
+# CONFIG-x contains all items being calculated if not set explicitly
 CONFIG-y += CONFIG_START_NETWORK
 CONFIG-y += CONFIG_SPARSE_BSS
 CONFIG-y += CONFIG_BLKFRONT
@@ -205,7 +208,10 @@ CONFIG-$(lwip) += CONFIG_LWIP
 $(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
 $(foreach i,$(CONFIG-n),$(eval $(i) ?= n))
 
-CONFIG-all := $(CONFIG-y) $(CONFIG-n)
+CONFIG-x += CONFIG_LIBXS
+CONFIG_LIBXS ?= $(CONFIG_XENBUS)
+
+CONFIG-all := $(CONFIG-y) $(CONFIG-n) $(CONFIG-x)
 
 # Export config items as compiler directives
 $(foreach i,$(CONFIG-all),$(eval DEFINES-$($(i)) += -D$(i)))
diff --git a/Makefile b/Makefile
index 06b60fc..9f95d19 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,7 @@ src-y += lib/stack_chk_fail.c
 src-y += lib/string.c
 src-y += lib/sys.c
 src-y += lib/xmalloc.c
-src-$(CONFIG_XENBUS) += lib/xs.c
+src-$(CONFIG_LIBXS) += lib/xs.c
 
 src-$(CONFIG_XENBUS) += xenbus/xenbus.c
 
diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
index d6fc260..46f974d 100644
--- a/arch/x86/testbuild/all-no
+++ b/arch/x86/testbuild/all-no
@@ -13,6 +13,7 @@ CONFIG_FBFRONT = n
 CONFIG_KBDFRONT = n
 CONFIG_CONSFRONT = n
 CONFIG_XENBUS = n
+CONFIG_LIBXS = n
 CONFIG_LIBXENEVTCHN = n
 CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
index 98bbfeb..3ead12f 100644
--- a/arch/x86/testbuild/all-yes
+++ b/arch/x86/testbuild/all-yes
@@ -13,6 +13,7 @@ CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
 CONFIG_XENBUS = y
+CONFIG_LIBXS = y
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 # The following are special: they need support from outside
diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
index 0603200..5c0b3c8 100644
--- a/arch/x86/testbuild/newxen-yes
+++ b/arch/x86/testbuild/newxen-yes
@@ -13,6 +13,7 @@ CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
 CONFIG_XENBUS = y
+CONFIG_LIBXS = y
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
diff --git a/lib/sys.c b/lib/sys.c
index a66cf73..98a4b88 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -523,7 +523,7 @@ int close(int fd)
     switch (file->type) {
         default:
             break;
-#ifdef CONFIG_XENBUS
+#ifdef CONFIG_LIBXS
 	case FTYPE_XENBUS:
             xs_daemon_close((void*)(intptr_t) fd);
             break;
@@ -958,7 +958,7 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
                 n++;
 	    FD_CLR(i, exceptfds);
 	    break;
-#ifdef CONFIG_XENBUS
+#ifdef CONFIG_LIBXS
 	case FTYPE_XENBUS:
 	    if (FD_ISSET(i, readfds)) {
                 if (files[i].dev)
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 17:55:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 17:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258616.445607 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9shF-00085z-Vr; Tue, 18 Jan 2022 17:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258616.445607; Tue, 18 Jan 2022 17:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9shF-00085r-Sm; Tue, 18 Jan 2022 17:55:05 +0000
Received: by outflank-mailman (input) for mailman id 258616;
 Tue, 18 Jan 2022 17:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shF-00085l-CB
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55: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 1n9shF-00061Q-AZ
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shF-000727-9e
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55: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=WrlOcQIGEyFYHKls1blKP+6jVymCOuYiOIMbaGl43n8=; b=c9q9nAv/8IyrwOi5t8GsXACDXD
	3hQBOqgdK9rmaWFMPt/YwiQYgLGatDVFsENWsK6HfhRov6HrStkAwDy3DcW0sWYd/j/I6X4hidUBB
	6VdtrFllcUXdDU8SyWnodvRnF0KKmYpWlLWyICCgXOF2YHHIKkuGYjw2GOk6jcLZjk4k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] config: use more recent mini-os commit
Message-Id: <E1n9shF-000727-9e@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 17:55:05 +0000

commit aa61568ac6f56d53012dc44edc9aedd34962f66d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 18 15:21:02 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 14:58:28 2022 +0000

    config: use more recent mini-os commit
    
    In order to be able to use the recent Mini-OS features switch to the
    most recent commit.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 1c1998a5a8..5c8c737fe4 100644
--- a/Config.mk
+++ b/Config.mk
@@ -231,7 +231,7 @@ MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= master
-MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9
+MINIOS_UPSTREAM_REVISION ?= a91161eb0f92dac4ad6d41f91117268bc23ef28d
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 17:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 17:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258617.445611 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9shQ-00088E-1s; Tue, 18 Jan 2022 17:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258617.445611; Tue, 18 Jan 2022 17:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9shP-000885-UE; Tue, 18 Jan 2022 17:55:15 +0000
Received: by outflank-mailman (input) for mailman id 258617;
 Tue, 18 Jan 2022 17:55: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 1n9shP-00087o-EV
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55: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 1n9shP-00061U-Di
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shP-00072f-Cj
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55: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=eIYoKIPkHHIP1WhnUURg4EszoEeUpkeq5zNL1Vgdwho=; b=WJ/JTpzUwdbZ3aguIWKjRCUPMT
	RQg026eZE7HMydqEk6N3JkQGgJ4fS89NxW22pIatxpYIgS27QzDT/5pPkpsaxiFHBa/JN/yL2z9zq
	FVCzZw6ZvR3KwgOE5G7IGNYGodFBO9EqWX47hfCvD/qsiev74lHKS0EylfOArXSZd97M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/evtchn: decouple more from mini-os
Message-Id: <E1n9shP-00072f-Cj@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 17:55:15 +0000

commit 93753cecc8830c22ad522ccb29724ef3a5decdc4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:23:44 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 14:58:28 2022 +0000

    tools/libs/evtchn: decouple more from mini-os
    
    Mini-OS and libevtchn are using implementation details of each other.
    Change that by letting libevtchn use the new alloc_file_type() and
    get_file_from_fd() function and the generic dev pointer of struct file
    from Mini-OS.
    
    By using private struct declarations Mini-OS will be able to drop the
    libevtchn specific definitions of struct evtchn_port_info and
    evtchn_port_list in future. While at it use bool for "pending" and
    "bound".
    
    Switch to use xce as function parameter instead of fd where possible.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/evtchn/minios.c | 143 ++++++++++++++++++++++++++++++---------------
 1 file changed, 96 insertions(+), 47 deletions(-)

diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index 8f84048b11..ee3da9f8fe 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
@@ -38,29 +38,40 @@
 
 #include "private.h"
 
-extern void minios_evtchn_close_fd(int fd);
+LIST_HEAD(port_list, port_info);
+
+struct port_info {
+    LIST_ENTRY(port_info) list;
+    evtchn_port_t port;
+    bool pending;
+    bool bound;
+};
 
 extern struct wait_queue_head event_queue;
 
+void minios_evtchn_close_fd(int fd);
+
 /* XXX Note: This is not threadsafe */
-static struct evtchn_port_info *port_alloc(int fd)
+static struct port_info *port_alloc(xenevtchn_handle *xce)
 {
-    struct evtchn_port_info *port_info;
+    struct port_info *port_info;
+    struct file *file = get_file_from_fd(xce->fd);
+    struct port_list *port_list = file->dev;
 
-    port_info = malloc(sizeof(struct evtchn_port_info));
+    port_info = malloc(sizeof(struct port_info));
     if ( port_info == NULL )
         return NULL;
 
-    port_info->pending = 0;
+    port_info->pending = false;
     port_info->port = -1;
-    port_info->bound = 0;
+    port_info->bound = false;
 
-    LIST_INSERT_HEAD(&files[fd].evtchn.ports, port_info, list);
+    LIST_INSERT_HEAD(port_list, port_info, list);
 
     return port_info;
 }
 
-static void port_dealloc(struct evtchn_port_info *port_info)
+static void port_dealloc(struct port_info *port_info)
 {
     if ( port_info->bound )
         unbind_evtchn(port_info->port);
@@ -69,18 +80,57 @@ static void port_dealloc(struct evtchn_port_info *port_info)
     free(port_info);
 }
 
+static int evtchn_close_fd(struct file *file)
+{
+    struct port_info *port_info, *tmp;
+    struct port_list *port_list = file->dev;
+
+    LIST_FOREACH_SAFE(port_info, port_list, list, tmp)
+        port_dealloc(port_info);
+    free(port_list);
+
+    return 0;
+}
+
+static const struct file_ops evtchn_ops = {
+    .name = "evtchn",
+    .close = evtchn_close_fd,
+    .select_rd = select_read_flag,
+};
+
+static unsigned int ftype_evtchn;
+
+__attribute__((constructor))
+static void evtchn_initialize(void)
+{
+    ftype_evtchn = alloc_file_type(&evtchn_ops);
+}
+
 /*
  * XENEVTCHN_NO_CLOEXEC is being ignored, as there is no exec() call supported
  * in Mini-OS.
  */
 int osdep_evtchn_open(xenevtchn_handle *xce, unsigned int flags)
 {
-    int fd = alloc_fd(FTYPE_EVTCHN);
+    int fd;
+    struct file *file;
+    struct port_list *list;
 
-    if ( fd == -1 )
+    list = malloc(sizeof(*list));
+    if ( !list )
         return -1;
 
-    LIST_INIT(&files[fd].evtchn.ports);
+    fd = alloc_fd(ftype_evtchn);
+    file = get_file_from_fd(fd);
+
+    if ( !file )
+    {
+        free(list);
+        return -1;
+    }
+
+    file->dev = list;
+    LIST_INIT(list);
     xce->fd = fd;
     printf("evtchn_open() -> %d\n", fd);
 
@@ -104,12 +154,9 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
 
 void minios_evtchn_close_fd(int fd)
 {
-    struct evtchn_port_info *port_info, *tmp;
+    struct file *file = get_file_from_fd(fd);
 
-    LIST_FOREACH_SAFE(port_info, &files[fd].evtchn.ports, list, tmp)
-        port_dealloc(port_info);
-
-    files[fd].type = FTYPE_NONE;
+    evtchn_close_fd(file);
 }
 
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
@@ -129,42 +176,43 @@ int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 
 static void evtchn_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
-    int fd = (int)(intptr_t)data;
-    struct evtchn_port_info *port_info;
+    xenevtchn_handle *xce = data;
+    struct file *file = get_file_from_fd(xce->fd);
+    struct port_info *port_info;
+    struct port_list *port_list;
 
-    assert(files[fd].type == FTYPE_EVTCHN);
+    assert(file);
+    port_list = file->dev;
     mask_evtchn(port);
-    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list)
+    LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port == port )
             goto found;
     }
 
-    printk("Unknown port for handle %d\n", fd);
+    printk("Unknown port %d for handle %d\n", port, xce->fd);
     return;
 
  found:
-    port_info->pending = 1;
-    files[fd].read = 1;
+    port_info->pending = true;
+    file->read = true;
     wake_up(&event_queue);
 }
 
 xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce,
                                                       uint32_t domid)
 {
-    int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct port_info *port_info;
     int ret;
     evtchn_port_t port;
 
     assert(get_current() == main_thread);
-    port_info = port_alloc(fd);
+    port_info = port_alloc(xce);
     if ( port_info == NULL )
         return -1;
 
     printf("xenevtchn_bind_unbound_port(%d)", domid);
-    ret = evtchn_alloc_unbound(domid, evtchn_handler,
-                               (void *)(intptr_t)fd, &port);
+    ret = evtchn_alloc_unbound(domid, evtchn_handler, xce, &port);
     printf(" = %d\n", ret);
 
     if ( ret < 0 )
@@ -174,7 +222,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce,
         return -1;
     }
 
-    port_info->bound = 1;
+    port_info->bound = true;
     port_info->port = port;
     unmask_evtchn(port);
 
@@ -185,19 +233,18 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
                                                      uint32_t domid,
                                                      evtchn_port_t remote_port)
 {
-    int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct port_info *port_info;
     evtchn_port_t local_port;
     int ret;
 
     assert(get_current() == main_thread);
-    port_info = port_alloc(fd);
+    port_info = port_alloc(xce);
     if ( port_info == NULL )
         return -1;
 
     printf("xenevtchn_bind_interdomain(%d, %"PRId32")", domid, remote_port);
     ret = evtchn_bind_interdomain(domid, remote_port, evtchn_handler,
-                                  (void *)(intptr_t)fd, &local_port);
+                                  xce, &local_port);
     printf(" = %d\n", ret);
 
     if ( ret < 0 )
@@ -207,7 +254,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
         return -1;
     }
 
-    port_info->bound = 1;
+    port_info->bound = true;
     port_info->port = local_port;
     unmask_evtchn(local_port);
 
@@ -217,9 +264,11 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
 int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct file *file = get_file_from_fd(fd);
+    struct port_info *port_info;
+    struct port_list *port_list = file->dev;
 
-    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list)
+    LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port == port )
         {
@@ -238,17 +287,16 @@ int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
 xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce,
                                               unsigned int virq)
 {
-    int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct port_info *port_info;
     evtchn_port_t port;
 
     assert(get_current() == main_thread);
-    port_info = port_alloc(fd);
+    port_info = port_alloc(xce);
     if ( port_info == NULL )
         return -1;
 
     printf("xenevtchn_bind_virq(%d)", virq);
-    port = bind_virq(virq, evtchn_handler, (void *)(intptr_t)fd);
+    port = bind_virq(virq, evtchn_handler, xce);
     printf(" = %d\n", port);
 
     if ( port < 0 )
@@ -258,7 +306,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce,
         return -1;
     }
 
-    port_info->bound = 1;
+    port_info->bound = true;
     port_info->port = port;
     unmask_evtchn(port);
 
@@ -267,27 +315,28 @@ xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce,
 
 xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
 {
-    int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct file *file = get_file_from_fd(xce->fd);
+    struct port_info *port_info;
+    struct port_list *port_list = file->dev;
     unsigned long flags;
     evtchn_port_t ret = -1;
 
     local_irq_save(flags);
 
-    files[fd].read = 0;
+    file->read = false;
 
-    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list)
+    LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port != -1 && port_info->pending )
         {
             if ( ret == -1 )
             {
                 ret = port_info->port;
-                port_info->pending = 0;
+                port_info->pending = false;
             }
             else
             {
-                files[fd].read = 1;
+                file->read = true;
                 break;
             }
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 17:55:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 17:55:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258618.445615 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9shb-0008Bi-2Z; Tue, 18 Jan 2022 17:55:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258618.445615; Tue, 18 Jan 2022 17:55: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 1n9sha-0008Ba-Vl; Tue, 18 Jan 2022 17:55:26 +0000
Received: by outflank-mailman (input) for mailman id 258618;
 Tue, 18 Jan 2022 17:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shZ-0008BJ-Hs
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shZ-00061n-H8
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shZ-00073V-Fz
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55: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=+rApLl/kLitZPPoQitpWA/aIPtfevy39qbKwiWkio5M=; b=f1jIFg5/4XuQZYeO+abls7JEz0
	bMiPo5YWPSfew3vImAtmnTeCJclFT5ILk0S4SvDTHT/WWBYpd6I/GnGGY68UdAn2plGDrlm74Xbp6
	EIKvNtOWjEeprYA7lV/e2CrlgOf++xqyNC8YAGG9RrnG2g2kj8cVFlo7cPSiFc3Ezj/8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/gnttab: decouple more from mini-os
Message-Id: <E1n9shZ-00073V-Fz@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 17:55:25 +0000

commit 11788ab3b9354ae1b4892e51f9d0232bf6825b70
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:23:45 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 14:58:28 2022 +0000

    tools/libs/gnttab: decouple more from mini-os
    
    libgnttab is using implementation details of Mini-OS. Change that by
    letting libgnttab use the new alloc_file_type() and get_file_from_fd()
    functions and the generic dev pointer of struct file from Mini-OS.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/gnttab/minios.c | 67 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 52 insertions(+), 15 deletions(-)

diff --git a/tools/libs/gnttab/minios.c b/tools/libs/gnttab/minios.c
index f78caadd30..f59fad3577 100644
--- a/tools/libs/gnttab/minios.c
+++ b/tools/libs/gnttab/minios.c
@@ -28,18 +28,55 @@
 #include <sys/mman.h>
 
 #include <errno.h>
+#include <malloc.h>
 #include <unistd.h>
 
 #include "private.h"
 
 void minios_gnttab_close_fd(int fd);
 
+static int gnttab_close_fd(struct file *file)
+{
+    gntmap_fini(file->dev);
+    free(file->dev);
+
+    return 0;
+}
+
+static const struct file_ops gnttab_ops = {
+    .name = "gnttab",
+    .close = gnttab_close_fd,
+};
+
+static unsigned int ftype_gnttab;
+
+__attribute__((constructor))
+static void gnttab_initialize(void)
+{
+    ftype_gnttab = alloc_file_type(&gnttab_ops);
+}
+
 int osdep_gnttab_open(xengnttab_handle *xgt)
 {
-    int fd = alloc_fd(FTYPE_GNTMAP);
-    if ( fd == -1 )
+    int fd;
+    struct file *file;
+    struct gntmap *gntmap;
+
+    gntmap = malloc(sizeof(*gntmap));
+    if ( !gntmap )
         return -1;
-    gntmap_init(&files[fd].gntmap);
+
+    fd = alloc_fd(ftype_gnttab);
+    file = get_file_from_fd(fd);
+
+    if ( !file )
+    {
+        free(gntmap);
+        return -1;
+    }
+
+    file->dev = gntmap;
+    gntmap_init(gntmap);
     xgt->fd = fd;
     return 0;
 }
@@ -54,8 +91,9 @@ int osdep_gnttab_close(xengnttab_handle *xgt)
 
 void minios_gnttab_close_fd(int fd)
 {
-    gntmap_fini(&files[fd].gntmap);
-    files[fd].type = FTYPE_NONE;
+    struct file *file = get_file_from_fd(fd);
+
+    gnttab_close_fd(file);
 }
 
 void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
@@ -64,16 +102,16 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
                              uint32_t notify_offset,
                              evtchn_port_t notify_port)
 {
-    int fd = xgt->fd;
+    struct file *file = get_file_from_fd(xgt->fd);
     int stride = 1;
+
     if (flags & XENGNTTAB_GRANT_MAP_SINGLE_DOMAIN)
         stride = 0;
     if (notify_offset != -1 || notify_port != -1) {
         errno = ENOSYS;
         return NULL;
     }
-    return gntmap_map_grant_refs(&files[fd].gntmap,
-                                 count, domids, stride,
+    return gntmap_map_grant_refs(file->dev, count, domids, stride,
                                  refs, prot & PROT_WRITE);
 }
 
@@ -81,11 +119,10 @@ int osdep_gnttab_unmap(xengnttab_handle *xgt,
                        void *start_address,
                        uint32_t count)
 {
-    int fd = xgt->fd;
+    struct file *file = get_file_from_fd(xgt->fd);
     int ret;
-    ret = gntmap_munmap(&files[fd].gntmap,
-                        (unsigned long) start_address,
-                        count);
+
+    ret = gntmap_munmap(file->dev, (unsigned long) start_address, count);
     if (ret < 0) {
         errno = -ret;
         return -1;
@@ -95,10 +132,10 @@ int osdep_gnttab_unmap(xengnttab_handle *xgt,
 
 int osdep_gnttab_set_max_grants(xengnttab_handle *xgt, uint32_t count)
 {
-    int fd = xgt->fd;
+    struct file *file = get_file_from_fd(xgt->fd);
     int ret;
-    ret = gntmap_set_max_grants(&files[fd].gntmap,
-                                count);
+
+    ret = gntmap_set_max_grants(file->dev, count);
     if (ret < 0) {
         errno = -ret;
         return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 17:55:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 17:55:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258619.445621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9shl-0008Ee-6F; Tue, 18 Jan 2022 17:55:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258619.445621; Tue, 18 Jan 2022 17:55: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 1n9shl-0008ES-1C; Tue, 18 Jan 2022 17:55:37 +0000
Received: by outflank-mailman (input) for mailman id 258619;
 Tue, 18 Jan 2022 17:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shj-0008EG-Kr
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shj-00062H-K5
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9shj-000749-JA
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 17:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8yTruCf4yzwS1t9sY777tLGOcY7jhBXDC5hHR3vpGgk=; b=f5/jsXD455A2bhEbUr7MxVO7gj
	bu5lnAdnOSq9d+W5AgL0tPJUkTE7XDXUYukIGrrxV8vYpbu7afOLc1L3mZ02MlwsG9TSNnUY6uN2t
	THcqg+wBnkD38MC1IoKQJaqEciZx3NAPiYAa7vIrRPPZk/SCoVoGnWKC95Y6NPAKRFfs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/ctrl: remove file related handling
Message-Id: <E1n9shj-000749-JA@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 17:55:35 +0000

commit 444597436d08ccae6d210a2b1b877fef636796ea
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:23:46 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 14:58:28 2022 +0000

    tools/libs/ctrl: remove file related handling
    
    There is no special file handling related to libxenctrl in Mini-OS
    any longer, so the close hook can be removed.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 tools/libs/ctrl/xc_minios.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/tools/libs/ctrl/xc_minios.c b/tools/libs/ctrl/xc_minios.c
index 1799daafdc..3dea7a78a5 100644
--- a/tools/libs/ctrl/xc_minios.c
+++ b/tools/libs/ctrl/xc_minios.c
@@ -35,15 +35,6 @@
 
 #include "xc_private.h"
 
-void minios_interface_close_fd(int fd);
-
-extern void minios_interface_close_fd(int fd);
-
-void minios_interface_close_fd(int fd)
-{
-    files[fd].type = FTYPE_NONE;
-}
-
 /* Optionally flush file to disk and discard page cache */
 void discard_file_cache(xc_interface *xch, int fd, int flush)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:33:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:33:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258627.445634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tHz-00043f-Cd; Tue, 18 Jan 2022 18:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258627.445634; Tue, 18 Jan 2022 18:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tHz-00043X-9G; Tue, 18 Jan 2022 18:33:03 +0000
Received: by outflank-mailman (input) for mailman id 258627;
 Tue, 18 Jan 2022 18: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 1n9tHy-00043R-3d
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tHy-0006nu-1o
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tHy-0001iA-0K
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=X4aZLPgbrrsAHxvJyjRrnm8geLzq5tyGwO1HDfhhTak=; b=hUZESwZI1ypOkUO9oh9SOwJMlP
	6VfcIbwoYsKMo9jxbanDBjCw95i4ZGxlKEPeAmFGw2HlZgwmd8bP4y1YaIhohkgCURCj6x38njfBx
	N9Ctf/RI+e7NJwRa9VRlp3KJZKvHrHMLdTFMDagqvLS9MReUO4FJtjXLC1DeDz4cfdpg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] remove event channel specific struct file definitions
Message-Id: <E1n9tHy-0001iA-0K@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:33:02 +0000

commit c117e7b103d3a0ce8bb32682997b60de20faf3f3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:17 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    remove event channel specific struct file definitions
    
    The event channel specific union member in struct file is no longer
    needed, so remove it together with the associated structure
    definitions.
    
    The event channel file type and its associated handling can be removed,
    too, as libxenevtchn is now supplying a struct file_ops via a call of
    alloc_file_type().
    
    This removes all contents of CONFIG_LIBXENEVTCHN guarded sections, so
    this config option can be removed.
    
    Add an extern declaration for event_queue as it is used by
    libxenevtchn.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 Config.mk                     |  1 -
 arch/x86/testbuild/all-no     |  1 -
 arch/x86/testbuild/all-yes    |  1 -
 arch/x86/testbuild/newxen-yes |  1 -
 include/lib.h                 | 17 +++--------------
 lib/sys.c                     |  7 -------
 6 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/Config.mk b/Config.mk
index 0302303..52eb26d 100644
--- a/Config.mk
+++ b/Config.mk
@@ -200,7 +200,6 @@ CONFIG-n += CONFIG_PARAVIRT
 endif
 # Support legacy CONFIG_XC value
 CONFIG_XC ?= $(libc)
-CONFIG-$(CONFIG_XC) += CONFIG_LIBXENEVTCHN
 CONFIG-$(CONFIG_XC) += CONFIG_LIBXENGNTTAB
 
 CONFIG-$(lwip) += CONFIG_LWIP
diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
index 46f974d..15c954f 100644
--- a/arch/x86/testbuild/all-no
+++ b/arch/x86/testbuild/all-no
@@ -14,7 +14,6 @@ CONFIG_KBDFRONT = n
 CONFIG_CONSFRONT = n
 CONFIG_XENBUS = n
 CONFIG_LIBXS = n
-CONFIG_LIBXENEVTCHN = n
 CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
 CONFIG_BALLOON = n
diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
index 3ead12f..9964d42 100644
--- a/arch/x86/testbuild/all-yes
+++ b/arch/x86/testbuild/all-yes
@@ -17,6 +17,5 @@ CONFIG_LIBXS = y
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 # The following are special: they need support from outside
-CONFIG_LIBXENEVTCHN = n
 CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
index 5c0b3c8..c251993 100644
--- a/arch/x86/testbuild/newxen-yes
+++ b/arch/x86/testbuild/newxen-yes
@@ -18,6 +18,5 @@ CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
 # The following are special: they need support from outside
-CONFIG_LIBXENEVTCHN = n
 CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
diff --git a/include/lib.h b/include/lib.h
index 4469680..5f24be5 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -155,6 +155,8 @@ do {                                                           \
 void sanity_check(void);
 
 #ifdef HAVE_LIBC
+extern struct wait_queue_head event_queue;
+
 #define FTYPE_NONE       0
 #define FTYPE_CONSOLE    1
 #define FTYPE_FILE       2
@@ -169,19 +171,9 @@ void sanity_check(void);
 #define FTYPE_TPM_TIS   11
 #define FTYPE_XENBUS    12
 #define FTYPE_GNTMAP    13
-#define FTYPE_EVTCHN    14
-#define FTYPE_N         15
+#define FTYPE_N         14
 #define FTYPE_SPARE     16
 
-LIST_HEAD(evtchn_port_list, evtchn_port_info);
-
-struct evtchn_port_info {
-        LIST_ENTRY(evtchn_port_info) list;
-        evtchn_port_t port;
-        unsigned long pending;
-        int bound;
-};
-
 struct file {
     unsigned int type;
     bool read;	/* maybe available for read */
@@ -189,9 +181,6 @@ struct file {
     union {
         int fd; /* Any fd from an upper layer. */
         void *dev;
-	struct {
-	    struct evtchn_port_list ports;
-	} evtchn;
 	struct gntmap gntmap;
     };
 };
diff --git a/lib/sys.c b/lib/sys.c
index 98a4b88..fdd0c45 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -533,11 +533,6 @@ int close(int fd)
             res = lwip_close(files[fd].fd);
             break;
 #endif
-#ifdef CONFIG_LIBXENEVTCHN
-	case FTYPE_EVTCHN:
-	    minios_evtchn_close_fd(fd);
-            break;
-#endif
 #ifdef CONFIG_LIBXENGNTTAB
 	case FTYPE_GNTMAP:
 	    minios_gnttab_close_fd(fd);
@@ -770,7 +765,6 @@ static const char *const file_types[] = {
     [FTYPE_NONE]    = "none",
     [FTYPE_CONSOLE] = "console",
     [FTYPE_XENBUS]  = "xenbus",
-    [FTYPE_EVTCHN]  = "evtchn",
     [FTYPE_SOCKET]  = "socket",
     [FTYPE_TAP]     = "net",
     [FTYPE_BLK]     = "blk",
@@ -970,7 +964,6 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
 	    FD_CLR(i, exceptfds);
 	    break;
 #endif
-	case FTYPE_EVTCHN:
 	case FTYPE_TAP:
 	case FTYPE_BLK:
 	case FTYPE_KBD:
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:33:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258628.445638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tIA-000465-Dw; Tue, 18 Jan 2022 18:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258628.445638; Tue, 18 Jan 2022 18: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 1n9tIA-00045x-As; Tue, 18 Jan 2022 18:33:14 +0000
Received: by outflank-mailman (input) for mailman id 258628;
 Tue, 18 Jan 2022 18: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 1n9tI8-00045k-6C
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tI8-0006o6-5T
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tI8-0001j3-4B
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PLwqan75vKMRXvSYXrqCM58GixWeYyflTyxnct4WIIM=; b=5SwSuYqtZQdFzbP4OYi9OnjLC/
	GrYWpcvNyd2J0deRmfkVTtpRUt2AtNuzBC14N9ZlKpyn/IXWXzGU96XM4hRfB6gT5Qa2/urEP+kSS
	Hfr8XXudEx6b/wYLbtQIjxFWF3SgaKHfsvcDXFUlD+rVi32fN4fBWCJqrEy+mMQCHvN8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] remove gnttab specific member from struct file
Message-Id: <E1n9tI8-0001j3-4B@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:33:12 +0000

commit f38bf39a14939b2ef911ff7a152247b9e09a3d36
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:18 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    remove gnttab specific member from struct file
    
    The gnttab specific union member in struct file is no longer
    needed, so remove it.
    
    The gnttab file type and its associated handling can be removed, too,
    as libxengnttab is now supplying a struct file_ops via a call of
    alloc_file_type().
    
    This removes all contents of CONFIG_LIBXENGNTTAB guarded sections, so
    this config option can be removed.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 Config.mk                     | 1 -
 arch/x86/testbuild/all-no     | 1 -
 arch/x86/testbuild/all-yes    | 1 -
 arch/x86/testbuild/newxen-yes | 1 -
 gntmap.c                      | 2 +-
 include/lib.h                 | 4 +---
 lib/sys.c                     | 5 -----
 7 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/Config.mk b/Config.mk
index 52eb26d..1a24b30 100644
--- a/Config.mk
+++ b/Config.mk
@@ -200,7 +200,6 @@ CONFIG-n += CONFIG_PARAVIRT
 endif
 # Support legacy CONFIG_XC value
 CONFIG_XC ?= $(libc)
-CONFIG-$(CONFIG_XC) += CONFIG_LIBXENGNTTAB
 
 CONFIG-$(lwip) += CONFIG_LWIP
 
diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
index 15c954f..f79a101 100644
--- a/arch/x86/testbuild/all-no
+++ b/arch/x86/testbuild/all-no
@@ -14,7 +14,6 @@ CONFIG_KBDFRONT = n
 CONFIG_CONSFRONT = n
 CONFIG_XENBUS = n
 CONFIG_LIBXS = n
-CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
 CONFIG_BALLOON = n
 CONFIG_USE_XEN_CONSOLE = n
diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
index 9964d42..faa3af3 100644
--- a/arch/x86/testbuild/all-yes
+++ b/arch/x86/testbuild/all-yes
@@ -17,5 +17,4 @@ CONFIG_LIBXS = y
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 # The following are special: they need support from outside
-CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
index c251993..dc83e67 100644
--- a/arch/x86/testbuild/newxen-yes
+++ b/arch/x86/testbuild/newxen-yes
@@ -18,5 +18,4 @@ CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
 # The following are special: they need support from outside
-CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
diff --git a/gntmap.c b/gntmap.c
index 6fa1dac..3422ab2 100644
--- a/gntmap.c
+++ b/gntmap.c
@@ -3,7 +3,7 @@
  *
  * Diego Ongaro <diego.ongaro@citrix.com>, July 2008
  *
- * Files of type FTYPE_GNTMAP contain a gntmap, which is an array of
+ * Files of libxengnttab contain a gntmap, which is an array of
  * (host address, grant handle) pairs. Grant handles come from a hypervisor map
  * operation and are needed for the corresponding unmap.
  *
diff --git a/include/lib.h b/include/lib.h
index 5f24be5..5838b0d 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -170,8 +170,7 @@ extern struct wait_queue_head event_queue;
 #define FTYPE_TPMFRONT  10
 #define FTYPE_TPM_TIS   11
 #define FTYPE_XENBUS    12
-#define FTYPE_GNTMAP    13
-#define FTYPE_N         14
+#define FTYPE_N         13
 #define FTYPE_SPARE     16
 
 struct file {
@@ -181,7 +180,6 @@ struct file {
     union {
         int fd; /* Any fd from an upper layer. */
         void *dev;
-	struct gntmap gntmap;
     };
 };
 
diff --git a/lib/sys.c b/lib/sys.c
index fdd0c45..9894233 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -533,11 +533,6 @@ int close(int fd)
             res = lwip_close(files[fd].fd);
             break;
 #endif
-#ifdef CONFIG_LIBXENGNTTAB
-	case FTYPE_GNTMAP:
-	    minios_gnttab_close_fd(fd);
-            break;
-#endif
 #ifdef CONFIG_NETFRONT
 	case FTYPE_TAP:
 	    shutdown_netfront(files[fd].dev);
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:33:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258629.445642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tIJ-00049F-FR; Tue, 18 Jan 2022 18:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258629.445642; Tue, 18 Jan 2022 18:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tIJ-000497-CM; Tue, 18 Jan 2022 18:33:23 +0000
Received: by outflank-mailman (input) for mailman id 258629;
 Tue, 18 Jan 2022 18: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 1n9tII-00048i-9p
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tII-0006oI-8q
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tII-0001k5-7t
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=AJXeXl4TgljwR1WqtG8VFrX2A6AYsb0Ld+WPBfSJQO0=; b=ES64lYk0qUdUOF+4woSFp/akH9
	ZHliZn382X3wGWGrakAAffUuMusK7SiQ4S71pBjaNmdhXmcQ3M4//0Pxr0Y0/ZSmZieNxSFT9WJo8
	yOqEugnKFldl2KW1MXelH2gHsSKEPHlKMhNsNKeP1B5VzW5l2/pMcfFmOVdTgEmJ1bqU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] use alloc_file_type() and get_file_from_fd() in xs
Message-Id: <E1n9tII-0001k5-7t@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:33:22 +0000

commit 0b4c24e0631bfe397be60b716f27e25334dc28a7
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:19 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    use alloc_file_type() and get_file_from_fd() in xs
    
    Allocate the needed file type via alloc_file_type().
    
    Instead of directly accessing the files[] array use get_file_from_fd().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h |  3 +--
 lib/sys.c     | 18 -----------------
 lib/xs.c      | 65 +++++++++++++++++++++++++++++++++++++++++++++--------------
 3 files changed, 51 insertions(+), 35 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 5838b0d..c5e4778 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -169,8 +169,7 @@ extern struct wait_queue_head event_queue;
 #define FTYPE_BLK        9
 #define FTYPE_TPMFRONT  10
 #define FTYPE_TPM_TIS   11
-#define FTYPE_XENBUS    12
-#define FTYPE_N         13
+#define FTYPE_N         12
 #define FTYPE_SPARE     16
 
 struct file {
diff --git a/lib/sys.c b/lib/sys.c
index 9894233..217073d 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -523,11 +523,6 @@ int close(int fd)
     switch (file->type) {
         default:
             break;
-#ifdef CONFIG_LIBXS
-	case FTYPE_XENBUS:
-            xs_daemon_close((void*)(intptr_t) fd);
-            break;
-#endif
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
             res = lwip_close(files[fd].fd);
@@ -759,7 +754,6 @@ int closedir(DIR *dir)
 static const char *const file_types[] = {
     [FTYPE_NONE]    = "none",
     [FTYPE_CONSOLE] = "console",
-    [FTYPE_XENBUS]  = "xenbus",
     [FTYPE_SOCKET]  = "socket",
     [FTYPE_TAP]     = "net",
     [FTYPE_BLK]     = "blk",
@@ -947,18 +941,6 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
                 n++;
 	    FD_CLR(i, exceptfds);
 	    break;
-#ifdef CONFIG_LIBXS
-	case FTYPE_XENBUS:
-	    if (FD_ISSET(i, readfds)) {
-                if (files[i].dev)
-		    n++;
-		else
-		    FD_CLR(i, readfds);
-	    }
-	    FD_CLR(i, writefds);
-	    FD_CLR(i, exceptfds);
-	    break;
-#endif
 	case FTYPE_TAP:
 	case FTYPE_BLK:
 	case FTYPE_KBD:
diff --git a/lib/xs.c b/lib/xs.c
index 4af0f96..7fe9b03 100644
--- a/lib/xs.c
+++ b/lib/xs.c
@@ -18,23 +18,56 @@ static inline int _xs_fileno(struct xs_handle *h) {
     return (intptr_t) h;
 }
 
+static int xs_close_fd(struct file *file)
+{
+    struct xenbus_event *event, *next;
+
+    for ( event = file->dev; event; event = next )
+    {
+        next = event->next;
+        free(event);
+    }
+
+    return 0;
+}
+
+static bool xs_can_read(struct file *file)
+{
+    return file->dev;
+}
+
+static const struct file_ops xenbus_ops = {
+    .name = "xenbus",
+    .close = xs_close_fd,
+    .select_rd = xs_can_read,
+};
+
+static unsigned int ftype_xenbus;
+
+__attribute__((constructor))
+static void xs_initialize(void)
+{
+    ftype_xenbus = alloc_file_type(&xenbus_ops);
+}
+
 struct xs_handle *xs_daemon_open()
 {
-    int fd = alloc_fd(FTYPE_XENBUS);
-    files[fd].dev = NULL;
-    printk("xs_daemon_open -> %d, %p\n", fd, &files[fd].dev);
+    int fd;
+    struct file *file;
+
+    fd = alloc_fd(ftype_xenbus);
+    file = get_file_from_fd(fd);
+    if ( !file )
+        return NULL;
+
+    file->dev = NULL;
+    printk("xs_daemon_open -> %d, %p\n", fd, &file->dev);
     return (void*)(intptr_t) fd;
 }
 
 void xs_daemon_close(struct xs_handle *h)
 {
-    int fd = _xs_fileno(h);
-    struct xenbus_event *event, *next;
-    for (event = files[fd].dev; event; event = next)
-    {
-        next = event->next;
-        free(event);
-    }
+    close(_xs_fileno(h));
 }
 
 int xs_fileno(struct xs_handle *h)
@@ -169,18 +202,20 @@ char **xs_directory(struct xs_handle *h, xs_transaction_t t,
 
 bool xs_watch(struct xs_handle *h, const char *path, const char *token)
 {
-    int fd = _xs_fileno(h);
+    struct file *file = get_file_from_fd(_xs_fileno(h));
+
     printk("xs_watch(%s, %s)\n", path, token);
     return xs_bool(xenbus_watch_path_token(XBT_NULL, path, token,
-                   (xenbus_event_queue *)&files[fd].dev));
+                                           (xenbus_event_queue *)&file->dev));
 }
 
 char **xs_read_watch(struct xs_handle *h, unsigned int *num)
 {
-    int fd = _xs_fileno(h);
     struct xenbus_event *event;
-    event = files[fd].dev;
-    files[fd].dev = event->next;
+    struct file *file = get_file_from_fd(_xs_fileno(h));
+
+    event = file->dev;
+    file->dev = event->next;
     printk("xs_read_watch() -> %s %s\n", event->path, event->token);
     *num = 2;
     return (char **) &event->path;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:33:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258630.445645 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tIT-0004CC-Gx; Tue, 18 Jan 2022 18:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258630.445645; Tue, 18 Jan 2022 18:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tIT-0004C4-Dt; Tue, 18 Jan 2022 18:33:33 +0000
Received: by outflank-mailman (input) for mailman id 258630;
 Tue, 18 Jan 2022 18:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tIS-0004Bv-DU
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tIS-0006oq-Cf
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tIS-0001kq-BA
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=s82Y/SrwWzmAqmmVF0GHcCiS32WDxFVU4dClweVRO24=; b=kqpIJEhAFYr4MwuQgMWN/jTu7+
	YRAzK6gSlhn+s743IbAC9KaxQJnlqmqpfVsl972URnda82Zlvh+vvl5npsgGJvo5h9E8FXNDJacHT
	33sfW9tBYWIF7MZipp9t1wWrBWcy1z3pfMuPMVAolsRuqs/l/uvigEyExBRDwstNlha0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] use alloc_file_type() and get_file_from_fd() in tpm_tis
Message-Id: <E1n9tIS-0001kq-BA@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:33:32 +0000

commit 75cbe52859b53fcb81fb0859ca51aec76605756e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:20 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    use alloc_file_type() and get_file_from_fd() in tpm_tis
    
    Allocate a file type dynamically via alloc_file_type().
    
    Instead of directly accessing the files[] array use get_file_from_fd().
    
    Make some now local functions static and modify their prototypes to
    match the file_ops requirements.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h     |   3 +-
 include/tpm_tis.h |   6 ---
 lib/sys.c         |  23 -----------
 tpm_tis.c         | 121 ++++++++++++++++++++++++++++++++++--------------------
 4 files changed, 78 insertions(+), 75 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index c5e4778..9dfb468 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -168,8 +168,7 @@ extern struct wait_queue_head event_queue;
 #define FTYPE_TAP        8
 #define FTYPE_BLK        9
 #define FTYPE_TPMFRONT  10
-#define FTYPE_TPM_TIS   11
-#define FTYPE_N         12
+#define FTYPE_N         11
 #define FTYPE_SPARE     16
 
 struct file {
diff --git a/include/tpm_tis.h b/include/tpm_tis.h
index 86e83f1..2af974d 100644
--- a/include/tpm_tis.h
+++ b/include/tpm_tis.h
@@ -37,14 +37,11 @@ struct tpm_chip;
 
 struct tpm_chip* init_tpm_tis(unsigned long baseaddr, int localities, unsigned int irq);
 struct tpm_chip* init_tpm2_tis(unsigned long baseaddr, int localities, unsigned int irq);
-void shutdown_tpm_tis(struct tpm_chip* tpm);
 
 int tpm_tis_request_locality(struct tpm_chip* tpm, int locality);
 int tpm_tis_cmd(struct tpm_chip* tpm, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen);
 
 #ifdef HAVE_LIBC
-#include <sys/stat.h>
-#include <fcntl.h>
 /* POSIX IO functions:
  * use tpm_tis_open() to get a file descriptor to the tpm device
  * use write() on the fd to send a command to the backend. You must
@@ -53,9 +50,6 @@ int tpm_tis_cmd(struct tpm_chip* tpm, uint8_t* req, size_t reqlen, uint8_t** res
  * fstat() to get the size of the response and lseek() to seek on it.
  */
 int tpm_tis_open(struct tpm_chip* tpm);
-int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count);
-int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count);
-int tpm_tis_posix_fstat(int fd, struct stat* buf);
 #endif
 
 #endif
diff --git a/lib/sys.c b/lib/sys.c
index 217073d..f472fdf 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -29,7 +29,6 @@
 #include <blkfront.h>
 #include <fbfront.h>
 #include <tpmfront.h>
-#include <tpm_tis.h>
 #include <xenbus.h>
 #include <xenstore.h>
 #include <poll.h>
@@ -355,11 +354,6 @@ int read(int fd, void *buf, size_t nbytes)
         case FTYPE_TPMFRONT: {
 	    return tpmfront_posix_read(fd, buf, nbytes);
         }
-#endif
-#ifdef CONFIG_TPM_TIS
-        case FTYPE_TPM_TIS: {
-	    return tpm_tis_posix_read(fd, buf, nbytes);
-        }
 #endif
 	default:
 	    break;
@@ -412,10 +406,6 @@ int write(int fd, const void *buf, size_t nbytes)
 #ifdef CONFIG_TPMFRONT
 	case FTYPE_TPMFRONT:
 	    return tpmfront_posix_write(fd, buf, nbytes);
-#endif
-#ifdef CONFIG_TPM_TIS
-	case FTYPE_TPM_TIS:
-	    return tpm_tis_posix_write(fd, buf, nbytes);
 #endif
 	default:
 	    break;
@@ -482,10 +472,6 @@ off_t lseek(int fd, off_t offset, int whence)
 #ifdef CONFIG_TPMFRONT
        case FTYPE_TPMFRONT:
           break;
-#endif
-#ifdef CONFIG_TPM_TIS
-       case FTYPE_TPM_TIS:
-          break;
 #endif
        case FTYPE_FILE:
           break;
@@ -543,11 +529,6 @@ int close(int fd)
             shutdown_tpmfront(files[fd].dev);
             break;
 #endif
-#ifdef CONFIG_TPM_TIS
-	case FTYPE_TPM_TIS:
-            shutdown_tpm_tis(files[fd].dev);
-            break;
-#endif
 #ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].dev);
@@ -636,10 +617,6 @@ int fstat(int fd, struct stat *buf)
 #ifdef CONFIG_TPMFRONT
 	case FTYPE_TPMFRONT:
 	   return tpmfront_posix_fstat(fd, buf);
-#endif
-#ifdef CONFIG_TPM_TIS
-	case FTYPE_TPM_TIS:
-	   return tpm_tis_posix_fstat(fd, buf);
 #endif
 	default:
 	    break;
diff --git a/tpm_tis.c b/tpm_tis.c
index 477f555..c3998f2 100644
--- a/tpm_tis.c
+++ b/tpm_tis.c
@@ -792,6 +792,9 @@ int tpm_tis_send(struct tpm_chip* tpm, uint8_t* buf, size_t len) {
    int status, burstcnt = 0;
    int count = 0;
    uint32_t ordinal;
+#ifdef HAVE_LIBC
+   struct file *file = get_file_from_fd(tpm->fd);
+#endif
 
    if(tpm_tis_request_locality(tpm, tpm->locality) < 0) {
       return -EBUSY;
@@ -844,9 +847,10 @@ int tpm_tis_send(struct tpm_chip* tpm, uint8_t* buf, size_t len) {
       }
    }
 #ifdef HAVE_LIBC
-   if(tpm->fd >= 0) {
-      files[tpm->fd].read = false;
-      files[tpm->fd].offset = 0;
+   if ( file )
+   {
+      file->read = false;
+      file->offset = 0;
    }
 #endif
    return len;
@@ -1093,6 +1097,25 @@ ssize_t tpm_getcap(struct tpm_chip *chip, uint32_t subcap_id, cap_t *cap,
         return rc;
 }
 
+static void shutdown_tpm_tis(struct tpm_chip *tpm)
+{
+    int i;
+
+    printk("Shutting down tpm_tis device\n");
+
+    iowrite32(TPM_INT_ENABLE(tpm, tpm->locality), ~TPM_GLOBAL_INT_ENABLE);
+
+    /* Unmap all of the mmio pages */
+    for ( i = 0; i < 5; ++i )
+    {
+        if ( tpm->pages[i] != NULL )
+        {
+            iounmap(tpm->pages[i], PAGE_SIZE);
+            tpm->pages[i] = NULL;
+        }
+    }
+    free(tpm);
+}
 
 struct tpm_chip* init_tpm_tis(unsigned long baseaddr, int localities, unsigned int irq)
 {
@@ -1242,25 +1265,6 @@ abort_egress:
    return NULL;
 }
 
-void shutdown_tpm_tis(struct tpm_chip* tpm){
-   int i;
-
-   printk("Shutting down tpm_tis device\n");
-
-   iowrite32(TPM_INT_ENABLE(tpm, tpm->locality), ~TPM_GLOBAL_INT_ENABLE);
-
-   /*Unmap all of the mmio pages */
-   for(i = 0; i < 5; ++i) {
-      if(tpm->pages[i] != NULL) {
-	 iounmap(tpm->pages[i], PAGE_SIZE);
-	 tpm->pages[i] = NULL;
-      }
-   }
-   free(tpm);
-   return;
-}
-
-
 int tpm_tis_cmd(struct tpm_chip* tpm, uint8_t* req, size_t reqlen, uint8_t** resp, size_t* resplen)
 {
    if(tpm->locality < 0) {
@@ -1279,23 +1283,19 @@ int tpm_tis_cmd(struct tpm_chip* tpm, uint8_t* req, size_t reqlen, uint8_t** res
 }
 
 #ifdef HAVE_LIBC
-int tpm_tis_open(struct tpm_chip* tpm)
+#include <sys/stat.h>
+#include <fcntl.h>
+
+static int tpm_tis_close(struct file *file)
 {
-   /* Silently prevent multiple opens */
-   if(tpm->fd != -1) {
-      return tpm->fd;
-   }
+    shutdown_tpm_tis(file->dev);
 
-   tpm->fd = alloc_fd(FTYPE_TPM_TIS);
-   printk("tpm_tis_open() -> %d\n", tpm->fd);
-   files[tpm->fd].dev = tpm;
-   return tpm->fd;
+    return 0;
 }
 
-int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count)
+static int tpm_tis_posix_write(struct file *file, const void *buf, size_t count)
 {
-   struct tpm_chip* tpm;
-   tpm = files[fd].dev;
+   struct tpm_chip *tpm = file->dev;
 
    if(tpm->locality < 0) {
       printk("tpm_tis_posix_write() failed! locality not set!\n");
@@ -1319,11 +1319,10 @@ int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count)
    return count;
 }
 
-int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
+static int tpm_tis_posix_read(struct file *file, void *buf, size_t count)
 {
    int rc;
-   struct tpm_chip* tpm;
-   tpm = files[fd].dev;
+   struct tpm_chip *tpm = file->dev;
 
    if(count == 0) {
       return 0;
@@ -1337,20 +1336,21 @@ int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
 
 
    /* Handle EOF case */
-   if(files[fd].offset >= tpm->data_len) {
+   if ( file->offset >= tpm->data_len )
+   {
       rc = 0;
    } else {
-      rc = min(tpm->data_len - files[fd].offset, count);
-      memcpy(buf, tpm->data_buffer + files[fd].offset, rc);
+      rc = min(tpm->data_len - file->offset, count);
+      memcpy(buf, tpm->data_buffer + file->offset, rc);
    }
-   files[fd].offset += rc;
+   file->offset += rc;
    /* Reset the data pending flag */
    return rc;
 }
-int tpm_tis_posix_fstat(int fd, struct stat* buf)
+
+static int tpm_tis_posix_fstat(struct file *file, struct stat *buf)
 {
-   struct tpm_chip* tpm;
-   tpm = files[fd].dev;
+   struct tpm_chip *tpm = file->dev;
 
    buf->st_mode = O_RDWR;
    buf->st_uid = 0;
@@ -1360,6 +1360,39 @@ int tpm_tis_posix_fstat(int fd, struct stat* buf)
    return 0;
 }
 
+static const struct file_ops tpm_tis_ops = {
+    .name = "tpm_tis",
+    .read = tpm_tis_posix_read,
+    .write = tpm_tis_posix_write,
+    .lseek = lseek_default,
+    .close = tpm_tis_close,
+    .fstat = tpm_tis_posix_fstat,
+};
+
+static unsigned int ftype_tis;
+
+__attribute__((constructor))
+static void tpm_tis_initialize(void)
+{
+    ftype_tis = alloc_file_type(&tpm_tis_ops);
+}
+
+int tpm_tis_open(struct tpm_chip *tpm)
+{
+    struct file *file;
+
+    /* Silently prevent multiple opens */
+    if ( tpm->fd != -1 )
+        return tpm->fd;
+
+    tpm->fd = alloc_fd(ftype_tis);
+    printk("tpm_tis_open() -> %d\n", tpm->fd);
+    file = get_file_from_fd(tpm->fd);
+    file->dev = tpm;
+
+    return tpm->fd;
+}
+
 /* TPM 2.0 */
 
 /*TPM2.0 Selftest*/
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:33:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258631.445650 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tId-0004Fg-Kg; Tue, 18 Jan 2022 18:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258631.445650; Tue, 18 Jan 2022 18: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 1n9tId-0004FY-Hg; Tue, 18 Jan 2022 18:33:43 +0000
Received: by outflank-mailman (input) for mailman id 258631;
 Tue, 18 Jan 2022 18: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 1n9tIc-0004FN-Gm
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tIc-0006p0-G0
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tIc-0001lh-FE
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=V4/1mYcINGj/FLdBi0GIyDEo2AKLrulnZ3/vmWKa0Yk=; b=0uKrpFmdwxMUDx12yCoBZxYDIE
	1cR2snFxO088kVWPijvaRU3mrqWFiM4aoOWV7Pasyk8ml8iOUtp43qyKjP4U/56cuU99Ys73PBnMl
	XecC9PZs5BC4q4HvSfqnJxNpcRAKfu6Lf5zWoZRNJyS6rldI7umoOyCR/rDvw0yizsLk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] use alloc_file_type() and get_file_from_fd() in tpmfront
Message-Id: <E1n9tIc-0001lh-FE@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:33:42 +0000

commit 446a03c3316b2c6eb98022901b88418236922ef2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:21 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    use alloc_file_type() and get_file_from_fd() in tpmfront
    
    Allocate a file type dynamically via alloc_file_type().
    
    Instead of directly accessing the files[] array use get_file_from_fd().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h      |   3 +-
 include/tpmfront.h |   5 ---
 lib/sys.c          |  23 ------------
 tpmfront.c         | 101 ++++++++++++++++++++++++++++++++++++-----------------
 4 files changed, 70 insertions(+), 62 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 9dfb468..9b7eaae 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -167,8 +167,7 @@ extern struct wait_queue_head event_queue;
 #define FTYPE_KBD        7
 #define FTYPE_TAP        8
 #define FTYPE_BLK        9
-#define FTYPE_TPMFRONT  10
-#define FTYPE_N         11
+#define FTYPE_N         10
 #define FTYPE_SPARE     16
 
 struct file {
diff --git a/include/tpmfront.h b/include/tpmfront.h
index b7da50e..a527371 100644
--- a/include/tpmfront.h
+++ b/include/tpmfront.h
@@ -81,7 +81,6 @@ int tpmfront_cmd(struct tpmfront_dev* dev, uint8_t* req, size_t reqlen, uint8_t*
 int tpmfront_set_locality(struct tpmfront_dev* dev, int locality);
 
 #ifdef HAVE_LIBC
-#include <sys/stat.h>
 /* POSIX IO functions:
  * use tpmfront_open() to get a file descriptor to the tpm device
  * use write() on the fd to send a command to the backend. You must
@@ -90,10 +89,6 @@ int tpmfront_set_locality(struct tpmfront_dev* dev, int locality);
  * fstat() to get the size of the response and lseek() to seek on it.
  */
 int tpmfront_open(struct tpmfront_dev* dev);
-int tpmfront_posix_read(int fd, uint8_t* buf, size_t count);
-int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count);
-int tpmfront_posix_fstat(int fd, struct stat* buf);
 #endif
 
-
 #endif
diff --git a/lib/sys.c b/lib/sys.c
index f472fdf..9973058 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -28,7 +28,6 @@
 #include <netfront.h>
 #include <blkfront.h>
 #include <fbfront.h>
-#include <tpmfront.h>
 #include <xenbus.h>
 #include <xenstore.h>
 #include <poll.h>
@@ -349,11 +348,6 @@ int read(int fd, void *buf, size_t nbytes)
         case FTYPE_BLK: {
 	    return blkfront_posix_read(fd, buf, nbytes);
         }
-#endif
-#ifdef CONFIG_TPMFRONT
-        case FTYPE_TPMFRONT: {
-	    return tpmfront_posix_read(fd, buf, nbytes);
-        }
 #endif
 	default:
 	    break;
@@ -402,10 +396,6 @@ int write(int fd, const void *buf, size_t nbytes)
 #ifdef CONFIG_BLKFRONT
 	case FTYPE_BLK:
 	    return blkfront_posix_write(fd, buf, nbytes);
-#endif
-#ifdef CONFIG_TPMFRONT
-	case FTYPE_TPMFRONT:
-	    return tpmfront_posix_write(fd, buf, nbytes);
 #endif
 	default:
 	    break;
@@ -468,10 +458,6 @@ off_t lseek(int fd, off_t offset, int whence)
 #ifdef CONFIG_BLKFRONT
        case FTYPE_BLK:
           break;
-#endif
-#ifdef CONFIG_TPMFRONT
-       case FTYPE_TPMFRONT:
-          break;
 #endif
        case FTYPE_FILE:
           break;
@@ -524,11 +510,6 @@ int close(int fd)
             shutdown_blkfront(files[fd].dev);
             break;
 #endif
-#ifdef CONFIG_TPMFRONT
-	case FTYPE_TPMFRONT:
-            shutdown_tpmfront(files[fd].dev);
-            break;
-#endif
 #ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].dev);
@@ -613,10 +594,6 @@ int fstat(int fd, struct stat *buf)
 #ifdef CONFIG_BLKFRONT
 	case FTYPE_BLK:
 	   return blkfront_posix_fstat(fd, buf);
-#endif
-#ifdef CONFIG_TPMFRONT
-	case FTYPE_TPMFRONT:
-	   return tpmfront_posix_fstat(fd, buf);
 #endif
 	default:
 	    break;
diff --git a/tpmfront.c b/tpmfront.c
index 0a2fefc..f4864d6 100644
--- a/tpmfront.c
+++ b/tpmfront.c
@@ -49,6 +49,10 @@
 void tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) {
    struct tpmfront_dev* dev = (struct tpmfront_dev*) data;
    tpmif_shared_page_t *shr = dev->page;
+#ifdef HAVE_LIBC
+    struct file *file = get_file_from_fd(dev->fd);
+#endif
+
    /*If we get a response when we didnt make a request, just ignore it */
    if(!dev->waiting) {
       return;
@@ -65,8 +69,9 @@ void tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) {
 
    dev->waiting = 0;
 #ifdef HAVE_LIBC
-   if(dev->fd >= 0) {
-      files[dev->fd].read = true;
+   if ( file )
+   {
+      file->read = true;
    }
 #endif
    wake_up(&dev->waitq);
@@ -405,6 +410,10 @@ int tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length)
 #ifdef TPMFRONT_PRINT_DEBUG
    int i;
 #endif
+#ifdef HAVE_LIBC
+    struct file *file = dev ? get_file_from_fd(dev->fd) : NULL;
+#endif
+
    /* Error Checking */
    if(dev == NULL || dev->state != XenbusStateConnected) {
       TPMFRONT_ERR("Tried to send message through disconnected frontend\n");
@@ -437,9 +446,10 @@ int tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length)
    dev->waiting = 1;
    dev->resplen = 0;
 #ifdef HAVE_LIBC
-   if(dev->fd >= 0) {
-      files[dev->fd].read = false;
-      files[dev->fd].offset = 0;
+   if ( file )
+   {
+      file->read = false;
+      file->offset = 0;
       dev->respgot = false;
    }
 #endif
@@ -529,25 +539,11 @@ int tpmfront_set_locality(struct tpmfront_dev* dev, int locality)
 
 #ifdef HAVE_LIBC
 #include <errno.h>
-int tpmfront_open(struct tpmfront_dev* dev)
-{
-   /* Silently prevent multiple opens */
-   if(dev->fd != -1) {
-      return dev->fd;
-   }
-
-   dev->fd = alloc_fd(FTYPE_TPMFRONT);
-   printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd);
-   files[dev->fd].dev = dev;
-   dev->respgot = false;
-   return dev->fd;
-}
 
-int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count)
+static int tpmfront_posix_write(struct file *file, const void *buf, size_t count)
 {
    int rc;
-   struct tpmfront_dev* dev;
-   dev = files[fd].dev;
+   struct tpmfront_dev *dev = file->dev;
 
    if(count == 0) {
       return 0;
@@ -566,14 +562,12 @@ int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count)
    return count;
 }
 
-int tpmfront_posix_read(int fd, uint8_t* buf, size_t count)
+static int tpmfront_posix_read(struct file *file, void *buf, size_t count)
 {
    int rc;
    uint8_t* dummybuf;
    size_t dummysz;
-   struct tpmfront_dev* dev;
-
-   dev = files[fd].dev;
+   struct tpmfront_dev *dev = file->dev;
 
    if(count == 0) {
       return 0;
@@ -588,29 +582,32 @@ int tpmfront_posix_read(int fd, uint8_t* buf, size_t count)
    }
 
    /* handle EOF case */
-   if(files[dev->fd].offset >= dev->resplen) {
+   if ( file->offset >= dev->resplen )
+   {
       return 0;
    }
 
    /* Compute the number of bytes and do the copy operation */
-   if((rc = min(count, dev->resplen - files[dev->fd].offset)) != 0) {
-      memcpy(buf, dev->respbuf + files[dev->fd].offset, rc);
-      files[dev->fd].offset += rc;
+   if ( (rc = min(count, dev->resplen - file->offset)) != 0 )
+   {
+      memcpy(buf, dev->respbuf + file->offset, rc);
+      file->offset += rc;
    }
 
    return rc;
 }
 
-int tpmfront_posix_fstat(int fd, struct stat* buf)
+static int tpmfront_posix_fstat(struct file *file, struct stat *buf)
 {
    uint8_t* dummybuf;
    size_t dummysz;
    int rc;
-   struct tpmfront_dev* dev = files[fd].dev;
+   struct tpmfront_dev *dev = file->dev;
 
    /* If we have a response waiting, then read it now from the backend
     * so we can get its length*/
-   if(dev->waiting || (files[dev->fd].read && !dev->respgot)) {
+   if ( dev->waiting || (file->read && !dev->respgot) )
+   {
       if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
 	 errno = EIO;
 	 return -1;
@@ -626,5 +623,45 @@ int tpmfront_posix_fstat(int fd, struct stat* buf)
    return 0;
 }
 
+static int tpmfront_close_fd(struct file *file)
+{
+    shutdown_tpmfront(file->dev);
+
+    return 0;
+}
+
+static const struct file_ops tpmfront_ops = {
+    .name = "tpmfront",
+    .read = tpmfront_posix_read,
+    .write = tpmfront_posix_write,
+    .lseek = lseek_default,
+    .close = tpmfront_close_fd,
+    .fstat = tpmfront_posix_fstat,
+};
+
+static unsigned int ftype_tpmfront;
+
+__attribute__((constructor))
+static void tpmfront_initialize(void)
+{
+    ftype_tpmfront = alloc_file_type(&tpmfront_ops);
+}
+
+int tpmfront_open(struct tpmfront_dev *dev)
+{
+    struct file *file;
+
+    /* Silently prevent multiple opens */
+    if ( dev->fd != -1 )
+        return dev->fd;
+
+    dev->fd = alloc_fd(ftype_tpmfront);
+    printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd);
+    file = get_file_from_fd(dev->fd);
+    file->dev = dev;
+    dev->respgot = false;
+
+    return dev->fd;
+}
 
 #endif
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:33:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258632.445654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tIn-0004IN-MR; Tue, 18 Jan 2022 18:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258632.445654; Tue, 18 Jan 2022 18: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 1n9tIn-0004IF-JC; Tue, 18 Jan 2022 18:33:53 +0000
Received: by outflank-mailman (input) for mailman id 258632;
 Tue, 18 Jan 2022 18: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 1n9tIm-0004I3-KC
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tIm-0006pA-JL
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tIm-0001mS-IR
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=xLrFmzJA1jk6IZjeUhu+8+QFs/Ys+34O5DS+uwZca5s=; b=t6DiyfE+llUDHsM+ThP1vvatpD
	spf6NQ/UZB+r48WTL39aqU11ChNVa63E0qqlB061+tkmjYGUIWRyvFhWsMG/dUnJp93l5g2aVqfle
	AME3soqpqdC/3rLkGYS/ngChjTYQKZbHuTPoDtgsqYcXh7KEMjFaopSged8W8XF7FfAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] use alloc_file_type() and get_file_from_fd() in blkfront
Message-Id: <E1n9tIm-0001mS-IR@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:33:52 +0000

commit 3b221172f1ee04327388c463e94be875cc1dfde2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:22 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    use alloc_file_type() and get_file_from_fd() in blkfront
    
    Allocate the file type dynamically via alloc_file_type().
    
    Instead of directly accessing the files[] array use get_file_from_fd().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 blkfront.c         | 93 ++++++++++++++++++++++++++++++++++++++++--------------
 include/blkfront.h |  5 ---
 include/lib.h      |  3 +-
 lib/sys.c          | 24 --------------
 4 files changed, 70 insertions(+), 55 deletions(-)

diff --git a/blkfront.c b/blkfront.c
index e3f42be..8f14089 100644
--- a/blkfront.c
+++ b/blkfront.c
@@ -59,10 +59,10 @@ void blkfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
 #ifdef HAVE_LIBC
     struct blkfront_dev *dev = data;
-    int fd = dev->fd;
+    struct file *file = get_file_from_fd(dev->fd);
 
-    if (fd != -1)
-        files[fd].read = true;
+    if ( file )
+        file->read = true;
 #endif
     wake_up(&blkfront_queue);
 }
@@ -483,9 +483,14 @@ int blkfront_aio_poll(struct blkfront_dev *dev)
 
 moretodo:
 #ifdef HAVE_LIBC
-    if (dev->fd != -1) {
-        files[dev->fd].read = false;
-        mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
+    {
+        struct file *file = get_file_from_fd(dev->fd);
+
+        if ( file )
+        {
+            file->read = false;
+            mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
+        }
     }
 #endif
 
@@ -554,22 +559,11 @@ moretodo:
 }
 
 #ifdef HAVE_LIBC
-int blkfront_open(struct blkfront_dev *dev)
+static int blkfront_posix_rwop(struct file *file, uint8_t *buf, size_t count,
+                               bool write)
 {
-    /* Silently prevent multiple opens */
-    if(dev->fd != -1) {
-       return dev->fd;
-    }
-    dev->fd = alloc_fd(FTYPE_BLK);
-    printk("blk_open(%s) -> %d\n", dev->nodename, dev->fd);
-    files[dev->fd].dev = dev;
-    return dev->fd;
-}
-
-int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write)
-{
-   struct blkfront_dev* dev = files[fd].dev;
-   off_t offset = files[fd].offset;
+   struct blkfront_dev *dev = file->dev;
+   off_t offset = file->offset;
    struct blkfront_aiocb aiocb;
    unsigned long long disksize = dev->info.sectors * dev->info.sector_size;
    unsigned int blocksize = dev->info.sector_size;
@@ -711,14 +705,24 @@ int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write)
    }
 
    free(copybuf);
-   files[fd].offset += rc;
+   file->offset += rc;
    return rc;
 
 }
 
-int blkfront_posix_fstat(int fd, struct stat* buf)
+static int blkfront_posix_read(struct file *file, void *buf, size_t nbytes)
 {
-   struct blkfront_dev* dev = files[fd].dev;
+    return blkfront_posix_rwop(file, buf, nbytes, false);
+}
+
+static int blkfront_posix_write(struct file *file, const void *buf, size_t nbytes)
+{
+    return blkfront_posix_rwop(file, (void *)buf, nbytes, true);
+}
+
+static int blkfront_posix_fstat(struct file *file, struct stat *buf)
+{
+   struct blkfront_dev *dev = file->dev;
 
    buf->st_mode = dev->info.mode;
    buf->st_uid = 0;
@@ -728,4 +732,45 @@ int blkfront_posix_fstat(int fd, struct stat* buf)
 
    return 0;
 }
+
+static int blkfront_close_fd(struct file *file)
+{
+    shutdown_blkfront(file->dev);
+
+    return 0;
+}
+
+static const struct file_ops blk_ops = {
+    .name = "blk",
+    .read = blkfront_posix_read,
+    .write = blkfront_posix_write,
+    .lseek = lseek_default,
+    .close = blkfront_close_fd,
+    .fstat = blkfront_posix_fstat,
+    .select_rd = select_read_flag,
+};
+
+static unsigned int ftype_blk;
+
+__attribute__((constructor))
+static void blkfron_initialize(void)
+{
+    ftype_blk = alloc_file_type(&blk_ops);
+}
+
+int blkfront_open(struct blkfront_dev *dev)
+{
+    struct file *file;
+
+    /* Silently prevent multiple opens */
+    if ( dev->fd != -1 )
+        return dev->fd;
+
+    dev->fd = alloc_fd(ftype_blk);
+    printk("blk_open(%s) -> %d\n", dev->nodename, dev->fd);
+    file = get_file_from_fd(dev->fd);
+    file->dev = dev;
+
+    return dev->fd;
+}
 #endif
diff --git a/include/blkfront.h b/include/blkfront.h
index 3528af9..7f84a0a 100644
--- a/include/blkfront.h
+++ b/include/blkfront.h
@@ -28,17 +28,12 @@ struct blkfront_info
 };
 struct blkfront_dev *init_blkfront(char *nodename, struct blkfront_info *info);
 #ifdef HAVE_LIBC
-#include <sys/stat.h>
 /* POSIX IO functions:
  * use blkfront_open() to get a file descriptor to the block device
  * Don't use the other blkfront posix functions here directly, instead use
  * read(), write(), lseek() and fstat() on the file descriptor
  */
 int blkfront_open(struct blkfront_dev *dev);
-int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write);
-#define blkfront_posix_write(fd, buf, count) blkfront_posix_rwop(fd, (uint8_t*)buf, count, 1)
-#define blkfront_posix_read(fd, buf, count) blkfront_posix_rwop(fd, (uint8_t*)buf, count, 0)
-int blkfront_posix_fstat(int fd, struct stat* buf);
 #endif
 void blkfront_aio(struct blkfront_aiocb *aiocbp, int write);
 #define blkfront_aio_read(aiocbp) blkfront_aio(aiocbp, 0)
diff --git a/include/lib.h b/include/lib.h
index 9b7eaae..2f472b0 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -166,8 +166,7 @@ extern struct wait_queue_head event_queue;
 #define FTYPE_FB         6
 #define FTYPE_KBD        7
 #define FTYPE_TAP        8
-#define FTYPE_BLK        9
-#define FTYPE_N         10
+#define FTYPE_N          9
 #define FTYPE_SPARE     16
 
 struct file {
diff --git a/lib/sys.c b/lib/sys.c
index 9973058..cfb5ac1 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -343,11 +343,6 @@ int read(int fd, void *buf, size_t nbytes)
 	    }
 	    return ret * sizeof(union xenfb_in_event);
         }
-#endif
-#ifdef CONFIG_BLKFRONT
-        case FTYPE_BLK: {
-	    return blkfront_posix_read(fd, buf, nbytes);
-        }
 #endif
 	default:
 	    break;
@@ -392,10 +387,6 @@ int write(int fd, const void *buf, size_t nbytes)
 	case FTYPE_TAP:
 	    netfront_xmit(files[fd].dev, (void*) buf, nbytes);
 	    return nbytes;
-#endif
-#ifdef CONFIG_BLKFRONT
-	case FTYPE_BLK:
-	    return blkfront_posix_write(fd, buf, nbytes);
 #endif
 	default:
 	    break;
@@ -455,10 +446,6 @@ off_t lseek(int fd, off_t offset, int whence)
         return ops->lseek(file, offset, whence);
 
     switch(file->type) {
-#ifdef CONFIG_BLKFRONT
-       case FTYPE_BLK:
-          break;
-#endif
        case FTYPE_FILE:
           break;
        default:
@@ -505,11 +492,6 @@ int close(int fd)
 	    shutdown_netfront(files[fd].dev);
             break;
 #endif
-#ifdef CONFIG_BLKFRONT
-	case FTYPE_BLK:
-            shutdown_blkfront(files[fd].dev);
-            break;
-#endif
 #ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].dev);
@@ -591,10 +573,6 @@ int fstat(int fd, struct stat *buf)
 	    buf->st_ctime = time(NULL);
 	    return 0;
 	}
-#ifdef CONFIG_BLKFRONT
-	case FTYPE_BLK:
-	   return blkfront_posix_fstat(fd, buf);
-#endif
 	default:
 	    break;
     }
@@ -710,7 +688,6 @@ static const char *const file_types[] = {
     [FTYPE_CONSOLE] = "console",
     [FTYPE_SOCKET]  = "socket",
     [FTYPE_TAP]     = "net",
-    [FTYPE_BLK]     = "blk",
     [FTYPE_KBD]     = "kbd",
     [FTYPE_FB]      = "fb",
 };
@@ -896,7 +873,6 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
 	    FD_CLR(i, exceptfds);
 	    break;
 	case FTYPE_TAP:
-	case FTYPE_BLK:
 	case FTYPE_KBD:
 	case FTYPE_FB:
 	    if (FD_ISSET(i, readfds)) {
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:34:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258633.445658 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tIx-0004LE-O3; Tue, 18 Jan 2022 18:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258633.445658; Tue, 18 Jan 2022 18:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tIx-0004L6-Kq; Tue, 18 Jan 2022 18:34:03 +0000
Received: by outflank-mailman (input) for mailman id 258633;
 Tue, 18 Jan 2022 18: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 1n9tIw-0004Kw-N8
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tIw-0006pY-MT
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tIw-0001nh-Li
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=PxVn77dpM+XWVvkPUiHHJd3T+Y9ZKwB3JujMvHFgO7I=; b=JR8GvfeO/OTal/G2qmWmSHI3Zh
	v7vIaUa/N8L/XH/k6GcGQ6kkjQxWMYrMHYi2xaeEFXdJ2u3vtY4eZrxaGHTbR1xUZTaOavJEs5+63
	nnk53fBwLzNLjpNWL33k1BepDjb9S6lVelaHfOn3hpmJUcMov2j2iHyHz+qX1YIa6Eys=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] use alloc_file_type() and get_file_from_fd() in netfront
Message-Id: <E1n9tIw-0001nh-Li@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:34:02 +0000

commit 729d79666c2966fea458c26940fed62bf229e42d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:23 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    use alloc_file_type() and get_file_from_fd() in netfront
    
    Allocate the file type dynamically via alloc_file_type().
    
    Instead of directly accessing the files[] array use get_file_from_fd().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h      |  3 +--
 include/netfront.h |  3 ++-
 lib/sys.c          | 23 -------------------
 netfront.c         | 65 ++++++++++++++++++++++++++++++++++++++++++++++--------
 4 files changed, 59 insertions(+), 35 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 2f472b0..b0d0880 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -165,8 +165,7 @@ extern struct wait_queue_head event_queue;
 #define FTYPE_SAVEFILE   5
 #define FTYPE_FB         6
 #define FTYPE_KBD        7
-#define FTYPE_TAP        8
-#define FTYPE_N          9
+#define FTYPE_N          8
 #define FTYPE_SPARE     16
 
 struct file {
diff --git a/include/netfront.h b/include/netfront.h
index ec641c8..75080c2 100644
--- a/include/netfront.h
+++ b/include/netfront.h
@@ -10,7 +10,8 @@ struct netfront_dev *init_netfront(char *nodename,
                                    char **ip);
 char *netfront_get_netmask(struct netfront_dev *dev);
 char *netfront_get_gateway(struct netfront_dev *dev);
-void netfront_xmit(struct netfront_dev *dev, unsigned char* data,int len);
+void netfront_xmit(struct netfront_dev *dev, const unsigned char *data,
+                   int len);
 void shutdown_netfront(struct netfront_dev *dev);
 void suspend_netfront(void);
 void resume_netfront(void);
diff --git a/lib/sys.c b/lib/sys.c
index cfb5ac1..3a05800 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -309,17 +309,6 @@ int read(int fd, void *buf, size_t nbytes)
 	case FTYPE_SOCKET:
 	    return lwip_read(files[fd].fd, buf, nbytes);
 #endif
-#ifdef CONFIG_NETFRONT
-	case FTYPE_TAP: {
-	    ssize_t ret;
-	    ret = netfront_receive(files[fd].dev, buf, nbytes);
-	    if (ret <= 0) {
-		errno = EAGAIN;
-		return -1;
-	    }
-	    return ret;
-	}
-#endif
 #ifdef CONFIG_KBDFRONT
         case FTYPE_KBD: {
             int ret, n;
@@ -382,11 +371,6 @@ int write(int fd, const void *buf, size_t nbytes)
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
 	    return lwip_write(files[fd].fd, (void*) buf, nbytes);
-#endif
-#ifdef CONFIG_NETFRONT
-	case FTYPE_TAP:
-	    netfront_xmit(files[fd].dev, (void*) buf, nbytes);
-	    return nbytes;
 #endif
 	default:
 	    break;
@@ -487,11 +471,6 @@ int close(int fd)
             res = lwip_close(files[fd].fd);
             break;
 #endif
-#ifdef CONFIG_NETFRONT
-	case FTYPE_TAP:
-	    shutdown_netfront(files[fd].dev);
-            break;
-#endif
 #ifdef CONFIG_KBDFRONT
 	case FTYPE_KBD:
             shutdown_kbdfront(files[fd].dev);
@@ -687,7 +666,6 @@ static const char *const file_types[] = {
     [FTYPE_NONE]    = "none",
     [FTYPE_CONSOLE] = "console",
     [FTYPE_SOCKET]  = "socket",
-    [FTYPE_TAP]     = "net",
     [FTYPE_KBD]     = "kbd",
     [FTYPE_FB]      = "fb",
 };
@@ -872,7 +850,6 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
                 n++;
 	    FD_CLR(i, exceptfds);
 	    break;
-	case FTYPE_TAP:
 	case FTYPE_KBD:
 	case FTYPE_FB:
 	    if (FD_ISSET(i, readfds)) {
diff --git a/netfront.c b/netfront.c
index 7696451..164fdc6 100644
--- a/netfront.c
+++ b/netfront.c
@@ -248,14 +248,14 @@ void netfront_select_handler(evtchn_port_t port, struct pt_regs *regs, void *dat
 {
     int flags;
     struct netfront_dev *dev = data;
-    int fd = dev->fd;
+    struct file *file = get_file_from_fd(dev->fd);
 
     local_irq_save(flags);
     network_tx_buf_gc(dev);
     local_irq_restore(flags);
 
-    if (fd != -1)
-        files[fd].read = true;
+    if ( file )
+        file->read = true;
     wake_up(&netfront_queue);
 }
 #endif
@@ -565,8 +565,53 @@ error:
 }
 
 #ifdef HAVE_LIBC
+static int netfront_read(struct file *file, void *buf, size_t nbytes)
+{
+    ssize_t ret;
+
+    ret = netfront_receive(file->dev, buf, nbytes);
+    if ( ret <= 0 )
+    {
+        errno = EAGAIN;
+        return -1;
+    }
+
+    return ret;
+}
+
+static int netfront_write(struct file *file, const void *buf, size_t nbytes)
+{
+    netfront_xmit(file->dev, buf, nbytes);
+
+    return nbytes;
+}
+
+static int netfront_close_fd(struct file *file)
+{
+    shutdown_netfront(file->dev);
+
+    return 0;
+}
+
+static const struct file_ops netfront_ops = {
+    .name = "net",
+    .read = netfront_read,
+    .write = netfront_write,
+    .close = netfront_close_fd,
+    .select_rd = select_read_flag,
+};
+
+static unsigned int ftype_netfront;
+
+__attribute__((constructor))
+static void netfront_initialize(void)
+{
+    ftype_netfront = alloc_file_type(&netfront_ops);
+}
+
 int netfront_tap_open(char *nodename) {
     struct netfront_dev *dev;
+    struct file *file;
 
     dev = init_netfront(nodename, NETIF_SELECT_RX, NULL, NULL);
     if (!dev) {
@@ -574,9 +619,10 @@ int netfront_tap_open(char *nodename) {
 	errno = EIO;
 	return -1;
     }
-    dev->fd = alloc_fd(FTYPE_TAP);
+    dev->fd = alloc_fd(ftype_netfront);
     printk("tap_open(%s) -> %d\n", nodename, dev->fd);
-    files[dev->fd].dev = dev;
+    file = get_file_from_fd(dev->fd);
+    file->dev = dev;
     return dev->fd;
 }
 #endif
@@ -720,7 +766,7 @@ void init_rx_buffers(struct netfront_dev *dev)
 }
 
 
-void netfront_xmit(struct netfront_dev *dev, unsigned char* data,int len)
+void netfront_xmit(struct netfront_dev *dev, const unsigned char *data, int len)
 {
     int flags;
     struct netif_tx_request *tx;
@@ -772,7 +818,8 @@ void netfront_xmit(struct netfront_dev *dev, unsigned char* data,int len)
 ssize_t netfront_receive(struct netfront_dev *dev, unsigned char *data, size_t len)
 {
     unsigned long flags;
-    int fd = dev->fd;
+    struct file *file = get_file_from_fd(dev->fd);
+
     ASSERT(current == main_thread);
 
     dev->rlen = 0;
@@ -781,9 +828,9 @@ ssize_t netfront_receive(struct netfront_dev *dev, unsigned char *data, size_t l
 
     local_irq_save(flags);
     network_rx(dev);
-    if (!dev->rlen && fd != -1)
+    if ( !dev->rlen && file )
         /* No data for us, make select stop returning */
-        files[fd].read = false;
+        file->read = false;
     /* Before re-enabling the interrupts, in case a packet just arrived in the
      * meanwhile. */
     local_irq_restore(flags);
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:34:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:34:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258634.445662 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tJ7-0004OH-PQ; Tue, 18 Jan 2022 18:34:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258634.445662; Tue, 18 Jan 2022 18:34:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tJ7-0004O9-MU; Tue, 18 Jan 2022 18:34:13 +0000
Received: by outflank-mailman (input) for mailman id 258634;
 Tue, 18 Jan 2022 18: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 1n9tJ6-0004Nw-QQ
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tJ6-0006pj-Ph
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tJ6-0001op-Ot
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=E2LPIvlRvSPk3UgcfzPyheNSTDHswAgoR4vrNB+grnY=; b=iI6wggRcyoeze9pCGzD6v0c4uj
	L8vIFbFAdJoNis0NPf/gkNCziXY4TqZSD6Ed6ha//dqZY1DPXd9zZfNUocZ+GS9vXlWIJZE1IKLJJ
	pCGvVimOPVbXA6bXrkEFLPuqAIFO3fecoSNQm4Wh0Fru2wIkOs91UW8OBLZhKtI3BMbk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] use alloc_file_type() and get_file_from_fd() in fbfront
Message-Id: <E1n9tJ6-0001op-Ot@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:34:12 +0000

commit 44bd6fe4c1a4ec06cc1613d51fa19113693d49b5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:24 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    use alloc_file_type() and get_file_from_fd() in fbfront
    
    Allocate file types dynamically via alloc_file_type().
    
    Instead of directly accessing the files[] array use get_file_from_fd().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 fbfront.c     | 128 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 include/lib.h |   4 +-
 lib/sys.c     |  47 ---------------------
 3 files changed, 109 insertions(+), 70 deletions(-)

diff --git a/fbfront.c b/fbfront.c
index 1e055fb..1b67f52 100644
--- a/fbfront.c
+++ b/fbfront.c
@@ -14,6 +14,9 @@
 #include <mini-os/xmalloc.h>
 #include <mini-os/fbfront.h>
 #include <mini-os/lib.h>
+#ifdef HAVE_LIBC
+#include <errno.h>
+#endif
 
 DECLARE_WAIT_QUEUE_HEAD(kbdfront_queue);
 
@@ -42,10 +45,10 @@ void kbdfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
 #ifdef HAVE_LIBC
     struct kbdfront_dev *dev = data;
-    int fd = dev->fd;
+    struct file *file = get_file_from_fd(dev->fd);
 
-    if (fd != -1)
-        files[fd].read = true;
+    if ( file )
+        file->read = true;
 #endif
     wake_up(&kbdfront_queue);
 }
@@ -204,10 +207,12 @@ int kbdfront_receive(struct kbdfront_dev *dev, union xenkbd_in_event *buf, int n
     struct xenkbd_page *page = dev->page;
     uint32_t prod, cons;
     int i;
-
 #ifdef HAVE_LIBC
-    if (dev->fd != -1) {
-        files[dev->fd].read = false;
+    struct file *file = get_file_from_fd(dev->fd);
+
+    if ( file )
+    {
+        file->read = false;
         mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
     }
 #endif
@@ -227,9 +232,9 @@ int kbdfront_receive(struct kbdfront_dev *dev, union xenkbd_in_event *buf, int n
     notify_remote_via_evtchn(dev->evtchn);
 
 #ifdef HAVE_LIBC
-    if (cons != prod && dev->fd != -1)
+    if ( cons != prod && file )
         /* still some events to read */
-        files[dev->fd].read = true;
+        file->read = true;
 #endif
 
     return i;
@@ -298,11 +303,52 @@ close_kbdfront:
 }
 
 #ifdef HAVE_LIBC
+static int kbd_read(struct file *file, void *buf, size_t nbytes)
+{
+    int ret, n;
+
+    n = nbytes / sizeof(union xenkbd_in_event);
+    ret = kbdfront_receive(file->dev, buf, n);
+    if ( ret <= 0 )
+    {
+        errno = EAGAIN;
+        return -1;
+    }
+
+    return ret * sizeof(union xenkbd_in_event);
+}
+
+static int kbd_close_fd(struct file *file)
+{
+    shutdown_kbdfront(file->dev);
+
+    return 0;
+}
+
+static struct file_ops kbd_ops = {
+    .name = "kbd",
+    .read = kbd_read,
+    .close = kbd_close_fd,
+    .select_rd = select_read_flag,
+};
+
+static unsigned int ftype_kbd;
+
+__attribute__((constructor))
+static void kbdfront_initialize(void)
+{
+    ftype_kbd = alloc_file_type(&kbd_ops);
+}
+
 int kbdfront_open(struct kbdfront_dev *dev)
 {
-    dev->fd = alloc_fd(FTYPE_KBD);
+    struct file *file;
+
+    dev->fd = alloc_fd(ftype_kbd);
     printk("kbd_open(%s) -> %d\n", dev->nodename, dev->fd);
-    files[dev->fd].dev = dev;
+    file = get_file_from_fd(dev->fd);
+    file->dev = dev;
+
     return dev->fd;
 }
 #endif
@@ -346,10 +392,10 @@ void fbfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
 #ifdef HAVE_LIBC
     struct fbfront_dev *dev = data;
-    int fd = dev->fd;
+    struct file *file = get_file_from_fd(dev->fd);
 
-    if (fd != -1)
-        files[fd].read = true;
+    if ( file )
+        file->read = true;
 #endif
     wake_up(&fbfront_queue);
 }
@@ -373,10 +419,12 @@ int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n)
     struct xenfb_page *page = dev->page;
     uint32_t prod, cons;
     int i;
-
 #ifdef HAVE_LIBC
-    if (dev->fd != -1) {
-        files[dev->fd].read = false;
+    struct file *file = get_file_from_fd(dev->fd);
+
+    if ( file )
+    {
+        file->read = false;
         mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
     }
 #endif
@@ -396,9 +444,9 @@ int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n)
     notify_remote_via_evtchn(dev->evtchn);
 
 #ifdef HAVE_LIBC
-    if (cons != prod && dev->fd != -1)
+    if ( cons != prod && file )
         /* still some events to read */
-        files[dev->fd].read = true;
+        file->read = true;
 #endif
 
     return i;
@@ -699,11 +747,51 @@ close_fbfront:
 }
 
 #ifdef HAVE_LIBC
+static int fbfront_read(struct file *file, void *buf, size_t nbytes)
+{
+    int ret, n;
+
+    n = nbytes / sizeof(union xenfb_in_event);
+    ret = fbfront_receive(file->dev, buf, n);
+    if ( ret <= 0 )
+    {
+        errno = EAGAIN;
+        return -1;
+    }
+
+    return ret * sizeof(union xenfb_in_event);
+}
+
+static int fbfront_close_fd(struct file *file)
+{
+    shutdown_fbfront(file->dev);
+
+    return 0;
+}
+
+static const struct file_ops fb_ops = {
+    .name = "fb",
+    .read = fbfront_read,
+    .close = fbfront_close_fd,
+    .select_rd = select_read_flag,
+};
+
+static unsigned int ftype_fb;
+
+__attribute__((constructor))
+static void fbfront_initialize(void)
+{
+    ftype_fb = alloc_file_type(&fb_ops);
+}
+
 int fbfront_open(struct fbfront_dev *dev)
 {
-    dev->fd = alloc_fd(FTYPE_FB);
+    struct file *file;
+
+    dev->fd = alloc_fd(ftype_fb);
     printk("fb_open(%s) -> %d\n", dev->nodename, dev->fd);
-    files[dev->fd].dev = dev;
+    file = get_file_from_fd(dev->fd);
+    file->dev = dev;
     return dev->fd;
 }
 #endif
diff --git a/include/lib.h b/include/lib.h
index b0d0880..b1beeed 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -163,9 +163,7 @@ extern struct wait_queue_head event_queue;
 #define FTYPE_SOCKET     3
 #define FTYPE_MEM        4
 #define FTYPE_SAVEFILE   5
-#define FTYPE_FB         6
-#define FTYPE_KBD        7
-#define FTYPE_N          8
+#define FTYPE_N          6
 #define FTYPE_SPARE     16
 
 struct file {
diff --git a/lib/sys.c b/lib/sys.c
index 3a05800..b31c6d8 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -308,30 +308,6 @@ int read(int fd, void *buf, size_t nbytes)
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
 	    return lwip_read(files[fd].fd, buf, nbytes);
-#endif
-#ifdef CONFIG_KBDFRONT
-        case FTYPE_KBD: {
-            int ret, n;
-            n = nbytes / sizeof(union xenkbd_in_event);
-            ret = kbdfront_receive(files[fd].dev, buf, n);
-	    if (ret <= 0) {
-		errno = EAGAIN;
-		return -1;
-	    }
-	    return ret * sizeof(union xenkbd_in_event);
-        }
-#endif
-#ifdef CONFIG_FBFRONT
-        case FTYPE_FB: {
-            int ret, n;
-            n = nbytes / sizeof(union xenfb_in_event);
-            ret = fbfront_receive(files[fd].dev, buf, n);
-	    if (ret <= 0) {
-		errno = EAGAIN;
-		return -1;
-	    }
-	    return ret * sizeof(union xenfb_in_event);
-        }
 #endif
 	default:
 	    break;
@@ -471,16 +447,6 @@ int close(int fd)
             res = lwip_close(files[fd].fd);
             break;
 #endif
-#ifdef CONFIG_KBDFRONT
-	case FTYPE_KBD:
-            shutdown_kbdfront(files[fd].dev);
-            break;
-#endif
-#ifdef CONFIG_FBFRONT
-	case FTYPE_FB:
-            shutdown_fbfront(files[fd].dev);
-            break;
-#endif
 #ifdef CONFIG_CONSFRONT
         case FTYPE_SAVEFILE:
         case FTYPE_CONSOLE:
@@ -666,8 +632,6 @@ static const char *const file_types[] = {
     [FTYPE_NONE]    = "none",
     [FTYPE_CONSOLE] = "console",
     [FTYPE_SOCKET]  = "socket",
-    [FTYPE_KBD]     = "kbd",
-    [FTYPE_FB]      = "fb",
 };
 
 static const char *get_type_name(unsigned int type)
@@ -850,17 +814,6 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
                 n++;
 	    FD_CLR(i, exceptfds);
 	    break;
-	case FTYPE_KBD:
-	case FTYPE_FB:
-	    if (FD_ISSET(i, readfds)) {
-		if (files[i].read)
-		    n++;
-		else
-		    FD_CLR(i, readfds);
-	    }
-	    FD_CLR(i, writefds);
-	    FD_CLR(i, exceptfds);
-	    break;
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
 	    if (FD_ISSET(i, readfds)) {
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:34:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:34:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258635.445666 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tJH-0004RZ-St; Tue, 18 Jan 2022 18:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258635.445666; Tue, 18 Jan 2022 18: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 1n9tJH-0004RR-Pq; Tue, 18 Jan 2022 18:34:23 +0000
Received: by outflank-mailman (input) for mailman id 258635;
 Tue, 18 Jan 2022 18: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 1n9tJG-0004R7-Ti
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tJG-0006pt-Su
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tJG-0001q3-S7
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=ZfK6/ygEO2TShxxjtQwWJ7uikVNTEomKWMPBiTq94lU=; b=JlFS/tg26vHDiXQmw+mOKwAiUR
	Xs7AXYoNYmwP5ns+wMwJxPxdgTvzsU8A0sp6PMwOifLtYuKCAs4YtQ8GlWgKiN/oHILuDV6VR45jk
	LZah3wecgkCY9TtWEfwgzeQZcgod6WzyLEWMOzJk/pORvcGDNTGtwaIHvIKgbMSM6IoU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] use file_ops and get_file_from_fd() for console
Message-Id: <E1n9tJG-0001q3-S7@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:34:22 +0000

commit 02d4145d14d3d77d92cb2b31aae90f64fe213369
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:25 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    use file_ops and get_file_from_fd() for console
    
    Add struct file_ops for the console related file types (FTYPE_CONSOLE
    and savefile). FTYPE_CONSOLE remains statically defined, as it is used
    to statically init stdin, stdout and stderr.
    
    Instead of directly accessing the files[] array use get_file_from_fd().
    
    With CONSOLE now handled via file_ops the bogus file descriptor case in
    select_poll() now needs to be handled more explicit instead of dropping
    into console handling, assuming that this case was basically meant to
    cover SAVEFILE.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 console/console.c      |   2 +-
 console/xenbus.c       | 112 +++++++++++++++++++++++++++++++++++++++++++++++++
 console/xencons_ring.c |   6 +--
 include/console.h      |   7 +++-
 include/lib.h          |   3 +-
 lib/sys.c              |  87 ++++++++++----------------------------
 6 files changed, 144 insertions(+), 73 deletions(-)

diff --git a/console/console.c b/console/console.c
index af1a6dd..68c8435 100644
--- a/console/console.c
+++ b/console/console.c
@@ -76,7 +76,7 @@ void xencons_tx(void)
 #endif
 
 
-void console_print(struct consfront_dev *dev, char *data, int length)
+void console_print(struct consfront_dev *dev, const char *data, int length)
 {
     char *curr_char, saved_char;
     char copied_str[length+1];
diff --git a/console/xenbus.c b/console/xenbus.c
index 05fc31c..d895045 100644
--- a/console/xenbus.c
+++ b/console/xenbus.c
@@ -192,3 +192,115 @@ void fini_consfront(struct consfront_dev *dev)
 {
     if (dev) free_consfront(dev);
 }
+
+#ifdef HAVE_LIBC
+static int consfront_read(struct file *file, void *buf, size_t nbytes)
+{
+    int ret;
+    DEFINE_WAIT(w);
+
+    while ( 1 )
+    {
+        add_waiter(w, console_queue);
+        ret = xencons_ring_recv(file->dev, buf, nbytes);
+        if ( ret )
+            break;
+        schedule();
+    }
+
+    remove_waiter(w, console_queue);
+
+    return ret;
+}
+
+static int savefile_write(struct file *file, const void *buf, size_t nbytes)
+{
+    int ret = 0, tot = nbytes;
+
+    while ( nbytes > 0 )
+    {
+        ret = xencons_ring_send(file->dev, buf, nbytes);
+        nbytes -= ret;
+        buf = (char *)buf + ret;
+    }
+
+    return tot - nbytes;
+}
+
+static int console_write(struct file *file, const void *buf, size_t nbytes)
+{
+    console_print(file->dev, buf, nbytes);
+
+    return nbytes;
+}
+
+static int consfront_close_fd(struct file *file)
+{
+    fini_consfront(file->dev);
+
+    return 0;
+}
+
+static int consfront_fstat(struct file *file, struct stat *buf)
+{
+    buf->st_mode = S_IRUSR | S_IWUSR;
+    buf->st_mode |= (file->type == FTYPE_CONSOLE) ? S_IFCHR : S_IFREG;
+    buf->st_atime = buf->st_mtime = buf->st_ctime = time(NULL);
+
+    return 0;
+}
+
+static bool consfront_select_rd(struct file *file)
+{
+    return xencons_ring_avail(file->dev);
+}
+
+static const struct file_ops savefile_ops = {
+    .name = "savefile",
+    .read = consfront_read,
+    .write = savefile_write,
+    .close = consfront_close_fd,
+    .fstat = consfront_fstat,
+    .select_rd = consfront_select_rd,
+    .select_wr = select_yes,
+};
+
+const struct file_ops console_ops = {
+    .name = "console",
+    .read = consfront_read,
+    .write = console_write,
+    .close = consfront_close_fd,
+    .fstat = consfront_fstat,
+    .select_rd = consfront_select_rd,
+    .select_wr = select_yes,
+};
+
+static unsigned int ftype_savefile;
+
+__attribute__((constructor))
+static void consfront_initialize(void)
+{
+    ftype_savefile = alloc_file_type(&savefile_ops);
+}
+
+int open_consfront(char *nodename)
+{
+    struct consfront_dev *dev;
+    struct file *file;
+
+    dev = init_consfront(nodename);
+    if ( !dev )
+        return -1;
+
+    dev->fd = alloc_fd(nodename ? ftype_savefile : FTYPE_CONSOLE);
+    file = get_file_from_fd(dev->fd);
+    if ( !file )
+    {
+        fini_consfront(dev);
+        return -1;
+    }
+    file->dev = dev;
+
+    return dev->fd;
+}
+#endif
diff --git a/console/xencons_ring.c b/console/xencons_ring.c
index c348f3c..efedf46 100644
--- a/console/xencons_ring.c
+++ b/console/xencons_ring.c
@@ -99,10 +99,10 @@ void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
 	struct consfront_dev *dev = (struct consfront_dev *) data;
 #ifdef HAVE_LIBC
-        int fd = dev ? dev->fd : -1;
+        struct file *file = dev ? get_file_from_fd(dev->fd) : NULL;
 
-        if (fd != -1)
-            files[fd].read = true;
+        if ( file )
+            file->read = true;
 
         wake_up(&console_queue);
 #else
diff --git a/include/console.h b/include/console.h
index 0d7bf07..e76e423 100644
--- a/include/console.h
+++ b/include/console.h
@@ -39,6 +39,7 @@
 #include <mini-os/os.h>
 #include <mini-os/traps.h>
 #include <mini-os/types.h>
+#include <mini-os/lib.h>
 #include <xen/grant_table.h>
 #include <xenbus.h>
 #include <xen/io/console.h>
@@ -77,7 +78,7 @@ void xencons_tx(void);
 
 void get_console(void *p);
 void init_console(void);
-void console_print(struct consfront_dev *dev, char *data, int length);
+void console_print(struct consfront_dev *dev, const char *data, int length);
 void fini_consfront(struct consfront_dev *dev);
 void suspend_console(void);
 void resume_console(void);
@@ -93,5 +94,9 @@ int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, uns
 int xencons_ring_avail(struct consfront_dev *dev);
 int xencons_ring_recv(struct consfront_dev *dev, char *data, unsigned len);
 void free_consfront(struct consfront_dev *dev);
+#ifdef HAVE_LIBC
+extern const struct file_ops console_ops;
+int open_consfront(char *nodename);
+#endif
 
 #endif /* _LIB_CONSOLE_H_ */
diff --git a/include/lib.h b/include/lib.h
index b1beeed..e815e0a 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -162,8 +162,7 @@ extern struct wait_queue_head event_queue;
 #define FTYPE_FILE       2
 #define FTYPE_SOCKET     3
 #define FTYPE_MEM        4
-#define FTYPE_SAVEFILE   5
-#define FTYPE_N          6
+#define FTYPE_N          5
 #define FTYPE_SPARE     16
 
 struct file {
diff --git a/lib/sys.c b/lib/sys.c
index b31c6d8..56c8e62 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -101,6 +101,9 @@ static const struct file_ops file_ops_none = {
 
 static const struct file_ops *file_ops[FTYPE_N + FTYPE_SPARE] = {
     [FTYPE_NONE] = &file_ops_none,
+#ifdef CONFIG_CONSFRONT
+    [FTYPE_CONSOLE] = &console_ops,
+#endif
 };
 
 unsigned int alloc_file_type(const struct file_ops *ops)
@@ -212,31 +215,26 @@ int mkdir(const char *pathname, mode_t mode)
 #ifdef CONFIG_CONSFRONT
 int posix_openpt(int flags)
 {
-    struct consfront_dev *dev;
+    int fd;
 
     /* Ignore flags */
+    fd = open_consfront(NULL);
+    printk("fd(%d) = posix_openpt\n", fd);
 
-    dev = init_consfront(NULL);
-    dev->fd = alloc_fd(FTYPE_CONSOLE);
-    files[dev->fd].dev = dev;
-
-    printk("fd(%d) = posix_openpt\n", dev->fd);
-    return(dev->fd);
+    return fd;
 }
 
 int open_savefile(const char *path, int save)
 {
-    struct consfront_dev *dev;
+    int fd;
     char nodename[64];
 
     snprintf(nodename, sizeof(nodename), "device/console/%d", save ? SAVE_CONSOLE : RESTORE_CONSOLE);
 
-    dev = init_consfront(nodename);
-    dev->fd = alloc_fd(FTYPE_SAVEFILE);
-    files[dev->fd].dev = dev;
+    fd = open_consfront(nodename);
+    printk("fd(%d) = open_savefile\n", fd);
 
-    printk("fd(%d) = open_savefile\n", dev->fd);
-    return(dev->fd);
+    return fd;
 }
 #else
 int posix_openpt(int flags)
@@ -291,20 +289,6 @@ int read(int fd, void *buf, size_t nbytes)
         return ops->read(file, buf, nbytes);
 
     switch (file->type) {
-        case FTYPE_SAVEFILE:
-	case FTYPE_CONSOLE: {
-	    int ret;
-            DEFINE_WAIT(w);
-            while(1) {
-                add_waiter(w, console_queue);
-                ret = xencons_ring_recv(files[fd].dev, buf, nbytes);
-                if (ret)
-                    break;
-                schedule();
-            }
-            remove_waiter(w, console_queue);
-            return ret;
-        }
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
 	    return lwip_read(files[fd].fd, buf, nbytes);
@@ -332,18 +316,6 @@ int write(int fd, const void *buf, size_t nbytes)
         return ops->write(file, buf, nbytes);
 
     switch (file->type) {
-        case FTYPE_SAVEFILE: {
-                int ret = 0, tot = nbytes;
-                while (nbytes > 0) {
-                    ret = xencons_ring_send(files[fd].dev, (char *)buf, nbytes);
-                    nbytes -= ret;
-                    buf = (char *)buf + ret;
-                }
-                return tot - nbytes;
-            }
-	case FTYPE_CONSOLE:
-	    console_print(files[fd].dev, (char *)buf, nbytes);
-	    return nbytes;
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
 	    return lwip_write(files[fd].fd, (void*) buf, nbytes);
@@ -446,12 +418,6 @@ int close(int fd)
 	case FTYPE_SOCKET:
             res = lwip_close(files[fd].fd);
             break;
-#endif
-#ifdef CONFIG_CONSFRONT
-        case FTYPE_SAVEFILE:
-        case FTYPE_CONSOLE:
-            fini_consfront(files[fd].dev);
-            break;
 #endif
 	case FTYPE_NONE:
             goto error;
@@ -501,15 +467,8 @@ int fstat(int fd, struct stat *buf)
         return ops->fstat(file, buf);
 
     switch (file->type) {
-	case FTYPE_SAVEFILE:
-	case FTYPE_CONSOLE:
 	case FTYPE_SOCKET: {
-            if (files[fd].type == FTYPE_CONSOLE)
-                buf->st_mode = S_IFCHR|S_IRUSR|S_IWUSR;
-            else if (files[fd].type == FTYPE_SOCKET)
-                buf->st_mode = S_IFSOCK|S_IRUSR|S_IWUSR;
-            else if (files[fd].type == FTYPE_SAVEFILE)
-                buf->st_mode = S_IFREG|S_IRUSR|S_IWUSR;
+            buf->st_mode = S_IFSOCK|S_IRUSR|S_IWUSR;
 	    buf->st_uid = 0;
 	    buf->st_gid = 0;
 	    buf->st_size = 0;
@@ -630,7 +589,6 @@ int closedir(DIR *dir)
 #if defined(LIBC_DEBUG) || defined(LIBC_VERBOSE)
 static const char *const file_types[] = {
     [FTYPE_NONE]    = "none",
-    [FTYPE_CONSOLE] = "console",
     [FTYPE_SOCKET]  = "socket",
 };
 
@@ -799,21 +757,18 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
             }
 
 	    if (FD_ISSET(i, readfds) || FD_ISSET(i, writefds) || FD_ISSET(i, exceptfds))
+            {
 		printk("bogus fd %d in select\n", i);
-	    /* Fallthrough.  */
-        }
-
-	case FTYPE_CONSOLE:
-	    if (FD_ISSET(i, readfds)) {
-                if (xencons_ring_avail(files[i].dev))
-		    n++;
-		else
-		    FD_CLR(i, readfds);
+                if ( FD_ISSET(i, readfds) )
+                    FD_CLR(i, readfds);
+                if ( FD_ISSET(i, writefds) )
+                    FD_CLR(i, writefds);
+                if ( FD_ISSET(i, exceptfds) )
+                    FD_CLR(i, exceptfds);
             }
-	    if (FD_ISSET(i, writefds))
-                n++;
-	    FD_CLR(i, exceptfds);
 	    break;
+        }
+
 #ifdef HAVE_LWIP
 	case FTYPE_SOCKET:
 	    if (FD_ISSET(i, readfds)) {
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:34:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:34:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258636.445671 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tJR-0004UW-Un; Tue, 18 Jan 2022 18:34:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258636.445671; Tue, 18 Jan 2022 18: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 1n9tJR-0004UK-RQ; Tue, 18 Jan 2022 18:34:33 +0000
Received: by outflank-mailman (input) for mailman id 258636;
 Tue, 18 Jan 2022 18: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 1n9tJR-0004U5-14
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tJR-0006qJ-0J
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tJQ-0001r9-VA
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:34:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xneoXORSF/jNiVfWXJ4vDEHMrR7Nh9LAaLHlrS28y6M=; b=Lj8yO1Spd2Ny1G4XAnuXuFMrZz
	3ulCmgxNSkZS+Qi/rdZIjtEaD9FJrfW5LJffXd7rTg2qJsDmUDlT6EbWPcOF/2ZOPG740vNPnUlDP
	iQ5dlALBvHjayRPvwrGTmtlUDRDwHLvVdGLQYyFyyCq/HXj4Nt9vQA90kb9QBFtQCnkw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] add struct file_ops for file type socket
Message-Id: <E1n9tJQ-0001r9-VA@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:34:32 +0000

commit ab2cce28102deea8ca04e3b7b85f85e2b9eebda9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:26 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    add struct file_ops for file type socket
    
    Even with some special handling needed in select_poll(), add a struct
    file_ops for FTYPE_SOCKET. Due to the need of the special handling it
    isn't possible to use a dynamically allocated file type.
    
    Most functions calling the file_ops methods can be simplified a lot now
    that no file type specific handling is left. Same applies to the file
    type name printing in debug/verbose mode.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 lib/sys.c | 148 +++++++++++++++++++++++++++-----------------------------------
 1 file changed, 64 insertions(+), 84 deletions(-)

diff --git a/lib/sys.c b/lib/sys.c
index 56c8e62..538d6e7 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -99,11 +99,67 @@ static const struct file_ops file_ops_none = {
     .name = "none",
 };
 
+#ifdef HAVE_LWIP
+static int socket_read(struct file *file, void *buf, size_t nbytes)
+{
+    return lwip_read(file->fd, buf, nbytes);
+}
+
+static int socket_write(struct file *file, const void *buf, size_t nbytes)
+{
+    return lwip_write(file->fd, buf, nbytes);
+}
+
+static int close_socket_fd(struct file *file)
+{
+    return lwip_close(file->fd);
+}
+
+static int socket_fstat(struct file *file, struct stat *buf)
+{
+    buf->st_mode = S_IFSOCK | S_IRUSR | S_IWUSR;
+    buf->st_atime = buf->st_mtime = buf->st_ctime = time(NULL);
+
+    return 0;
+}
+
+static int socket_fcntl(struct file *file, int cmd, va_list args)
+{
+    long arg;
+
+    arg = va_arg(args, long);
+
+    if ( cmd == F_SETFL && !(arg & ~O_NONBLOCK) )
+    {
+        /* Only flag supported: non-blocking mode */
+        uint32_t nblock = !!(arg & O_NONBLOCK);
+
+        return lwip_ioctl(file->fd, FIONBIO, &nblock);
+    }
+
+    printk("socket fcntl(fd, %d, %lx/%lo)\n", cmd, arg, arg);
+    errno = ENOSYS;
+    return -1;
+}
+
+static const struct file_ops socket_ops = {
+    .name = "socket",
+    .read = socket_read,
+    .write = socket_write,
+    .close = close_socket_fd,
+    .fstat = socket_fstat,
+    .fcntl = socket_fcntl,
+};
+#endif
+
 static const struct file_ops *file_ops[FTYPE_N + FTYPE_SPARE] = {
     [FTYPE_NONE] = &file_ops_none,
 #ifdef CONFIG_CONSFRONT
     [FTYPE_CONSOLE] = &console_ops,
 #endif
+#ifdef HAVE_LWIP
+    [FTYPE_SOCKET] = &socket_ops,
+#endif
 };
 
 unsigned int alloc_file_type(const struct file_ops *ops)
@@ -288,15 +344,6 @@ int read(int fd, void *buf, size_t nbytes)
     if ( ops->read )
         return ops->read(file, buf, nbytes);
 
-    switch (file->type) {
-#ifdef HAVE_LWIP
-	case FTYPE_SOCKET:
-	    return lwip_read(files[fd].fd, buf, nbytes);
-#endif
-	default:
-	    break;
-    }
-
  error:
     printk("read(%d): Bad descriptor\n", fd);
     errno = EBADF;
@@ -315,15 +362,6 @@ int write(int fd, const void *buf, size_t nbytes)
     if ( ops->write )
         return ops->write(file, buf, nbytes);
 
-    switch (file->type) {
-#ifdef HAVE_LWIP
-	case FTYPE_SOCKET:
-	    return lwip_write(files[fd].fd, (void*) buf, nbytes);
-#endif
-	default:
-	    break;
-    }
-
  error:
     printk("write(%d): Bad descriptor\n", fd);
     errno = EBADF;
@@ -406,24 +444,10 @@ int close(int fd)
     ops = get_file_ops(file->type);
     printk("close(%d)\n", fd);
     if ( ops->close )
-    {
         res = ops->close(file);
-        goto out;
-    }
-
-    switch (file->type) {
-        default:
-            break;
-#ifdef HAVE_LWIP
-	case FTYPE_SOCKET:
-            res = lwip_close(files[fd].fd);
-            break;
-#endif
-	case FTYPE_NONE:
-            goto error;
-    }
+    else if ( file->type == FTYPE_NONE )
+        goto error;
 
- out:
     memset(files + fd, 0, sizeof(struct file));
     BUILD_BUG_ON(FTYPE_NONE != 0);
 
@@ -466,21 +490,6 @@ int fstat(int fd, struct stat *buf)
     if ( ops->fstat )
         return ops->fstat(file, buf);
 
-    switch (file->type) {
-	case FTYPE_SOCKET: {
-            buf->st_mode = S_IFSOCK|S_IRUSR|S_IWUSR;
-	    buf->st_uid = 0;
-	    buf->st_gid = 0;
-	    buf->st_size = 0;
-	    buf->st_atime = 
-	    buf->st_mtime = 
-	    buf->st_ctime = time(NULL);
-	    return 0;
-	}
-	default:
-	    break;
-    }
-
  error:
     printk("statf(%d): Bad descriptor\n", fd);
     errno = EBADF;
@@ -538,21 +547,9 @@ int fcntl(int fd, int cmd, ...)
     arg = va_arg(ap, long);
     va_end(ap);
 
-    switch (cmd) {
-#ifdef HAVE_LWIP
-	case F_SETFL:
-	    if (files[fd].type == FTYPE_SOCKET && !(arg & ~O_NONBLOCK)) {
-		/* Only flag supported: non-blocking mode */
-		uint32_t nblock = !!(arg & O_NONBLOCK);
-		return lwip_ioctl(files[fd].fd, FIONBIO, &nblock);
-	    }
-	    /* Fallthrough */
-#endif
-	default:
-	    printk("fcntl(%d, %d, %lx/%lo)\n", fd, cmd, arg, arg);
-	    errno = ENOSYS;
-	    return -1;
-    }
+    printk("fcntl(%d, %d, %lx/%lo)\n", fd, cmd, arg, arg);
+    errno = ENOSYS;
+    return -1;
 }
 
 DIR *opendir(const char *name)
@@ -586,23 +583,6 @@ int closedir(DIR *dir)
 
 /* We assume that only the main thread calls select(). */
 
-#if defined(LIBC_DEBUG) || defined(LIBC_VERBOSE)
-static const char *const file_types[] = {
-    [FTYPE_NONE]    = "none",
-    [FTYPE_SOCKET]  = "socket",
-};
-
-static const char *get_type_name(unsigned int type)
-{
-    if ( type < ARRAY_SIZE(file_ops) && file_ops[type] )
-        return file_ops[type]->name;
-
-    if ( type < ARRAY_SIZE(file_types) && file_types[type] )
-        return file_types[type];
-
-    return "none";
-}
-#endif
 #ifdef LIBC_DEBUG
 static void dump_set(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
 {
@@ -613,7 +593,7 @@ static void dump_set(int nfds, fd_set *readfds, fd_set *writefds, fd_set *except
 	if (FD_ISSET(i, set)) { \
 	    if (comma) \
 		printk(", "); \
-            printk("%d(%s)", i, get_type_name(files[i].type)); \
+            printk("%d(%s)", i, get_file_ops(files[i].type)->name); \
 	    comma = 1; \
 	} \
     } \
@@ -647,7 +627,7 @@ static void dump_pollfds(struct pollfd *pfd, int nfds, int timeout)
         fd = pfd[i].fd;
         if (comma)
             printk(", ");
-        printk("%d(%s)/%02x", fd, get_type_name(files[fd].type),
+        printk("%d(%s)/%02x", fd, get_file_ops(files[fd].type)->name,
             pfd[i].events);
             comma = 1;
     }
@@ -809,7 +789,7 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
 	printk("%d(%d): ", nb, sock_n);
 	for (i = 0; i < nfds; i++) {
 	    if (nbread[i] || nbwrite[i] || nbexcept[i])
-                printk(" %d(%c):", i, get_type_name(files[i].type));
+                printk(" %d(%c):", i, get_file_ops(files[i].type)->name);
 	    if (nbread[i])
 	    	printk(" %dR", nbread[i]);
 	    if (nbwrite[i])
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:34:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258637.445674 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tJb-0004XG-W7; Tue, 18 Jan 2022 18:34:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258637.445674; Tue, 18 Jan 2022 18: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 1n9tJb-0004X8-T4; Tue, 18 Jan 2022 18:34:43 +0000
Received: by outflank-mailman (input) for mailman id 258637;
 Tue, 18 Jan 2022 18: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 1n9tJb-0004Wx-44
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tJb-0006qW-3G
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tJb-0001sD-2S
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=ywKDFeBjh/l+64YuyB3JG/J+F6XFKhLf2q4ER1Bufns=; b=RhDk9/ONN8eNWRtIN+bs15BgXH
	A1HL3uwJWBgiUnG2osTOIYMXoityzdi0p7tI2cnhLw1qgg6PshE3Z1jCsbxQaSdK41bzcnJBmZRAS
	3cLF1uFE5/rHMAM7gEkbN4KYBX790T9/nI1xFYA1OmtFawJ1S1yV5hh5TN47Wv0MWhYo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] add struct file_ops for FTYPE_FILE
Message-Id: <E1n9tJb-0001sD-2S@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:34:43 +0000

commit bc96610efee56106dbe7971f29c7f4522cfdaf6a
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:27 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    add struct file_ops for FTYPE_FILE
    
    FTYPE_FILE is the last relevant file type without a struct file_ops.
    Add it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 lib/sys.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/lib/sys.c b/lib/sys.c
index 538d6e7..7f3dc4e 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -99,6 +99,11 @@ static const struct file_ops file_ops_none = {
     .name = "none",
 };
 
+static const struct file_ops file_file_ops = {
+    .name = "file",
+    .lseek = lseek_default,
+};
+
 #ifdef HAVE_LWIP
 static int socket_read(struct file *file, void *buf, size_t nbytes)
 {
@@ -157,6 +162,7 @@ static const struct file_ops *file_ops[FTYPE_N + FTYPE_SPARE] = {
 #ifdef CONFIG_CONSFRONT
     [FTYPE_CONSOLE] = &console_ops,
 #endif
+    [FTYPE_FILE] = &file_file_ops,
 #ifdef HAVE_LWIP
     [FTYPE_SOCKET] = &socket_ops,
 #endif
@@ -415,16 +421,9 @@ off_t lseek(int fd, off_t offset, int whence)
     if ( ops->lseek )
         return ops->lseek(file, offset, whence);
 
-    switch(file->type) {
-       case FTYPE_FILE:
-          break;
-       default:
-          /* Not implemented for this filetype */
-          errno = ESPIPE;
-          return (off_t) -1;
-    }
-
-    return lseek_default(file, offset, whence);
+    /* Not implemented for this filetype */
+    errno = ESPIPE;
+    return (off_t) -1;
 }
 
 int fsync(int fd) {
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 18 18:34:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Jan 2022 18:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258638.445678 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tJm-0004a6-1d; Tue, 18 Jan 2022 18:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258638.445678; Tue, 18 Jan 2022 18:34:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1n9tJl-0004Zy-Um; Tue, 18 Jan 2022 18:34:53 +0000
Received: by outflank-mailman (input) for mailman id 258638;
 Tue, 18 Jan 2022 18: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 1n9tJl-0004Zn-6p
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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 1n9tJl-0006qc-6C
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1n9tJl-0001ti-5S
 for xen-changelog@lists.xenproject.org; Tue, 18 Jan 2022 18: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=06QPxH+h0WCcnoDTrB/M3bbpFyHasygkIQA85W15utY=; b=ClEb2+mHNcKhwzC9GGrk34RaXe
	y1b8DZLTnE8fZB/2G2ZPsyPMAVv3e7fRuiCExRiZF07sb4vuTe+dTmkCmVsX7zeneMBvd3cIaoWah
	O7Qphr0RlXwsByIVpxscHHv3TlstEBCrEUfX9mbXsWV/cD4tRiltqhgIHg9e+pr1FG9s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] make files array private to sys.c
Message-Id: <E1n9tJl-0001ti-5S@xenbits.xenproject.org>
Date: Tue, 18 Jan 2022 18:34:53 +0000

commit 83ff43bff4bdd6879539fcb2b3d6ba5e61a64135
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:33:28 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 18:26:43 2022 +0000

    make files array private to sys.c
    
    There is no user of the files[] array outside of lib/sys.c left, so
    it can be made static.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h | 2 --
 lib/sys.c     | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index e815e0a..bec9964 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -175,8 +175,6 @@ struct file {
     };
 };
 
-extern struct file files[];
-
 struct file_ops {
     const char *name;
     int (*read)(struct file *file, void *buf, size_t nbytes);
diff --git a/lib/sys.c b/lib/sys.c
index 7f3dc4e..8f8a3de 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -89,7 +89,7 @@ extern void minios_evtchn_close_fd(int fd);
 extern void minios_gnttab_close_fd(int fd);
 
 pthread_mutex_t fd_lock = PTHREAD_MUTEX_INITIALIZER;
-struct file files[NOFILE] = {
+static struct file files[NOFILE] = {
     { .type = FTYPE_CONSOLE }, /* stdin */
     { .type = FTYPE_CONSOLE }, /* stdout */
     { .type = FTYPE_CONSOLE }, /* stderr */
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 02:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 02:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258704.445858 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA17m-0002Ja-Ku; Wed, 19 Jan 2022 02:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258704.445858; Wed, 19 Jan 2022 02:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA17m-0002JP-Hs; Wed, 19 Jan 2022 02:55:02 +0000
Received: by outflank-mailman (input) for mailman id 258704;
 Wed, 19 Jan 2022 02:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA17l-0002JJ-Ow
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA17l-0001LK-Nw
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA17l-0008LT-MK
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02: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=Enyz1ZvcmN+MJw6m+loAYF3AjQ3Xcz/mTKPD7vyd7Yw=; b=bH3kEG4f5Jv4NJp6Zy1Wx8Jw9b
	yA64oGMPCX2tLIJ1D0FBTwIkpIRwImaYKhy/zgOIlzW6klGIR7wtdKfG4P82V6tP9z4Pkg5k0HJeg
	yYjHtQw9/Eq5hCLtQT8bEl0Q+z6BdWHDR9fsMlgz7eLq1Hvb5ZL7ceBCm0Nrr3pAVRt4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: adjust include/xen/compile.h generation
Message-Id: <E1nA17l-0008LT-MK@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 02:55:01 +0000

commit 299deb9dd93e5aae2f3b24ec001214458077a185
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 14 11:03:03 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 14 11:03:03 2022 +0100

    build: adjust include/xen/compile.h generation
    
    Prior to 19427e439e01 ("build: generate "include/xen/compile.h" with
    if_changed") running "make install-xen" as root would not have printed
    the banner under normal circumstances. Its printing would instead have
    indicated that something was wrong (or during a normal build the lack
    of printing would do so).
    
    Further aforementioned change had another undesirable effect, which I
    didn't notice during review: Originally compile.h would have been
    re-generated (and final binaries re-linked) when its dependencies were
    updated after an earlier build. This is no longer the case now, which
    means that if some other file also was updated, then the re-build done
    during "make install-xen" would happen with a stale compile.h (as its
    updating is suppressed in this case).
    
    Restore the earlier behavior for both aspects.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index dc6bdc44c7..1e10d9f680 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -424,6 +424,7 @@ targets += .banner
 quiet_cmd_compile.h = UPD     $@
 define cmd_compile.h
     if [ ! -r $@ -o -O $@ ]; then \
+	cat .banner; \
 	sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
 	    -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
 	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
@@ -441,7 +442,7 @@ define cmd_compile.h
 endef
 
 include/xen/compile.h: include/xen/compile.h.in .banner FORCE
-	@cat .banner
+	$(if $(filter-out FORCE,$?),$(Q)rm -fv $@)
 	$(call if_changed,compile.h)
 
 targets += include/xen/compile.h
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 02:55:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 02:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258705.445862 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA17x-0002MA-Nf; Wed, 19 Jan 2022 02:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258705.445862; Wed, 19 Jan 2022 02:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA17x-0002M2-Kk; Wed, 19 Jan 2022 02:55:13 +0000
Received: by outflank-mailman (input) for mailman id 258705;
 Wed, 19 Jan 2022 02:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA17v-0002Ln-Sn
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA17v-0001Lb-Rv
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA17v-0008M2-Qv
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SHgNHeB33Tt9Z/aOgE3RDd0PUQMVlQlm/59zSw9oNmM=; b=5F+1st/jQU1gtniV/lRXqWEJlj
	VS7zJCTxLi8omzstiBsh11lNajrrn/IfwE8euBo2t8OtoH2sTS4Fvdgb/GwhD0rD1fiu3tJ7B/sgq
	4kvwDio+9lW8zKxUlKUuqsc9IWw6yBU1S6oVBKBGDdZZay6C/N/flWLbyC7q1DEvbjZQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: convert remaining hvm_funcs hook invocations to alt-call
Message-Id: <E1nA17v-0008M2-Qv@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 02:55:11 +0000

commit 27a63cdac3880c918848430eb25181437d5795e9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 17 09:45:04 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 17 09:45:04 2022 +0100

    x86/HVM: convert remaining hvm_funcs hook invocations to alt-call
    
    The aim being to have as few indirect calls as possible (see [1]),
    whereas during initial conversion performance was the main aspect and
    hence rarely used hooks didn't get converted. Apparently one use of
    get_interrupt_shadow() was missed at the time.
    
    While doing this, drop NULL checks ahead of CPU management and .nhvm_*()
    calls when the hook is always present. Also convert the
    .nhvm_vcpu_reset() call to alternative_vcall(), as the return value is
    unused and the caller has currently no way of propagating it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Tamas K Lengyel <tamas@tklengyel.com>
    
    [1] https://lists.xen.org/archives/html/xen-devel/2021-11/msg01822.html
---
 xen/arch/x86/hvm/emulate.c         |  2 +-
 xen/arch/x86/hvm/hvm.c             | 25 +++++++++++++------------
 xen/arch/x86/hvm/nestedhvm.c       | 14 ++++++--------
 xen/arch/x86/include/asm/hvm/hvm.h | 38 +++++++++++++++++++-------------------
 xen/arch/x86/monitor.c             |  3 ++-
 xen/arch/x86/vm_event.c            |  2 +-
 6 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index dd59ad89be..2b3fb4d6ba 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2549,7 +2549,7 @@ static int hvmemul_vmfunc(
 
     if ( !hvm_funcs.altp2m_vcpu_emulate_vmfunc )
         return X86EMUL_UNHANDLEABLE;
-    rc = hvm_funcs.altp2m_vcpu_emulate_vmfunc(ctxt->regs);
+    rc = alternative_call(hvm_funcs.altp2m_vcpu_emulate_vmfunc, ctxt->regs);
     if ( rc == X86EMUL_EXCEPTION )
         x86_emul_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC, ctxt);
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 10ee4e9570..3b87506ac4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -126,14 +126,14 @@ static int cpu_callback(
     switch ( action )
     {
     case CPU_UP_PREPARE:
-        rc = hvm_funcs.cpu_up_prepare(cpu);
+        rc = alternative_call(hvm_funcs.cpu_up_prepare, cpu);
         break;
     case CPU_DYING:
         hvm_cpu_down();
         break;
     case CPU_UP_CANCELED:
     case CPU_DEAD:
-        hvm_funcs.cpu_dead(cpu);
+        alternative_vcall(hvm_funcs.cpu_dead, cpu);
         break;
     default:
         break;
@@ -707,7 +707,7 @@ int hvm_domain_initialise(struct domain *d)
     if ( rc )
         goto fail2;
 
-    rc = hvm_funcs.domain_initialise(d);
+    rc = alternative_call(hvm_funcs.domain_initialise, d);
     if ( rc != 0 )
         goto fail2;
 
@@ -740,7 +740,7 @@ void hvm_domain_relinquish_resources(struct domain *d)
         alternative_vcall(hvm_funcs.domain_relinquish_resources, d);
 
     if ( hvm_funcs.nhvm_domain_relinquish_resources )
-        hvm_funcs.nhvm_domain_relinquish_resources(d);
+        alternative_vcall(hvm_funcs.nhvm_domain_relinquish_resources, d);
 
     viridian_domain_deinit(d);
 
@@ -870,7 +870,7 @@ static int hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
         return 0;
 
     /* Architecture-specific vmcs/vmcb bits */
-    hvm_funcs.save_cpu_ctxt(v, &ctxt);
+    alternative_vcall(hvm_funcs.save_cpu_ctxt, v, &ctxt);
 
     hvm_get_segment_register(v, x86_seg_idtr, &seg);
     ctxt.idtr_limit = seg.limit;
@@ -1093,14 +1093,14 @@ static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
 #undef UNFOLD_ARBYTES
 
     /* Architecture-specific vmcs/vmcb bits */
-    if ( hvm_funcs.load_cpu_ctxt(v, &ctxt) < 0 )
+    if ( alternative_call(hvm_funcs.load_cpu_ctxt, v, &ctxt) < 0 )
         return -EINVAL;
 
     v->arch.hvm.guest_cr[2] = ctxt.cr2;
     hvm_update_guest_cr(v, 2);
 
     if ( hvm_funcs.tsc_scaling.setup )
-        hvm_funcs.tsc_scaling.setup(v);
+        alternative_vcall(hvm_funcs.tsc_scaling.setup, v);
 
     v->arch.msrs->tsc_aux = ctxt.msr_tsc_aux;
 
@@ -1563,7 +1563,8 @@ int hvm_vcpu_initialise(struct vcpu *v)
     if ( rc != 0 ) /* teardown: vlapic_destroy */
         goto fail2;
 
-    if ( (rc = hvm_funcs.vcpu_initialise(v)) != 0 ) /* teardown: hvm_funcs.vcpu_destroy */
+    rc = alternative_call(hvm_funcs.vcpu_initialise, v);
+    if ( rc != 0 ) /* teardown: hvm_funcs.vcpu_destroy */
         goto fail3;
 
     softirq_tasklet_init(&v->arch.hvm.assert_evtchn_irq_tasklet,
@@ -1611,7 +1612,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
     free_compat_arg_xlat(v);
  fail4:
     hvmemul_cache_destroy(v);
-    hvm_funcs.vcpu_destroy(v);
+    alternative_vcall(hvm_funcs.vcpu_destroy, v);
  fail3:
     vlapic_destroy(v);
  fail2:
@@ -1635,7 +1636,7 @@ void hvm_vcpu_destroy(struct vcpu *v)
     free_compat_arg_xlat(v);
 
     tasklet_kill(&v->arch.hvm.assert_evtchn_irq_tasklet);
-    hvm_funcs.vcpu_destroy(v);
+    alternative_vcall(hvm_funcs.vcpu_destroy, v);
 
     vlapic_destroy(v);
 
@@ -3874,7 +3875,7 @@ enum hvm_intblk hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack)
          !(guest_cpu_user_regs()->eflags & X86_EFLAGS_IF) )
         return hvm_intblk_rflags_ie;
 
-    intr_shadow = hvm_funcs.get_interrupt_shadow(v);
+    intr_shadow = alternative_call(hvm_funcs.get_interrupt_shadow, v);
 
     if ( intr_shadow & (HVM_INTR_SHADOW_STI|HVM_INTR_SHADOW_MOV_SS) )
         return hvm_intblk_shadow;
@@ -3990,7 +3991,7 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
     hvm_set_segment_register(v, x86_seg_idtr, &reg);
 
     if ( hvm_funcs.tsc_scaling.setup )
-        hvm_funcs.tsc_scaling.setup(v);
+        alternative_vcall(hvm_funcs.tsc_scaling.setup, v);
 
     /* Sync AP's TSC with BSP's. */
     v->arch.hvm.cache_tsc_offset =
diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
index bd1101987d..5021da667a 100644
--- a/xen/arch/x86/hvm/nestedhvm.c
+++ b/xen/arch/x86/hvm/nestedhvm.c
@@ -54,8 +54,7 @@ nestedhvm_vcpu_reset(struct vcpu *v)
 
     hvm_asid_flush_vcpu_asid(&nv->nv_n2asid);
 
-    if ( hvm_funcs.nhvm_vcpu_reset )
-        hvm_funcs.nhvm_vcpu_reset(v);
+    alternative_vcall(hvm_funcs.nhvm_vcpu_reset, v);
 
     /* vcpu is in host mode */
     nestedhvm_vcpu_exit_guestmode(v);
@@ -64,14 +63,14 @@ nestedhvm_vcpu_reset(struct vcpu *v)
 int
 nestedhvm_vcpu_initialise(struct vcpu *v)
 {
-    int rc = -EOPNOTSUPP;
+    int rc;
 
     if ( !shadow_io_bitmap[0] )
         return -ENOMEM;
 
-    if ( !hvm_funcs.nhvm_vcpu_initialise ||
-         ((rc = hvm_funcs.nhvm_vcpu_initialise(v)) != 0) )
-         return rc;
+    rc = alternative_call(hvm_funcs.nhvm_vcpu_initialise, v);
+    if ( rc )
+        return rc;
 
     nestedhvm_vcpu_reset(v);
     return 0;
@@ -80,8 +79,7 @@ nestedhvm_vcpu_initialise(struct vcpu *v)
 void
 nestedhvm_vcpu_destroy(struct vcpu *v)
 {
-    if ( hvm_funcs.nhvm_vcpu_destroy )
-        hvm_funcs.nhvm_vcpu_destroy(v);
+    alternative_vcall(hvm_funcs.nhvm_vcpu_destroy, v);
 }
 
 static void
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index cd9e73e266..b26302d9e7 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -561,13 +561,12 @@ static inline void hvm_invlpg(struct vcpu *v, unsigned long linear)
 
 static inline int hvm_cpu_up(void)
 {
-    return (hvm_funcs.cpu_up ? hvm_funcs.cpu_up() : 0);
+    return alternative_call(hvm_funcs.cpu_up);
 }
 
 static inline void hvm_cpu_down(void)
 {
-    if ( hvm_funcs.cpu_down )
-        hvm_funcs.cpu_down();
+    alternative_vcall(hvm_funcs.cpu_down);
 }
 
 static inline unsigned int hvm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
@@ -601,7 +600,7 @@ static inline void hvm_invalidate_regs_fields(struct cpu_user_regs *regs)
 static inline int nhvm_vcpu_vmexit_event(
     struct vcpu *v, const struct x86_event *event)
 {
-    return hvm_funcs.nhvm_vcpu_vmexit_event(v, event);
+    return alternative_call(hvm_funcs.nhvm_vcpu_vmexit_event, v, event);
 }
 
 /* returns l1 guest's cr3 that points to the page table used to
@@ -609,45 +608,46 @@ static inline int nhvm_vcpu_vmexit_event(
  */
 static inline uint64_t nhvm_vcpu_p2m_base(struct vcpu *v)
 {
-    return hvm_funcs.nhvm_vcpu_p2m_base(v);
+    return alternative_call(hvm_funcs.nhvm_vcpu_p2m_base, v);
 }
 
 /* returns true, when l1 guest intercepts the specified trap */
 static inline bool_t nhvm_vmcx_guest_intercepts_event(
     struct vcpu *v, unsigned int vector, int errcode)
 {
-    return hvm_funcs.nhvm_vmcx_guest_intercepts_event(v, vector, errcode);
+    return alternative_call(hvm_funcs.nhvm_vmcx_guest_intercepts_event, v,
+                            vector, errcode);
 }
 
 /* returns true when l1 guest wants to use hap to run l2 guest */
 static inline bool_t nhvm_vmcx_hap_enabled(struct vcpu *v)
 {
-    return hvm_funcs.nhvm_vmcx_hap_enabled(v);
+    return alternative_call(hvm_funcs.nhvm_vmcx_hap_enabled, v);
 }
 
 /* interrupt */
 static inline enum hvm_intblk nhvm_interrupt_blocked(struct vcpu *v)
 {
-    return hvm_funcs.nhvm_intr_blocked(v);
+    return alternative_call(hvm_funcs.nhvm_intr_blocked, v);
 }
 
 static inline int nhvm_hap_walk_L1_p2m(
     struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
     uint8_t *p2m_acc, struct npfec npfec)
 {
-    return hvm_funcs.nhvm_hap_walk_L1_p2m(
+    return alternative_call(hvm_funcs.nhvm_hap_walk_L1_p2m,
         v, L2_gpa, L1_gpa, page_order, p2m_acc, npfec);
 }
 
 static inline void hvm_enable_msr_interception(struct domain *d, uint32_t msr)
 {
-    hvm_funcs.enable_msr_interception(d, msr);
+    alternative_vcall(hvm_funcs.enable_msr_interception, d, msr);
 }
 
 static inline bool_t hvm_is_singlestep_supported(void)
 {
     return (hvm_funcs.is_singlestep_supported &&
-            hvm_funcs.is_singlestep_supported());
+            alternative_call(hvm_funcs.is_singlestep_supported));
 }
 
 static inline bool hvm_hap_supported(void)
@@ -665,14 +665,14 @@ static inline bool hvm_altp2m_supported(void)
 static inline void altp2m_vcpu_update_p2m(struct vcpu *v)
 {
     if ( hvm_funcs.altp2m_vcpu_update_p2m )
-        hvm_funcs.altp2m_vcpu_update_p2m(v);
+        alternative_vcall(hvm_funcs.altp2m_vcpu_update_p2m, v);
 }
 
 /* updates VMCS fields related to VMFUNC and #VE */
 static inline void altp2m_vcpu_update_vmfunc_ve(struct vcpu *v)
 {
     if ( hvm_funcs.altp2m_vcpu_update_vmfunc_ve )
-        hvm_funcs.altp2m_vcpu_update_vmfunc_ve(v);
+        alternative_vcall(hvm_funcs.altp2m_vcpu_update_vmfunc_ve, v);
 }
 
 /* emulates #VE */
@@ -680,7 +680,7 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
 {
     if ( hvm_funcs.altp2m_vcpu_emulate_ve )
     {
-        hvm_funcs.altp2m_vcpu_emulate_ve(v);
+        alternative_vcall(hvm_funcs.altp2m_vcpu_emulate_ve, v);
         return true;
     }
     return false;
@@ -689,7 +689,7 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
 static inline int hvm_vmtrace_control(struct vcpu *v, bool enable, bool reset)
 {
     if ( hvm_funcs.vmtrace_control )
-        return hvm_funcs.vmtrace_control(v, enable, reset);
+        return alternative_call(hvm_funcs.vmtrace_control, v, enable, reset);
 
     return -EOPNOTSUPP;
 }
@@ -698,7 +698,7 @@ static inline int hvm_vmtrace_control(struct vcpu *v, bool enable, bool reset)
 static inline int hvm_vmtrace_output_position(struct vcpu *v, uint64_t *pos)
 {
     if ( hvm_funcs.vmtrace_output_position )
-        return hvm_funcs.vmtrace_output_position(v, pos);
+        return alternative_call(hvm_funcs.vmtrace_output_position, v, pos);
 
     return -EOPNOTSUPP;
 }
@@ -707,7 +707,7 @@ static inline int hvm_vmtrace_set_option(
     struct vcpu *v, uint64_t key, uint64_t value)
 {
     if ( hvm_funcs.vmtrace_set_option )
-        return hvm_funcs.vmtrace_set_option(v, key, value);
+        return alternative_call(hvm_funcs.vmtrace_set_option, v, key, value);
 
     return -EOPNOTSUPP;
 }
@@ -716,7 +716,7 @@ static inline int hvm_vmtrace_get_option(
     struct vcpu *v, uint64_t key, uint64_t *value)
 {
     if ( hvm_funcs.vmtrace_get_option )
-        return hvm_funcs.vmtrace_get_option(v, key, value);
+        return alternative_call(hvm_funcs.vmtrace_get_option, v, key, value);
 
     return -EOPNOTSUPP;
 }
@@ -724,7 +724,7 @@ static inline int hvm_vmtrace_get_option(
 static inline int hvm_vmtrace_reset(struct vcpu *v)
 {
     if ( hvm_funcs.vmtrace_reset )
-        return hvm_funcs.vmtrace_reset(v);
+        return alternative_call(hvm_funcs.vmtrace_reset, v);
 
     return -EOPNOTSUPP;
 }
diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
index 40d2673707..3079726a8b 100644
--- a/xen/arch/x86/monitor.c
+++ b/xen/arch/x86/monitor.c
@@ -270,7 +270,8 @@ int arch_monitor_domctl_event(struct domain *d,
         ad->monitor.descriptor_access_enabled = requested_status;
 
         for_each_vcpu ( d, v )
-            hvm_funcs.set_descriptor_access_exiting(v, requested_status);
+            alternative_vcall(hvm_funcs.set_descriptor_access_exiting, v,
+                              requested_status);
 
         domain_unpause(d);
         break;
diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index ffcc64c40b..7027c08a92 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -204,7 +204,7 @@ void vm_event_fill_regs(vm_event_request_t *req)
     ASSERT(is_hvm_vcpu(curr));
 
     /* Architecture-specific vmcs/vmcb bits */
-    hvm_funcs.save_cpu_ctxt(curr, &ctxt);
+    alternative_vcall(hvm_funcs.save_cpu_ctxt, curr, &ctxt);
 
     req->data.regs.x86.rax = regs->rax;
     req->data.regs.x86.rcx = regs->rcx;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 02:55:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 02:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258706.445866 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA187-0002Pj-PC; Wed, 19 Jan 2022 02:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258706.445866; Wed, 19 Jan 2022 02:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA187-0002Pb-MK; Wed, 19 Jan 2022 02:55:23 +0000
Received: by outflank-mailman (input) for mailman id 258706;
 Wed, 19 Jan 2022 02: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 1nA185-0002PD-Ve
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA185-0001Lv-Uw
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA185-0008Me-U6
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DpRyQjw/7BOrYVGo1tJUobu10KFLdu4Fy+1Vsc92mJA=; b=pcPNxQ+zRQklWZnqMlfk+M136v
	tBAT50gZ07cke7y+nGKANplIUx+DkGl5BjrtN0kJ7VsyJehXFsstb0J0BMUaon5A5MZ+Bf00yvdJ4
	KJXoLzhX2ih0hUCXBrwJkMJ8aeU+dyjp3hycudhbkTFO3QHlRcdob70YfqRsZMdE07sM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: update my email address
Message-Id: <E1nA185-0008Me-U6@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 02:55:21 +0000

commit 5fdd3a45bd0181a3748f39b84357a6cf0d6e0845
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Mon Jan 17 17:28:36 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 17 17:28:36 2022 +0100

    MAINTAINERS: update my email address
    
    I am no longer an employee at AIS. Use my personal email address
    instead.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@gmail.com>
    Reviewed-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4a2884dfa7..feea7d14cf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -302,7 +302,7 @@ F:	tools/debugger/gdbsx/
 
 GOLANG BINDINGS
 M:	George Dunlap <george.dunlap@citrix.com>
-M:     Nick Rosbrook <rosbrookn@ainfosec.com>
+M:	Nick Rosbrook <rosbrookn@gmail.com>
 S:	Maintained
 F:	tools/golang
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 02:55:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 02:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258707.445871 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA18H-0002SU-R9; Wed, 19 Jan 2022 02:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258707.445871; Wed, 19 Jan 2022 02:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA18H-0002SL-Nn; Wed, 19 Jan 2022 02:55:33 +0000
Received: by outflank-mailman (input) for mailman id 258707;
 Wed, 19 Jan 2022 02: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 1nA18G-0002S9-2T
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02: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 1nA18G-0001M6-1h
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA18G-0008N9-0j
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02: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=/uGZ9LjD0sk1R1P/QNvCS6ymr5c6BHUrryEa1N1MNBk=; b=Ogz1WgoYrT9lsOO9Kx6P7i5/MJ
	AzWj28BBnt2jtzY5w4qibKUWHtTSwzme0nsECJjcFYcHBpyOkV7Mc9F7Xp3vpZvYC4rBfGfbyCEBJ
	+qi83AQCRobbDaibkLDk8JeJpsGLeJTA4IRh3xd2ZF2ngnoDiEkfzVehG1HjNEJC3J1A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: email address update in TXT section
Message-Id: <E1nA18G-0008N9-0j@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 02:55:32 +0000

commit 369a01ce84f3dbbfdcb79fc178c83bdcf16b2c43
Author:     Lukasz Hawrylko <lukasz@hawrylko.pl>
AuthorDate: Mon Jan 17 17:29:00 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 17 17:29:00 2022 +0100

    MAINTAINERS: email address update in TXT section
    
    As I am not working for Intel anymore, I would like to update my email address
    to my private one.
    
    Signed-off-by: Lukasz Hawrylko <lukasz@hawrylko.pl>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index feea7d14cf..64934cc070 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -316,7 +316,7 @@ F:	xen/common/hypfs.c
 F:	xen/include/xen/hypfs.h
 
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
-R:	Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
+R:	Lukasz Hawrylko <lukasz@hawrylko.pl>
 R:	Daniel P. Smith <dpsmith@apertussolutions.com>
 S:	Odd Fixes
 F:	xen/arch/x86/include/asm/tboot.h
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 02:55:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 02:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258708.445874 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA18R-0002VM-SS; Wed, 19 Jan 2022 02:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258708.445874; Wed, 19 Jan 2022 02:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nA18R-0002VE-PQ; Wed, 19 Jan 2022 02:55:43 +0000
Received: by outflank-mailman (input) for mailman id 258708;
 Wed, 19 Jan 2022 02: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 1nA18Q-0002V1-7I
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02: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 1nA18Q-0001MZ-4v
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nA18Q-0008Ng-3v
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 02: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=wVgM12S+0csCuYI67FXV6y8Par/Dzrj7pyJIV8NQ3Eo=; b=piuU9OLhWR5bJ+RIeSa+u4Krvs
	TuGMOKosxqHpFWBfAKYODPOo59v2KicMWmXc82y/4zmnNgssNWWXSq1x6d0wQoDkSNtTpypRBtdHU
	s4gwaLVbIYUHHzjISsLN8uNlD4w84nC92KMA4TaJybiWIsu9dPdAaMBJNT1tv27tNyi4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/APIC: mark wait_tick_pvh() __init
Message-Id: <E1nA18Q-0008Ng-3v@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 02:55:42 +0000

commit ad47bc9a9742e73bea97ae791f66adf1caecaa63
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 17 17:29:42 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 17 17:29:42 2022 +0100

    x86/APIC: mark wait_tick_pvh() __init
    
    It should have been that way right from its introduction by 02e0de011555
    ("x86: APIC timer calibration when running as a guest").
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/apic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 55c103aaff..d7d5c15155 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1190,7 +1190,7 @@ static void __init check_deadline_errata(void)
            "please update microcode to version %#x (or later)\n", rev);
 }
 
-static void wait_tick_pvh(void)
+static void __init wait_tick_pvh(void)
 {
     u64 lapse_ns = 1000000000ULL / HZ;
     s_time_t start, curr_time;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:55:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258824.446185 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAUU-0006vN-5m; Wed, 19 Jan 2022 12:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258824.446185; Wed, 19 Jan 2022 12:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAUU-0006vF-2n; Wed, 19 Jan 2022 12:55:06 +0000
Received: by outflank-mailman (input) for mailman id 258824;
 Wed, 19 Jan 2022 12:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUS-0006v9-Lc
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUS-0004Sh-JA
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUS-0000R3-HV
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pOi319/g2mtWPgaJhuKABswhePMcTGsyDIzoGzbAOXY=; b=BgFmbTidoJgZw5gtkwAD4tX4Wb
	wJMR8OTMhBs83xgwxHIU9NEzCqdFPPmzqKUf0UxyCR/2E790ie975DdjS8pQHV5YRXQjr+TDIebp3
	Y5F/+44VeXmkUkE0V+QcwvJCKXV2tVosMroxbE8fHQIYEYEwHVln790pnpf4GrlWIX58=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mwait-idle: mention assumption that WBINVD is not needed
Message-Id: <E1nAAUS-0000R3-HV@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:55:04 +0000

commit 07d134e1745b696e63044ffb43d2bb60899e57d6
Author:     Alexander Monakov <amonakov@ispras.ru>
AuthorDate: Wed Jan 19 13:44:31 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:44:31 2022 +0100

    x86/mwait-idle: mention assumption that WBINVD is not needed
    
    Intel SDM does not explicitly say that entering a C-state via MWAIT will
    implicitly flush CPU caches as appropriate for that C-state. However,
    documentation for individual Intel CPU generations does mention this
    behavior.
    
    Since intel_idle binds to any Intel CPU with MWAIT, list this assumption
    of MWAIT behavior.
    
    In passing, reword opening comment to make it clear that the driver can
    load on any old and future Intel CPU with MWAIT.
    
    Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: 8bb2e2a887afdf8a39e68fa0dccf82a168aae655]
    
    Dropped "reword opending comment" part - this doesn't apply to our code:
    First thing mwait_idle_probe() does is call x86_match_cpu(); we do not
    have a 2nd such call looking for just MWAIT (in order to the use _CST
    data directly, which we can't get our hands at _CST at this point yet).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index d1739f6fc3..5c9dc0405f 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -31,6 +31,10 @@
  *
  * Chipset BM_STS (bus master status) bit is a NOP
  *	for preventing entry into deep C-states
+ *
+ * CPU will flush caches as needed when entering a C-state via MWAIT
+ *	(in contrast to entering ACPI C3, in which case the WBINVD
+ *	instruction needs to be executed to flush the caches)
  */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258825.446190 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAUe-0006xD-71; Wed, 19 Jan 2022 12:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258825.446190; Wed, 19 Jan 2022 12:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAUe-0006x5-4B; Wed, 19 Jan 2022 12:55:16 +0000
Received: by outflank-mailman (input) for mailman id 258825;
 Wed, 19 Jan 2022 12:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUc-0006wn-NH
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUc-0004Sv-MU
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUc-0000Rd-Ld
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ltRojAAy6pY4mlzFik/rtIx0uyVievzkLgphkQ4d4uw=; b=V2Id9UZLzgCla0wVsFSFQa5+5B
	PfClvY48wckl42W9QDlIx7MKzPz4tqog3t+aCqI3xc29f/QEHd3PLIg65SIgjoFEz649joPpgfOLs
	B6TEIGAmlZtuexiDcXhvyefhCo4dxEd9nwlsg3wc+dXaQcj0ZyNYWSnSPPhiwZW9qZVs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mwait-idle: update ICX C6 data
Message-Id: <E1nAAUc-0000Rd-Ld@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:55:14 +0000

commit b07050e1e8f749720485c6c7e75ea46add32c20a
Author:     Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
AuthorDate: Wed Jan 19 13:45:11 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:45:11 2022 +0100

    x86/mwait-idle: update ICX C6 data
    
    Change IceLake Xeon C6 latency from 128 us to 170 us. The latency
    was measured with the "wult" tool and corresponds to the 99.99th
    percentile when measuring with the "nic" method. Note, the 128 us
    figure correspond to the median latency, but in intel_idle we use
    the "worst case" latency figure instead.
    
    C6 target residency was increased from 384 us to 600 us, which may
    result in less C6 residency in some workloads. This value was tested
    and compared to values 384, and 1000. Value 600 is a reasonable
    tradeoff between power and performance.
    
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Acked-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: d484b8bfc6fa71a088e4ac85d9ce11aa0385867e]
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 5c9dc0405f..15c4996581 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -574,8 +574,8 @@ static const struct cpuidle_state icx_cstates[] = {
        {
                .name = "C6-ICX",
                .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
-               .exit_latency = 128,
-               .target_residency = 384,
+               .exit_latency = 170,
+               .target_residency = 600,
        },
        {}
 };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258826.446194 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAUo-000710-8e; Wed, 19 Jan 2022 12:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258826.446194; Wed, 19 Jan 2022 12:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAUo-00070r-5W; Wed, 19 Jan 2022 12:55:26 +0000
Received: by outflank-mailman (input) for mailman id 258826;
 Wed, 19 Jan 2022 12:55:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUm-00070M-QQ
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUm-0004TB-Pg
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUm-0000SI-Oe
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HhGOXXgIYXUQxaIzVJlNRz0BS/54TQT0FBGHq0yNODw=; b=IkyFlvMDs68aoB/m5QJLlMCkzo
	lJ2ZBKHCQbM+XwR0NTdfrKrxTZHLBPY8WkrI3DKJQStf7uQVSp+c0wBIcxI+uP81gINfoKSxRkIWC
	4xDvgWFVddsUgHYgtTFmv+Vu2HPEePt+ySFZ4UxLiA7TnmZvvED7vIKC3BQ4KTx7U5qI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mwait-idle: add Icelake-D support
Message-Id: <E1nAAUm-0000SI-Oe@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:55:24 +0000

commit d05c67efd94f301b48bc486246161b05acaa8df2
Author:     Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
AuthorDate: Wed Jan 19 13:46:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:46:05 2022 +0100

    x86/mwait-idle: add Icelake-D support
    
    This patch adds Icelake Xeon D support to the intel_idle driver.
    
    Since Icelake D and Icelake SP C-state characteristics the same,
    we use Icelake SP C-states table for Icelake D as well.
    
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Acked-by: Chen Yu <yu.c.chen@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: 22141d5f411895bb1b0df2a6b05f702e11e63918]
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 15c4996581..97e19246b6 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -990,6 +990,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconstrel = {
 	ICPU(0x9e, skl),
 	ICPU(0x55, skx),
 	ICPU(0x6a, icx),
+	ICPU(0x6c, icx),
 	ICPU(0x57, knl),
 	ICPU(0x85, knl),
 	ICPU(0x5c, bxt),
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:55:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258827.446198 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAUy-00073u-A0; Wed, 19 Jan 2022 12:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258827.446198; Wed, 19 Jan 2022 12:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAUy-00073m-76; Wed, 19 Jan 2022 12:55:36 +0000
Received: by outflank-mailman (input) for mailman id 258827;
 Wed, 19 Jan 2022 12:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUw-00073X-Vy
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUw-0004TM-VF
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAUw-0000TJ-UF
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=81ONnMLeQgnKXkQ6I3rPcMLr5HQ5+qDfKmfbHN+zCEo=; b=uv6cShuCyj4pA/ZyaYhIj4EhUY
	utDwEkn0xGJUCTI/PKOpCZ2x6PgmLfVVbkfgv8YMpVgFcHlRks1kGWzM7loFnhzLkcIAv0lzB2Ewj
	kX94rTGbHQF0MSDTf1btTj9pFxvujgOgEpx8IlAfDlZSwVyaanHyOD3loCUdX8NFJ0RE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] config: use more recent mini-os commit
Message-Id: <E1nAAUw-0000TJ-UF@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:55:34 +0000

commit fa52b153c51ea56eafa134d6321b6ca8a8574a88
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 19 08:28:21 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 19 09:37:55 2022 +0000

    config: use more recent mini-os commit
    
    In order to be able to use the recent Mini-OS features switch to the
    most recent commit.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 5c8c737fe4..168273e157 100644
--- a/Config.mk
+++ b/Config.mk
@@ -231,7 +231,7 @@ MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= master
-MINIOS_UPSTREAM_REVISION ?= a91161eb0f92dac4ad6d41f91117268bc23ef28d
+MINIOS_UPSTREAM_REVISION ?= 83ff43bff4bdd6879539fcb2b3d6ba5e61a64135
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:55:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258828.446202 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAV8-00076d-BN; Wed, 19 Jan 2022 12:55:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258828.446202; Wed, 19 Jan 2022 12:55: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 1nAAV8-00076V-8X; Wed, 19 Jan 2022 12:55:46 +0000
Received: by outflank-mailman (input) for mailman id 258828;
 Wed, 19 Jan 2022 12:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAV7-00076L-2p
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAV7-0004Tp-21
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAV7-0000Tu-16
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iCJfRtGxCetd0eNGQllUoCMxRZxSz5C1/xTq0MNx7So=; b=Go3SfQDOLqG6mXCCODrc60GesO
	fsVZilyYUHU8lTIr+5VzZ4dbRCAoR3W7P/KykW6JcPRYvQVCe5MtzbQZOx/r7KqZGKfauCFgJxLua
	BBOPFxv8/QoXGyd41grAITkxOXNJw2aZPjDtyKAYs4/Vum0+94cGFjtnBTrZiqwQCuaE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/evtchn: remove old mini-os callback
Message-Id: <E1nAAV7-0000Tu-16@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:55:45 +0000

commit 9375860adaf2ec9779b4925ec8c3750f27ebb88c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 19 08:28:22 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 19 09:37:58 2022 +0000

    tools/libs/evtchn: remove old mini-os callback
    
    It is possible now to delete minios_evtchn_close_fd() and the extern
    declaration of event_queue.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/evtchn/minios.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index ee3da9f8fe..30f98bc7e4 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
@@ -47,10 +47,6 @@ struct port_info {
     bool bound;
 };
 
-extern struct wait_queue_head event_queue;
-
-void minios_evtchn_close_fd(int fd);
-
 /* XXX Note: This is not threadsafe */
 static struct port_info *port_alloc(xenevtchn_handle *xce)
 {
@@ -152,13 +148,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return -1;
 }
 
-void minios_evtchn_close_fd(int fd)
-{
-    struct file *file = get_file_from_fd(fd);
-
-    evtchn_close_fd(file);
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int ret;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:55:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:55:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258829.446206 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAVI-00079U-Cs; Wed, 19 Jan 2022 12:55:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258829.446206; Wed, 19 Jan 2022 12:55:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAVI-00079M-9x; Wed, 19 Jan 2022 12:55:56 +0000
Received: by outflank-mailman (input) for mailman id 258829;
 Wed, 19 Jan 2022 12:55:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVH-000793-5f
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVH-0004Tw-4x
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVH-0000Uc-47
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cs/Fbr9+wPWphnO921hTzMesUOV2JFbisRVVqGKBQvg=; b=nvqlYaVfFPb3xzgWOV9e6OyUci
	L+X2VUHNjcfmhZdZKo+Pr80gTvbZiuhs6XD/y4yayKGSBQ9x7Z3/xiuWaKu6yTYjdNBoCETt2jBkd
	i+rjMRKUxGQ33Nq3hX/2efxX4oexBQTZVeGxqM8sgKn0LoPvLhnrrxq7UGMyNXPP55ks=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/gnttab: remove old mini-os callback
Message-Id: <E1nAAVH-0000Uc-47@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:55:55 +0000

commit ec43f0886eee614d3c6a6bef6851336368450fb2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 19 08:28:23 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 19 09:38:01 2022 +0000

    tools/libs/gnttab: remove old mini-os callback
    
    It is possible now to delete minios_gnttab_close_fd().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/gnttab/minios.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/tools/libs/gnttab/minios.c b/tools/libs/gnttab/minios.c
index f59fad3577..cac89f0ba6 100644
--- a/tools/libs/gnttab/minios.c
+++ b/tools/libs/gnttab/minios.c
@@ -33,8 +33,6 @@
 
 #include "private.h"
 
-void minios_gnttab_close_fd(int fd);
-
 static int gnttab_close_fd(struct file *file)
 {
     gntmap_fini(file->dev);
@@ -89,13 +87,6 @@ int osdep_gnttab_close(xengnttab_handle *xgt)
     return close(xgt->fd);
 }
 
-void minios_gnttab_close_fd(int fd)
-{
-    struct file *file = get_file_from_fd(fd);
-
-    gnttab_close_fd(file);
-}
-
 void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
                              uint32_t count, int flags, int prot,
                              uint32_t *domids, uint32_t *refs,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:56:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:56:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258830.446210 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAVS-0007CH-EJ; Wed, 19 Jan 2022 12:56:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258830.446210; Wed, 19 Jan 2022 12:56:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAVS-0007C9-BM; Wed, 19 Jan 2022 12:56:06 +0000
Received: by outflank-mailman (input) for mailman id 258830;
 Wed, 19 Jan 2022 12:56:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVR-0007C0-8u
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVR-0004UD-8D
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVR-0000Ve-79
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gHHFd+WEHrVWTZMgzFBNYTTbS8EsKjIAqbTdBCpMFbg=; b=7Nok2t+W5xTCjc62viZA79K/+S
	KWnu5ROgt8QSOgXGHNasDbWBS70KOHkq859bHSPkIbAZtJBOeQEMLAtoCQ6uNKxOudfLcj/be19Sl
	Ftodaj9vwOgcai3mVCGmqRrCnfRnYI2vYhvsXkqjCb4wCE3nzms3qArIpQ1vRXZdbx7w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging
Message-Id: <E1nAAVR-0000Ve-79@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:56:05 +0000

commit dc6534112574098b15db79b25a08c420679415e6
Merge: d05c67efd94f301b48bc486246161b05acaa8df2 ec43f0886eee614d3c6a6bef6851336368450fb2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jan 19 13:49:30 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:49:30 2022 +0100

    Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging

 Config.mk                  |  2 +-
 tools/libs/evtchn/minios.c | 11 -----------
 tools/libs/gnttab/minios.c |  9 ---------
 3 files changed, 1 insertion(+), 21 deletions(-)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:56:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:56:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258831.446213 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAVc-0007Er-G1; Wed, 19 Jan 2022 12:56:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258831.446213; Wed, 19 Jan 2022 12:56:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAVc-0007Ej-Cu; Wed, 19 Jan 2022 12:56:16 +0000
Received: by outflank-mailman (input) for mailman id 258831;
 Wed, 19 Jan 2022 12:56:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVb-0007Ed-C1
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVb-0004Vs-BK
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVb-0000WE-AX
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c0hooIfD0vCwyk17Vm5BLv24LEKEyJLfuR0witKLPII=; b=OgI/FYz6b65yTz0mIlnk57ZrnY
	yQlF4WKepW62ks4EHHHFj08LqZWgeg2zPQzxLjwIn670RXaURyqWkb414kcPqF9nTWQmPZUGapui8
	XVt3etxZF2vuWYWkMfepwIbMK2v4QHhpwEWV+Q6/JphC6kWELI8jptzh+u/E10hldvfs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mwait-idle: Adjust the SKX C6 parameters if PC6 is disabled
Message-Id: <E1nAAVb-0000WE-AX@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:56:15 +0000

commit d4fb2cc5c0eea6873e4ffb0eeea6ea1d6023b654
Author:     Chen Yu <yu.c.chen@intel.com>
AuthorDate: Wed Jan 19 13:50:43 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:50:43 2022 +0100

    x86/mwait-idle: Adjust the SKX C6 parameters if PC6 is disabled
    
    Because cpuidle assumes worst-case C-state parameters, PC6 parameters
    are used for describing C6, which is worst-case for requesting CC6.
    When PC6 is enabled, this is appropriate. But if PC6 is disabled
    in the BIOS, the exit latency and target residency should be adjusted
    accordingly.
    
    Exit latency:
    Previously the C6 exit latency was measured as the PC6 exit latency.
    With PC6 disabled, the C6 exit latency should be the one of CC6.
    
    Target residency:
    With PC6 disabled, the idle duration within [CC6, PC6) would make the
    idle governor choose C1E over C6. This would cause low energy-efficiency.
    We should lower the bar to request C6 when PC6 is disabled.
    
    To fill this gap, check if PC6 is disabled in the BIOS in the
    MSR_PKG_CST_CONFIG_CONTROL(0xe2) register. If so, use the CC6 exit latency
    for C6 and set target_residency to 3 times of the new exit latency. [This
    is consistent with how intel_idle driver uses _CST to calculate the
    target_residency.] As a result, the OS would be more likely to choose C6
    over C1E when PC6 is disabled, which is reasonable, because if C6 is
    enabled, it implies that the user cares about energy, so choosing C6 more
    frequently makes sense.
    
    The new CC6 exit latency of 92us was measured with wult[1] on SKX via NIC
    wakeup as the 99.99th percentile. Also CLX and CPX both have the same CPU
    model number as SkX, but their CC6 exit latencies are similar to the SKX
    one, 96us and 89us respectively, so reuse the SKX value for them.
    
    There is a concern that it might be better to use a more generic approach
    instead of optimizing every platform. However, if the required code
    complexity and different PC6 bit interpretation on different platforms
    are taken into account, tuning the code per platform seems to be an
    acceptable tradeoff.
    
    Link: https://intel.github.io/wult/ # [1]
    Suggested-by: Len Brown <len.brown@intel.com>
    Signed-off-by: Chen Yu <yu.c.chen@intel.com>
    Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: 64233338499126c5c31e07165735ab5441c7e45a]
    
    Alongside the dropping of "const" from skx_cstates[] add __read_mostly,
    and extend that to other similar non-const tables.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 39 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 97e19246b6..9e04d969d6 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -484,7 +484,7 @@ static const struct cpuidle_state bdw_cstates[] = {
 	{}
 };
 
-static struct cpuidle_state skl_cstates[] = {
+static struct cpuidle_state __read_mostly skl_cstates[] = {
 	{
 		.name = "C1-SKL",
 		.flags = MWAIT2flg(0x00),
@@ -536,7 +536,7 @@ static struct cpuidle_state skl_cstates[] = {
 	{}
 };
 
-static const struct cpuidle_state skx_cstates[] = {
+static struct cpuidle_state __read_mostly skx_cstates[] = {
 	{
 		.name = "C1-SKX",
 		.flags = MWAIT2flg(0x00),
@@ -674,7 +674,7 @@ static const struct cpuidle_state knl_cstates[] = {
 	{}
 };
 
-static struct cpuidle_state bxt_cstates[] = {
+static struct cpuidle_state __read_mostly bxt_cstates[] = {
 	{
 		.name = "C1-BXT",
 		.flags = MWAIT2flg(0x00),
@@ -1129,6 +1129,36 @@ static void __init sklh_idle_state_table_update(void)
 	skl_cstates[6].flags |= CPUIDLE_FLAG_DISABLED;	/* C9-SKL */
 }
 
+/*
+ * skx_idle_state_table_update - Adjust the Sky Lake/Cascade Lake
+ * idle states table.
+ */
+static void __init skx_idle_state_table_update(void)
+{
+	unsigned long long msr;
+
+	rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr);
+
+	/*
+	 * 000b: C0/C1 (no package C-state support)
+	 * 001b: C2
+	 * 010b: C6 (non-retention)
+	 * 011b: C6 (retention)
+	 * 111b: No Package C state limits.
+	 */
+	if ((msr & 0x7) < 2) {
+		/*
+		 * Uses the CC6 + PC0 latency and 3 times of
+		 * latency for target_residency if the PC6
+		 * is disabled in BIOS. This is consistent
+		 * with how intel_idle driver uses _CST
+		 * to set the target_residency.
+		 */
+		skx_cstates[2].exit_latency = 92;
+		skx_cstates[2].target_residency = 276;
+	}
+}
+
 /*
  * mwait_idle_state_table_update()
  *
@@ -1147,6 +1177,9 @@ static void __init mwait_idle_state_table_update(void)
 	case 0x5e: /* SKL-H */
 		sklh_idle_state_table_update();
 		break;
+	case 0x55: /* SKL-X */
+		skx_idle_state_table_update();
+		break;
  	}
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 12:56:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 12:56:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258832.446218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAAVn-0007I3-JE; Wed, 19 Jan 2022 12:56:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258832.446218; Wed, 19 Jan 2022 12:56: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 1nAAVn-0007Hv-G5; Wed, 19 Jan 2022 12:56:27 +0000
Received: by outflank-mailman (input) for mailman id 258832;
 Wed, 19 Jan 2022 12:56:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVl-0007HY-FY
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVl-0004W5-Ej
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAAVl-0000Wx-Dr
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 12:56:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lwY58PEiV8w4bnoK0eehn7I3TIh776RVMkexG8YXi3Q=; b=4v6FP7TZBNrLE1O7GWLBhT5gVy
	fjv8aMyhMPF6DUk+8WqURmZWxzkQSbR/ryaT2C26EED6N2uMp4VTi4dEPvb4mt9BJjILexheKF305
	FRtFPXGNBlpqNSf4Jb9GsmPlFHb08fxbuttP0DTirq1XX80i7PJduIluAmf6RmT6q0iE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: move cpu policy related prototypes to xenguest.h
Message-Id: <E1nAAVl-0000Wx-Dr@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 12:56:25 +0000

commit 2fc98a9587704b3cdedfe3ae2a6104e7d9e251bd
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jan 19 13:51:26 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:51:26 2022 +0100

    libs/guest: move cpu policy related prototypes to xenguest.h
    
    Do this before adding any more stuff to xg_cpuid_x86.c.
    
    The placement in xenctrl.h is wrong, as they are implemented by the
    xenguest library. Note that xg_cpuid_x86.c needs to include
    xg_private.h, and in turn also fix xg_private.h to include
    xc_bitops.h. The bitops definition of BITS_PER_LONG needs to be
    changed to not be an expression, so that xxhash.h can use it in a
    preprocessor if directive.
    
    As a result also modify xen-cpuid to include xenguest.h.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/include/xenctrl.h         | 55 ----------------------------------------
 tools/include/xenguest.h        | 56 +++++++++++++++++++++++++++++++++++++++++
 tools/libs/ctrl/xc_bitops.h     |  6 ++++-
 tools/libs/guest/xg_cpuid_x86.c |  1 -
 tools/libs/guest/xg_private.h   |  1 +
 tools/misc/xen-cpuid.c          |  1 +
 6 files changed, 63 insertions(+), 57 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 07b96e6671..95bd5eca67 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2528,61 +2528,6 @@ int xc_psr_get_domain_data(xc_interface *xch, uint32_t domid,
                            uint64_t *data);
 int xc_psr_get_hw_info(xc_interface *xch, uint32_t socket,
                        xc_psr_feat_type type, xc_psr_hw_info *hw_info);
-
-typedef struct xc_cpu_policy xc_cpu_policy_t;
-
-/* Create and free a xc_cpu_policy object. */
-xc_cpu_policy_t *xc_cpu_policy_init(void);
-void xc_cpu_policy_destroy(xc_cpu_policy_t *policy);
-
-/* Retrieve a system policy, or get/set a domains policy. */
-int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
-                             xc_cpu_policy_t *policy);
-int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
-                             xc_cpu_policy_t *policy);
-int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
-                             xc_cpu_policy_t *policy);
-
-/* Manipulate a policy via architectural representations. */
-int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *policy,
-                            xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
-                            xen_msr_entry_t *msrs, uint32_t *nr_msrs);
-int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy,
-                               const xen_cpuid_leaf_t *leaves,
-                               uint32_t nr);
-int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy,
-                              const xen_msr_entry_t *msrs, uint32_t nr);
-
-/* Compatibility calculations. */
-bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host,
-                                 xc_cpu_policy_t *guest);
-
-int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
-int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
-                          uint32_t *nr_features, uint32_t *featureset);
-
-int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
-                           uint32_t *nr_msrs);
-int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
-                             uint32_t nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t nr_msrs, xen_msr_entry_t *msrs,
-                             uint32_t *err_leaf_p, uint32_t *err_subleaf_p,
-                             uint32_t *err_msr_p);
-
-uint32_t xc_get_cpu_featureset_size(void);
-
-enum xc_static_cpu_featuremask {
-    XC_FEATUREMASK_KNOWN,
-    XC_FEATUREMASK_SPECIAL,
-    XC_FEATUREMASK_PV_MAX,
-    XC_FEATUREMASK_PV_DEF,
-    XC_FEATUREMASK_HVM_SHADOW_MAX,
-    XC_FEATUREMASK_HVM_SHADOW_DEF,
-    XC_FEATUREMASK_HVM_HAP_MAX,
-    XC_FEATUREMASK_HVM_HAP_DEF,
-};
-const uint32_t *xc_get_static_cpu_featuremask(enum xc_static_cpu_featuremask);
-
 #endif
 
 int xc_livepatch_upload(xc_interface *xch,
diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h
index 61d0a82f48..e01f494b77 100644
--- a/tools/include/xenguest.h
+++ b/tools/include/xenguest.h
@@ -782,4 +782,60 @@ xen_pfn_t *xc_map_m2p(xc_interface *xch,
                       unsigned long max_mfn,
                       int prot,
                       unsigned long *mfn0);
+
+#if defined(__i386__) || defined(__x86_64__)
+typedef struct xc_cpu_policy xc_cpu_policy_t;
+
+/* Create and free a xc_cpu_policy object. */
+xc_cpu_policy_t *xc_cpu_policy_init(void);
+void xc_cpu_policy_destroy(xc_cpu_policy_t *policy);
+
+/* Retrieve a system policy, or get/set a domains policy. */
+int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
+                             xc_cpu_policy_t *policy);
+int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
+                             xc_cpu_policy_t *policy);
+int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
+                             xc_cpu_policy_t *policy);
+
+/* Manipulate a policy via architectural representations. */
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *policy,
+                            xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
+                            xen_msr_entry_t *msrs, uint32_t *nr_msrs);
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy,
+                               const xen_cpuid_leaf_t *leaves,
+                               uint32_t nr);
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy,
+                              const xen_msr_entry_t *msrs, uint32_t nr);
+
+/* Compatibility calculations. */
+bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host,
+                                 xc_cpu_policy_t *guest);
+
+int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
+int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
+                          uint32_t *nr_features, uint32_t *featureset);
+
+int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
+                           uint32_t *nr_msrs);
+int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
+                             uint32_t nr_leaves, xen_cpuid_leaf_t *leaves,
+                             uint32_t nr_msrs, xen_msr_entry_t *msrs,
+                             uint32_t *err_leaf_p, uint32_t *err_subleaf_p,
+                             uint32_t *err_msr_p);
+
+uint32_t xc_get_cpu_featureset_size(void);
+
+enum xc_static_cpu_featuremask {
+    XC_FEATUREMASK_KNOWN,
+    XC_FEATUREMASK_SPECIAL,
+    XC_FEATUREMASK_PV_MAX,
+    XC_FEATUREMASK_PV_DEF,
+    XC_FEATUREMASK_HVM_SHADOW_MAX,
+    XC_FEATUREMASK_HVM_SHADOW_DEF,
+    XC_FEATUREMASK_HVM_HAP_MAX,
+    XC_FEATUREMASK_HVM_HAP_DEF,
+};
+const uint32_t *xc_get_static_cpu_featuremask(enum xc_static_cpu_featuremask);
+#endif /* __i386__ || __x86_64__ */
 #endif /* XENGUEST_H */
diff --git a/tools/libs/ctrl/xc_bitops.h b/tools/libs/ctrl/xc_bitops.h
index f0bac4a071..4a776dc3a5 100644
--- a/tools/libs/ctrl/xc_bitops.h
+++ b/tools/libs/ctrl/xc_bitops.h
@@ -6,7 +6,11 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define BITS_PER_LONG (sizeof(unsigned long) * 8)
+#ifdef __LP64__
+#define BITS_PER_LONG 64
+#else
+#define BITS_PER_LONG 32
+#endif
 
 #define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
 #define BITMAP_SHIFT(_nr) ((_nr) % 8)
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 198892ebdf..b9e827ce7e 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -23,7 +23,6 @@
 #include <stdbool.h>
 #include <limits.h>
 #include "xg_private.h"
-#include "xc_bitops.h"
 #include <xen/hvm/params.h>
 #include <xen-tools/libs.h>
 
diff --git a/tools/libs/guest/xg_private.h b/tools/libs/guest/xg_private.h
index 28441ee13f..09e24f1227 100644
--- a/tools/libs/guest/xg_private.h
+++ b/tools/libs/guest/xg_private.h
@@ -27,6 +27,7 @@
 #include <sys/stat.h>
 
 #include "xc_private.h"
+#include "xc_bitops.h"
 #include "xenguest.h"
 
 #include <xen/memory.h>
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index fb36cac07b..a3003245f1 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -8,6 +8,7 @@
 #include <inttypes.h>
 
 #include <xenctrl.h>
+#include <xenguest.h>
 
 #include <xen-tools/libs.h>
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 14:44:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 14:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258870.446325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nACBv-00060i-3y; Wed, 19 Jan 2022 14:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258870.446325; Wed, 19 Jan 2022 14: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 1nACBv-00060Y-0r; Wed, 19 Jan 2022 14:44:03 +0000
Received: by outflank-mailman (input) for mailman id 258870;
 Wed, 19 Jan 2022 14: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 1nACBu-00060S-GP
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14: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 1nACBu-0006SF-Ef
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nACBu-0000V6-DT
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14: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=Su1TgH943mF5J98nyqXEDEbOhyek0Iin38lgb688ROs=; b=2W1orzD3l9hkUDqt/JumrG+6kJ
	Oj3P8r5X6SUb5mRi3dIRmfXW/LAng4SGYRByZuN6YLHceC9RKvE2cBNc/YkIsCbuvLwDtOIYmxQPV
	SMiGbuX/EY0di0e0BqV/QSTvUGAxsyy2EcrcfaQ43E8o7wt9jQUJZem+S24xcBbkGrRo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] config: use more recent mini-os commit
Message-Id: <E1nACBu-0000V6-DT@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 14:44:02 +0000

commit aa61568ac6f56d53012dc44edc9aedd34962f66d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Jan 18 15:21:02 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 14:58:28 2022 +0000

    config: use more recent mini-os commit
    
    In order to be able to use the recent Mini-OS features switch to the
    most recent commit.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 1c1998a5a8..5c8c737fe4 100644
--- a/Config.mk
+++ b/Config.mk
@@ -231,7 +231,7 @@ MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= master
-MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9
+MINIOS_UPSTREAM_REVISION ?= a91161eb0f92dac4ad6d41f91117268bc23ef28d
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 14:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 14:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258871.446329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nACC5-00062M-5O; Wed, 19 Jan 2022 14:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258871.446329; Wed, 19 Jan 2022 14: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 1nACC5-00062E-2J; Wed, 19 Jan 2022 14:44:13 +0000
Received: by outflank-mailman (input) for mailman id 258871;
 Wed, 19 Jan 2022 14: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 1nACC4-000626-Ib
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14: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 1nACC4-0006SJ-Hn
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nACC4-0000WP-Gu
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14: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=D9t9WyBODzmja9P7B8abnnV0cZeH0J8J58Ic3K38Kss=; b=llftV3QE9lu/hx4515eCejeInV
	IPVj+o0QzJ7dFjSAP+Ye7RazXpHFq6qSV9NUSIG4opTUX5Vbbm+biclek/31qGk1SA00est018zR7
	6Ssbsv93XjS+qiIVmzydeUsXb62EJkotV5otm921HZvch8L2Og/tf07kpwCpF+M/lko4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/evtchn: decouple more from mini-os
Message-Id: <E1nACC4-0000WP-Gu@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 14:44:12 +0000

commit 93753cecc8830c22ad522ccb29724ef3a5decdc4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:23:44 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 14:58:28 2022 +0000

    tools/libs/evtchn: decouple more from mini-os
    
    Mini-OS and libevtchn are using implementation details of each other.
    Change that by letting libevtchn use the new alloc_file_type() and
    get_file_from_fd() function and the generic dev pointer of struct file
    from Mini-OS.
    
    By using private struct declarations Mini-OS will be able to drop the
    libevtchn specific definitions of struct evtchn_port_info and
    evtchn_port_list in future. While at it use bool for "pending" and
    "bound".
    
    Switch to use xce as function parameter instead of fd where possible.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/evtchn/minios.c | 143 ++++++++++++++++++++++++++++++---------------
 1 file changed, 96 insertions(+), 47 deletions(-)

diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index 8f84048b11..ee3da9f8fe 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
@@ -38,29 +38,40 @@
 
 #include "private.h"
 
-extern void minios_evtchn_close_fd(int fd);
+LIST_HEAD(port_list, port_info);
+
+struct port_info {
+    LIST_ENTRY(port_info) list;
+    evtchn_port_t port;
+    bool pending;
+    bool bound;
+};
 
 extern struct wait_queue_head event_queue;
 
+void minios_evtchn_close_fd(int fd);
+
 /* XXX Note: This is not threadsafe */
-static struct evtchn_port_info *port_alloc(int fd)
+static struct port_info *port_alloc(xenevtchn_handle *xce)
 {
-    struct evtchn_port_info *port_info;
+    struct port_info *port_info;
+    struct file *file = get_file_from_fd(xce->fd);
+    struct port_list *port_list = file->dev;
 
-    port_info = malloc(sizeof(struct evtchn_port_info));
+    port_info = malloc(sizeof(struct port_info));
     if ( port_info == NULL )
         return NULL;
 
-    port_info->pending = 0;
+    port_info->pending = false;
     port_info->port = -1;
-    port_info->bound = 0;
+    port_info->bound = false;
 
-    LIST_INSERT_HEAD(&files[fd].evtchn.ports, port_info, list);
+    LIST_INSERT_HEAD(port_list, port_info, list);
 
     return port_info;
 }
 
-static void port_dealloc(struct evtchn_port_info *port_info)
+static void port_dealloc(struct port_info *port_info)
 {
     if ( port_info->bound )
         unbind_evtchn(port_info->port);
@@ -69,18 +80,57 @@ static void port_dealloc(struct evtchn_port_info *port_info)
     free(port_info);
 }
 
+static int evtchn_close_fd(struct file *file)
+{
+    struct port_info *port_info, *tmp;
+    struct port_list *port_list = file->dev;
+
+    LIST_FOREACH_SAFE(port_info, port_list, list, tmp)
+        port_dealloc(port_info);
+    free(port_list);
+
+    return 0;
+}
+
+static const struct file_ops evtchn_ops = {
+    .name = "evtchn",
+    .close = evtchn_close_fd,
+    .select_rd = select_read_flag,
+};
+
+static unsigned int ftype_evtchn;
+
+__attribute__((constructor))
+static void evtchn_initialize(void)
+{
+    ftype_evtchn = alloc_file_type(&evtchn_ops);
+}
+
 /*
  * XENEVTCHN_NO_CLOEXEC is being ignored, as there is no exec() call supported
  * in Mini-OS.
  */
 int osdep_evtchn_open(xenevtchn_handle *xce, unsigned int flags)
 {
-    int fd = alloc_fd(FTYPE_EVTCHN);
+    int fd;
+    struct file *file;
+    struct port_list *list;
 
-    if ( fd == -1 )
+    list = malloc(sizeof(*list));
+    if ( !list )
         return -1;
 
-    LIST_INIT(&files[fd].evtchn.ports);
+    fd = alloc_fd(ftype_evtchn);
+    file = get_file_from_fd(fd);
+
+    if ( !file )
+    {
+        free(list);
+        return -1;
+    }
+
+    file->dev = list;
+    LIST_INIT(list);
     xce->fd = fd;
     printf("evtchn_open() -> %d\n", fd);
 
@@ -104,12 +154,9 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
 
 void minios_evtchn_close_fd(int fd)
 {
-    struct evtchn_port_info *port_info, *tmp;
+    struct file *file = get_file_from_fd(fd);
 
-    LIST_FOREACH_SAFE(port_info, &files[fd].evtchn.ports, list, tmp)
-        port_dealloc(port_info);
-
-    files[fd].type = FTYPE_NONE;
+    evtchn_close_fd(file);
 }
 
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
@@ -129,42 +176,43 @@ int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 
 static void evtchn_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
-    int fd = (int)(intptr_t)data;
-    struct evtchn_port_info *port_info;
+    xenevtchn_handle *xce = data;
+    struct file *file = get_file_from_fd(xce->fd);
+    struct port_info *port_info;
+    struct port_list *port_list;
 
-    assert(files[fd].type == FTYPE_EVTCHN);
+    assert(file);
+    port_list = file->dev;
     mask_evtchn(port);
-    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list)
+    LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port == port )
             goto found;
     }
 
-    printk("Unknown port for handle %d\n", fd);
+    printk("Unknown port %d for handle %d\n", port, xce->fd);
     return;
 
  found:
-    port_info->pending = 1;
-    files[fd].read = 1;
+    port_info->pending = true;
+    file->read = true;
     wake_up(&event_queue);
 }
 
 xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce,
                                                       uint32_t domid)
 {
-    int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct port_info *port_info;
     int ret;
     evtchn_port_t port;
 
     assert(get_current() == main_thread);
-    port_info = port_alloc(fd);
+    port_info = port_alloc(xce);
     if ( port_info == NULL )
         return -1;
 
     printf("xenevtchn_bind_unbound_port(%d)", domid);
-    ret = evtchn_alloc_unbound(domid, evtchn_handler,
-                               (void *)(intptr_t)fd, &port);
+    ret = evtchn_alloc_unbound(domid, evtchn_handler, xce, &port);
     printf(" = %d\n", ret);
 
     if ( ret < 0 )
@@ -174,7 +222,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_unbound_port(xenevtchn_handle *xce,
         return -1;
     }
 
-    port_info->bound = 1;
+    port_info->bound = true;
     port_info->port = port;
     unmask_evtchn(port);
 
@@ -185,19 +233,18 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
                                                      uint32_t domid,
                                                      evtchn_port_t remote_port)
 {
-    int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct port_info *port_info;
     evtchn_port_t local_port;
     int ret;
 
     assert(get_current() == main_thread);
-    port_info = port_alloc(fd);
+    port_info = port_alloc(xce);
     if ( port_info == NULL )
         return -1;
 
     printf("xenevtchn_bind_interdomain(%d, %"PRId32")", domid, remote_port);
     ret = evtchn_bind_interdomain(domid, remote_port, evtchn_handler,
-                                  (void *)(intptr_t)fd, &local_port);
+                                  xce, &local_port);
     printf(" = %d\n", ret);
 
     if ( ret < 0 )
@@ -207,7 +254,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
         return -1;
     }
 
-    port_info->bound = 1;
+    port_info->bound = true;
     port_info->port = local_port;
     unmask_evtchn(local_port);
 
@@ -217,9 +264,11 @@ xenevtchn_port_or_error_t xenevtchn_bind_interdomain(xenevtchn_handle *xce,
 int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct file *file = get_file_from_fd(fd);
+    struct port_info *port_info;
+    struct port_list *port_list = file->dev;
 
-    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list)
+    LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port == port )
         {
@@ -238,17 +287,16 @@ int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t port)
 xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce,
                                               unsigned int virq)
 {
-    int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct port_info *port_info;
     evtchn_port_t port;
 
     assert(get_current() == main_thread);
-    port_info = port_alloc(fd);
+    port_info = port_alloc(xce);
     if ( port_info == NULL )
         return -1;
 
     printf("xenevtchn_bind_virq(%d)", virq);
-    port = bind_virq(virq, evtchn_handler, (void *)(intptr_t)fd);
+    port = bind_virq(virq, evtchn_handler, xce);
     printf(" = %d\n", port);
 
     if ( port < 0 )
@@ -258,7 +306,7 @@ xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce,
         return -1;
     }
 
-    port_info->bound = 1;
+    port_info->bound = true;
     port_info->port = port;
     unmask_evtchn(port);
 
@@ -267,27 +315,28 @@ xenevtchn_port_or_error_t xenevtchn_bind_virq(xenevtchn_handle *xce,
 
 xenevtchn_port_or_error_t xenevtchn_pending(xenevtchn_handle *xce)
 {
-    int fd = xce->fd;
-    struct evtchn_port_info *port_info;
+    struct file *file = get_file_from_fd(xce->fd);
+    struct port_info *port_info;
+    struct port_list *port_list = file->dev;
     unsigned long flags;
     evtchn_port_t ret = -1;
 
     local_irq_save(flags);
 
-    files[fd].read = 0;
+    file->read = false;
 
-    LIST_FOREACH(port_info, &files[fd].evtchn.ports, list)
+    LIST_FOREACH(port_info, port_list, list)
     {
         if ( port_info->port != -1 && port_info->pending )
         {
             if ( ret == -1 )
             {
                 ret = port_info->port;
-                port_info->pending = 0;
+                port_info->pending = false;
             }
             else
             {
-                files[fd].read = 1;
+                file->read = true;
                 break;
             }
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 14:44:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 14:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258872.446333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nACCG-00065G-70; Wed, 19 Jan 2022 14:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258872.446333; Wed, 19 Jan 2022 14: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 1nACCG-000656-3t; Wed, 19 Jan 2022 14:44:24 +0000
Received: by outflank-mailman (input) for mailman id 258872;
 Wed, 19 Jan 2022 14: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 1nACCE-00064k-MA
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14: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 1nACCE-0006Sc-LO
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nACCE-0000Xz-KY
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14: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=81ibwShGgspPdJZjWy3s8Jw4mjkGymIaxbv73lRTQGU=; b=7Dsv3Bg5VBPsPRPn/gn55RN3Rp
	DaAaMtkt7UhvDSfVH6wJ2lHHX61XbWeYkypHCTVotGp/ZVd0+y1n0olhCeVfkpbTT0I3UY0YyZzpx
	Aeil7UPsWWkKNsiECk/XzZiIUqwoZzMQ3A8vU8yA9TN3/B+MpJHLbFXaIGCg2zwyJ+4g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/gnttab: decouple more from mini-os
Message-Id: <E1nACCE-0000Xz-KY@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 14:44:22 +0000

commit 11788ab3b9354ae1b4892e51f9d0232bf6825b70
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:23:45 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 14:58:28 2022 +0000

    tools/libs/gnttab: decouple more from mini-os
    
    libgnttab is using implementation details of Mini-OS. Change that by
    letting libgnttab use the new alloc_file_type() and get_file_from_fd()
    functions and the generic dev pointer of struct file from Mini-OS.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/gnttab/minios.c | 67 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 52 insertions(+), 15 deletions(-)

diff --git a/tools/libs/gnttab/minios.c b/tools/libs/gnttab/minios.c
index f78caadd30..f59fad3577 100644
--- a/tools/libs/gnttab/minios.c
+++ b/tools/libs/gnttab/minios.c
@@ -28,18 +28,55 @@
 #include <sys/mman.h>
 
 #include <errno.h>
+#include <malloc.h>
 #include <unistd.h>
 
 #include "private.h"
 
 void minios_gnttab_close_fd(int fd);
 
+static int gnttab_close_fd(struct file *file)
+{
+    gntmap_fini(file->dev);
+    free(file->dev);
+
+    return 0;
+}
+
+static const struct file_ops gnttab_ops = {
+    .name = "gnttab",
+    .close = gnttab_close_fd,
+};
+
+static unsigned int ftype_gnttab;
+
+__attribute__((constructor))
+static void gnttab_initialize(void)
+{
+    ftype_gnttab = alloc_file_type(&gnttab_ops);
+}
+
 int osdep_gnttab_open(xengnttab_handle *xgt)
 {
-    int fd = alloc_fd(FTYPE_GNTMAP);
-    if ( fd == -1 )
+    int fd;
+    struct file *file;
+    struct gntmap *gntmap;
+
+    gntmap = malloc(sizeof(*gntmap));
+    if ( !gntmap )
         return -1;
-    gntmap_init(&files[fd].gntmap);
+
+    fd = alloc_fd(ftype_gnttab);
+    file = get_file_from_fd(fd);
+
+    if ( !file )
+    {
+        free(gntmap);
+        return -1;
+    }
+
+    file->dev = gntmap;
+    gntmap_init(gntmap);
     xgt->fd = fd;
     return 0;
 }
@@ -54,8 +91,9 @@ int osdep_gnttab_close(xengnttab_handle *xgt)
 
 void minios_gnttab_close_fd(int fd)
 {
-    gntmap_fini(&files[fd].gntmap);
-    files[fd].type = FTYPE_NONE;
+    struct file *file = get_file_from_fd(fd);
+
+    gnttab_close_fd(file);
 }
 
 void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
@@ -64,16 +102,16 @@ void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
                              uint32_t notify_offset,
                              evtchn_port_t notify_port)
 {
-    int fd = xgt->fd;
+    struct file *file = get_file_from_fd(xgt->fd);
     int stride = 1;
+
     if (flags & XENGNTTAB_GRANT_MAP_SINGLE_DOMAIN)
         stride = 0;
     if (notify_offset != -1 || notify_port != -1) {
         errno = ENOSYS;
         return NULL;
     }
-    return gntmap_map_grant_refs(&files[fd].gntmap,
-                                 count, domids, stride,
+    return gntmap_map_grant_refs(file->dev, count, domids, stride,
                                  refs, prot & PROT_WRITE);
 }
 
@@ -81,11 +119,10 @@ int osdep_gnttab_unmap(xengnttab_handle *xgt,
                        void *start_address,
                        uint32_t count)
 {
-    int fd = xgt->fd;
+    struct file *file = get_file_from_fd(xgt->fd);
     int ret;
-    ret = gntmap_munmap(&files[fd].gntmap,
-                        (unsigned long) start_address,
-                        count);
+
+    ret = gntmap_munmap(file->dev, (unsigned long) start_address, count);
     if (ret < 0) {
         errno = -ret;
         return -1;
@@ -95,10 +132,10 @@ int osdep_gnttab_unmap(xengnttab_handle *xgt,
 
 int osdep_gnttab_set_max_grants(xengnttab_handle *xgt, uint32_t count)
 {
-    int fd = xgt->fd;
+    struct file *file = get_file_from_fd(xgt->fd);
     int ret;
-    ret = gntmap_set_max_grants(&files[fd].gntmap,
-                                count);
+
+    ret = gntmap_set_max_grants(file->dev, count);
     if (ret < 0) {
         errno = -ret;
         return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 14:44:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 14:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258873.446337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nACCQ-00069C-9f; Wed, 19 Jan 2022 14:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258873.446337; Wed, 19 Jan 2022 14: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 1nACCQ-000694-6Z; Wed, 19 Jan 2022 14:44:34 +0000
Received: by outflank-mailman (input) for mailman id 258873;
 Wed, 19 Jan 2022 14: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 1nACCO-00068o-PK
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14: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 1nACCO-0006Sn-OY
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nACCO-0000Z6-NX
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 14: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=GxwvUb7Dj63a5QNtUpjbqbTuEtrsW4jTCs3+HBf8dfY=; b=3R+tyMImnB9jCNIGyiAdQqcyEn
	4UvSM9aobJecLVkVOj+qSBtWILMCuFSGUrCtUq6GNhIsoPRssS0MiaHl+TT0Xmk4Di5a2Y/V4iEAc
	tJwGfaOaBbUd2lXQQzsxzww89D6x2PyDGt57DQHj6G0WbkO6YdfIRiP6e3aD0UBVO8e0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/ctrl: remove file related handling
Message-Id: <E1nACCO-0000Z6-NX@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 14:44:32 +0000

commit 444597436d08ccae6d210a2b1b877fef636796ea
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sun Jan 16 09:23:46 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 18 14:58:28 2022 +0000

    tools/libs/ctrl: remove file related handling
    
    There is no special file handling related to libxenctrl in Mini-OS
    any longer, so the close hook can be removed.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 tools/libs/ctrl/xc_minios.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/tools/libs/ctrl/xc_minios.c b/tools/libs/ctrl/xc_minios.c
index 1799daafdc..3dea7a78a5 100644
--- a/tools/libs/ctrl/xc_minios.c
+++ b/tools/libs/ctrl/xc_minios.c
@@ -35,15 +35,6 @@
 
 #include "xc_private.h"
 
-void minios_interface_close_fd(int fd);
-
-extern void minios_interface_close_fd(int fd);
-
-void minios_interface_close_fd(int fd)
-{
-    files[fd].type = FTYPE_NONE;
-}
-
 /* Optionally flush file to disk and discard page cache */
 void discard_file_cache(xc_interface *xch, int fd, int flush)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 19 22:33:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Jan 2022 22:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258926.446442 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAJVp-0003BM-NQ; Wed, 19 Jan 2022 22:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258926.446442; Wed, 19 Jan 2022 22:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAJVp-0003BE-Ke; Wed, 19 Jan 2022 22:33:05 +0000
Received: by outflank-mailman (input) for mailman id 258926;
 Wed, 19 Jan 2022 22:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAJVo-0003B7-Ok
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 22:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAJVo-0006oF-Lj
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 22:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAJVo-0000Zw-Jr
 for xen-changelog@lists.xenproject.org; Wed, 19 Jan 2022 22:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vyHGCmuHBtOrYUl5ZrZN1XR++0R0RkP56CvIt5Eb0e0=; b=i82ughCXAdbbGKCgGe8FdO4TxL
	FOKL5gT2Bt2v29vDoOMqv/SppUy9tco8D3u8B/3wjubszQnJ3axEUUhuw21I0k3p4u68Eg3HBL7fh
	T62t4H0STCMnMFAaz8+b+PnCX6qsT+iHsMCq9KatSbK8zH4f3p9+F64esx6sdeyupeOk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Config.mk: update seabios to 1.15.0
Message-Id: <E1nAJVo-0000Zw-Jr@xenbits.xenproject.org>
Date: Wed, 19 Jan 2022 22:33:04 +0000

commit 9b7cdb83fccf59912e56714dd79dbfab57518a65
Author:     Wei Liu <wl@xen.org>
AuthorDate: Sun Jan 16 12:54:27 2022 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Wed Jan 19 22:25:21 2022 +0000

    Config.mk: update seabios to 1.15.0
    
    Signed-off-by: Wei Liu <wl@xen.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 168273e157..95c053212e 100644
--- a/Config.mk
+++ b/Config.mk
@@ -233,7 +233,7 @@ OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= master
 MINIOS_UPSTREAM_REVISION ?= 83ff43bff4bdd6879539fcb2b3d6ba5e61a64135
 
-SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
+SEABIOS_UPSTREAM_REVISION ?= rel-1.15.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:22:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258950.446502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN5P-0003m0-5j; Thu, 20 Jan 2022 02:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258950.446502; Thu, 20 Jan 2022 02: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 1nAN5P-0003lq-1d; Thu, 20 Jan 2022 02:22:03 +0000
Received: by outflank-mailman (input) for mailman id 258950;
 Thu, 20 Jan 2022 02: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 1nAN5O-0003kK-5t
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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 1nAN5O-0004vu-57
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN5O-0008Ip-3u
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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=4zIigmW+YlwL6tRo9j9kbmVwZvvDHtuk5MJHAbKyRLg=; b=b5jv2iwaI/F4UrLqRozKwLIKzY
	XOUT6tepl8dAhjyvH17JNCWyK4/BY1Jan6bujVy2rKNVHRGY95QTO8RhP/1nDeLT/JHKAI5nq4VxU
	GC4GwSTVj3LrGxyFVxxtirBJnmrQAvCbFFOQgf8GAoh6lmpljAR9mQwpaV6eurhbd+7I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mwait-idle: mention assumption that WBINVD is not needed
Message-Id: <E1nAN5O-0008Ip-3u@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:22:02 +0000

commit 07d134e1745b696e63044ffb43d2bb60899e57d6
Author:     Alexander Monakov <amonakov@ispras.ru>
AuthorDate: Wed Jan 19 13:44:31 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:44:31 2022 +0100

    x86/mwait-idle: mention assumption that WBINVD is not needed
    
    Intel SDM does not explicitly say that entering a C-state via MWAIT will
    implicitly flush CPU caches as appropriate for that C-state. However,
    documentation for individual Intel CPU generations does mention this
    behavior.
    
    Since intel_idle binds to any Intel CPU with MWAIT, list this assumption
    of MWAIT behavior.
    
    In passing, reword opening comment to make it clear that the driver can
    load on any old and future Intel CPU with MWAIT.
    
    Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: 8bb2e2a887afdf8a39e68fa0dccf82a168aae655]
    
    Dropped "reword opending comment" part - this doesn't apply to our code:
    First thing mwait_idle_probe() does is call x86_match_cpu(); we do not
    have a 2nd such call looking for just MWAIT (in order to the use _CST
    data directly, which we can't get our hands at _CST at this point yet).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index d1739f6fc3..5c9dc0405f 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -31,6 +31,10 @@
  *
  * Chipset BM_STS (bus master status) bit is a NOP
  *	for preventing entry into deep C-states
+ *
+ * CPU will flush caches as needed when entering a C-state via MWAIT
+ *	(in contrast to entering ACPI C3, in which case the WBINVD
+ *	instruction needs to be executed to flush the caches)
  */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258953.446506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN5Z-0003ty-71; Thu, 20 Jan 2022 02:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258953.446506; Thu, 20 Jan 2022 02: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 1nAN5Z-0003tq-3Z; Thu, 20 Jan 2022 02:22:13 +0000
Received: by outflank-mailman (input) for mailman id 258953;
 Thu, 20 Jan 2022 02: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 1nAN5Y-0003tW-98
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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 1nAN5Y-0004w0-8U
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN5Y-0008JS-7R
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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=bAABmHXtxbpSSuLUECeE4ZOLt2ZWqsBypwVeX8uPw6U=; b=U1bRj/ZctXQZMTYYcjmfDL6jHy
	t7HkbOiTz9LT25i7iba+1RWpKVZpjsx7oD+2B0Sh6gsoW3jk2fKbA4q8PjIP/dQh7UDgQZhiWjY5y
	pyloZpTMA+0yYTNpHKi5HpZlpFOCegDLnIj9l5ATF5HNsIhmtiGPu10xM7KpxZ57mncI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mwait-idle: update ICX C6 data
Message-Id: <E1nAN5Y-0008JS-7R@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:22:12 +0000

commit b07050e1e8f749720485c6c7e75ea46add32c20a
Author:     Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
AuthorDate: Wed Jan 19 13:45:11 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:45:11 2022 +0100

    x86/mwait-idle: update ICX C6 data
    
    Change IceLake Xeon C6 latency from 128 us to 170 us. The latency
    was measured with the "wult" tool and corresponds to the 99.99th
    percentile when measuring with the "nic" method. Note, the 128 us
    figure correspond to the median latency, but in intel_idle we use
    the "worst case" latency figure instead.
    
    C6 target residency was increased from 384 us to 600 us, which may
    result in less C6 residency in some workloads. This value was tested
    and compared to values 384, and 1000. Value 600 is a reasonable
    tradeoff between power and performance.
    
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Acked-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: d484b8bfc6fa71a088e4ac85d9ce11aa0385867e]
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 5c9dc0405f..15c4996581 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -574,8 +574,8 @@ static const struct cpuidle_state icx_cstates[] = {
        {
                .name = "C6-ICX",
                .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
-               .exit_latency = 128,
-               .target_residency = 384,
+               .exit_latency = 170,
+               .target_residency = 600,
        },
        {}
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:22:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258954.446510 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN5j-00040Q-80; Thu, 20 Jan 2022 02:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258954.446510; Thu, 20 Jan 2022 02: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 1nAN5j-00040I-53; Thu, 20 Jan 2022 02:22:23 +0000
Received: by outflank-mailman (input) for mailman id 258954;
 Thu, 20 Jan 2022 02: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 1nAN5i-000405-CG
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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 1nAN5i-0004wI-BT
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN5i-0008KA-Ae
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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=urt2z6HxjwA670jIKfqdmhrFZ1ms+J30oZ1+SyvZK0s=; b=ymxQwxPONkynVytCzIHqH76m1m
	76XhIXDNULchABtw/gCj1+qGv9aY7bgeEyY7O2uL/+3LLwQ4C5+hekGjIbCTUlO1TbPe4xCcbHd2O
	BwXhIkRf3D2hqRLioxIwPHPmOSwUp3H/bJnWVB+2ylQ+pX7nJdtiuEeXA0kww4KaJje4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mwait-idle: add Icelake-D support
Message-Id: <E1nAN5i-0008KA-Ae@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:22:22 +0000

commit d05c67efd94f301b48bc486246161b05acaa8df2
Author:     Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
AuthorDate: Wed Jan 19 13:46:05 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:46:05 2022 +0100

    x86/mwait-idle: add Icelake-D support
    
    This patch adds Icelake Xeon D support to the intel_idle driver.
    
    Since Icelake D and Icelake SP C-state characteristics the same,
    we use Icelake SP C-states table for Icelake D as well.
    
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Acked-by: Chen Yu <yu.c.chen@intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: 22141d5f411895bb1b0df2a6b05f702e11e63918]
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 15c4996581..97e19246b6 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -990,6 +990,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconstrel = {
 	ICPU(0x9e, skl),
 	ICPU(0x55, skx),
 	ICPU(0x6a, icx),
+	ICPU(0x6c, icx),
 	ICPU(0x57, knl),
 	ICPU(0x85, knl),
 	ICPU(0x5c, bxt),
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:22:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258955.446514 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN5t-00045S-9u; Thu, 20 Jan 2022 02:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258955.446514; Thu, 20 Jan 2022 02: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 1nAN5t-00045H-6h; Thu, 20 Jan 2022 02:22:33 +0000
Received: by outflank-mailman (input) for mailman id 258955;
 Thu, 20 Jan 2022 02: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 1nAN5s-000457-HI
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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 1nAN5s-0004wU-GX
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN5s-0008LU-Fb
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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=Dy4MJi8qqNtfQrNFkGMxtDPPDOzSWGjfQkfK+2MlURs=; b=vbLk3RFW68+BCdsXvFegtMpLnp
	yPFwg1y+GrUohdqBOl4lZR9RqG4GCYxywBl4Jm4SZlXyXvzsWDh+0njXGOvZKwZyL2SAKPcVk34zO
	2ydR3pr+NCFHOADv9Qx0Wmo6onHU/uGD73Fz663KjYUKgSLIlwq7XEb5Sjytzug+Bj50=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] config: use more recent mini-os commit
Message-Id: <E1nAN5s-0008LU-Fb@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:22:32 +0000

commit fa52b153c51ea56eafa134d6321b6ca8a8574a88
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 19 08:28:21 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 19 09:37:55 2022 +0000

    config: use more recent mini-os commit
    
    In order to be able to use the recent Mini-OS features switch to the
    most recent commit.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 5c8c737fe4..168273e157 100644
--- a/Config.mk
+++ b/Config.mk
@@ -231,7 +231,7 @@ MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= master
-MINIOS_UPSTREAM_REVISION ?= a91161eb0f92dac4ad6d41f91117268bc23ef28d
+MINIOS_UPSTREAM_REVISION ?= 83ff43bff4bdd6879539fcb2b3d6ba5e61a64135
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:22:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258956.446518 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN63-00048O-BD; Thu, 20 Jan 2022 02:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258956.446518; Thu, 20 Jan 2022 02: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 1nAN63-00048G-8B; Thu, 20 Jan 2022 02:22:43 +0000
Received: by outflank-mailman (input) for mailman id 258956;
 Thu, 20 Jan 2022 02: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 1nAN62-000489-KO
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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 1nAN62-0004we-Jc
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN62-0008M7-Ii
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02: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=OaHjpBoHJJ9gsLRtQBKChtUMnhg0xIcA1sQbXzq+gQY=; b=fL4lqCw/V7iy5C6msrfWHN0QNJ
	GBSOSbScy/lLml+uk5VTZSy6s6CsbeSWLDU+WtgKE/fngVnMOthuqEvdsQnDxBeEHhbvHozq5XiMR
	YixafR/Afb+SjxHcDLzA9ScrQ6VmLl4MYWlZkGls9TLRab5NCgnVcmgTw02FbSDAoOp4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/evtchn: remove old mini-os callback
Message-Id: <E1nAN62-0008M7-Ii@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:22:42 +0000

commit 9375860adaf2ec9779b4925ec8c3750f27ebb88c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 19 08:28:22 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 19 09:37:58 2022 +0000

    tools/libs/evtchn: remove old mini-os callback
    
    It is possible now to delete minios_evtchn_close_fd() and the extern
    declaration of event_queue.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/evtchn/minios.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index ee3da9f8fe..30f98bc7e4 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
@@ -47,10 +47,6 @@ struct port_info {
     bool bound;
 };
 
-extern struct wait_queue_head event_queue;
-
-void minios_evtchn_close_fd(int fd);
-
 /* XXX Note: This is not threadsafe */
 static struct port_info *port_alloc(xenevtchn_handle *xce)
 {
@@ -152,13 +148,6 @@ int osdep_evtchn_restrict(xenevtchn_handle *xce, domid_t domid)
     return -1;
 }
 
-void minios_evtchn_close_fd(int fd)
-{
-    struct file *file = get_file_from_fd(fd);
-
-    evtchn_close_fd(file);
-}
-
 int xenevtchn_notify(xenevtchn_handle *xce, evtchn_port_t port)
 {
     int ret;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:22:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258957.446522 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN6E-0004CB-Cl; Thu, 20 Jan 2022 02:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258957.446522; Thu, 20 Jan 2022 02: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 1nAN6E-0004C1-9n; Thu, 20 Jan 2022 02:22:54 +0000
Received: by outflank-mailman (input) for mailman id 258957;
 Thu, 20 Jan 2022 02:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6C-0004Bs-NZ
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6C-0004xC-Ml
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6C-0008Mu-Lq
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jqiMPTETX+aI1nBi5pGrlxEpxXcVzbGqmcZAlBt1+nA=; b=OTLcD8+rJ89SPb5vUPHqaGYxvr
	9luGuBVJuYoNBgGijROMFjqT+TE6Cc7aD9A0golTQA6PsLjgA7MaPcw3ciDTez8I0EkzHTmaXKE4c
	6u6w6OGHPiT1winMRU8H2FJVwEVAkcnRtsRHpJVns99T2KNR8++SsfWi+WVCWU9k7PDQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/gnttab: remove old mini-os callback
Message-Id: <E1nAN6C-0008Mu-Lq@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:22:52 +0000

commit ec43f0886eee614d3c6a6bef6851336368450fb2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 19 08:28:23 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jan 19 09:38:01 2022 +0000

    tools/libs/gnttab: remove old mini-os callback
    
    It is possible now to delete minios_gnttab_close_fd().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/gnttab/minios.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/tools/libs/gnttab/minios.c b/tools/libs/gnttab/minios.c
index f59fad3577..cac89f0ba6 100644
--- a/tools/libs/gnttab/minios.c
+++ b/tools/libs/gnttab/minios.c
@@ -33,8 +33,6 @@
 
 #include "private.h"
 
-void minios_gnttab_close_fd(int fd);
-
 static int gnttab_close_fd(struct file *file)
 {
     gntmap_fini(file->dev);
@@ -89,13 +87,6 @@ int osdep_gnttab_close(xengnttab_handle *xgt)
     return close(xgt->fd);
 }
 
-void minios_gnttab_close_fd(int fd)
-{
-    struct file *file = get_file_from_fd(fd);
-
-    gnttab_close_fd(file);
-}
-
 void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
                              uint32_t count, int flags, int prot,
                              uint32_t *domids, uint32_t *refs,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:23:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258958.446526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN6O-0004FS-EK; Thu, 20 Jan 2022 02:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258958.446526; Thu, 20 Jan 2022 02: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 1nAN6O-0004FK-BK; Thu, 20 Jan 2022 02:23:04 +0000
Received: by outflank-mailman (input) for mailman id 258958;
 Thu, 20 Jan 2022 02:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6M-0004Eu-Qh
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6M-0004xl-Py
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6M-0008PD-P8
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NMJYzxTtbIwbydv20BwLUhUz1p6l1jgEyFMt4PudmEk=; b=217pPzqbBvJW02j92WrBb1n5LM
	+AczwnkzGI9wLaALGvXYL4Z3zDuRkDKTdqIO1wz28A3QykXNvzVB0uvD+J1kkF7jYu0tLHu+VXxTy
	cqsOY8m0OgVekoWtm78/zYvu1FMyhGQPuMVBm2Hi8IklZ64ohekYR67o6J/EPA8FAbX0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging
Message-Id: <E1nAN6M-0008PD-P8@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:23:02 +0000

commit dc6534112574098b15db79b25a08c420679415e6
Merge: d05c67efd94f301b48bc486246161b05acaa8df2 ec43f0886eee614d3c6a6bef6851336368450fb2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jan 19 13:49:30 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:49:30 2022 +0100

    Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging

 Config.mk                  |  2 +-
 tools/libs/evtchn/minios.c | 11 -----------
 tools/libs/gnttab/minios.c |  9 ---------
 3 files changed, 1 insertion(+), 21 deletions(-)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:23:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258959.446530 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN6Y-0004JC-H0; Thu, 20 Jan 2022 02:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258959.446530; Thu, 20 Jan 2022 02: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 1nAN6Y-0004J4-E5; Thu, 20 Jan 2022 02:23:14 +0000
Received: by outflank-mailman (input) for mailman id 258959;
 Thu, 20 Jan 2022 02:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6W-0004Is-U6
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6W-0004y9-TP
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6W-0008QM-SM
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QWOBjhHYr1xeIXO0+KTjpAsgiPHV+VBeFbObg23QPc8=; b=Lppyq+omWDKWRaYLXlDTM5QzTG
	UHLWct/jyoBRP0Ohk4y0I+Tv5m4OGFnJSUxbjxhO8oEHoZ656K8Msn085l9PXvqNRFhsUr1YMJpGC
	eYXQmZC1RWoxR0FIZ4DjuAxq/ERZQi+4qZKoUBtk7dK1+YyUkKgIuhvJ35s5iOPRG6TY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mwait-idle: Adjust the SKX C6 parameters if PC6 is disabled
Message-Id: <E1nAN6W-0008QM-SM@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:23:12 +0000

commit d4fb2cc5c0eea6873e4ffb0eeea6ea1d6023b654
Author:     Chen Yu <yu.c.chen@intel.com>
AuthorDate: Wed Jan 19 13:50:43 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:50:43 2022 +0100

    x86/mwait-idle: Adjust the SKX C6 parameters if PC6 is disabled
    
    Because cpuidle assumes worst-case C-state parameters, PC6 parameters
    are used for describing C6, which is worst-case for requesting CC6.
    When PC6 is enabled, this is appropriate. But if PC6 is disabled
    in the BIOS, the exit latency and target residency should be adjusted
    accordingly.
    
    Exit latency:
    Previously the C6 exit latency was measured as the PC6 exit latency.
    With PC6 disabled, the C6 exit latency should be the one of CC6.
    
    Target residency:
    With PC6 disabled, the idle duration within [CC6, PC6) would make the
    idle governor choose C1E over C6. This would cause low energy-efficiency.
    We should lower the bar to request C6 when PC6 is disabled.
    
    To fill this gap, check if PC6 is disabled in the BIOS in the
    MSR_PKG_CST_CONFIG_CONTROL(0xe2) register. If so, use the CC6 exit latency
    for C6 and set target_residency to 3 times of the new exit latency. [This
    is consistent with how intel_idle driver uses _CST to calculate the
    target_residency.] As a result, the OS would be more likely to choose C6
    over C1E when PC6 is disabled, which is reasonable, because if C6 is
    enabled, it implies that the user cares about energy, so choosing C6 more
    frequently makes sense.
    
    The new CC6 exit latency of 92us was measured with wult[1] on SKX via NIC
    wakeup as the 99.99th percentile. Also CLX and CPX both have the same CPU
    model number as SkX, but their CC6 exit latencies are similar to the SKX
    one, 96us and 89us respectively, so reuse the SKX value for them.
    
    There is a concern that it might be better to use a more generic approach
    instead of optimizing every platform. However, if the required code
    complexity and different PC6 bit interpretation on different platforms
    are taken into account, tuning the code per platform seems to be an
    acceptable tradeoff.
    
    Link: https://intel.github.io/wult/ # [1]
    Suggested-by: Len Brown <len.brown@intel.com>
    Signed-off-by: Chen Yu <yu.c.chen@intel.com>
    Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: 64233338499126c5c31e07165735ab5441c7e45a]
    
    Alongside the dropping of "const" from skx_cstates[] add __read_mostly,
    and extend that to other similar non-const tables.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 39 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 97e19246b6..9e04d969d6 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -484,7 +484,7 @@ static const struct cpuidle_state bdw_cstates[] = {
 	{}
 };
 
-static struct cpuidle_state skl_cstates[] = {
+static struct cpuidle_state __read_mostly skl_cstates[] = {
 	{
 		.name = "C1-SKL",
 		.flags = MWAIT2flg(0x00),
@@ -536,7 +536,7 @@ static struct cpuidle_state skl_cstates[] = {
 	{}
 };
 
-static const struct cpuidle_state skx_cstates[] = {
+static struct cpuidle_state __read_mostly skx_cstates[] = {
 	{
 		.name = "C1-SKX",
 		.flags = MWAIT2flg(0x00),
@@ -674,7 +674,7 @@ static const struct cpuidle_state knl_cstates[] = {
 	{}
 };
 
-static struct cpuidle_state bxt_cstates[] = {
+static struct cpuidle_state __read_mostly bxt_cstates[] = {
 	{
 		.name = "C1-BXT",
 		.flags = MWAIT2flg(0x00),
@@ -1129,6 +1129,36 @@ static void __init sklh_idle_state_table_update(void)
 	skl_cstates[6].flags |= CPUIDLE_FLAG_DISABLED;	/* C9-SKL */
 }
 
+/*
+ * skx_idle_state_table_update - Adjust the Sky Lake/Cascade Lake
+ * idle states table.
+ */
+static void __init skx_idle_state_table_update(void)
+{
+	unsigned long long msr;
+
+	rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, msr);
+
+	/*
+	 * 000b: C0/C1 (no package C-state support)
+	 * 001b: C2
+	 * 010b: C6 (non-retention)
+	 * 011b: C6 (retention)
+	 * 111b: No Package C state limits.
+	 */
+	if ((msr & 0x7) < 2) {
+		/*
+		 * Uses the CC6 + PC0 latency and 3 times of
+		 * latency for target_residency if the PC6
+		 * is disabled in BIOS. This is consistent
+		 * with how intel_idle driver uses _CST
+		 * to set the target_residency.
+		 */
+		skx_cstates[2].exit_latency = 92;
+		skx_cstates[2].target_residency = 276;
+	}
+}
+
 /*
  * mwait_idle_state_table_update()
  *
@@ -1147,6 +1177,9 @@ static void __init mwait_idle_state_table_update(void)
 	case 0x5e: /* SKL-H */
 		sklh_idle_state_table_update();
 		break;
+	case 0x55: /* SKL-X */
+		skx_idle_state_table_update();
+		break;
  	}
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 02:23:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 02:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.258960.446534 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN6i-0004M4-Ip; Thu, 20 Jan 2022 02:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 258960.446534; Thu, 20 Jan 2022 02:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAN6i-0004Lw-FV; Thu, 20 Jan 2022 02:23:24 +0000
Received: by outflank-mailman (input) for mailman id 258960;
 Thu, 20 Jan 2022 02:23: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 1nAN6h-0004Li-1c
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23: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 1nAN6h-0004yI-0c
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAN6g-0008RZ-Vx
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 02:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3xsT9Gq3iJyVx6cDi35SRdzD8MAc8ETUPCAj3tl/ZpI=; b=U1nfQSm2AvxARqUdogxdiOL44m
	GaKR+SByjaWdP5lbFpy6BFmfPKP3XtOkMUozpbpPqaYTXgQCt6DuAEtAxxMtIFq96UHZKDQcu7VuG
	oyAgGctUOtOwtjjn5SqqnZgC+6EKU7YIaNxMUWfNCc/3H7OKRxU7/429ign6ECvUbUKE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: move cpu policy related prototypes to xenguest.h
Message-Id: <E1nAN6g-0008RZ-Vx@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 02:23:22 +0000

commit 2fc98a9587704b3cdedfe3ae2a6104e7d9e251bd
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jan 19 13:51:26 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 19 13:51:26 2022 +0100

    libs/guest: move cpu policy related prototypes to xenguest.h
    
    Do this before adding any more stuff to xg_cpuid_x86.c.
    
    The placement in xenctrl.h is wrong, as they are implemented by the
    xenguest library. Note that xg_cpuid_x86.c needs to include
    xg_private.h, and in turn also fix xg_private.h to include
    xc_bitops.h. The bitops definition of BITS_PER_LONG needs to be
    changed to not be an expression, so that xxhash.h can use it in a
    preprocessor if directive.
    
    As a result also modify xen-cpuid to include xenguest.h.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/include/xenctrl.h         | 55 ----------------------------------------
 tools/include/xenguest.h        | 56 +++++++++++++++++++++++++++++++++++++++++
 tools/libs/ctrl/xc_bitops.h     |  6 ++++-
 tools/libs/guest/xg_cpuid_x86.c |  1 -
 tools/libs/guest/xg_private.h   |  1 +
 tools/misc/xen-cpuid.c          |  1 +
 6 files changed, 63 insertions(+), 57 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 07b96e6671..95bd5eca67 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2528,61 +2528,6 @@ int xc_psr_get_domain_data(xc_interface *xch, uint32_t domid,
                            uint64_t *data);
 int xc_psr_get_hw_info(xc_interface *xch, uint32_t socket,
                        xc_psr_feat_type type, xc_psr_hw_info *hw_info);
-
-typedef struct xc_cpu_policy xc_cpu_policy_t;
-
-/* Create and free a xc_cpu_policy object. */
-xc_cpu_policy_t *xc_cpu_policy_init(void);
-void xc_cpu_policy_destroy(xc_cpu_policy_t *policy);
-
-/* Retrieve a system policy, or get/set a domains policy. */
-int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
-                             xc_cpu_policy_t *policy);
-int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
-                             xc_cpu_policy_t *policy);
-int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
-                             xc_cpu_policy_t *policy);
-
-/* Manipulate a policy via architectural representations. */
-int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *policy,
-                            xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
-                            xen_msr_entry_t *msrs, uint32_t *nr_msrs);
-int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy,
-                               const xen_cpuid_leaf_t *leaves,
-                               uint32_t nr);
-int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy,
-                              const xen_msr_entry_t *msrs, uint32_t nr);
-
-/* Compatibility calculations. */
-bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host,
-                                 xc_cpu_policy_t *guest);
-
-int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
-int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
-                          uint32_t *nr_features, uint32_t *featureset);
-
-int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
-                           uint32_t *nr_msrs);
-int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
-                             uint32_t nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t nr_msrs, xen_msr_entry_t *msrs,
-                             uint32_t *err_leaf_p, uint32_t *err_subleaf_p,
-                             uint32_t *err_msr_p);
-
-uint32_t xc_get_cpu_featureset_size(void);
-
-enum xc_static_cpu_featuremask {
-    XC_FEATUREMASK_KNOWN,
-    XC_FEATUREMASK_SPECIAL,
-    XC_FEATUREMASK_PV_MAX,
-    XC_FEATUREMASK_PV_DEF,
-    XC_FEATUREMASK_HVM_SHADOW_MAX,
-    XC_FEATUREMASK_HVM_SHADOW_DEF,
-    XC_FEATUREMASK_HVM_HAP_MAX,
-    XC_FEATUREMASK_HVM_HAP_DEF,
-};
-const uint32_t *xc_get_static_cpu_featuremask(enum xc_static_cpu_featuremask);
-
 #endif
 
 int xc_livepatch_upload(xc_interface *xch,
diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h
index 61d0a82f48..e01f494b77 100644
--- a/tools/include/xenguest.h
+++ b/tools/include/xenguest.h
@@ -782,4 +782,60 @@ xen_pfn_t *xc_map_m2p(xc_interface *xch,
                       unsigned long max_mfn,
                       int prot,
                       unsigned long *mfn0);
+
+#if defined(__i386__) || defined(__x86_64__)
+typedef struct xc_cpu_policy xc_cpu_policy_t;
+
+/* Create and free a xc_cpu_policy object. */
+xc_cpu_policy_t *xc_cpu_policy_init(void);
+void xc_cpu_policy_destroy(xc_cpu_policy_t *policy);
+
+/* Retrieve a system policy, or get/set a domains policy. */
+int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
+                             xc_cpu_policy_t *policy);
+int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
+                             xc_cpu_policy_t *policy);
+int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
+                             xc_cpu_policy_t *policy);
+
+/* Manipulate a policy via architectural representations. */
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t *policy,
+                            xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
+                            xen_msr_entry_t *msrs, uint32_t *nr_msrs);
+int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t *policy,
+                               const xen_cpuid_leaf_t *leaves,
+                               uint32_t nr);
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t *policy,
+                              const xen_msr_entry_t *msrs, uint32_t nr);
+
+/* Compatibility calculations. */
+bool xc_cpu_policy_is_compatible(xc_interface *xch, xc_cpu_policy_t *host,
+                                 xc_cpu_policy_t *guest);
+
+int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
+int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
+                          uint32_t *nr_features, uint32_t *featureset);
+
+int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
+                           uint32_t *nr_msrs);
+int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
+                             uint32_t nr_leaves, xen_cpuid_leaf_t *leaves,
+                             uint32_t nr_msrs, xen_msr_entry_t *msrs,
+                             uint32_t *err_leaf_p, uint32_t *err_subleaf_p,
+                             uint32_t *err_msr_p);
+
+uint32_t xc_get_cpu_featureset_size(void);
+
+enum xc_static_cpu_featuremask {
+    XC_FEATUREMASK_KNOWN,
+    XC_FEATUREMASK_SPECIAL,
+    XC_FEATUREMASK_PV_MAX,
+    XC_FEATUREMASK_PV_DEF,
+    XC_FEATUREMASK_HVM_SHADOW_MAX,
+    XC_FEATUREMASK_HVM_SHADOW_DEF,
+    XC_FEATUREMASK_HVM_HAP_MAX,
+    XC_FEATUREMASK_HVM_HAP_DEF,
+};
+const uint32_t *xc_get_static_cpu_featuremask(enum xc_static_cpu_featuremask);
+#endif /* __i386__ || __x86_64__ */
 #endif /* XENGUEST_H */
diff --git a/tools/libs/ctrl/xc_bitops.h b/tools/libs/ctrl/xc_bitops.h
index f0bac4a071..4a776dc3a5 100644
--- a/tools/libs/ctrl/xc_bitops.h
+++ b/tools/libs/ctrl/xc_bitops.h
@@ -6,7 +6,11 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define BITS_PER_LONG (sizeof(unsigned long) * 8)
+#ifdef __LP64__
+#define BITS_PER_LONG 64
+#else
+#define BITS_PER_LONG 32
+#endif
 
 #define BITMAP_ENTRY(_nr,_bmap) ((_bmap))[(_nr) / 8]
 #define BITMAP_SHIFT(_nr) ((_nr) % 8)
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 198892ebdf..b9e827ce7e 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -23,7 +23,6 @@
 #include <stdbool.h>
 #include <limits.h>
 #include "xg_private.h"
-#include "xc_bitops.h"
 #include <xen/hvm/params.h>
 #include <xen-tools/libs.h>
 
diff --git a/tools/libs/guest/xg_private.h b/tools/libs/guest/xg_private.h
index 28441ee13f..09e24f1227 100644
--- a/tools/libs/guest/xg_private.h
+++ b/tools/libs/guest/xg_private.h
@@ -27,6 +27,7 @@
 #include <sys/stat.h>
 
 #include "xc_private.h"
+#include "xc_bitops.h"
 #include "xenguest.h"
 
 #include <xen/memory.h>
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index fb36cac07b..a3003245f1 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -8,6 +8,7 @@
 #include <inttypes.h>
 
 #include <xenctrl.h>
+#include <xenguest.h>
 
 #include <xen-tools/libs.h>
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 12:44:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 12:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259061.446782 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAWnM-0006Go-32; Thu, 20 Jan 2022 12:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259061.446782; Thu, 20 Jan 2022 12: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 1nAWnL-0006Gg-WC; Thu, 20 Jan 2022 12:44:03 +0000
Received: by outflank-mailman (input) for mailman id 259061;
 Thu, 20 Jan 2022 12: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 1nAWnK-0006GY-Ao
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 12: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 1nAWnK-0008QP-A2
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 12:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAWnK-0001Gx-8s
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 12:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rfjn46UUvwFX2csQYqDY4h1NhuNZ6Yd/zvJslN6eK50=; b=V8G72NqGuDzkt8IfuqbuFd6rjI
	AOfqxxExXNLuB/2IPcITdkLJ8qzOP3ktRJxcB93/ySQq+wJY1VdpSUCq3XIpzEoNZEx0ETgQnJ//s
	aahJG+3Zu7vaq63h7zDnYUwRlhzlHx24G1R2AjbwhiUsear34iBkdphITY+A1zju9Jxw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Config.mk: update seabios to 1.15.0
Message-Id: <E1nAWnK-0001Gx-8s@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 12:44:02 +0000

commit 9b7cdb83fccf59912e56714dd79dbfab57518a65
Author:     Wei Liu <wl@xen.org>
AuthorDate: Sun Jan 16 12:54:27 2022 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Wed Jan 19 22:25:21 2022 +0000

    Config.mk: update seabios to 1.15.0
    
    Signed-off-by: Wei Liu <wl@xen.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 168273e157..95c053212e 100644
--- a/Config.mk
+++ b/Config.mk
@@ -233,7 +233,7 @@ OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= master
 MINIOS_UPSTREAM_REVISION ?= 83ff43bff4bdd6879539fcb2b3d6ba5e61a64135
 
-SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
+SEABIOS_UPSTREAM_REVISION ?= rel-1.15.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 13:11:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 13:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259062.446787 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAXDX-0000c3-1g; Thu, 20 Jan 2022 13:11:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259062.446787; Thu, 20 Jan 2022 13:11: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 1nAXDW-0000bv-Uu; Thu, 20 Jan 2022 13:11:06 +0000
Received: by outflank-mailman (input) for mailman id 259062;
 Thu, 20 Jan 2022 13:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAXDV-0000bp-1R
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 13:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAXDU-0000U8-Vt
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 13:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAXDU-00041j-U6
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 13:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tqa7Se1yzkJFtuPcYBqZxYrnCL7Qju9ChiatKFbJamg=; b=CXvDkwEoWU6u7DXmCRO8LRUKAe
	+44fdhCMvuDaMZFTVh1Un/e/++6djtMOhakz6OBjPM+Z7X5VZwSRTwAIqwUCqsgptV7CTUOyN8KuL
	7f4IRnbamFBtmEnTUNOwDfaAroIqKuaxxlYicOsEQJ/BotPlMW7/qEWOclzgbcVWnLmw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Drop .is_singlestep_supported() callback
Message-Id: <E1nAXDU-00041j-U6@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 13:11:04 +0000

commit 4e1df69cc9f51b2e017af1da3ed5b45917642115
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 13 18:37:13 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 13:09:57 2022 +0000

    x86/hvm: Drop .is_singlestep_supported() callback
    
    There is absolutely no need for a function pointer call here.
    
    Drop the hook, introduce a singlestep_supported boolean, and configure it in
    start_vmx() like all other optional functionality.
    
    No functional change, but rather more efficient logic.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c         | 8 ++------
 xen/arch/x86/include/asm/hvm/hvm.h | 7 +++----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a7a0d66234..1c46669762 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2120,11 +2120,6 @@ static void vmx_enable_msr_interception(struct domain *d, uint32_t msr)
         vmx_set_msr_intercept(v, msr, VMX_MSR_W);
 }
 
-static bool_t vmx_is_singlestep_supported(void)
-{
-    return !!cpu_has_monitor_trap_flag;
-}
-
 static void vmx_vcpu_update_eptp(struct vcpu *v)
 {
     struct domain *d = v->domain;
@@ -2454,7 +2449,6 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .nhvm_domain_relinquish_resources = nvmx_domain_relinquish_resources,
     .nhvm_hap_walk_L1_p2m = nvmx_hap_walk_L1_p2m,
     .enable_msr_interception = vmx_enable_msr_interception,
-    .is_singlestep_supported = vmx_is_singlestep_supported,
     .altp2m_vcpu_update_p2m = vmx_vcpu_update_eptp,
     .altp2m_vcpu_update_vmfunc_ve = vmx_vcpu_update_vmfunc_ve,
     .altp2m_vcpu_emulate_ve = vmx_vcpu_emulate_ve,
@@ -2661,6 +2655,8 @@ const struct hvm_function_table * __init start_vmx(void)
         return NULL;
     }
 
+    vmx_function_table.singlestep_supported = cpu_has_monitor_trap_flag;
+
     if ( cpu_has_vmx_dt_exiting )
         vmx_function_table.set_descriptor_access_exiting =
             vmx_set_descriptor_access_exiting;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index b26302d9e7..9338cf25a6 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -97,6 +97,7 @@ struct hvm_function_table {
 
     /* Necessary hardware support for alternate p2m's? */
     bool altp2m_supported;
+    bool singlestep_supported;
 
     /* Hardware virtual interrupt delivery enable? */
     bool virtual_intr_delivery_enabled;
@@ -208,7 +209,6 @@ struct hvm_function_table {
                                 uint8_t *p2m_acc, struct npfec npfec);
 
     void (*enable_msr_interception)(struct domain *d, uint32_t msr);
-    bool_t (*is_singlestep_supported)(void);
 
     /* Alternate p2m */
     void (*altp2m_vcpu_update_p2m)(struct vcpu *v);
@@ -644,10 +644,9 @@ static inline void hvm_enable_msr_interception(struct domain *d, uint32_t msr)
     alternative_vcall(hvm_funcs.enable_msr_interception, d, msr);
 }
 
-static inline bool_t hvm_is_singlestep_supported(void)
+static inline bool hvm_is_singlestep_supported(void)
 {
-    return (hvm_funcs.is_singlestep_supported &&
-            alternative_call(hvm_funcs.is_singlestep_supported));
+    return hvm_funcs.singlestep_supported;
 }
 
 static inline bool hvm_hap_supported(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 16:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 16:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259148.447099 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaXf-0002ud-GC; Thu, 20 Jan 2022 16:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259148.447099; Thu, 20 Jan 2022 16:44:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaXf-0002uV-Cx; Thu, 20 Jan 2022 16:44:07 +0000
Received: by outflank-mailman (input) for mailman id 259148;
 Thu, 20 Jan 2022 16:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaXd-0002uP-8k
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44: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 1nAaXd-0004xJ-4U
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaXd-0006Kj-3b
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9kV7MDD+7IXgM4OnpFnpLNYJfCBp4dCX8mA6OFtc+PU=; b=EJ6HVkmM3BdO9AmaOVsHgO2Wnx
	9dhaZQ69TFpvfoehEVl+6t7b7gRq7db/sN5fu1g/ATc1QJWQQ2mc2IXDzN+67hDMk8rRG73VFxG5C
	FSu1r2b0422jqSF3J5vtk1ebk2sHbOHh7vpxaMZ1NEGuo+B2XVqD0Osk8i2bCI2gZtTA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/guest: Introduce {get,set}_reg() infrastructure
Message-Id: <E1nAaXd-0006Kj-3b@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 16:44:05 +0000

commit 88d3ff7ab15da277a85b39735797293fb541c718
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 17 12:28:39 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/guest: Introduce {get,set}_reg() infrastructure
    
    Various registers have per-guest-type or per-vendor locations or access
    requirements.  To support their use from common code, provide accessors which
    allow for per-guest-type behaviour.
    
    For now, just infrastructure handling default cases and expectations.
    Subsequent patches will start handling registers using this infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c               | 22 ++++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c           | 30 ++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c           | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/hvm/hvm.h   | 15 +++++++++++++++
 xen/arch/x86/include/asm/pv/domain.h |  4 ++++
 xen/arch/x86/pv/emulate.c            | 31 +++++++++++++++++++++++++++++++
 6 files changed, 133 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3b87506ac4..b530e986e8 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3744,6 +3744,28 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_call(hvm_funcs.get_reg, v, reg);
+    }
+}
+
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_vcall(hvm_funcs.set_reg, v, reg, val);
+    }
+}
+
 static bool is_sysdesc_access(const struct x86_emulate_state *state,
                               const struct x86_emulate_ctxt *ctxt)
 {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index fae39c4b4c..bb6b8e560a 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2469,6 +2469,33 @@ static bool svm_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t svm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
@@ -2518,6 +2545,9 @@ static struct hvm_function_table __initdata svm_function_table = {
     .nhvm_intr_blocked = nsvm_intr_blocked,
     .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
 
+    .get_reg = svm_get_reg,
+    .set_reg = svm_set_reg,
+
     .tsc_scaling = {
         .max_ratio = ~TSC_RATIO_RSVD_BITS,
     },
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 1c46669762..6b0455a1cf 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2399,6 +2399,33 @@ static int vmtrace_reset(struct vcpu *v)
     return 0;
 }
 
+static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2458,6 +2485,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .vmtrace_set_option = vmtrace_set_option,
     .vmtrace_get_option = vmtrace_get_option,
     .vmtrace_reset = vmtrace_reset,
+
+    .get_reg = vmx_get_reg,
+    .set_reg = vmx_set_reg,
+
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 9338cf25a6..3ab177d9dd 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -223,6 +223,9 @@ struct hvm_function_table {
     int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
     int (*vmtrace_reset)(struct vcpu *v);
 
+    uint64_t (*get_reg)(struct vcpu *v, unsigned int reg);
+    void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -728,6 +731,18 @@ static inline int hvm_vmtrace_reset(struct vcpu *v)
     return -EOPNOTSUPP;
 }
 
+/*
+ * Accessors for registers which have per-guest-type or per-vendor locations
+ * (e.g. VMCS, msr load/save lists, VMCB, VMLOAD lazy, etc).
+ *
+ * The caller is responsible for all auditing - these accessors do not fail,
+ * but do use domain_crash() for usage errors.
+ *
+ * Must cope with being called in non-current context.
+ */
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg);
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
diff --git a/xen/arch/x86/include/asm/pv/domain.h b/xen/arch/x86/include/asm/pv/domain.h
index df9716ff26..3a67816764 100644
--- a/xen/arch/x86/include/asm/pv/domain.h
+++ b/xen/arch/x86/include/asm/pv/domain.h
@@ -65,6 +65,10 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e8bb326efd..ae049b60f2 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -90,6 +90,37 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
     }
 }
 
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 16:44:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 16:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259149.447103 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaXo-0002wH-HW; Thu, 20 Jan 2022 16:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259149.447103; Thu, 20 Jan 2022 16:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaXo-0002w8-EV; Thu, 20 Jan 2022 16:44:16 +0000
Received: by outflank-mailman (input) for mailman id 259149;
 Thu, 20 Jan 2022 16:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaXn-0002vy-96
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44: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 1nAaXn-0004xO-8F
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaXn-0006Mn-75
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KgXYAuGevUxC2Rs5L3Q9WBZSBcH1t3H1oddqE0Og4zk=; b=vFCXDdHuJAazi2iIat01d4c6xm
	fOxJ6kJj83Z3vvNZiOj/6Md4ZLP6f4p85jN90lTdduch6fGZIHXoCoEcjc4U+MBZO7tYS6uCqEOsJ
	mKQrkKySbPFgXveTeQU1poWLGsPPTsap98IyD/PoADvzDaL8UMLCB6GmgOJ4YmbDHGnM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msr: Split MSR_SPEC_CTRL handling
Message-Id: <E1nAaXn-0006Mn-75@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 16:44:15 +0000

commit 6536688439dbca1d08fd6db5be29c39e3917fb2f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 12 13:52:47 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/msr: Split MSR_SPEC_CTRL handling
    
    In order to fix a VT-x bug, and support MSR_SPEC_CTRL on AMD, move
    MSR_SPEC_CTRL handling into the new {pv,hvm}_{get,set}_reg() infrastructure.
    
    Duplicate the msrs->spec_ctrl.raw accesses in the PV and VT-x paths for now.
    The SVM path is currently unreachable because of the CPUID policy.
    
    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 |  7 +++++++
 xen/arch/x86/msr.c         | 22 +++++++++++++++++-----
 xen/arch/x86/pv/emulate.c  |  9 +++++++++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 6b0455a1cf..833a4af6f0 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2405,6 +2405,9 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return v->arch.msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -2419,6 +2422,10 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        v->arch.msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index b834456c7b..71cbfa8ee3 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -28,6 +28,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/pv/domain.h>
 #include <asm/setup.h>
 
 #include <public/hvm/params.h>
@@ -265,8 +266,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_SPEC_CTRL:
         if ( !cp->feat.ibrsb )
             goto gp_fault;
-        *val = msrs->spec_ctrl.raw;
-        break;
+        goto get_reg;
 
     case MSR_INTEL_PLATFORM_INFO:
         *val = mp->platform_info.raw;
@@ -424,6 +424,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     return ret;
 
+ get_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        *val = pv_get_reg(v, msr);
+    else
+        *val = hvm_get_reg(v, msr);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
@@ -513,9 +520,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
         if ( val & rsvd )
             goto gp_fault; /* Rsvd bit set? */
-
-        msrs->spec_ctrl.raw = val;
-        break;
+        goto set_reg;
 
     case MSR_PRED_CMD:
         if ( !cp->feat.ibrsb && !cp->extd.ibpb )
@@ -663,6 +668,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
     return ret;
 
+ set_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        pv_set_reg(v, msr, val);
+    else
+        hvm_set_reg(v, msr, val);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index ae049b60f2..0a7907ec5e 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -92,12 +92,16 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 
 uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -108,12 +112,17 @@ uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 
 void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 16:44:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 16:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259150.447107 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaXy-0002yn-JC; Thu, 20 Jan 2022 16:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259150.447107; Thu, 20 Jan 2022 16:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaXy-0002ye-Fy; Thu, 20 Jan 2022 16:44:26 +0000
Received: by outflank-mailman (input) for mailman id 259150;
 Thu, 20 Jan 2022 16:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaXx-0002yI-C8
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44: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 1nAaXx-0004xg-BO
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaXx-0006OD-AU
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZAJb/UMkgYLawUYfozLqsgXSc9dEbvp+ovrWPj2n8/E=; b=uaXDc1E+QC5VhrfBMETJ+9Q/sH
	Mirfe4DlWcr4LCbc5JHAo7Jq605A+nRzyXwLFudnwTXqSuLXHsNzaymz/jZw8aU5V/6dPwAEoHV83
	D+pLCEcij3eZXy5viad8cGEIWAZdABVjWYFoeh1lbmx2A3RTA5EBcL+8F/LQ7iVkLN0I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
Message-Id: <E1nAaXx-0006OD-AU@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 16:44:25 +0000

commit 95b13fa43e0753b7514bef13abe28253e8614f62
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 12 16:36:29 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
    
    These were written before Spectre/Meltdown went public, and there was large
    uncertainty in how the protections would evolve.  As it turns out, they're
    very specific to Intel hardware, and not very suitable for AMD.
    
    Drop the macros, opencoding the relevant subset of functionality, and leaving
    grep-fodder to locate the logic.  No change at all for VT-x.
    
    For AMD, the only relevant piece of functionality is DO_OVERWRITE_RSB,
    although we will soon be adding (different) logic to handle MSR_SPEC_CTRL.
    
    This has a marginal improvement of removing an unconditional pile of long-nops
    from the vmentry/exit path.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/svm/entry.S             |  5 +++--
 xen/arch/x86/hvm/vmx/entry.S             |  8 ++++++--
 xen/arch/x86/include/asm/spec_ctrl_asm.h | 19 ++++---------------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index e208a4b32a..276215d36a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -59,7 +59,7 @@ __UNLIKELY_END(nsvm_hap)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
 
         pop  %r15
         pop  %r14
@@ -86,7 +86,8 @@ __UNLIKELY_END(nsvm_hap)
 
         GET_CURRENT(bx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: ac  */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         stgi
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 27c8c5ca49..30139ae58e 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -33,7 +33,9 @@ ENTRY(vmx_asm_vmexit_handler)
         movb $1,VCPU_vmx_launched(%rbx)
         mov  %rax,VCPU_hvm_guest_cr2(%rbx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
+        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -80,7 +82,9 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
 
diff --git a/xen/arch/x86/include/asm/spec_ctrl_asm.h b/xen/arch/x86/include/asm/spec_ctrl_asm.h
index cb34299a86..2b3f123cb5 100644
--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -68,14 +68,16 @@
  *
  * The following ASM fragments implement this algorithm.  See their local
  * comments for further details.
- *  - SPEC_CTRL_ENTRY_FROM_HVM
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
  *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
- *  - SPEC_CTRL_EXIT_TO_HVM
+ *
+ * Additionally, the following grep-fodder exists to find the HVM logic.
+ *  - SPEC_CTRL_ENTRY_FROM_{SVM,VMX}
+ *  - SPEC_CTRL_EXIT_TO_{SVM,VMX}
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
@@ -225,12 +227,6 @@
     wrmsr
 .endm
 
-/* Use after a VMEXIT from an HVM guest. */
-#define SPEC_CTRL_ENTRY_FROM_HVM                                        \
-    ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM;           \
-    ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM,                        \
-        X86_FEATURE_SC_MSR_HVM
-
 /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */
 #define SPEC_CTRL_ENTRY_FROM_PV                                         \
     ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_PV;            \
@@ -255,13 +251,6 @@
     ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
         X86_FEATURE_SC_VERW_PV
 
-/* Use when exiting to HVM guest context. */
-#define SPEC_CTRL_EXIT_TO_HVM                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM;             \
-    ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
-        X86_FEATURE_SC_VERW_HVM
-
 /*
  * Use in IST interrupt/exception context.  May interrupt Xen or PV context.
  * Fine grain control of SCF_ist_wrmsr is needed for safety in the S3 resume
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 16:44:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 16:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259151.447111 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaY8-00032l-M0; Thu, 20 Jan 2022 16:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259151.447111; Thu, 20 Jan 2022 16:44:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaY8-00032b-In; Thu, 20 Jan 2022 16:44:36 +0000
Received: by outflank-mailman (input) for mailman id 259151;
 Thu, 20 Jan 2022 16:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaY7-00032O-GW
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44: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 1nAaY7-0004xs-Fe
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaY7-0006Pm-E6
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cBsqz8YL4GHziwT0lSei8wSHiDv9bnKduJ7MxoSm8tQ=; b=qIzPkYlUNrU9O8UpGwfj0Ufn9l
	oGxPZ8NJD5KYWWDY9PcY5u4vvLSYfN1LDqb7SVlmGznU1ZV7Faa2RfSFanxdVcY+c+0yI+/vzYsFE
	MnZol6j+ydDxBX9VObcOTdmkufA7+RRkJro/q/4o6X8gvGaUuQsLoLbPwk4bZDiR4T0E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
Message-Id: <E1nAaY7-0006Pm-E6@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 16:44:35 +0000

commit 81f0eaadf84d273a6ff8df3660b874a02d0e7677
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 12 15:47:27 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
    
    The logic was based on a mistaken understanding of how NMI blocking on vmexit
    works.  NMIs are only blocked for EXIT_REASON_NMI, and not for general exits.
    Therefore, an NMI can in general hit early in the vmx_asm_vmexit_handler path,
    and the guest's value will be clobbered before it is saved.
    
    Switch to using MSR load/save lists.  This causes the guest value to be saved
    atomically with respect to NMIs/MCEs/etc.
    
    First, update vmx_cpuid_policy_changed() to configure the load/save lists at
    the same time as configuring the intercepts.  This function is always used in
    remote context, so extend the vmx_vmcs_{enter,exit}() block to cover the whole
    function, rather than having multiple remote acquisitions of the same VMCS.
    
    Both of vmx_{add,del}_guest_msr() can fail.  The -ESRCH delete case is fine,
    but all others are fatal to the running of the VM, so handle them using
    domain_crash() - this path is only used during domain construction anyway.
    
    Second, update vmx_{get,set}_reg() to use the MSR load/save lists rather than
    vcpu_msrs, and update the vcpu_msrs comment to describe the new state
    location.
    
    Finally, adjust the entry/exit asm.
    
    Because the guest value is saved and loaded atomically, we do not need to
    manually load the guest value, nor do we need to enable SCF_use_shadow.  This
    lets us remove the use of DO_SPEC_CTRL_EXIT_TO_GUEST.  Additionally,
    SPEC_CTRL_ENTRY_FROM_PV gets removed too, because on an early entry failure,
    we're no longer in the guest MSR_SPEC_CTRL context needing to switch back to
    Xen's context.
    
    The only action remaining is to load Xen's MSR_SPEC_CTRL value on vmexit.  We
    could in principle use the host msr list, but is expected to complicated
    future work.  Delete DO_SPEC_CTRL_ENTRY_FROM_HVM entirely, and use a shorter
    code sequence to simply reload Xen's setting from the top-of-stack block.
    
    Adjust the comment at the top of spec_ctrl_asm.h in light of this bugfix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/entry.S             | 22 ++++++++++------
 xen/arch/x86/hvm/vmx/vmx.c               | 44 +++++++++++++++++++++++++++++---
 xen/arch/x86/include/asm/msr.h           | 10 +++++++-
 xen/arch/x86/include/asm/spec_ctrl_asm.h | 32 +++--------------------
 4 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 30139ae58e..7ee3382fd0 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -35,7 +35,14 @@ ENTRY(vmx_asm_vmexit_handler)
 
         /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
-        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
+
+        .macro restore_spec_ctrl
+            mov    $MSR_SPEC_CTRL, %ecx
+            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            xor    %edx, %edx
+            wrmsr
+        .endm
+        ALTERNATIVE "", restore_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -82,8 +89,7 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
-        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: %rsp=regs/cpuinfo              Clob:    */
         ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
@@ -119,12 +125,12 @@ UNLIKELY_END(realmode)
         SAVE_ALL
 
         /*
-         * PV variant needed here as no guest code has executed (so
-         * MSR_SPEC_CTRL can't have changed value), and NMIs/MCEs are liable
-         * to hit (in which case the HVM variant might corrupt things).
+         * SPEC_CTRL_ENTRY notes
+         *
+         * If we end up here, no guest code has executed.  The MSR lists have
+         * not been processed, so we still have Xen's choice of MSR_SPEC_CTRL
+         * in context, and the RSB is unchanged.
          */
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 833a4af6f0..bcd0ec572c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -592,6 +592,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)
 static void vmx_cpuid_policy_changed(struct vcpu *v)
 {
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
+    int rc = 0;
 
     if ( opt_hvm_fep ||
          (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
@@ -601,17 +602,29 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
 
     /*
      * We can safely pass MSR_SPEC_CTRL through to the guest, even if STIBP
      * isn't enumerated in hardware, as SPEC_CTRL_STIBP is ignored.
      */
     if ( cp->feat.ibrsb )
+    {
         vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
+
+        rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
+        if ( rc )
+            goto out;
+    }
     else
+    {
         vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
 
+        rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
+        if ( rc && rc != -ESRCH )
+            goto out;
+        rc = 0; /* Tolerate -ESRCH */
+    }
+
     /* MSR_PRED_CMD is safe to pass through if the guest knows about it. */
     if ( cp->feat.ibrsb || cp->extd.ibpb )
         vmx_clear_msr_intercept(v, MSR_PRED_CMD,  VMX_MSR_RW);
@@ -623,6 +636,15 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
         vmx_clear_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
+
+ out:
+    vmx_vmcs_exit(v);
+
+    if ( rc )
+    {
+        printk(XENLOG_G_ERR "%pv MSR list error: %d", v, rc);
+        domain_crash(v->domain);
+    }
 }
 
 int vmx_guest_x86_mode(struct vcpu *v)
@@ -2402,11 +2424,20 @@ static int vmtrace_reset(struct vcpu *v)
 static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     struct domain *d = v->domain;
+    uint64_t val = 0;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        return v->arch.msrs->spec_ctrl.raw;
+        rc = vmx_read_guest_msr(v, reg, &val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
+        return val;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
@@ -2419,11 +2450,18 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     struct domain *d = v->domain;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        v->arch.msrs->spec_ctrl.raw = val;
+        rc = vmx_write_guest_msr(v, reg, val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
         break;
 
     default:
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 1d3eca9063..10039c2d22 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -287,7 +287,15 @@ extern struct msr_policy     raw_msr_policy,
 /* Container object for per-vCPU MSRs */
 struct vcpu_msrs
 {
-    /* 0x00000048 - MSR_SPEC_CTRL */
+    /*
+     * 0x00000048 - MSR_SPEC_CTRL
+     *
+     * For PV guests, this holds the guest kernel value.  It is accessed on
+     * every entry/exit path.
+     *
+     * For VT-x guests, the guest value is held in the MSR guest load/save
+     * list.
+     */
     struct {
         uint32_t raw;
     } spec_ctrl;
diff --git a/xen/arch/x86/include/asm/spec_ctrl_asm.h b/xen/arch/x86/include/asm/spec_ctrl_asm.h
index 2b3f123cb5..bf82528a12 100644
--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -42,9 +42,10 @@
  *     path, or late in the exit path after restoring the guest value.  This
  *     will corrupt the guest value.
  *
- * Factor 1 is dealt with by relying on NMIs/MCEs being blocked immediately
- * after VMEXIT.  The VMEXIT-specific code reads MSR_SPEC_CTRL and updates
- * current before loading Xen's MSR_SPEC_CTRL setting.
+ * Factor 1 is dealt with:
+ *   - On VMX by using MSR load/save lists to have vmentry/exit atomically
+ *     load/save the guest value.  Xen's value is loaded in regular code, and
+ *     there is no need to use the shadow logic (below).
  *
  * Factor 2 is harder.  We maintain a shadow_spec_ctrl value, and a use_shadow
  * boolean in the per cpu spec_ctrl_flags.  The synchronous use is:
@@ -128,31 +129,6 @@
 #endif
 .endm
 
-.macro DO_SPEC_CTRL_ENTRY_FROM_HVM
-/*
- * Requires %rbx=current, %rsp=regs/cpuinfo
- * Clobbers %rax, %rcx, %rdx
- *
- * The common case is that a guest has direct access to MSR_SPEC_CTRL, at
- * which point we need to save the guest value before setting IBRS for Xen.
- * Unilaterally saving the guest value is shorter and faster than checking.
- */
-    mov $MSR_SPEC_CTRL, %ecx
-    rdmsr
-
-    /* Stash the value from hardware. */
-    mov VCPU_arch_msrs(%rbx), %rdx
-    mov %eax, VCPUMSR_spec_ctrl_raw(%rdx)
-    xor %edx, %edx
-
-    /* Clear SPEC_CTRL shadowing *before* loading Xen's value. */
-    andb $~SCF_use_shadow, CPUINFO_spec_ctrl_flags(%rsp)
-
-    /* Load Xen's intended value. */
-    movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-    wrmsr
-.endm
-
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 20 16:44:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Jan 2022 16:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259152.447115 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaYI-00036Q-NL; Thu, 20 Jan 2022 16:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259152.447115; Thu, 20 Jan 2022 16:44:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAaYI-00036I-KL; Thu, 20 Jan 2022 16:44:46 +0000
Received: by outflank-mailman (input) for mailman id 259152;
 Thu, 20 Jan 2022 16:44:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaYH-000360-KX
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44: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 1nAaYH-0004y5-Jf
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAaYH-0006R7-Ic
 for xen-changelog@lists.xenproject.org; Thu, 20 Jan 2022 16:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eHDR4+WU3dLBV9mgt8Cy5fU+KUWqoW/1sxscnKp0Vrw=; b=Il9weZW3Yu7uqH2gYldeE560je
	r7NXrxdYytZUdK0pgYexcFXTxv6bEZ/V2ca+U4uwfLZ60+PT7CmnUbIp3Ey5QwwDOQV+pjxT9aMfN
	KRcRcxJLRJVOKsCKEmkmNUgsxugL8RJy9WLdSQW06oSSwek0gejy5JSVD/4AO11L7c2E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Drop hvm_{get,set}_guest_bndcfgs() and use {get,set}_regs() instead
Message-Id: <E1nAaYH-0006R7-Ic@xenbits.xenproject.org>
Date: Thu, 20 Jan 2022 16:44:45 +0000

commit 0626219dcc6a4376c1a4b04209d6c15d06e23875
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 17 18:40:50 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/hvm: Drop hvm_{get,set}_guest_bndcfgs() and use {get,set}_regs() instead
    
    hvm_{get,set}_guest_bndcfgs() are thin wrappers around accessing MSR_BNDCFGS.
    
    MPX was implemented on Skylake uarch CPUs and dropped in subsequent CPUs, and
    is disabled by default in Xen VMs.
    
    It would be nice to move all the logic into vmx_msr_{read,write}_intercept(),
    but the common HVM migration code uses guest_{rd,wr}msr().  Therefore, use
    {get,set}_regs() to reduce the quantity of "common" HVM code.
    
    In lieu of having hvm_set_guest_bndcfgs() split out, use some #ifdef
    CONFIG_HVM in guest_wrmsr().  In vmx_{get,set}_regs(), split the switch
    statements into two depending on whether the require remote VMCS acquisition
    or not.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c             | 37 --------------------------
 xen/arch/x86/hvm/vmx/vmx.c         | 54 ++++++++++++++++++--------------------
 xen/arch/x86/include/asm/hvm/hvm.h | 12 ---------
 xen/arch/x86/msr.c                 | 34 +++++++++++++++++++-----
 4 files changed, 53 insertions(+), 84 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b530e986e8..d7d3299b43 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -324,43 +324,6 @@ int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
     return 1;
 }
 
-bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val)
-{
-    if ( !hvm_funcs.set_guest_bndcfgs ||
-         !is_canonical_address(val) ||
-         (val & IA32_BNDCFGS_RESERVED) )
-        return false;
-
-    /*
-     * While MPX instructions are supposed to be gated on XCR0.BND*, let's
-     * nevertheless force the relevant XCR0 bits on when the feature is being
-     * enabled in BNDCFGS.
-     */
-    if ( (val & IA32_BNDCFGS_ENABLE) &&
-         !(v->arch.xcr0_accum & (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR)) )
-    {
-        uint64_t xcr0 = get_xcr0();
-        int rc;
-
-        if ( v != current )
-            return false;
-
-        rc = handle_xsetbv(XCR_XFEATURE_ENABLED_MASK,
-                           xcr0 | X86_XCR0_BNDREGS | X86_XCR0_BNDCSR);
-
-        if ( rc )
-        {
-            HVM_DBG_LOG(DBG_LEVEL_1, "Failed to force XCR0.BND*: %d", rc);
-            return false;
-        }
-
-        if ( handle_xsetbv(XCR_XFEATURE_ENABLED_MASK, xcr0) )
-            /* nothing, best effort only */;
-    }
-
-    return alternative_call(hvm_funcs.set_guest_bndcfgs, v, val);
-}
-
 /*
  * Get the ratio to scale host TSC frequency to gtsc_khz. zero will be
  * returned if TSC scaling is unavailable or ratio cannot be handled
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index bcd0ec572c..c44cf8f5d4 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1212,28 +1212,6 @@ static int vmx_get_guest_pat(struct vcpu *v, u64 *gpat)
     return 1;
 }
 
-static bool vmx_set_guest_bndcfgs(struct vcpu *v, u64 val)
-{
-    ASSERT(cpu_has_mpx && cpu_has_vmx_mpx);
-
-    vmx_vmcs_enter(v);
-    __vmwrite(GUEST_BNDCFGS, val);
-    vmx_vmcs_exit(v);
-
-    return true;
-}
-
-static bool vmx_get_guest_bndcfgs(struct vcpu *v, u64 *val)
-{
-    ASSERT(cpu_has_mpx && cpu_has_vmx_mpx);
-
-    vmx_vmcs_enter(v);
-    __vmread(GUEST_BNDCFGS, val);
-    vmx_vmcs_exit(v);
-
-    return true;
-}
-
 static void vmx_handle_cd(struct vcpu *v, unsigned long value)
 {
     if ( !paging_mode_hap(v->domain) )
@@ -2427,6 +2405,7 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
     uint64_t val = 0;
     int rc;
 
+    /* Logic which doesn't require remote VMCS acquisition. */
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
@@ -2438,13 +2417,25 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
             domain_crash(d);
         }
         return val;
+    }
+
+    /* Logic which maybe requires remote VMCS acquisition. */
+    vmx_vmcs_enter(v);
+    switch ( reg )
+    {
+    case MSR_IA32_BNDCFGS:
+        __vmread(GUEST_BNDCFGS, &val);
+        break;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
         domain_crash(d);
-        return 0;
+        break;
     }
+    vmx_vmcs_exit(v);
+
+    return val;
 }
 
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
@@ -2452,6 +2443,7 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
     struct domain *d = v->domain;
     int rc;
 
+    /* Logic which doesn't require remote VMCS acquisition. */
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
@@ -2462,6 +2454,15 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
                    __func__, v, reg, rc);
             domain_crash(d);
         }
+        return;
+    }
+
+    /* Logic which maybe requires remote VMCS acquisition. */
+    vmx_vmcs_enter(v);
+    switch ( reg )
+    {
+    case MSR_IA32_BNDCFGS:
+        __vmwrite(GUEST_BNDCFGS, val);
         break;
 
     default:
@@ -2469,6 +2470,7 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
                __func__, v, reg, val);
         domain_crash(d);
     }
+    vmx_vmcs_exit(v);
 }
 
 static struct hvm_function_table __initdata vmx_function_table = {
@@ -2792,12 +2794,6 @@ const struct hvm_function_table * __init start_vmx(void)
         vmx_function_table.tsc_scaling.setup = vmx_setup_tsc_scaling;
     }
 
-    if ( cpu_has_mpx && cpu_has_vmx_mpx )
-    {
-        vmx_function_table.set_guest_bndcfgs = vmx_set_guest_bndcfgs;
-        vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs;
-    }
-
     lbr_tsx_fixup_check();
     ler_to_fixup_check();
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 3ab177d9dd..842f98763c 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -149,9 +149,6 @@ struct hvm_function_table {
     int  (*get_guest_pat)(struct vcpu *v, u64 *);
     int  (*set_guest_pat)(struct vcpu *v, u64);
 
-    bool (*get_guest_bndcfgs)(struct vcpu *v, u64 *);
-    bool (*set_guest_bndcfgs)(struct vcpu *v, u64);
-
     void (*set_tsc_offset)(struct vcpu *v, u64 offset, u64 at_tsc);
 
     void (*inject_event)(const struct x86_event *event);
@@ -291,8 +288,6 @@ void hvm_set_segment_register(struct vcpu *v, enum x86_segment seg,
 
 void hvm_set_info_guest(struct vcpu *v);
 
-bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val);
-
 int hvm_vmexit_cpuid(struct cpu_user_regs *regs, unsigned int inst_len);
 void hvm_migrate_timers(struct vcpu *v);
 void hvm_do_resume(struct vcpu *v);
@@ -479,12 +474,6 @@ static inline unsigned long hvm_get_shadow_gs_base(struct vcpu *v)
     return alternative_call(hvm_funcs.get_shadow_gs_base, v);
 }
 
-static inline bool hvm_get_guest_bndcfgs(struct vcpu *v, u64 *val)
-{
-    return hvm_funcs.get_guest_bndcfgs &&
-           alternative_call(hvm_funcs.get_guest_bndcfgs, v, val);
-}
-
 #define has_hvm_params(d) \
     ((d)->arch.hvm.params != NULL)
 
@@ -767,7 +756,6 @@ int hvm_guest_x86_mode(struct vcpu *v);
 unsigned long hvm_get_shadow_gs_base(struct vcpu *v);
 void hvm_cpuid_policy_changed(struct vcpu *v);
 void hvm_set_tsc_offset(struct vcpu *v, uint64_t offset, uint64_t at_tsc);
-bool hvm_get_guest_bndcfgs(struct vcpu *v, uint64_t *val);
 
 /* End of prototype list */
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 71cbfa8ee3..2cc355575d 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -30,6 +30,7 @@
 #include <asm/msr.h>
 #include <asm/pv/domain.h>
 #include <asm/setup.h>
+#include <asm/xstate.h>
 
 #include <public/hvm/params.h>
 
@@ -323,10 +324,9 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         break;
 
     case MSR_IA32_BNDCFGS:
-        if ( !cp->feat.mpx || !is_hvm_domain(d) ||
-             !hvm_get_guest_bndcfgs(v, val) )
+        if ( !cp->feat.mpx ) /* Implies Intel HVM only */
             goto gp_fault;
-        break;
+        goto get_reg;
 
     case MSR_IA32_XSS:
         if ( !cp->xstate.xsaves )
@@ -593,11 +593,33 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         ret = guest_wrmsr_x2apic(v, msr, val);
         break;
 
+#ifdef CONFIG_HVM
     case MSR_IA32_BNDCFGS:
-        if ( !cp->feat.mpx || !is_hvm_domain(d) ||
-             !hvm_set_guest_bndcfgs(v, val) )
+        if ( !cp->feat.mpx || /* Implies Intel HVM only */
+             !is_canonical_address(val) || (val & IA32_BNDCFGS_RESERVED) )
             goto gp_fault;
-        break;
+
+        /*
+         * While MPX instructions are supposed to be gated on XCR0.BND*, let's
+         * nevertheless force the relevant XCR0 bits on when the feature is
+         * being enabled in BNDCFGS.
+         */
+        if ( (val & IA32_BNDCFGS_ENABLE) &&
+             !(v->arch.xcr0_accum & (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR)) )
+        {
+            uint64_t xcr0 = get_xcr0();
+
+            if ( v != current ||
+                 handle_xsetbv(XCR_XFEATURE_ENABLED_MASK,
+                               xcr0 | X86_XCR0_BNDREGS | X86_XCR0_BNDCSR) )
+                goto gp_fault;
+
+            if ( handle_xsetbv(XCR_XFEATURE_ENABLED_MASK, xcr0) )
+                /* nothing, best effort only */;
+        }
+
+        goto set_reg;
+#endif /* CONFIG_HVM */
 
     case MSR_IA32_XSS:
         if ( !cp->xstate.xsaves )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 10:11:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 10:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259301.447423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAqso-0004YC-TG; Fri, 21 Jan 2022 10:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259301.447423; Fri, 21 Jan 2022 10: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 1nAqso-0004Y4-QM; Fri, 21 Jan 2022 10:11:02 +0000
Received: by outflank-mailman (input) for mailman id 259301;
 Fri, 21 Jan 2022 10: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 1nAqso-0004Xy-8w
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 10: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 1nAqso-0001gn-82
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 10:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAqso-0007sB-78
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 10: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=U476eNmq7NRvVLCPfnTgecF7HSua2fiKWfplnukEcoM=; b=fAbOwctBrOVCQNKe4fRzjmUZV5
	sNoiQTJ7pvPwlXCThZfA398UB2mvDVaNUO/dkN+OlGPVruExKtoUm9ws4Wp+FuTglnLxnlFxNOnwG
	EqxUBWfdqAdUUX/gFNA+KFDos3PywU9TAcxkkKQxeVJg3yry88S4gVbFN4M6afjYBTvk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Drop .is_singlestep_supported() callback
Message-Id: <E1nAqso-0007sB-78@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 10:11:02 +0000

commit 4e1df69cc9f51b2e017af1da3ed5b45917642115
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 13 18:37:13 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 13:09:57 2022 +0000

    x86/hvm: Drop .is_singlestep_supported() callback
    
    There is absolutely no need for a function pointer call here.
    
    Drop the hook, introduce a singlestep_supported boolean, and configure it in
    start_vmx() like all other optional functionality.
    
    No functional change, but rather more efficient logic.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c         | 8 ++------
 xen/arch/x86/include/asm/hvm/hvm.h | 7 +++----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a7a0d66234..1c46669762 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2120,11 +2120,6 @@ static void vmx_enable_msr_interception(struct domain *d, uint32_t msr)
         vmx_set_msr_intercept(v, msr, VMX_MSR_W);
 }
 
-static bool_t vmx_is_singlestep_supported(void)
-{
-    return !!cpu_has_monitor_trap_flag;
-}
-
 static void vmx_vcpu_update_eptp(struct vcpu *v)
 {
     struct domain *d = v->domain;
@@ -2454,7 +2449,6 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .nhvm_domain_relinquish_resources = nvmx_domain_relinquish_resources,
     .nhvm_hap_walk_L1_p2m = nvmx_hap_walk_L1_p2m,
     .enable_msr_interception = vmx_enable_msr_interception,
-    .is_singlestep_supported = vmx_is_singlestep_supported,
     .altp2m_vcpu_update_p2m = vmx_vcpu_update_eptp,
     .altp2m_vcpu_update_vmfunc_ve = vmx_vcpu_update_vmfunc_ve,
     .altp2m_vcpu_emulate_ve = vmx_vcpu_emulate_ve,
@@ -2661,6 +2655,8 @@ const struct hvm_function_table * __init start_vmx(void)
         return NULL;
     }
 
+    vmx_function_table.singlestep_supported = cpu_has_monitor_trap_flag;
+
     if ( cpu_has_vmx_dt_exiting )
         vmx_function_table.set_descriptor_access_exiting =
             vmx_set_descriptor_access_exiting;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index b26302d9e7..9338cf25a6 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -97,6 +97,7 @@ struct hvm_function_table {
 
     /* Necessary hardware support for alternate p2m's? */
     bool altp2m_supported;
+    bool singlestep_supported;
 
     /* Hardware virtual interrupt delivery enable? */
     bool virtual_intr_delivery_enabled;
@@ -208,7 +209,6 @@ struct hvm_function_table {
                                 uint8_t *p2m_acc, struct npfec npfec);
 
     void (*enable_msr_interception)(struct domain *d, uint32_t msr);
-    bool_t (*is_singlestep_supported)(void);
 
     /* Alternate p2m */
     void (*altp2m_vcpu_update_p2m)(struct vcpu *v);
@@ -644,10 +644,9 @@ static inline void hvm_enable_msr_interception(struct domain *d, uint32_t msr)
     alternative_vcall(hvm_funcs.enable_msr_interception, d, msr);
 }
 
-static inline bool_t hvm_is_singlestep_supported(void)
+static inline bool hvm_is_singlestep_supported(void)
 {
-    return (hvm_funcs.is_singlestep_supported &&
-            alternative_call(hvm_funcs.is_singlestep_supported));
+    return hvm_funcs.singlestep_supported;
 }
 
 static inline bool hvm_hap_supported(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 12:11:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 12:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259326.447517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAskx-0003CM-GP; Fri, 21 Jan 2022 12:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259326.447517; Fri, 21 Jan 2022 12:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAskx-0003CE-Cb; Fri, 21 Jan 2022 12:11:03 +0000
Received: by outflank-mailman (input) for mailman id 259326;
 Fri, 21 Jan 2022 12: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 1nAskw-0003C8-Ay
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 12: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 1nAskw-0003n8-9D
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 12:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAskw-0008Dc-8A
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 12:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kaQ/8LJ16KeGATrHRoAOSzYc2E00ObwQqDgkB5yYKKQ=; b=cOVF2hROTSPhen1GzqiMKz0C6/
	4b73vbp/cVbHv40TgtfytcemmvE8HktolX0p1PNm1qHk5xFTlD0mhipFwG829iortkAUepvxBJZCt
	7CU2OFAUg/3L+HzyzBunZ7NefUeK53qjo29w9KoqZ5UgcPxjb8HXce4wiFfbuxQV+L38=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] fix wrong function declaration
Message-Id: <E1nAskw-0008Dc-8A@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 12:11:02 +0000

commit 2535683834cc33729cad8d444caa3c170942fe26
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 19 14:06:00 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 12:09:33 2022 +0000

    fix wrong function declaration
    
    Coverity spotted a wrong function declaration, fix it.
    
    Coverity-Id: 1497423
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 include/balloon.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/balloon.h b/include/balloon.h
index 8f7c8bd..510e475 100644
--- a/include/balloon.h
+++ b/include/balloon.h
@@ -50,7 +50,7 @@ static inline int chk_free_pages(unsigned long needed)
 {
     return needed <= nr_free_pages;
 }
-static inline balloon_set_nr_pages(unsigned long pages, unsigned long pfn) { }
+static inline void balloon_set_nr_pages(unsigned long pages, unsigned long pfn) { }
 
 #endif /* CONFIG_BALLOON */
 #endif /* _BALLOON_H_ */
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 14:11:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 14:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259361.447607 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAud8-0001nl-Ay; Fri, 21 Jan 2022 14:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259361.447607; Fri, 21 Jan 2022 14:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAud8-0001nc-7r; Fri, 21 Jan 2022 14:11:06 +0000
Received: by outflank-mailman (input) for mailman id 259361;
 Fri, 21 Jan 2022 14:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAud7-0001nW-3C
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAud7-0005y7-0O
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAud6-0000NF-Ve
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b2YUBpckY1r/pp2XtAbb9uJLULYN+ICb1tMxdOt2zOE=; b=UxPHVJM3Tl+EtDpPAnNgZEqIL9
	oFnFRc4aMXaNibS9qr8uRDNi1Q6+6Sz3AXdLhqMCMyTdpMLPvdsmJd1uyR5lq1YWvIo7PEWiVrfK9
	g5FubvujHyBYSwxD0r1rna4Tvwy7z0bM+mJo5XX1UD9Mx8iUcqpC9In7mrg1agO4Fwd0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Fix build with the get/set_reg() infrastructure
Message-Id: <E1nAud6-0000NF-Ve@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 14:11:04 +0000

commit 13caa585791234fe3e3719c8376f7ea731012451
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 21 10:19:00 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 12:42:11 2022 +0000

    x86: Fix build with the get/set_reg() infrastructure
    
    I clearly messed up concluding that the stubs were safe to drop.
    
    The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
    and CONFIG_HVM.  As a result logic of the form `if ( pv/hvm ) ... else ...`
    will always have one side which can't be DCE'd.
    
    While technically only the hvm stubs are needed, due to the use of the
    is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
    avoid leaving a bear trap for future users.
    
    Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/hvm.h   | 10 ++++++++++
 xen/arch/x86/include/asm/pv/domain.h | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 842f98763c..a441cbc221 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -854,6 +854,16 @@ static inline int hvm_vmtrace_get_option(
     return -EOPNOTSUPP;
 }
 
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/arch/x86/include/asm/pv/domain.h b/xen/arch/x86/include/asm/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/arch/x86/include/asm/pv/domain.h
+++ b/xen/arch/x86/include/asm/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, unsigned long cr4);
 /* Create a cr4 value to load into hardware, based on vcpu settings. */
 unsigned long pv_make_cr4(const struct vcpu *v);
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 bool xpti_pcid_enabled(void);
 
 #else  /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; }
 
 static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
 
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #endif	/* CONFIG_PV */
 
 void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 14:11:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 14:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259362.447611 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAudI-0001po-CS; Fri, 21 Jan 2022 14:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259362.447611; Fri, 21 Jan 2022 14:11:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAudI-0001pf-9O; Fri, 21 Jan 2022 14:11:16 +0000
Received: by outflank-mailman (input) for mailman id 259362;
 Fri, 21 Jan 2022 14:11:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAudH-0001pO-4R
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAudH-0005zy-3h
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAudH-0000O1-2k
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4ZdVXcHq5Qn/iInSdwx1s60frRmoYrnUHu9KieFZgZQ=; b=lMKx7xpiU7pLDP2hyn63pF4WVA
	lv3Zk84NS0wyjsbUW7wnHiLJZZodQ8+igYTlnJhnIJJYIYrOs3KelFkBHTFN+jKS/LY6LvY5+5ZMk
	z+Yc0llc6cLF81liC12M6mwIlIZB0cwO/13AlAX+HJCvLBKyHRZvWeHOvT0eWXQ03WUU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: use talloc_asprintf_append() in do_control_help()
Message-Id: <E1nAudH-0000O1-2k@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 14:11:15 +0000

commit c1c059fdfd9e01760af44f46d61ed2f5f4117b30
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Jan 20 07:59:47 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 12:42:11 2022 +0000

    tools/xenstore: use talloc_asprintf_append() in do_control_help()
    
    Instead of calculating the length of all help output and then
    allocating the space for it, just use talloc_asprintf_append() to
    expand the text as needed.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/xenstored_control.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 7b4300ef77..f0e00db633 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -853,36 +853,23 @@ static struct cmd_s cmds[] = {
 static int do_control_help(void *ctx, struct connection *conn,
 			   char **vec, int num)
 {
-	int cmd, len = 0;
+	int cmd;
 	char *resp;
 
 	if (num)
 		return EINVAL;
 
-	for (cmd = 0; cmd < ARRAY_SIZE(cmds); cmd++) {
-		len += strlen(cmds[cmd].cmd) + 1;
-		len += strlen(cmds[cmd].pars) + 1;
-	}
-	len++;
-
-	resp = talloc_array(ctx, char, len);
+	resp = talloc_asprintf(ctx, "%s", "");
 	if (!resp)
 		return ENOMEM;
-
-	len = 0;
 	for (cmd = 0; cmd < ARRAY_SIZE(cmds); cmd++) {
-		strcpy(resp + len, cmds[cmd].cmd);
-		len += strlen(cmds[cmd].cmd);
-		resp[len] = '\t';
-		len++;
-		strcpy(resp + len, cmds[cmd].pars);
-		len += strlen(cmds[cmd].pars);
-		resp[len] = '\n';
-		len++;
+		resp = talloc_asprintf_append(resp, "%s\t%s\n",
+					      cmds[cmd].cmd, cmds[cmd].pars);
+		if (!resp)
+			return ENOMEM;
 	}
-	resp[len] = 0;
 
-	send_reply(conn, XS_CONTROL, resp, len);
+	send_reply(conn, XS_CONTROL, resp, strlen(resp) + 1);
 	return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 14:11:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 14:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259363.447615 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAudS-0001t9-Ds; Fri, 21 Jan 2022 14:11:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259363.447615; Fri, 21 Jan 2022 14:11:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAudS-0001t1-Aq; Fri, 21 Jan 2022 14:11:26 +0000
Received: by outflank-mailman (input) for mailman id 259363;
 Fri, 21 Jan 2022 14:11:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAudR-0001sq-88
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAudR-00060J-71
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAudR-0000On-5y
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 14:11:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=85uGyosoik6AZpJjBqNLx6N5rdhS2Xx7tdZWVMg1msc=; b=1XuNLZIvjFiBigYJdeVkqLz0ha
	iDKHxs2r5XMQfw/3jEf0rqGiHcaaawygnqBdyhdHZYbxePPasMgGpWhhGuI36epugifwsujmt5U6e
	jvPqr3lc2a1cqMaV6+tA7xX5sCWMuB2zJLuUggj33+90H4FqMKR6ddzh50asNafqfss0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/x86: import intel-family.h from Linux
Message-Id: <E1nAudR-0000On-5y@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 14:11:25 +0000

commit d9bc1888d245a50f479c289caa95d2f7c6f9382c
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Jan 20 17:13:00 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 12:42:11 2022 +0000

    xen/x86: import intel-family.h from Linux
    
    Last commit to the file is:
    
    7d697f0d5737 x86/cpu: Drop spurious underscore from RAPTOR_LAKE #define
    
    This should help the readability of code that's currently open-coding
    Intel model numbers.
    
    No change introduced to existing code, it's expected that new code
    could start using the defines. Changing existing users could cause
    quite a lot of code churn.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/intel-family.h | 145 ++++++++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)

diff --git a/xen/arch/x86/include/asm/intel-family.h b/xen/arch/x86/include/asm/intel-family.h
new file mode 100644
index 0000000000..ffc49151be
--- /dev/null
+++ b/xen/arch/x86/include/asm/intel-family.h
@@ -0,0 +1,145 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_X86_INTEL_FAMILY_H
+#define _ASM_X86_INTEL_FAMILY_H
+
+/*
+ * "Big Core" Processors (Branded as Core, Xeon, etc...)
+ *
+ * While adding a new CPUID for a new microarchitecture, add a new
+ * group to keep logically sorted out in chronological order. Within
+ * that group keep the CPUID for the variants sorted by model number.
+ *
+ * The defined symbol names have the following form:
+ *	INTEL_FAM6{OPTFAMILY}_{MICROARCH}{OPTDIFF}
+ * where:
+ * OPTFAMILY	Describes the family of CPUs that this belongs to. Default
+ *		is assumed to be "_CORE" (and should be omitted). Other values
+ *		currently in use are _ATOM and _XEON_PHI
+ * MICROARCH	Is the code name for the micro-architecture for this core.
+ *		N.B. Not the platform name.
+ * OPTDIFF	If needed, a short string to differentiate by market segment.
+ *
+ *		Common OPTDIFFs:
+ *
+ *			- regular client parts
+ *		_L	- regular mobile parts
+ *		_G	- parts with extra graphics on
+ *		_X	- regular server parts
+ *		_D	- micro server parts
+ *
+ *		Historical OPTDIFFs:
+ *
+ *		_EP	- 2 socket server parts
+ *		_EX	- 4+ socket server parts
+ *
+ * The #define line may optionally include a comment including platform or core
+ * names. An exception is made for skylake/kabylake where steppings seem to have gotten
+ * their own names :-(
+ */
+
+#define INTEL_FAM6_CORE_YONAH		0x0E
+
+#define INTEL_FAM6_CORE2_MEROM		0x0F
+#define INTEL_FAM6_CORE2_MEROM_L	0x16
+#define INTEL_FAM6_CORE2_PENRYN		0x17
+#define INTEL_FAM6_CORE2_DUNNINGTON	0x1D
+
+#define INTEL_FAM6_NEHALEM		0x1E
+#define INTEL_FAM6_NEHALEM_G		0x1F /* Auburndale / Havendale */
+#define INTEL_FAM6_NEHALEM_EP		0x1A
+#define INTEL_FAM6_NEHALEM_EX		0x2E
+
+#define INTEL_FAM6_WESTMERE		0x25
+#define INTEL_FAM6_WESTMERE_EP		0x2C
+#define INTEL_FAM6_WESTMERE_EX		0x2F
+
+#define INTEL_FAM6_SANDYBRIDGE		0x2A
+#define INTEL_FAM6_SANDYBRIDGE_X	0x2D
+#define INTEL_FAM6_IVYBRIDGE		0x3A
+#define INTEL_FAM6_IVYBRIDGE_X		0x3E
+
+#define INTEL_FAM6_HASWELL		0x3C
+#define INTEL_FAM6_HASWELL_X		0x3F
+#define INTEL_FAM6_HASWELL_L		0x45
+#define INTEL_FAM6_HASWELL_G		0x46
+
+#define INTEL_FAM6_BROADWELL		0x3D
+#define INTEL_FAM6_BROADWELL_G		0x47
+#define INTEL_FAM6_BROADWELL_X		0x4F
+#define INTEL_FAM6_BROADWELL_D		0x56
+
+#define INTEL_FAM6_SKYLAKE_L		0x4E	/* Sky Lake             */
+#define INTEL_FAM6_SKYLAKE		0x5E	/* Sky Lake             */
+#define INTEL_FAM6_SKYLAKE_X		0x55	/* Sky Lake             */
+/*                 CASCADELAKE_X	0x55	   Sky Lake -- s: 7     */
+/*                 COOPERLAKE_X		0x55	   Sky Lake -- s: 11    */
+
+#define INTEL_FAM6_KABYLAKE_L		0x8E	/* Sky Lake             */
+/*                 AMBERLAKE_L		0x8E	   Sky Lake -- s: 9     */
+/*                 COFFEELAKE_L		0x8E	   Sky Lake -- s: 10    */
+/*                 WHISKEYLAKE_L	0x8E       Sky Lake -- s: 11,12 */
+
+#define INTEL_FAM6_KABYLAKE		0x9E	/* Sky Lake             */
+/*                 COFFEELAKE		0x9E	   Sky Lake -- s: 10-13 */
+
+#define INTEL_FAM6_COMETLAKE		0xA5	/* Sky Lake             */
+#define INTEL_FAM6_COMETLAKE_L		0xA6	/* Sky Lake             */
+
+#define INTEL_FAM6_CANNONLAKE_L		0x66	/* Palm Cove */
+
+#define INTEL_FAM6_ICELAKE_X		0x6A	/* Sunny Cove */
+#define INTEL_FAM6_ICELAKE_D		0x6C	/* Sunny Cove */
+#define INTEL_FAM6_ICELAKE		0x7D	/* Sunny Cove */
+#define INTEL_FAM6_ICELAKE_L		0x7E	/* Sunny Cove */
+#define INTEL_FAM6_ICELAKE_NNPI		0x9D	/* Sunny Cove */
+
+#define INTEL_FAM6_LAKEFIELD		0x8A	/* Sunny Cove / Tremont */
+
+#define INTEL_FAM6_ROCKETLAKE		0xA7	/* Cypress Cove */
+
+#define INTEL_FAM6_TIGERLAKE_L		0x8C	/* Willow Cove */
+#define INTEL_FAM6_TIGERLAKE		0x8D	/* Willow Cove */
+
+#define INTEL_FAM6_SAPPHIRERAPIDS_X	0x8F	/* Golden Cove */
+
+#define INTEL_FAM6_ALDERLAKE		0x97	/* Golden Cove / Gracemont */
+#define INTEL_FAM6_ALDERLAKE_L		0x9A	/* Golden Cove / Gracemont */
+
+#define INTEL_FAM6_RAPTORLAKE		0xB7
+
+/* "Small Core" Processors (Atom) */
+
+#define INTEL_FAM6_ATOM_BONNELL		0x1C /* Diamondville, Pineview */
+#define INTEL_FAM6_ATOM_BONNELL_MID	0x26 /* Silverthorne, Lincroft */
+
+#define INTEL_FAM6_ATOM_SALTWELL	0x36 /* Cedarview */
+#define INTEL_FAM6_ATOM_SALTWELL_MID	0x27 /* Penwell */
+#define INTEL_FAM6_ATOM_SALTWELL_TABLET	0x35 /* Cloverview */
+
+#define INTEL_FAM6_ATOM_SILVERMONT	0x37 /* Bay Trail, Valleyview */
+#define INTEL_FAM6_ATOM_SILVERMONT_D	0x4D /* Avaton, Rangely */
+#define INTEL_FAM6_ATOM_SILVERMONT_MID	0x4A /* Merriefield */
+
+#define INTEL_FAM6_ATOM_AIRMONT		0x4C /* Cherry Trail, Braswell */
+#define INTEL_FAM6_ATOM_AIRMONT_MID	0x5A /* Moorefield */
+#define INTEL_FAM6_ATOM_AIRMONT_NP	0x75 /* Lightning Mountain */
+
+#define INTEL_FAM6_ATOM_GOLDMONT	0x5C /* Apollo Lake */
+#define INTEL_FAM6_ATOM_GOLDMONT_D	0x5F /* Denverton */
+
+/* Note: the micro-architecture is "Goldmont Plus" */
+#define INTEL_FAM6_ATOM_GOLDMONT_PLUS	0x7A /* Gemini Lake */
+
+#define INTEL_FAM6_ATOM_TREMONT_D	0x86 /* Jacobsville */
+#define INTEL_FAM6_ATOM_TREMONT		0x96 /* Elkhart Lake */
+#define INTEL_FAM6_ATOM_TREMONT_L	0x9C /* Jasper Lake */
+
+/* Xeon Phi */
+
+#define INTEL_FAM6_XEON_PHI_KNL		0x57 /* Knights Landing */
+#define INTEL_FAM6_XEON_PHI_KNM		0x85 /* Knights Mill */
+
+/* Family 5 */
+#define INTEL_FAM5_QUARK_X1000		0x09 /* Quark X1000 SoC */
+
+#endif /* _ASM_X86_INTEL_FAMILY_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 15:44:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 15:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259407.447751 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAw57-0000JJ-Pg; Fri, 21 Jan 2022 15:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259407.447751; Fri, 21 Jan 2022 15:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAw57-0000JB-Mm; Fri, 21 Jan 2022 15:44:05 +0000
Received: by outflank-mailman (input) for mailman id 259407;
 Fri, 21 Jan 2022 15:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw56-0000J5-Es
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw56-0007eA-BX
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw56-0006zu-AR
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7gOil9vd/vzFT2vj1B8deT20apG5ktV2qm+x6jhCo5Q=; b=mH3Ngynf1fIC4CoSdBPblZwAJ/
	TuxsqJ1EI1HLQ3W4Lt6twqo7i5kpBeQD5RJ4BJlNx6LW+pquJc5O7MtHfNx3Ptrdbh556PNn+P+sw
	DyaMgktta6RJ+EwFQumchEHqHVTfT4LUowveKnpL23jcnaJa38rrQVzII4Ylw3M1xCaY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: merge hashtable_private.h into hashtable.c
Message-Id: <E1nAw56-0006zu-AR@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 15:44:04 +0000

commit 65e7c9410bda8262bb2d3a02cb51f011ba573c1b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 21 16:21:18 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 15:34:45 2022 +0000

    tools/xenstore: merge hashtable_private.h into hashtable.c
    
    hashtable_private.h is used in hashtable.c only.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/hashtable.c         | 31 ++++++++++++--
 tools/xenstore/hashtable_private.h | 85 --------------------------------------
 2 files changed, 27 insertions(+), 89 deletions(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index 394b1cf9d0..39fb3ed338 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -1,13 +1,29 @@
 /* Copyright (C) 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
 
 #include "hashtable.h"
-#include "hashtable_private.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
 #include <stdint.h>
 
+struct entry
+{
+    void *k, *v;
+    unsigned int h;
+    struct entry *next;
+};
+
+struct hashtable {
+    unsigned int tablelength;
+    struct entry **table;
+    unsigned int entrycount;
+    unsigned int loadlimit;
+    unsigned int primeindex;
+    unsigned int (*hashfn) (void *k);
+    int (*eqfn) (void *k1, void *k2);
+};
+
 /*
 Credit for primes table: Aaron Krowne
  http://br.endernet.org/~akrowne/
@@ -25,6 +41,13 @@ static const unsigned int primes[] = {
 const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
 const unsigned int max_load_factor = 65; /* percentage */
 
+/*****************************************************************************/
+/* indexFor */
+static inline unsigned int
+indexFor(unsigned int tablelength, unsigned int hashvalue) {
+    return (hashvalue % tablelength);
+}
+
 /*****************************************************************************/
 struct hashtable *
 create_hashtable(unsigned int minsize,
@@ -211,7 +234,7 @@ hashtable_remove(struct hashtable *h, void *k)
             *pE = e->next;
             h->entrycount--;
             v = e->v;
-            freekey(e->k);
+            free(e->k);
             free(e);
             return v;
         }
@@ -235,7 +258,7 @@ hashtable_destroy(struct hashtable *h, int free_values)
         {
             e = table[i];
             while (NULL != e)
-            { f = e; e = e->next; freekey(f->k); free(f->v); free(f); }
+            { f = e; e = e->next; free(f->k); free(f->v); free(f); }
         }
     }
     else
@@ -244,7 +267,7 @@ hashtable_destroy(struct hashtable *h, int free_values)
         {
             e = table[i];
             while (NULL != e)
-            { f = e; e = e->next; freekey(f->k); free(f); }
+            { f = e; e = e->next; free(f->k); free(f); }
         }
     }
     free(h->table);
diff --git a/tools/xenstore/hashtable_private.h b/tools/xenstore/hashtable_private.h
deleted file mode 100644
index 3e95f60057..0000000000
--- a/tools/xenstore/hashtable_private.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
-
-#ifndef __HASHTABLE_PRIVATE_CWC22_H__
-#define __HASHTABLE_PRIVATE_CWC22_H__
-
-#include "hashtable.h"
-
-/*****************************************************************************/
-struct entry
-{
-    void *k, *v;
-    unsigned int h;
-    struct entry *next;
-};
-
-struct hashtable {
-    unsigned int tablelength;
-    struct entry **table;
-    unsigned int entrycount;
-    unsigned int loadlimit;
-    unsigned int primeindex;
-    unsigned int (*hashfn) (void *k);
-    int (*eqfn) (void *k1, void *k2);
-};
-
-/*****************************************************************************/
-unsigned int
-hash(struct hashtable *h, void *k);
-
-/*****************************************************************************/
-/* indexFor */
-static inline unsigned int
-indexFor(unsigned int tablelength, unsigned int hashvalue) {
-    return (hashvalue % tablelength);
-};
-
-/* Only works if tablelength == 2^N */
-/*static inline unsigned int
-indexFor(unsigned int tablelength, unsigned int hashvalue)
-{
-    return (hashvalue & (tablelength - 1u));
-}
-*/
-
-/*****************************************************************************/
-#define freekey(X) free(X)
-/*define freekey(X) ; */
-
-
-/*****************************************************************************/
-
-#endif /* __HASHTABLE_PRIVATE_CWC22_H__*/
-
-/*
- * Copyright (c) 2002, Christopher Clark
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 
- * * Neither the name of the original author; nor the names of any contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * 
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 15:44:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 15:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259408.447755 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAw5H-0000LM-RR; Fri, 21 Jan 2022 15:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259408.447755; Fri, 21 Jan 2022 15:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAw5H-0000LE-OF; Fri, 21 Jan 2022 15:44:15 +0000
Received: by outflank-mailman (input) for mailman id 259408;
 Fri, 21 Jan 2022 15:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5G-0000L4-Ff
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5G-0007eX-Ev
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5G-00071H-Dm
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DD/0N5rP1v0JAKNzPehLVSUuMsGf1RM8UFZe+hBGGN4=; b=hlCNqgX+JUoEeGzqrdVMefOPKa
	y31pSmZk46A77gvBdGOLBf25dmSzEYtKnUKzuZKk8Q2WqodvngaI46/UqLegMFVBsfmqNtV7Siysq
	Nk1056IYHTMBa/EeP3prGjOnOvZF4+7hm62oJdHzS/2TgtQKh0tGk2ndiX64dTl3TvL0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: fix hashtable_expand() zeroing new area
Message-Id: <E1nAw5G-00071H-Dm@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 15:44:14 +0000

commit b977929d3646a390f1a7b4540fcd7a36aa59ff14
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 21 16:21:19 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 15:34:45 2022 +0000

    tools/xenstore: fix hashtable_expand() zeroing new area
    
    When realloc()ing the hashtable for expanding it, zero out all the new
    bytes at the end of the table, not only one byte for each new element.
    
    Fixes: 186f0e02a1c ("Added hashtable implementation")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/hashtable.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index 39fb3ed338..6ac336eff1 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -136,7 +136,8 @@ hashtable_expand(struct hashtable *h)
                    realloc(h->table, newsize * sizeof(struct entry *));
         if (NULL == newtable) { (h->primeindex)--; return 0; }
         h->table = newtable;
-        memset(newtable[h->tablelength], 0, newsize - h->tablelength);
+        memset(newtable + h->tablelength, 0,
+               (newsize - h->tablelength) * sizeof(*newtable));
         for (i = 0; i < h->tablelength; i++) {
             for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) {
                 index = indexFor(newsize,e->h);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 15:44:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 15:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259409.447759 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAw5R-0000PI-UQ; Fri, 21 Jan 2022 15:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259409.447759; Fri, 21 Jan 2022 15:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAw5R-0000PA-RL; Fri, 21 Jan 2022 15:44:25 +0000
Received: by outflank-mailman (input) for mailman id 259409;
 Fri, 21 Jan 2022 15:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5Q-0000Ow-Iv
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5Q-0007eq-I8
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5Q-00072X-HC
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nNGRZoHEzLeslLDY+lXcdS8fjcIFL+nJ48qIlgOkUOU=; b=WeHcKthgd/gWSkdBO7xou7af2U
	3Eye0R4FFscbP6df4PIABhy/Lebmcu1hPJOzNotJ8nOCklYuLbE5TFXfvrACnnSql74ORCbYnmB+7
	C/TT3mqD0gq9Ww2WqSMZdCwS4dNdtca9ziJNC3JhGy/rVFs/LugiRErLYUTJ9khMCz6g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: drop DEFINE_HASHTABLE_* macros and usage intro
Message-Id: <E1nAw5Q-00072X-HC@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 15:44:24 +0000

commit 447d514efe0db58d50ee89512856058793f1ba7b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 21 16:21:20 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 15:34:46 2022 +0000

    tools/xenstore: drop DEFINE_HASHTABLE_* macros and usage intro
    
    The DEFINE_HASHTABLE_* macros are used nowhere, so drop them.
    The usage intro isn't really needed either.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/hashtable.h | 76 ----------------------------------------------
 1 file changed, 76 deletions(-)

diff --git a/tools/xenstore/hashtable.h b/tools/xenstore/hashtable.h
index b90781abd4..62fef6081a 100644
--- a/tools/xenstore/hashtable.h
+++ b/tools/xenstore/hashtable.h
@@ -5,62 +5,6 @@
 
 struct hashtable;
 
-/* Example of use:
- *
- *      struct hashtable  *h;
- *      struct some_key   *k;
- *      struct some_value *v;
- *
- *      static unsigned int         hash_from_key_fn( void *k );
- *      static int                  keys_equal_fn ( void *key1, void *key2 );
- *
- *      h = create_hashtable(16, hash_from_key_fn, keys_equal_fn);
- *      k = (struct some_key *)     malloc(sizeof(struct some_key));
- *      v = (struct some_value *)   malloc(sizeof(struct some_value));
- *
- *      (initialise k and v to suitable values)
- * 
- *      if (! hashtable_insert(h,k,v) )
- *      {     exit(-1);               }
- *
- *      if (NULL == (found = hashtable_search(h,k) ))
- *      {    printf("not found!");                  }
- *
- *      if (NULL == (found = hashtable_remove(h,k) ))
- *      {    printf("Not found\n");                 }
- *
- */
-
-/* Macros may be used to define type-safe(r) hashtable access functions, with
- * methods specialized to take known key and value types as parameters.
- * 
- * Example:
- *
- * Insert this at the start of your file:
- *
- * DEFINE_HASHTABLE_INSERT(insert_some, struct some_key, struct some_value);
- * DEFINE_HASHTABLE_SEARCH(search_some, struct some_key, struct some_value);
- * DEFINE_HASHTABLE_REMOVE(remove_some, struct some_key, struct some_value);
- *
- * This defines the functions 'insert_some', 'search_some' and 'remove_some'.
- * These operate just like hashtable_insert etc., with the same parameters,
- * but their function signatures have 'struct some_key *' rather than
- * 'void *', and hence can generate compile time errors if your program is
- * supplying incorrect data as a key (and similarly for value).
- *
- * Note that the hash and key equality functions passed to create_hashtable
- * still take 'void *' parameters instead of 'some key *'. This shouldn't be
- * a difficult issue as they're only defined and passed once, and the other
- * functions will ensure that only valid keys are supplied to them.
- *
- * The cost for this checking is increased code size and runtime overhead
- * - if performance is important, it may be worth switching back to the
- * unsafe methods once your program has been debugged with the safe methods.
- * This just requires switching to some simple alternative defines - eg:
- * #define insert_some hashtable_insert
- *
- */
-
 /*****************************************************************************
  * create_hashtable
    
@@ -98,12 +42,6 @@ create_hashtable(unsigned int minsize,
 int 
 hashtable_insert(struct hashtable *h, void *k, void *v);
 
-#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \
-int fnname (struct hashtable *h, keytype *k, valuetype *v) \
-{ \
-    return hashtable_insert(h,k,v); \
-}
-
 /*****************************************************************************
  * hashtable_search
    
@@ -116,12 +54,6 @@ int fnname (struct hashtable *h, keytype *k, valuetype *v) \
 void *
 hashtable_search(struct hashtable *h, void *k);
 
-#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \
-valuetype * fnname (struct hashtable *h, keytype *k) \
-{ \
-    return (valuetype *) (hashtable_search(h,k)); \
-}
-
 /*****************************************************************************
  * hashtable_remove
    
@@ -134,13 +66,6 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
 void * /* returns value */
 hashtable_remove(struct hashtable *h, void *k);
 
-#define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \
-valuetype * fnname (struct hashtable *h, keytype *k) \
-{ \
-    return (valuetype *) (hashtable_remove(h,k)); \
-}
-
-
 /*****************************************************************************
  * hashtable_count
    
@@ -151,7 +76,6 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
 unsigned int
 hashtable_count(struct hashtable *h);
 
-
 /*****************************************************************************
  * hashtable_destroy
    
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 21 15:44:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Jan 2022 15:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259410.447763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAw5b-0000Rw-W4; Fri, 21 Jan 2022 15:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259410.447763; Fri, 21 Jan 2022 15:44:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nAw5b-0000Ro-Sw; Fri, 21 Jan 2022 15:44:35 +0000
Received: by outflank-mailman (input) for mailman id 259410;
 Fri, 21 Jan 2022 15:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5a-0000RY-M7
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5a-0007f0-LM
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nAw5a-00073Q-KR
 for xen-changelog@lists.xenproject.org; Fri, 21 Jan 2022 15:44:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lb4mhD66BZiWFYL0iwhfovAlcFt/aDJhxld6fwVCsO0=; b=QbZK/AhoIgn8rYJTog4UL7mWaS
	aWkG7EQ9A8BpAvmrMnkLAK4+3ACMXwjcBh7Agw9E+NIwbm68kl/7h2a1qc85SOiWJsMtmy81cTEgX
	rtyycg5NPWx76hT2ySDOgdKQYp4Gq6hlA1YMJnMbOfLEQorSItHrw3CwFR/c50X5JGHo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore: fix error handling of check_store()
Message-Id: <E1nAw5a-00073Q-KR@xenbits.xenproject.org>
Date: Fri, 21 Jan 2022 15:44:34 +0000

commit fe9be76d880b1d43b9dca471f45af3fd380ecb00
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 21 14:12:19 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 15:34:46 2022 +0000

    tools/xenstore: fix error handling of check_store()
    
    check_store() has an incomplete error handling: it doesn't check
    whether "root" allocation succeeded, and it is leaking the memory of
    "root" in case create_hashtable() fails.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/xenstored_core.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index c386ae6129..91d3adccb1 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2050,14 +2050,18 @@ static void clean_store(struct hashtable *reachable)
 
 void check_store(void)
 {
-	char * root = talloc_strdup(NULL, "/");
-	struct hashtable * reachable =
-		create_hashtable(16, hash_from_key_fn, keys_equal_fn);
- 
-	if (!reachable) {
+	char *root = talloc_strdup(NULL, "/");
+	struct hashtable *reachable;
+
+	if (!root) {
 		log("check_store: ENOMEM");
 		return;
 	}
+	reachable = create_hashtable(16, hash_from_key_fn, keys_equal_fn);
+	if (!reachable) {
+		log("check_store: ENOMEM");
+		goto out_root;
+	}
 
 	log("Checking store ...");
 	if (!check_store_(root, reachable) &&
@@ -2067,6 +2071,7 @@ void check_store(void)
 
 	hashtable_destroy(reachable, 0 /* Don't free values (they are all
 					  (void *)1) */);
+ out_root:
 	talloc_free(root);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259590.447994 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGrA-0000qt-1v; Sat, 22 Jan 2022 13:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259590.447994; Sat, 22 Jan 2022 13:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGr9-0000qh-Um; Sat, 22 Jan 2022 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 259590;
 Sat, 22 Jan 2022 13: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 1nBGr8-0000qX-E6
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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 1nBGr8-0001Yf-D2
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGr8-0006Cb-Bv
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ColXUbMsWIL6oL6nKl6y4fKy/4/mXrvUKLPP5kQ6rD4=; b=rx/juBm1b3b7Os+pw1uZuEDPda
	oFbHbqe7wIaTmLAMQ9wlNBjQ7opDPkWaQ6leYecE923xAHZnWexMBOE8dY3w3urZ/rwktmnlGrewT
	bw7ZzV7qMHPkoQiWS35BcHhr4zr5dlcOvMCK8IZj5A6srq4s7+vXA5gI6U/0Woe5vDm8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/guest: Introduce {get,set}_reg() infrastructure
Message-Id: <E1nBGr8-0006Cb-Bv@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:55:02 +0000

commit 88d3ff7ab15da277a85b39735797293fb541c718
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 17 12:28:39 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/guest: Introduce {get,set}_reg() infrastructure
    
    Various registers have per-guest-type or per-vendor locations or access
    requirements.  To support their use from common code, provide accessors which
    allow for per-guest-type behaviour.
    
    For now, just infrastructure handling default cases and expectations.
    Subsequent patches will start handling registers using this infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c               | 22 ++++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c           | 30 ++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c           | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/hvm/hvm.h   | 15 +++++++++++++++
 xen/arch/x86/include/asm/pv/domain.h |  4 ++++
 xen/arch/x86/pv/emulate.c            | 31 +++++++++++++++++++++++++++++++
 6 files changed, 133 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3b87506ac4..b530e986e8 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3744,6 +3744,28 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_call(hvm_funcs.get_reg, v, reg);
+    }
+}
+
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_vcall(hvm_funcs.set_reg, v, reg, val);
+    }
+}
+
 static bool is_sysdesc_access(const struct x86_emulate_state *state,
                               const struct x86_emulate_ctxt *ctxt)
 {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index fae39c4b4c..bb6b8e560a 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2469,6 +2469,33 @@ static bool svm_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t svm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
@@ -2518,6 +2545,9 @@ static struct hvm_function_table __initdata svm_function_table = {
     .nhvm_intr_blocked = nsvm_intr_blocked,
     .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
 
+    .get_reg = svm_get_reg,
+    .set_reg = svm_set_reg,
+
     .tsc_scaling = {
         .max_ratio = ~TSC_RATIO_RSVD_BITS,
     },
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 1c46669762..6b0455a1cf 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2399,6 +2399,33 @@ static int vmtrace_reset(struct vcpu *v)
     return 0;
 }
 
+static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2458,6 +2485,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .vmtrace_set_option = vmtrace_set_option,
     .vmtrace_get_option = vmtrace_get_option,
     .vmtrace_reset = vmtrace_reset,
+
+    .get_reg = vmx_get_reg,
+    .set_reg = vmx_set_reg,
+
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 9338cf25a6..3ab177d9dd 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -223,6 +223,9 @@ struct hvm_function_table {
     int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
     int (*vmtrace_reset)(struct vcpu *v);
 
+    uint64_t (*get_reg)(struct vcpu *v, unsigned int reg);
+    void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -728,6 +731,18 @@ static inline int hvm_vmtrace_reset(struct vcpu *v)
     return -EOPNOTSUPP;
 }
 
+/*
+ * Accessors for registers which have per-guest-type or per-vendor locations
+ * (e.g. VMCS, msr load/save lists, VMCB, VMLOAD lazy, etc).
+ *
+ * The caller is responsible for all auditing - these accessors do not fail,
+ * but do use domain_crash() for usage errors.
+ *
+ * Must cope with being called in non-current context.
+ */
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg);
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
diff --git a/xen/arch/x86/include/asm/pv/domain.h b/xen/arch/x86/include/asm/pv/domain.h
index df9716ff26..3a67816764 100644
--- a/xen/arch/x86/include/asm/pv/domain.h
+++ b/xen/arch/x86/include/asm/pv/domain.h
@@ -65,6 +65,10 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e8bb326efd..ae049b60f2 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -90,6 +90,37 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
     }
 }
 
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:55:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259591.447998 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGrK-0000sz-3H; Sat, 22 Jan 2022 13:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259591.447998; Sat, 22 Jan 2022 13:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGrK-0000sr-07; Sat, 22 Jan 2022 13:55:14 +0000
Received: by outflank-mailman (input) for mailman id 259591;
 Sat, 22 Jan 2022 13: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 1nBGrI-0000sj-Iw
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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 1nBGrI-0001Yk-I8
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGrI-0006DC-G6
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FiwE5BhR87bGS+RawG4PnZ4oSQzsUr7vkusa7eH7eTk=; b=rYj+7TiyrX24daM+ZjmTkh6xDi
	3mJ1n3fVULqJhNKL/QWxYHIMg51UI/LZ6JYu2wBlnw6Wgu4FVcUNLFfNWxT9Q4kC7b+F4lCIjwS69
	bZxXk0E0ma20YLzHyBDpAUewtsfQzJn1PT0XIVRpTro/KnfDVplbCxBXpSsgZ+q9jHMc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msr: Split MSR_SPEC_CTRL handling
Message-Id: <E1nBGrI-0006DC-G6@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:55:12 +0000

commit 6536688439dbca1d08fd6db5be29c39e3917fb2f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 12 13:52:47 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/msr: Split MSR_SPEC_CTRL handling
    
    In order to fix a VT-x bug, and support MSR_SPEC_CTRL on AMD, move
    MSR_SPEC_CTRL handling into the new {pv,hvm}_{get,set}_reg() infrastructure.
    
    Duplicate the msrs->spec_ctrl.raw accesses in the PV and VT-x paths for now.
    The SVM path is currently unreachable because of the CPUID policy.
    
    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 |  7 +++++++
 xen/arch/x86/msr.c         | 22 +++++++++++++++++-----
 xen/arch/x86/pv/emulate.c  |  9 +++++++++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 6b0455a1cf..833a4af6f0 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2405,6 +2405,9 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return v->arch.msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -2419,6 +2422,10 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        v->arch.msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index b834456c7b..71cbfa8ee3 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -28,6 +28,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/pv/domain.h>
 #include <asm/setup.h>
 
 #include <public/hvm/params.h>
@@ -265,8 +266,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_SPEC_CTRL:
         if ( !cp->feat.ibrsb )
             goto gp_fault;
-        *val = msrs->spec_ctrl.raw;
-        break;
+        goto get_reg;
 
     case MSR_INTEL_PLATFORM_INFO:
         *val = mp->platform_info.raw;
@@ -424,6 +424,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     return ret;
 
+ get_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        *val = pv_get_reg(v, msr);
+    else
+        *val = hvm_get_reg(v, msr);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
@@ -513,9 +520,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
         if ( val & rsvd )
             goto gp_fault; /* Rsvd bit set? */
-
-        msrs->spec_ctrl.raw = val;
-        break;
+        goto set_reg;
 
     case MSR_PRED_CMD:
         if ( !cp->feat.ibrsb && !cp->extd.ibpb )
@@ -663,6 +668,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
     return ret;
 
+ set_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        pv_set_reg(v, msr, val);
+    else
+        hvm_set_reg(v, msr, val);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index ae049b60f2..0a7907ec5e 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -92,12 +92,16 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 
 uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -108,12 +112,17 @@ uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 
 void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:55:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259592.448002 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGrU-0000wO-4e; Sat, 22 Jan 2022 13:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259592.448002; Sat, 22 Jan 2022 13:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGrU-0000wF-1f; Sat, 22 Jan 2022 13:55:24 +0000
Received: by outflank-mailman (input) for mailman id 259592;
 Sat, 22 Jan 2022 13: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 1nBGrS-0000vU-MF
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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 1nBGrS-0001Z0-LU
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGrS-0006Du-KT
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qCAGbNqnrf5gus9pB59Bn5XW6G2aYsiVD/o59IrFzzk=; b=bh9awLukTrlGHWB+Zevn2SxqEQ
	6VY82PMnfFHhKMpuXAiLzSFCkWr+0EYkridNkRZs9OZsAT6Su++P5KiwAOO//TD1taooqUx4foB+X
	KzBT4BixXKHhJuNheDF717YopwiAgUpGsxvIqy0V4whcWJYaTFfDCvBc8GWYtKKIlYTk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
Message-Id: <E1nBGrS-0006Du-KT@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:55:22 +0000

commit 95b13fa43e0753b7514bef13abe28253e8614f62
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 12 16:36:29 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
    
    These were written before Spectre/Meltdown went public, and there was large
    uncertainty in how the protections would evolve.  As it turns out, they're
    very specific to Intel hardware, and not very suitable for AMD.
    
    Drop the macros, opencoding the relevant subset of functionality, and leaving
    grep-fodder to locate the logic.  No change at all for VT-x.
    
    For AMD, the only relevant piece of functionality is DO_OVERWRITE_RSB,
    although we will soon be adding (different) logic to handle MSR_SPEC_CTRL.
    
    This has a marginal improvement of removing an unconditional pile of long-nops
    from the vmentry/exit path.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/svm/entry.S             |  5 +++--
 xen/arch/x86/hvm/vmx/entry.S             |  8 ++++++--
 xen/arch/x86/include/asm/spec_ctrl_asm.h | 19 ++++---------------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index e208a4b32a..276215d36a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -59,7 +59,7 @@ __UNLIKELY_END(nsvm_hap)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
 
         pop  %r15
         pop  %r14
@@ -86,7 +86,8 @@ __UNLIKELY_END(nsvm_hap)
 
         GET_CURRENT(bx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: ac  */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         stgi
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 27c8c5ca49..30139ae58e 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -33,7 +33,9 @@ ENTRY(vmx_asm_vmexit_handler)
         movb $1,VCPU_vmx_launched(%rbx)
         mov  %rax,VCPU_hvm_guest_cr2(%rbx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
+        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -80,7 +82,9 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
 
diff --git a/xen/arch/x86/include/asm/spec_ctrl_asm.h b/xen/arch/x86/include/asm/spec_ctrl_asm.h
index cb34299a86..2b3f123cb5 100644
--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -68,14 +68,16 @@
  *
  * The following ASM fragments implement this algorithm.  See their local
  * comments for further details.
- *  - SPEC_CTRL_ENTRY_FROM_HVM
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
  *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
- *  - SPEC_CTRL_EXIT_TO_HVM
+ *
+ * Additionally, the following grep-fodder exists to find the HVM logic.
+ *  - SPEC_CTRL_ENTRY_FROM_{SVM,VMX}
+ *  - SPEC_CTRL_EXIT_TO_{SVM,VMX}
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
@@ -225,12 +227,6 @@
     wrmsr
 .endm
 
-/* Use after a VMEXIT from an HVM guest. */
-#define SPEC_CTRL_ENTRY_FROM_HVM                                        \
-    ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM;           \
-    ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM,                        \
-        X86_FEATURE_SC_MSR_HVM
-
 /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */
 #define SPEC_CTRL_ENTRY_FROM_PV                                         \
     ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_PV;            \
@@ -255,13 +251,6 @@
     ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
         X86_FEATURE_SC_VERW_PV
 
-/* Use when exiting to HVM guest context. */
-#define SPEC_CTRL_EXIT_TO_HVM                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM;             \
-    ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
-        X86_FEATURE_SC_VERW_HVM
-
 /*
  * Use in IST interrupt/exception context.  May interrupt Xen or PV context.
  * Fine grain control of SCF_ist_wrmsr is needed for safety in the S3 resume
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:55:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259593.448005 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGre-0000zc-73; Sat, 22 Jan 2022 13:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259593.448005; Sat, 22 Jan 2022 13:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGre-0000zV-3h; Sat, 22 Jan 2022 13:55:34 +0000
Received: by outflank-mailman (input) for mailman id 259593;
 Sat, 22 Jan 2022 13: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 1nBGrc-0000zH-Pn
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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 1nBGrc-0001ZR-Ow
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGrc-0006F0-O7
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+IjwbE/FI53y8u2Jx7sfjCUmLPmsl7W3nuJf1+bO0pg=; b=bvGJloFIFZG1ogOWVuPIgcOgVw
	h0E2zYRETYVt81r84JzHhUNhGfNxe62SSv93iYi7+KpPsUHjfOba8o4nC4tpGlyTnmcfH4x12uG8p
	y56+HrI5PdeMbajkHLhvssiBz387KIFD/o1A7aT0i/YjH/RDt6ICA0Tk7tAAdg01Kr3I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
Message-Id: <E1nBGrc-0006F0-O7@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:55:32 +0000

commit 81f0eaadf84d273a6ff8df3660b874a02d0e7677
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 12 15:47:27 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
    
    The logic was based on a mistaken understanding of how NMI blocking on vmexit
    works.  NMIs are only blocked for EXIT_REASON_NMI, and not for general exits.
    Therefore, an NMI can in general hit early in the vmx_asm_vmexit_handler path,
    and the guest's value will be clobbered before it is saved.
    
    Switch to using MSR load/save lists.  This causes the guest value to be saved
    atomically with respect to NMIs/MCEs/etc.
    
    First, update vmx_cpuid_policy_changed() to configure the load/save lists at
    the same time as configuring the intercepts.  This function is always used in
    remote context, so extend the vmx_vmcs_{enter,exit}() block to cover the whole
    function, rather than having multiple remote acquisitions of the same VMCS.
    
    Both of vmx_{add,del}_guest_msr() can fail.  The -ESRCH delete case is fine,
    but all others are fatal to the running of the VM, so handle them using
    domain_crash() - this path is only used during domain construction anyway.
    
    Second, update vmx_{get,set}_reg() to use the MSR load/save lists rather than
    vcpu_msrs, and update the vcpu_msrs comment to describe the new state
    location.
    
    Finally, adjust the entry/exit asm.
    
    Because the guest value is saved and loaded atomically, we do not need to
    manually load the guest value, nor do we need to enable SCF_use_shadow.  This
    lets us remove the use of DO_SPEC_CTRL_EXIT_TO_GUEST.  Additionally,
    SPEC_CTRL_ENTRY_FROM_PV gets removed too, because on an early entry failure,
    we're no longer in the guest MSR_SPEC_CTRL context needing to switch back to
    Xen's context.
    
    The only action remaining is to load Xen's MSR_SPEC_CTRL value on vmexit.  We
    could in principle use the host msr list, but is expected to complicated
    future work.  Delete DO_SPEC_CTRL_ENTRY_FROM_HVM entirely, and use a shorter
    code sequence to simply reload Xen's setting from the top-of-stack block.
    
    Adjust the comment at the top of spec_ctrl_asm.h in light of this bugfix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/entry.S             | 22 ++++++++++------
 xen/arch/x86/hvm/vmx/vmx.c               | 44 +++++++++++++++++++++++++++++---
 xen/arch/x86/include/asm/msr.h           | 10 +++++++-
 xen/arch/x86/include/asm/spec_ctrl_asm.h | 32 +++--------------------
 4 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 30139ae58e..7ee3382fd0 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -35,7 +35,14 @@ ENTRY(vmx_asm_vmexit_handler)
 
         /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
-        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
+
+        .macro restore_spec_ctrl
+            mov    $MSR_SPEC_CTRL, %ecx
+            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            xor    %edx, %edx
+            wrmsr
+        .endm
+        ALTERNATIVE "", restore_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -82,8 +89,7 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
-        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: %rsp=regs/cpuinfo              Clob:    */
         ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
@@ -119,12 +125,12 @@ UNLIKELY_END(realmode)
         SAVE_ALL
 
         /*
-         * PV variant needed here as no guest code has executed (so
-         * MSR_SPEC_CTRL can't have changed value), and NMIs/MCEs are liable
-         * to hit (in which case the HVM variant might corrupt things).
+         * SPEC_CTRL_ENTRY notes
+         *
+         * If we end up here, no guest code has executed.  The MSR lists have
+         * not been processed, so we still have Xen's choice of MSR_SPEC_CTRL
+         * in context, and the RSB is unchanged.
          */
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 833a4af6f0..bcd0ec572c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -592,6 +592,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)
 static void vmx_cpuid_policy_changed(struct vcpu *v)
 {
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
+    int rc = 0;
 
     if ( opt_hvm_fep ||
          (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
@@ -601,17 +602,29 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
 
     /*
      * We can safely pass MSR_SPEC_CTRL through to the guest, even if STIBP
      * isn't enumerated in hardware, as SPEC_CTRL_STIBP is ignored.
      */
     if ( cp->feat.ibrsb )
+    {
         vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
+
+        rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
+        if ( rc )
+            goto out;
+    }
     else
+    {
         vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
 
+        rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
+        if ( rc && rc != -ESRCH )
+            goto out;
+        rc = 0; /* Tolerate -ESRCH */
+    }
+
     /* MSR_PRED_CMD is safe to pass through if the guest knows about it. */
     if ( cp->feat.ibrsb || cp->extd.ibpb )
         vmx_clear_msr_intercept(v, MSR_PRED_CMD,  VMX_MSR_RW);
@@ -623,6 +636,15 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
         vmx_clear_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
+
+ out:
+    vmx_vmcs_exit(v);
+
+    if ( rc )
+    {
+        printk(XENLOG_G_ERR "%pv MSR list error: %d", v, rc);
+        domain_crash(v->domain);
+    }
 }
 
 int vmx_guest_x86_mode(struct vcpu *v)
@@ -2402,11 +2424,20 @@ static int vmtrace_reset(struct vcpu *v)
 static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     struct domain *d = v->domain;
+    uint64_t val = 0;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        return v->arch.msrs->spec_ctrl.raw;
+        rc = vmx_read_guest_msr(v, reg, &val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
+        return val;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
@@ -2419,11 +2450,18 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     struct domain *d = v->domain;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        v->arch.msrs->spec_ctrl.raw = val;
+        rc = vmx_write_guest_msr(v, reg, val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
         break;
 
     default:
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 1d3eca9063..10039c2d22 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -287,7 +287,15 @@ extern struct msr_policy     raw_msr_policy,
 /* Container object for per-vCPU MSRs */
 struct vcpu_msrs
 {
-    /* 0x00000048 - MSR_SPEC_CTRL */
+    /*
+     * 0x00000048 - MSR_SPEC_CTRL
+     *
+     * For PV guests, this holds the guest kernel value.  It is accessed on
+     * every entry/exit path.
+     *
+     * For VT-x guests, the guest value is held in the MSR guest load/save
+     * list.
+     */
     struct {
         uint32_t raw;
     } spec_ctrl;
diff --git a/xen/arch/x86/include/asm/spec_ctrl_asm.h b/xen/arch/x86/include/asm/spec_ctrl_asm.h
index 2b3f123cb5..bf82528a12 100644
--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -42,9 +42,10 @@
  *     path, or late in the exit path after restoring the guest value.  This
  *     will corrupt the guest value.
  *
- * Factor 1 is dealt with by relying on NMIs/MCEs being blocked immediately
- * after VMEXIT.  The VMEXIT-specific code reads MSR_SPEC_CTRL and updates
- * current before loading Xen's MSR_SPEC_CTRL setting.
+ * Factor 1 is dealt with:
+ *   - On VMX by using MSR load/save lists to have vmentry/exit atomically
+ *     load/save the guest value.  Xen's value is loaded in regular code, and
+ *     there is no need to use the shadow logic (below).
  *
  * Factor 2 is harder.  We maintain a shadow_spec_ctrl value, and a use_shadow
  * boolean in the per cpu spec_ctrl_flags.  The synchronous use is:
@@ -128,31 +129,6 @@
 #endif
 .endm
 
-.macro DO_SPEC_CTRL_ENTRY_FROM_HVM
-/*
- * Requires %rbx=current, %rsp=regs/cpuinfo
- * Clobbers %rax, %rcx, %rdx
- *
- * The common case is that a guest has direct access to MSR_SPEC_CTRL, at
- * which point we need to save the guest value before setting IBRS for Xen.
- * Unilaterally saving the guest value is shorter and faster than checking.
- */
-    mov $MSR_SPEC_CTRL, %ecx
-    rdmsr
-
-    /* Stash the value from hardware. */
-    mov VCPU_arch_msrs(%rbx), %rdx
-    mov %eax, VCPUMSR_spec_ctrl_raw(%rdx)
-    xor %edx, %edx
-
-    /* Clear SPEC_CTRL shadowing *before* loading Xen's value. */
-    andb $~SCF_use_shadow, CPUINFO_spec_ctrl_flags(%rsp)
-
-    /* Load Xen's intended value. */
-    movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-    wrmsr
-.endm
-
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:55:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259594.448010 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGro-00012n-AR; Sat, 22 Jan 2022 13:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259594.448010; Sat, 22 Jan 2022 13:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGro-00012f-7B; Sat, 22 Jan 2022 13:55:44 +0000
Received: by outflank-mailman (input) for mailman id 259594;
 Sat, 22 Jan 2022 13: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 1nBGrm-00012T-TU
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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 1nBGrm-0001Zb-Sh
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGrm-0006Fd-Rm
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pOHuhuLb5np5VNiiLUsWNxrM3769/V4etcvC2mO5MVw=; b=L1oLYR1ix/1Z6S8mDGqGMDCvnl
	unDOrDCt6DN45tA/xK8scChC+pcDK7tTi7tLXEXX7Y9vjEbXh25sKeDQxGah6F3sin3emXWbNZwDs
	HL73+4dtUxmSjoG8comAweIy0JP2W2cFgpdVjoR1S+PoOtiRrBElIara5s+2JsGQbDp0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Drop hvm_{get,set}_guest_bndcfgs() and use {get,set}_regs() instead
Message-Id: <E1nBGrm-0006Fd-Rm@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:55:42 +0000

commit 0626219dcc6a4376c1a4b04209d6c15d06e23875
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 17 18:40:50 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 20 16:32:11 2022 +0000

    x86/hvm: Drop hvm_{get,set}_guest_bndcfgs() and use {get,set}_regs() instead
    
    hvm_{get,set}_guest_bndcfgs() are thin wrappers around accessing MSR_BNDCFGS.
    
    MPX was implemented on Skylake uarch CPUs and dropped in subsequent CPUs, and
    is disabled by default in Xen VMs.
    
    It would be nice to move all the logic into vmx_msr_{read,write}_intercept(),
    but the common HVM migration code uses guest_{rd,wr}msr().  Therefore, use
    {get,set}_regs() to reduce the quantity of "common" HVM code.
    
    In lieu of having hvm_set_guest_bndcfgs() split out, use some #ifdef
    CONFIG_HVM in guest_wrmsr().  In vmx_{get,set}_regs(), split the switch
    statements into two depending on whether the require remote VMCS acquisition
    or not.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c             | 37 --------------------------
 xen/arch/x86/hvm/vmx/vmx.c         | 54 ++++++++++++++++++--------------------
 xen/arch/x86/include/asm/hvm/hvm.h | 12 ---------
 xen/arch/x86/msr.c                 | 34 +++++++++++++++++++-----
 4 files changed, 53 insertions(+), 84 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b530e986e8..d7d3299b43 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -324,43 +324,6 @@ int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
     return 1;
 }
 
-bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val)
-{
-    if ( !hvm_funcs.set_guest_bndcfgs ||
-         !is_canonical_address(val) ||
-         (val & IA32_BNDCFGS_RESERVED) )
-        return false;
-
-    /*
-     * While MPX instructions are supposed to be gated on XCR0.BND*, let's
-     * nevertheless force the relevant XCR0 bits on when the feature is being
-     * enabled in BNDCFGS.
-     */
-    if ( (val & IA32_BNDCFGS_ENABLE) &&
-         !(v->arch.xcr0_accum & (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR)) )
-    {
-        uint64_t xcr0 = get_xcr0();
-        int rc;
-
-        if ( v != current )
-            return false;
-
-        rc = handle_xsetbv(XCR_XFEATURE_ENABLED_MASK,
-                           xcr0 | X86_XCR0_BNDREGS | X86_XCR0_BNDCSR);
-
-        if ( rc )
-        {
-            HVM_DBG_LOG(DBG_LEVEL_1, "Failed to force XCR0.BND*: %d", rc);
-            return false;
-        }
-
-        if ( handle_xsetbv(XCR_XFEATURE_ENABLED_MASK, xcr0) )
-            /* nothing, best effort only */;
-    }
-
-    return alternative_call(hvm_funcs.set_guest_bndcfgs, v, val);
-}
-
 /*
  * Get the ratio to scale host TSC frequency to gtsc_khz. zero will be
  * returned if TSC scaling is unavailable or ratio cannot be handled
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index bcd0ec572c..c44cf8f5d4 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1212,28 +1212,6 @@ static int vmx_get_guest_pat(struct vcpu *v, u64 *gpat)
     return 1;
 }
 
-static bool vmx_set_guest_bndcfgs(struct vcpu *v, u64 val)
-{
-    ASSERT(cpu_has_mpx && cpu_has_vmx_mpx);
-
-    vmx_vmcs_enter(v);
-    __vmwrite(GUEST_BNDCFGS, val);
-    vmx_vmcs_exit(v);
-
-    return true;
-}
-
-static bool vmx_get_guest_bndcfgs(struct vcpu *v, u64 *val)
-{
-    ASSERT(cpu_has_mpx && cpu_has_vmx_mpx);
-
-    vmx_vmcs_enter(v);
-    __vmread(GUEST_BNDCFGS, val);
-    vmx_vmcs_exit(v);
-
-    return true;
-}
-
 static void vmx_handle_cd(struct vcpu *v, unsigned long value)
 {
     if ( !paging_mode_hap(v->domain) )
@@ -2427,6 +2405,7 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
     uint64_t val = 0;
     int rc;
 
+    /* Logic which doesn't require remote VMCS acquisition. */
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
@@ -2438,13 +2417,25 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
             domain_crash(d);
         }
         return val;
+    }
+
+    /* Logic which maybe requires remote VMCS acquisition. */
+    vmx_vmcs_enter(v);
+    switch ( reg )
+    {
+    case MSR_IA32_BNDCFGS:
+        __vmread(GUEST_BNDCFGS, &val);
+        break;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
         domain_crash(d);
-        return 0;
+        break;
     }
+    vmx_vmcs_exit(v);
+
+    return val;
 }
 
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
@@ -2452,6 +2443,7 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
     struct domain *d = v->domain;
     int rc;
 
+    /* Logic which doesn't require remote VMCS acquisition. */
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
@@ -2462,6 +2454,15 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
                    __func__, v, reg, rc);
             domain_crash(d);
         }
+        return;
+    }
+
+    /* Logic which maybe requires remote VMCS acquisition. */
+    vmx_vmcs_enter(v);
+    switch ( reg )
+    {
+    case MSR_IA32_BNDCFGS:
+        __vmwrite(GUEST_BNDCFGS, val);
         break;
 
     default:
@@ -2469,6 +2470,7 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
                __func__, v, reg, val);
         domain_crash(d);
     }
+    vmx_vmcs_exit(v);
 }
 
 static struct hvm_function_table __initdata vmx_function_table = {
@@ -2792,12 +2794,6 @@ const struct hvm_function_table * __init start_vmx(void)
         vmx_function_table.tsc_scaling.setup = vmx_setup_tsc_scaling;
     }
 
-    if ( cpu_has_mpx && cpu_has_vmx_mpx )
-    {
-        vmx_function_table.set_guest_bndcfgs = vmx_set_guest_bndcfgs;
-        vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs;
-    }
-
     lbr_tsx_fixup_check();
     ler_to_fixup_check();
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 3ab177d9dd..842f98763c 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -149,9 +149,6 @@ struct hvm_function_table {
     int  (*get_guest_pat)(struct vcpu *v, u64 *);
     int  (*set_guest_pat)(struct vcpu *v, u64);
 
-    bool (*get_guest_bndcfgs)(struct vcpu *v, u64 *);
-    bool (*set_guest_bndcfgs)(struct vcpu *v, u64);
-
     void (*set_tsc_offset)(struct vcpu *v, u64 offset, u64 at_tsc);
 
     void (*inject_event)(const struct x86_event *event);
@@ -291,8 +288,6 @@ void hvm_set_segment_register(struct vcpu *v, enum x86_segment seg,
 
 void hvm_set_info_guest(struct vcpu *v);
 
-bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val);
-
 int hvm_vmexit_cpuid(struct cpu_user_regs *regs, unsigned int inst_len);
 void hvm_migrate_timers(struct vcpu *v);
 void hvm_do_resume(struct vcpu *v);
@@ -479,12 +474,6 @@ static inline unsigned long hvm_get_shadow_gs_base(struct vcpu *v)
     return alternative_call(hvm_funcs.get_shadow_gs_base, v);
 }
 
-static inline bool hvm_get_guest_bndcfgs(struct vcpu *v, u64 *val)
-{
-    return hvm_funcs.get_guest_bndcfgs &&
-           alternative_call(hvm_funcs.get_guest_bndcfgs, v, val);
-}
-
 #define has_hvm_params(d) \
     ((d)->arch.hvm.params != NULL)
 
@@ -767,7 +756,6 @@ int hvm_guest_x86_mode(struct vcpu *v);
 unsigned long hvm_get_shadow_gs_base(struct vcpu *v);
 void hvm_cpuid_policy_changed(struct vcpu *v);
 void hvm_set_tsc_offset(struct vcpu *v, uint64_t offset, uint64_t at_tsc);
-bool hvm_get_guest_bndcfgs(struct vcpu *v, uint64_t *val);
 
 /* End of prototype list */
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 71cbfa8ee3..2cc355575d 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -30,6 +30,7 @@
 #include <asm/msr.h>
 #include <asm/pv/domain.h>
 #include <asm/setup.h>
+#include <asm/xstate.h>
 
 #include <public/hvm/params.h>
 
@@ -323,10 +324,9 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         break;
 
     case MSR_IA32_BNDCFGS:
-        if ( !cp->feat.mpx || !is_hvm_domain(d) ||
-             !hvm_get_guest_bndcfgs(v, val) )
+        if ( !cp->feat.mpx ) /* Implies Intel HVM only */
             goto gp_fault;
-        break;
+        goto get_reg;
 
     case MSR_IA32_XSS:
         if ( !cp->xstate.xsaves )
@@ -593,11 +593,33 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         ret = guest_wrmsr_x2apic(v, msr, val);
         break;
 
+#ifdef CONFIG_HVM
     case MSR_IA32_BNDCFGS:
-        if ( !cp->feat.mpx || !is_hvm_domain(d) ||
-             !hvm_set_guest_bndcfgs(v, val) )
+        if ( !cp->feat.mpx || /* Implies Intel HVM only */
+             !is_canonical_address(val) || (val & IA32_BNDCFGS_RESERVED) )
             goto gp_fault;
-        break;
+
+        /*
+         * While MPX instructions are supposed to be gated on XCR0.BND*, let's
+         * nevertheless force the relevant XCR0 bits on when the feature is
+         * being enabled in BNDCFGS.
+         */
+        if ( (val & IA32_BNDCFGS_ENABLE) &&
+             !(v->arch.xcr0_accum & (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR)) )
+        {
+            uint64_t xcr0 = get_xcr0();
+
+            if ( v != current ||
+                 handle_xsetbv(XCR_XFEATURE_ENABLED_MASK,
+                               xcr0 | X86_XCR0_BNDREGS | X86_XCR0_BNDCSR) )
+                goto gp_fault;
+
+            if ( handle_xsetbv(XCR_XFEATURE_ENABLED_MASK, xcr0) )
+                /* nothing, best effort only */;
+        }
+
+        goto set_reg;
+#endif /* CONFIG_HVM */
 
     case MSR_IA32_XSS:
         if ( !cp->xstate.xsaves )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:55:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259595.448014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGry-00015B-Bt; Sat, 22 Jan 2022 13:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259595.448014; Sat, 22 Jan 2022 13:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGry-000154-8k; Sat, 22 Jan 2022 13:55:54 +0000
Received: by outflank-mailman (input) for mailman id 259595;
 Sat, 22 Jan 2022 13:55: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 1nBGrx-00014h-0Q
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55: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 1nBGrw-0001Zl-W0
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGrw-0006GE-VC
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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=uXPR8DKwG6Drqf3Qh3oA1PK/Iqs0OTttipT79W61Vsk=; b=OepPUQTYQkFmqbV3IK8E9OI/t+
	68ypLYinbLiTHs3IufPATywRKTdYmVWP51VV0UWJx6z55AJsiS9knlQXQ4AMeQcfdYBYV6BbV3Rk6
	vUY5sUyMsmmXneu76AAnQsHLyDDv8l6ssoL5eSyrvobsms+qcS4jQCl/FhA+IPB/sobY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Fix build with the get/set_reg() infrastructure
Message-Id: <E1nBGrw-0006GE-VC@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:55:52 +0000

commit 13caa585791234fe3e3719c8376f7ea731012451
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 21 10:19:00 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 12:42:11 2022 +0000

    x86: Fix build with the get/set_reg() infrastructure
    
    I clearly messed up concluding that the stubs were safe to drop.
    
    The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
    and CONFIG_HVM.  As a result logic of the form `if ( pv/hvm ) ... else ...`
    will always have one side which can't be DCE'd.
    
    While technically only the hvm stubs are needed, due to the use of the
    is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
    avoid leaving a bear trap for future users.
    
    Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/hvm.h   | 10 ++++++++++
 xen/arch/x86/include/asm/pv/domain.h | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 842f98763c..a441cbc221 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -854,6 +854,16 @@ static inline int hvm_vmtrace_get_option(
     return -EOPNOTSUPP;
 }
 
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/arch/x86/include/asm/pv/domain.h b/xen/arch/x86/include/asm/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/arch/x86/include/asm/pv/domain.h
+++ b/xen/arch/x86/include/asm/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, unsigned long cr4);
 /* Create a cr4 value to load into hardware, based on vcpu settings. */
 unsigned long pv_make_cr4(const struct vcpu *v);
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 bool xpti_pcid_enabled(void);
 
 #else  /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; }
 
 static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
 
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #endif	/* CONFIG_PV */
 
 void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:56:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259596.448018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGs8-00018D-DA; Sat, 22 Jan 2022 13:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259596.448018; Sat, 22 Jan 2022 13:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGs8-000185-AI; Sat, 22 Jan 2022 13:56:04 +0000
Received: by outflank-mailman (input) for mailman id 259596;
 Sat, 22 Jan 2022 13: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 1nBGs7-00017q-3W
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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 1nBGs7-0001a8-2r
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGs7-0006HE-23
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A3+B75bdk3xO8auQC/glFMSqGqv6lN837jxYQrakW+M=; b=EFFuJ4ZHlAtxiZL0eAPAYx4m4x
	65J9+2mNsUMBlp7ZmN6zYxWB4ZnETichcByFonZqvnun1q7sdY6gktmCzi5bG0btQn0+x324bX3F6
	SocHjjBtqO8dPkAJ/EA/L4tAsNZC99agddMdv1Z3u3vh3XGcafjW8gjw8Vmlz9uQ7ASQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: use talloc_asprintf_append() in do_control_help()
Message-Id: <E1nBGs7-0006HE-23@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:56:03 +0000

commit c1c059fdfd9e01760af44f46d61ed2f5f4117b30
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Jan 20 07:59:47 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 12:42:11 2022 +0000

    tools/xenstore: use talloc_asprintf_append() in do_control_help()
    
    Instead of calculating the length of all help output and then
    allocating the space for it, just use talloc_asprintf_append() to
    expand the text as needed.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/xenstored_control.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 7b4300ef77..f0e00db633 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -853,36 +853,23 @@ static struct cmd_s cmds[] = {
 static int do_control_help(void *ctx, struct connection *conn,
 			   char **vec, int num)
 {
-	int cmd, len = 0;
+	int cmd;
 	char *resp;
 
 	if (num)
 		return EINVAL;
 
-	for (cmd = 0; cmd < ARRAY_SIZE(cmds); cmd++) {
-		len += strlen(cmds[cmd].cmd) + 1;
-		len += strlen(cmds[cmd].pars) + 1;
-	}
-	len++;
-
-	resp = talloc_array(ctx, char, len);
+	resp = talloc_asprintf(ctx, "%s", "");
 	if (!resp)
 		return ENOMEM;
-
-	len = 0;
 	for (cmd = 0; cmd < ARRAY_SIZE(cmds); cmd++) {
-		strcpy(resp + len, cmds[cmd].cmd);
-		len += strlen(cmds[cmd].cmd);
-		resp[len] = '\t';
-		len++;
-		strcpy(resp + len, cmds[cmd].pars);
-		len += strlen(cmds[cmd].pars);
-		resp[len] = '\n';
-		len++;
+		resp = talloc_asprintf_append(resp, "%s\t%s\n",
+					      cmds[cmd].cmd, cmds[cmd].pars);
+		if (!resp)
+			return ENOMEM;
 	}
-	resp[len] = 0;
 
-	send_reply(conn, XS_CONTROL, resp, len);
+	send_reply(conn, XS_CONTROL, resp, strlen(resp) + 1);
 	return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:56:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:56:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259597.448022 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsJ-0001Be-F8; Sat, 22 Jan 2022 13:56:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259597.448022; Sat, 22 Jan 2022 13:56:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsJ-0001BW-Bx; Sat, 22 Jan 2022 13:56:15 +0000
Received: by outflank-mailman (input) for mailman id 259597;
 Sat, 22 Jan 2022 13: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 1nBGsH-0001BG-8U
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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 1nBGsH-0001bq-69
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsH-0006I5-5G
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EDxJXcnbtAPe4xYNGGOTkFAyc8TxtdYPVmPIqzGbTEw=; b=AnY+fw9qqQvNg14sv5oyPPTgD/
	PchSafx52jAizVRX5iGJ/kvStwRWXGQILckTTZTiSz6mXqQEpAZUObRZmYesf7Lvt62sJkwccgFCi
	9jjcxvVebwyXRRPWlq9gqp59uPWMfKrHoTBRaTVkJvWNzS8k9ZeiTePCeJBgNnWxBtWU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: import intel-family.h from Linux
Message-Id: <E1nBGsH-0006I5-5G@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:56:13 +0000

commit d9bc1888d245a50f479c289caa95d2f7c6f9382c
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Jan 20 17:13:00 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 12:42:11 2022 +0000

    xen/x86: import intel-family.h from Linux
    
    Last commit to the file is:
    
    7d697f0d5737 x86/cpu: Drop spurious underscore from RAPTOR_LAKE #define
    
    This should help the readability of code that's currently open-coding
    Intel model numbers.
    
    No change introduced to existing code, it's expected that new code
    could start using the defines. Changing existing users could cause
    quite a lot of code churn.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/intel-family.h | 145 ++++++++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)

diff --git a/xen/arch/x86/include/asm/intel-family.h b/xen/arch/x86/include/asm/intel-family.h
new file mode 100644
index 0000000000..ffc49151be
--- /dev/null
+++ b/xen/arch/x86/include/asm/intel-family.h
@@ -0,0 +1,145 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_X86_INTEL_FAMILY_H
+#define _ASM_X86_INTEL_FAMILY_H
+
+/*
+ * "Big Core" Processors (Branded as Core, Xeon, etc...)
+ *
+ * While adding a new CPUID for a new microarchitecture, add a new
+ * group to keep logically sorted out in chronological order. Within
+ * that group keep the CPUID for the variants sorted by model number.
+ *
+ * The defined symbol names have the following form:
+ *	INTEL_FAM6{OPTFAMILY}_{MICROARCH}{OPTDIFF}
+ * where:
+ * OPTFAMILY	Describes the family of CPUs that this belongs to. Default
+ *		is assumed to be "_CORE" (and should be omitted). Other values
+ *		currently in use are _ATOM and _XEON_PHI
+ * MICROARCH	Is the code name for the micro-architecture for this core.
+ *		N.B. Not the platform name.
+ * OPTDIFF	If needed, a short string to differentiate by market segment.
+ *
+ *		Common OPTDIFFs:
+ *
+ *			- regular client parts
+ *		_L	- regular mobile parts
+ *		_G	- parts with extra graphics on
+ *		_X	- regular server parts
+ *		_D	- micro server parts
+ *
+ *		Historical OPTDIFFs:
+ *
+ *		_EP	- 2 socket server parts
+ *		_EX	- 4+ socket server parts
+ *
+ * The #define line may optionally include a comment including platform or core
+ * names. An exception is made for skylake/kabylake where steppings seem to have gotten
+ * their own names :-(
+ */
+
+#define INTEL_FAM6_CORE_YONAH		0x0E
+
+#define INTEL_FAM6_CORE2_MEROM		0x0F
+#define INTEL_FAM6_CORE2_MEROM_L	0x16
+#define INTEL_FAM6_CORE2_PENRYN		0x17
+#define INTEL_FAM6_CORE2_DUNNINGTON	0x1D
+
+#define INTEL_FAM6_NEHALEM		0x1E
+#define INTEL_FAM6_NEHALEM_G		0x1F /* Auburndale / Havendale */
+#define INTEL_FAM6_NEHALEM_EP		0x1A
+#define INTEL_FAM6_NEHALEM_EX		0x2E
+
+#define INTEL_FAM6_WESTMERE		0x25
+#define INTEL_FAM6_WESTMERE_EP		0x2C
+#define INTEL_FAM6_WESTMERE_EX		0x2F
+
+#define INTEL_FAM6_SANDYBRIDGE		0x2A
+#define INTEL_FAM6_SANDYBRIDGE_X	0x2D
+#define INTEL_FAM6_IVYBRIDGE		0x3A
+#define INTEL_FAM6_IVYBRIDGE_X		0x3E
+
+#define INTEL_FAM6_HASWELL		0x3C
+#define INTEL_FAM6_HASWELL_X		0x3F
+#define INTEL_FAM6_HASWELL_L		0x45
+#define INTEL_FAM6_HASWELL_G		0x46
+
+#define INTEL_FAM6_BROADWELL		0x3D
+#define INTEL_FAM6_BROADWELL_G		0x47
+#define INTEL_FAM6_BROADWELL_X		0x4F
+#define INTEL_FAM6_BROADWELL_D		0x56
+
+#define INTEL_FAM6_SKYLAKE_L		0x4E	/* Sky Lake             */
+#define INTEL_FAM6_SKYLAKE		0x5E	/* Sky Lake             */
+#define INTEL_FAM6_SKYLAKE_X		0x55	/* Sky Lake             */
+/*                 CASCADELAKE_X	0x55	   Sky Lake -- s: 7     */
+/*                 COOPERLAKE_X		0x55	   Sky Lake -- s: 11    */
+
+#define INTEL_FAM6_KABYLAKE_L		0x8E	/* Sky Lake             */
+/*                 AMBERLAKE_L		0x8E	   Sky Lake -- s: 9     */
+/*                 COFFEELAKE_L		0x8E	   Sky Lake -- s: 10    */
+/*                 WHISKEYLAKE_L	0x8E       Sky Lake -- s: 11,12 */
+
+#define INTEL_FAM6_KABYLAKE		0x9E	/* Sky Lake             */
+/*                 COFFEELAKE		0x9E	   Sky Lake -- s: 10-13 */
+
+#define INTEL_FAM6_COMETLAKE		0xA5	/* Sky Lake             */
+#define INTEL_FAM6_COMETLAKE_L		0xA6	/* Sky Lake             */
+
+#define INTEL_FAM6_CANNONLAKE_L		0x66	/* Palm Cove */
+
+#define INTEL_FAM6_ICELAKE_X		0x6A	/* Sunny Cove */
+#define INTEL_FAM6_ICELAKE_D		0x6C	/* Sunny Cove */
+#define INTEL_FAM6_ICELAKE		0x7D	/* Sunny Cove */
+#define INTEL_FAM6_ICELAKE_L		0x7E	/* Sunny Cove */
+#define INTEL_FAM6_ICELAKE_NNPI		0x9D	/* Sunny Cove */
+
+#define INTEL_FAM6_LAKEFIELD		0x8A	/* Sunny Cove / Tremont */
+
+#define INTEL_FAM6_ROCKETLAKE		0xA7	/* Cypress Cove */
+
+#define INTEL_FAM6_TIGERLAKE_L		0x8C	/* Willow Cove */
+#define INTEL_FAM6_TIGERLAKE		0x8D	/* Willow Cove */
+
+#define INTEL_FAM6_SAPPHIRERAPIDS_X	0x8F	/* Golden Cove */
+
+#define INTEL_FAM6_ALDERLAKE		0x97	/* Golden Cove / Gracemont */
+#define INTEL_FAM6_ALDERLAKE_L		0x9A	/* Golden Cove / Gracemont */
+
+#define INTEL_FAM6_RAPTORLAKE		0xB7
+
+/* "Small Core" Processors (Atom) */
+
+#define INTEL_FAM6_ATOM_BONNELL		0x1C /* Diamondville, Pineview */
+#define INTEL_FAM6_ATOM_BONNELL_MID	0x26 /* Silverthorne, Lincroft */
+
+#define INTEL_FAM6_ATOM_SALTWELL	0x36 /* Cedarview */
+#define INTEL_FAM6_ATOM_SALTWELL_MID	0x27 /* Penwell */
+#define INTEL_FAM6_ATOM_SALTWELL_TABLET	0x35 /* Cloverview */
+
+#define INTEL_FAM6_ATOM_SILVERMONT	0x37 /* Bay Trail, Valleyview */
+#define INTEL_FAM6_ATOM_SILVERMONT_D	0x4D /* Avaton, Rangely */
+#define INTEL_FAM6_ATOM_SILVERMONT_MID	0x4A /* Merriefield */
+
+#define INTEL_FAM6_ATOM_AIRMONT		0x4C /* Cherry Trail, Braswell */
+#define INTEL_FAM6_ATOM_AIRMONT_MID	0x5A /* Moorefield */
+#define INTEL_FAM6_ATOM_AIRMONT_NP	0x75 /* Lightning Mountain */
+
+#define INTEL_FAM6_ATOM_GOLDMONT	0x5C /* Apollo Lake */
+#define INTEL_FAM6_ATOM_GOLDMONT_D	0x5F /* Denverton */
+
+/* Note: the micro-architecture is "Goldmont Plus" */
+#define INTEL_FAM6_ATOM_GOLDMONT_PLUS	0x7A /* Gemini Lake */
+
+#define INTEL_FAM6_ATOM_TREMONT_D	0x86 /* Jacobsville */
+#define INTEL_FAM6_ATOM_TREMONT		0x96 /* Elkhart Lake */
+#define INTEL_FAM6_ATOM_TREMONT_L	0x9C /* Jasper Lake */
+
+/* Xeon Phi */
+
+#define INTEL_FAM6_XEON_PHI_KNL		0x57 /* Knights Landing */
+#define INTEL_FAM6_XEON_PHI_KNM		0x85 /* Knights Mill */
+
+/* Family 5 */
+#define INTEL_FAM5_QUARK_X1000		0x09 /* Quark X1000 SoC */
+
+#endif /* _ASM_X86_INTEL_FAMILY_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:56:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259598.448026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsS-0001EJ-GQ; Sat, 22 Jan 2022 13:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259598.448026; Sat, 22 Jan 2022 13:56:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsS-0001EB-DY; Sat, 22 Jan 2022 13:56:24 +0000
Received: by outflank-mailman (input) for mailman id 259598;
 Sat, 22 Jan 2022 13: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 1nBGsR-0001Dy-A8
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13: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 1nBGsR-0001c6-9P
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsR-0006Ix-8W
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hZPBA9ruN+mT4KJVHuBZloMoGV3BMKsPCtHeOkEKhvo=; b=yJyOalQavlQodL/9uConQ4Oeuo
	4vO9IKhkKimo53ZWDRODX5fHs9OManHnzyfjb9TsQhbDLPD03ohjaxsDIHwiVxIxW4XlfZAocXN34
	jzcEgV+br42l1tHWRoDgrs3tZ+AEgZQANQKqJnI2R5V5SQitZ1WvikI3REFp1MELTeP4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: merge hashtable_private.h into hashtable.c
Message-Id: <E1nBGsR-0006Ix-8W@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:56:23 +0000

commit 65e7c9410bda8262bb2d3a02cb51f011ba573c1b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 21 16:21:18 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 15:34:45 2022 +0000

    tools/xenstore: merge hashtable_private.h into hashtable.c
    
    hashtable_private.h is used in hashtable.c only.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/hashtable.c         | 31 ++++++++++++--
 tools/xenstore/hashtable_private.h | 85 --------------------------------------
 2 files changed, 27 insertions(+), 89 deletions(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index 394b1cf9d0..39fb3ed338 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -1,13 +1,29 @@
 /* Copyright (C) 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
 
 #include "hashtable.h"
-#include "hashtable_private.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
 #include <stdint.h>
 
+struct entry
+{
+    void *k, *v;
+    unsigned int h;
+    struct entry *next;
+};
+
+struct hashtable {
+    unsigned int tablelength;
+    struct entry **table;
+    unsigned int entrycount;
+    unsigned int loadlimit;
+    unsigned int primeindex;
+    unsigned int (*hashfn) (void *k);
+    int (*eqfn) (void *k1, void *k2);
+};
+
 /*
 Credit for primes table: Aaron Krowne
  http://br.endernet.org/~akrowne/
@@ -25,6 +41,13 @@ static const unsigned int primes[] = {
 const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
 const unsigned int max_load_factor = 65; /* percentage */
 
+/*****************************************************************************/
+/* indexFor */
+static inline unsigned int
+indexFor(unsigned int tablelength, unsigned int hashvalue) {
+    return (hashvalue % tablelength);
+}
+
 /*****************************************************************************/
 struct hashtable *
 create_hashtable(unsigned int minsize,
@@ -211,7 +234,7 @@ hashtable_remove(struct hashtable *h, void *k)
             *pE = e->next;
             h->entrycount--;
             v = e->v;
-            freekey(e->k);
+            free(e->k);
             free(e);
             return v;
         }
@@ -235,7 +258,7 @@ hashtable_destroy(struct hashtable *h, int free_values)
         {
             e = table[i];
             while (NULL != e)
-            { f = e; e = e->next; freekey(f->k); free(f->v); free(f); }
+            { f = e; e = e->next; free(f->k); free(f->v); free(f); }
         }
     }
     else
@@ -244,7 +267,7 @@ hashtable_destroy(struct hashtable *h, int free_values)
         {
             e = table[i];
             while (NULL != e)
-            { f = e; e = e->next; freekey(f->k); free(f); }
+            { f = e; e = e->next; free(f->k); free(f); }
         }
     }
     free(h->table);
diff --git a/tools/xenstore/hashtable_private.h b/tools/xenstore/hashtable_private.h
deleted file mode 100644
index 3e95f60057..0000000000
--- a/tools/xenstore/hashtable_private.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk> */
-
-#ifndef __HASHTABLE_PRIVATE_CWC22_H__
-#define __HASHTABLE_PRIVATE_CWC22_H__
-
-#include "hashtable.h"
-
-/*****************************************************************************/
-struct entry
-{
-    void *k, *v;
-    unsigned int h;
-    struct entry *next;
-};
-
-struct hashtable {
-    unsigned int tablelength;
-    struct entry **table;
-    unsigned int entrycount;
-    unsigned int loadlimit;
-    unsigned int primeindex;
-    unsigned int (*hashfn) (void *k);
-    int (*eqfn) (void *k1, void *k2);
-};
-
-/*****************************************************************************/
-unsigned int
-hash(struct hashtable *h, void *k);
-
-/*****************************************************************************/
-/* indexFor */
-static inline unsigned int
-indexFor(unsigned int tablelength, unsigned int hashvalue) {
-    return (hashvalue % tablelength);
-};
-
-/* Only works if tablelength == 2^N */
-/*static inline unsigned int
-indexFor(unsigned int tablelength, unsigned int hashvalue)
-{
-    return (hashvalue & (tablelength - 1u));
-}
-*/
-
-/*****************************************************************************/
-#define freekey(X) free(X)
-/*define freekey(X) ; */
-
-
-/*****************************************************************************/
-
-#endif /* __HASHTABLE_PRIVATE_CWC22_H__*/
-
-/*
- * Copyright (c) 2002, Christopher Clark
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 
- * * Neither the name of the original author; nor the names of any contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- * 
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:56:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259599.448029 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsc-0001Hc-JT; Sat, 22 Jan 2022 13:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259599.448029; Sat, 22 Jan 2022 13:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsc-0001HU-GX; Sat, 22 Jan 2022 13:56:34 +0000
Received: by outflank-mailman (input) for mailman id 259599;
 Sat, 22 Jan 2022 13:56:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsb-0001HJ-D5
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsb-0001cc-CL
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsb-0006Jc-Bc
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JhK/BDUsT1fltV7qZ3GdNqwhV0bWbQDiTMoouoBUGG0=; b=dEsKLrEzUY/sLNuSy4mBomFEop
	sP9HcRZN24Nt3CDkc7FXC7XwGYZu6iQLBshEaV6mNdrLykKysC5egKLKyrX+OLkoznrcwNsYARp3T
	yG8lO6R2kvbLgeYCF80nyAXi9ONANhcW2bfSMbUHSqygmiO7q1Z0smRQfRSazd10yb8w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: fix hashtable_expand() zeroing new area
Message-Id: <E1nBGsb-0006Jc-Bc@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:56:33 +0000

commit b977929d3646a390f1a7b4540fcd7a36aa59ff14
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 21 16:21:19 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 15:34:45 2022 +0000

    tools/xenstore: fix hashtable_expand() zeroing new area
    
    When realloc()ing the hashtable for expanding it, zero out all the new
    bytes at the end of the table, not only one byte for each new element.
    
    Fixes: 186f0e02a1c ("Added hashtable implementation")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/hashtable.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index 39fb3ed338..6ac336eff1 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -136,7 +136,8 @@ hashtable_expand(struct hashtable *h)
                    realloc(h->table, newsize * sizeof(struct entry *));
         if (NULL == newtable) { (h->primeindex)--; return 0; }
         h->table = newtable;
-        memset(newtable[h->tablelength], 0, newsize - h->tablelength);
+        memset(newtable + h->tablelength, 0,
+               (newsize - h->tablelength) * sizeof(*newtable));
         for (i = 0; i < h->tablelength; i++) {
             for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) {
                 index = indexFor(newsize,e->h);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:56:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259600.448033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsm-0001KV-LO; Sat, 22 Jan 2022 13:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259600.448033; Sat, 22 Jan 2022 13:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsm-0001KN-IE; Sat, 22 Jan 2022 13:56:44 +0000
Received: by outflank-mailman (input) for mailman id 259600;
 Sat, 22 Jan 2022 13:56:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsl-0001KE-GK
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsl-0001cm-Fe
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsl-0006KF-EZ
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jqCvChu38MjMO1NiCj/OLs6+eN8xtdr73m3/eIN3dVo=; b=xCDm6IvuwBXOs8D4Jx+feNsu5W
	VsRzqYZ/WKncfmICc8oRT65bicofyTQ7XuLSr0WgntLu9T0+rarAhJCFkIALeYBOBBqZVZ0NOHW7B
	oGCSzXA3JHPuTc8Gz4oZuVvLAc+Hyjy7Cu4bskIvq7JzoMCFJcymJCXurUS0XX/lKgKo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: drop DEFINE_HASHTABLE_* macros and usage intro
Message-Id: <E1nBGsl-0006KF-EZ@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:56:43 +0000

commit 447d514efe0db58d50ee89512856058793f1ba7b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 21 16:21:20 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 15:34:46 2022 +0000

    tools/xenstore: drop DEFINE_HASHTABLE_* macros and usage intro
    
    The DEFINE_HASHTABLE_* macros are used nowhere, so drop them.
    The usage intro isn't really needed either.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/hashtable.h | 76 ----------------------------------------------
 1 file changed, 76 deletions(-)

diff --git a/tools/xenstore/hashtable.h b/tools/xenstore/hashtable.h
index b90781abd4..62fef6081a 100644
--- a/tools/xenstore/hashtable.h
+++ b/tools/xenstore/hashtable.h
@@ -5,62 +5,6 @@
 
 struct hashtable;
 
-/* Example of use:
- *
- *      struct hashtable  *h;
- *      struct some_key   *k;
- *      struct some_value *v;
- *
- *      static unsigned int         hash_from_key_fn( void *k );
- *      static int                  keys_equal_fn ( void *key1, void *key2 );
- *
- *      h = create_hashtable(16, hash_from_key_fn, keys_equal_fn);
- *      k = (struct some_key *)     malloc(sizeof(struct some_key));
- *      v = (struct some_value *)   malloc(sizeof(struct some_value));
- *
- *      (initialise k and v to suitable values)
- * 
- *      if (! hashtable_insert(h,k,v) )
- *      {     exit(-1);               }
- *
- *      if (NULL == (found = hashtable_search(h,k) ))
- *      {    printf("not found!");                  }
- *
- *      if (NULL == (found = hashtable_remove(h,k) ))
- *      {    printf("Not found\n");                 }
- *
- */
-
-/* Macros may be used to define type-safe(r) hashtable access functions, with
- * methods specialized to take known key and value types as parameters.
- * 
- * Example:
- *
- * Insert this at the start of your file:
- *
- * DEFINE_HASHTABLE_INSERT(insert_some, struct some_key, struct some_value);
- * DEFINE_HASHTABLE_SEARCH(search_some, struct some_key, struct some_value);
- * DEFINE_HASHTABLE_REMOVE(remove_some, struct some_key, struct some_value);
- *
- * This defines the functions 'insert_some', 'search_some' and 'remove_some'.
- * These operate just like hashtable_insert etc., with the same parameters,
- * but their function signatures have 'struct some_key *' rather than
- * 'void *', and hence can generate compile time errors if your program is
- * supplying incorrect data as a key (and similarly for value).
- *
- * Note that the hash and key equality functions passed to create_hashtable
- * still take 'void *' parameters instead of 'some key *'. This shouldn't be
- * a difficult issue as they're only defined and passed once, and the other
- * functions will ensure that only valid keys are supplied to them.
- *
- * The cost for this checking is increased code size and runtime overhead
- * - if performance is important, it may be worth switching back to the
- * unsafe methods once your program has been debugged with the safe methods.
- * This just requires switching to some simple alternative defines - eg:
- * #define insert_some hashtable_insert
- *
- */
-
 /*****************************************************************************
  * create_hashtable
    
@@ -98,12 +42,6 @@ create_hashtable(unsigned int minsize,
 int 
 hashtable_insert(struct hashtable *h, void *k, void *v);
 
-#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \
-int fnname (struct hashtable *h, keytype *k, valuetype *v) \
-{ \
-    return hashtable_insert(h,k,v); \
-}
-
 /*****************************************************************************
  * hashtable_search
    
@@ -116,12 +54,6 @@ int fnname (struct hashtable *h, keytype *k, valuetype *v) \
 void *
 hashtable_search(struct hashtable *h, void *k);
 
-#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \
-valuetype * fnname (struct hashtable *h, keytype *k) \
-{ \
-    return (valuetype *) (hashtable_search(h,k)); \
-}
-
 /*****************************************************************************
  * hashtable_remove
    
@@ -134,13 +66,6 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
 void * /* returns value */
 hashtable_remove(struct hashtable *h, void *k);
 
-#define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \
-valuetype * fnname (struct hashtable *h, keytype *k) \
-{ \
-    return (valuetype *) (hashtable_remove(h,k)); \
-}
-
-
 /*****************************************************************************
  * hashtable_count
    
@@ -151,7 +76,6 @@ valuetype * fnname (struct hashtable *h, keytype *k) \
 unsigned int
 hashtable_count(struct hashtable *h);
 
-
 /*****************************************************************************
  * hashtable_destroy
    
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 22 13:56:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 22 Jan 2022 13:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259601.448038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsw-0001Op-N0; Sat, 22 Jan 2022 13:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259601.448038; Sat, 22 Jan 2022 13:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBGsw-0001Oh-Jo; Sat, 22 Jan 2022 13:56:54 +0000
Received: by outflank-mailman (input) for mailman id 259601;
 Sat, 22 Jan 2022 13:56:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsv-0001OY-JP
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsv-0001cw-Ij
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBGsv-0006Kp-Hx
 for xen-changelog@lists.xenproject.org; Sat, 22 Jan 2022 13:56:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gbni/76houmgLc8wnnfK7sHNmCzT08wv/sb8XUBzvuA=; b=ZZYsG/OSkN4Yhkl+dlYGJWMiLg
	hhojCDpTzxN626nkHoO1wByVJtYxwAFcW9AQlq5FFkDwLbXOcgs2Zo4BaIoD6LtPgpbpw/gO8v/Qs
	+UNgtd+4HPBKh2raz/u9zefZvZYbWLOturaD7M56wKbDr9kmpVOWtVcKv8UqDpt7OL9o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: fix error handling of check_store()
Message-Id: <E1nBGsv-0006Kp-Hx@xenbits.xenproject.org>
Date: Sat, 22 Jan 2022 13:56:53 +0000

commit fe9be76d880b1d43b9dca471f45af3fd380ecb00
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 21 14:12:19 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 21 15:34:46 2022 +0000

    tools/xenstore: fix error handling of check_store()
    
    check_store() has an incomplete error handling: it doesn't check
    whether "root" allocation succeeded, and it is leaking the memory of
    "root" in case create_hashtable() fails.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xenstore/xenstored_core.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index c386ae6129..91d3adccb1 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2050,14 +2050,18 @@ static void clean_store(struct hashtable *reachable)
 
 void check_store(void)
 {
-	char * root = talloc_strdup(NULL, "/");
-	struct hashtable * reachable =
-		create_hashtable(16, hash_from_key_fn, keys_equal_fn);
- 
-	if (!reachable) {
+	char *root = talloc_strdup(NULL, "/");
+	struct hashtable *reachable;
+
+	if (!root) {
 		log("check_store: ENOMEM");
 		return;
 	}
+	reachable = create_hashtable(16, hash_from_key_fn, keys_equal_fn);
+	if (!reachable) {
+		log("check_store: ENOMEM");
+		goto out_root;
+	}
 
 	log("Checking store ...");
 	if (!check_store_(root, reachable) &&
@@ -2067,6 +2071,7 @@ void check_store(void)
 
 	hashtable_destroy(reachable, 0 /* Don't free values (they are all
 					  (void *)1) */);
+ out_root:
 	talloc_free(root);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 07:55:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 07:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259715.448186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuBu-00054r-3n; Mon, 24 Jan 2022 07:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259715.448186; Mon, 24 Jan 2022 07:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuBu-00054j-0H; Mon, 24 Jan 2022 07:55:06 +0000
Received: by outflank-mailman (input) for mailman id 259715;
 Mon, 24 Jan 2022 07:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuBs-00054d-Vj
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55: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 1nBuBs-0003Em-SX
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuBs-0003qC-Rj
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rs99Dgkx99YRWV/tcbbNQAqEdnHKQX+lT/4NXLN3G+s=; b=3/VbsCOlYnbvN10a8x/c26Vgxb
	pjPXvW3Xa/lLKO+w1cJYv6oGbkMJXq5tm+yFjYGQHWfB3QzSoUcZ5nprKQJyK9yMvRTplgHcNPp2J
	/DrSs55+3I2oDcUma+o1lmE9fNOYDsvys3nNgHIptwOocW21+fvgZuS5d4E+6l3NSSsY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: no need for timer calibration when using TDT
Message-Id: <E1nBuBs-0003qC-Rj@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 07:55:04 +0000

commit 0731a56c7c72fc117b69982e002954645fc3685b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:38:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:38:55 2022 +0100

    x86/APIC: no need for timer calibration when using TDT
    
    The only global effect of calibrate_APIC_clock() is the setting of
    "bus_scale"; the final __setup_APIC_LVTT(0) is (at best) redundant with
    the immediately following setup_APIC_timer() invocation. Yet "bus_scale"
    isn't used when using TDT. Avoid wasting 100ms for calibration in this
    case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/apic.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index d7d5c15155..5d3e1f3952 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1292,11 +1292,15 @@ void __init setup_boot_APIC_clock(void)
 
     check_deadline_errata();
 
+    if ( !boot_cpu_has(X86_FEATURE_TSC_DEADLINE) )
+        tdt_enable = false;
+
     local_irq_save(flags);
 
-    calibrate_APIC_clock();
+    if ( !tdt_enable || apic_verbosity )
+        calibrate_APIC_clock();
 
-    if ( tdt_enable && boot_cpu_has(X86_FEATURE_TSC_DEADLINE) )
+    if ( tdt_enable )
     {
         printk(KERN_DEBUG "TSC deadline timer enabled\n");
         tdt_enabled = true;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 07:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 07:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259716.448189 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuC4-00056m-5K; Mon, 24 Jan 2022 07:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259716.448189; Mon, 24 Jan 2022 07:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuC4-00056d-1s; Mon, 24 Jan 2022 07:55:16 +0000
Received: by outflank-mailman (input) for mailman id 259716;
 Mon, 24 Jan 2022 07:55: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 1nBuC3-00056L-0P
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55: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 1nBuC2-0003Eq-Vq
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuC2-0003r3-V3
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S1qZdBN8ox2rHDnM4SkDFmFK9Y8yyqXEOtH7h4/ylQA=; b=ubnBxIeTf4dla9vv0OkkYHAv30
	7V6uQFH2pjZy8LE8NbuXaxrWRKDeMWbgWkxb9i0uBtSeiUrmWom9o+LMrj0M/K/ZLaNniemregANJ
	AjViS698eJPCkvFrZgPGCUl8UMmYJ1uH6tfdRS1b/qe+hJAduCdi424nuGcs5XuuLki0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: drop 32-bit days remnants
Message-Id: <E1nBuC2-0003r3-V3@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 07:55:14 +0000

commit 8593782ace71149339adace3201d3467ae7bf502
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:40:13 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:40:13 2022 +0100

    x86/APIC: drop 32-bit days remnants
    
    Mercury and Neptune were Pentium chipsets - no need to work around their
    errata, even more so that the workaround looks fragile.
    
    Also ditch a Pentium-related and stale part of a comment.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/apic.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 5d3e1f3952..5836561585 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1042,11 +1042,6 @@ static void __init wait_8254_wraparound(void)
     do {
         prev_count = curr_count;
         curr_count = get_8254_timer_count();
-
-        /* workaround for broken Mercury/Neptune */
-        if (prev_count >= curr_count + 0x100)
-            curr_count = get_8254_timer_count();
-        
     } while (prev_count >= curr_count);
 }
 
@@ -1056,9 +1051,6 @@ static void __init wait_8254_wraparound(void)
  * this function twice on the boot CPU, once with a bogus timeout
  * value, second time for real. The other (noncalibrating) CPUs
  * call this function only once, with the real, calibrated value.
- *
- * We do reads before writes even if unnecessary, to get around the
- * P5 APIC double write bug.
  */
 
 #define APIC_DIVISOR 1
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 07:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 07:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259717.448192 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuCE-00059o-6R; Mon, 24 Jan 2022 07:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259717.448192; Mon, 24 Jan 2022 07:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuCE-00059g-3P; Mon, 24 Jan 2022 07:55:26 +0000
Received: by outflank-mailman (input) for mailman id 259717;
 Mon, 24 Jan 2022 07:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCD-00059T-3V
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCD-0003F8-2h
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCD-0003rn-1r
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55: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=MPtcRcLv8EmO4zfeIXI2LO3FYJYymx/xxy0VWOxIfSY=; b=mf9wvDb1s7Z0eQk6b2/0+LF91T
	Dz6q1Yv8UEntBh/2K9ygJIr7WOrF833RHIVz3aMQaGyH28C0Fx38vK5PDsYF2vuHVhHLKwtVtE1o2
	6gbZVkHCUpHmG+GAoa7HtnnPNiLFxR2fQCM4kEHeHp5Txf2sWrn7s5QqvF6cW5aX0BeQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: minor adjustments to init_pit()
Message-Id: <E1nBuCD-0003rn-1r@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 07:55:25 +0000

commit 5e73b2594c540400d8d8510a7e38ab52cc69b243
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:40:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:40:59 2022 +0100

    x86/time: minor adjustments to init_pit()
    
    For one, "using_pit" shouldn't be set ahead of the function's last
    (for now: only) error path. Otherwise "clocksource=pit" on the command
    line can lead to misbehavior when actually taking that error path.
    
    And then make an implicit assumption explicit: CALIBRATE_FRAC cannot,
    for example, simply be changed to 10. The way init_pit() works, the
    upper bound on the calibration period is about 54ms.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/time.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 1daff92dca..7fb760cf55 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -333,8 +333,6 @@ static s64 __init init_pit(struct platform_timesource *pts)
     u64 start, end;
     unsigned long count;
 
-    using_pit = true;
-
     /* Set the Gate high, disable speaker. */
     outb((portb & ~0x02) | 0x01, 0x61);
 
@@ -344,6 +342,7 @@ static s64 __init init_pit(struct platform_timesource *pts)
      * (LSB and MSB) to begin countdown.
      */
 #define CALIBRATE_LATCH CALIBRATE_VALUE(CLOCK_TICK_RATE)
+    BUILD_BUG_ON(CALIBRATE_LATCH >> 16);
     outb(0xb0, PIT_MODE);                  /* binary, mode 0, LSB/MSB, Ch 2 */
     outb(CALIBRATE_LATCH & 0xff, PIT_CH2); /* LSB of count */
     outb(CALIBRATE_LATCH >> 8, PIT_CH2);   /* MSB of count */
@@ -361,6 +360,8 @@ static s64 __init init_pit(struct platform_timesource *pts)
     if ( count == 0 )
         return 0;
 
+    using_pit = true;
+
     return (end - start) * CALIBRATE_FRAC;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 07:55:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 07:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259718.448197 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuCO-0005D4-89; Mon, 24 Jan 2022 07:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259718.448197; Mon, 24 Jan 2022 07:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuCO-0005Ct-54; Mon, 24 Jan 2022 07:55:36 +0000
Received: by outflank-mailman (input) for mailman id 259718;
 Mon, 24 Jan 2022 07:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCN-0005Cm-6i
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCN-0003FJ-5l
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCN-0003sY-4v
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ecUGjwE+i1G4c3IEhvr89UPLp4CvfVMZuiLHvc6LUsc=; b=Is7l3lhEah87PpJrfQIkLlge7p
	xm3mPCXxFHw2MFRRMR5qwKtfAwwTsM7gBu7xwWv4Raf5JcIErOgVeOaJLMcBtfg4xVjI3iH3j/DB1
	9FvSM/5Os452a5tnwhjIu/owD45NFMcCLfGSbwEoPonU01a88E0SOEcP3GN0aK4RWOrc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mwait-idle: stop exposing platform acronyms
Message-Id: <E1nBuCN-0003sY-4v@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 07:55:35 +0000

commit 73394e18bcbac9c029d524525ccbb53ca2a7d612
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:42:25 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:42:25 2022 +0100

    x86/mwait-idle: stop exposing platform acronyms
    
    This follows Linux commit de09cdd09fa1 ("intel_idle: stop exposing
    platform acronyms in sysfs"), but their main justifications (sysfs
    exposure and similarity with acpi-idle) don't apply to us. The field is
    only used in a single printk() right now, but having the platform tags
    there isn't useful either.
    
    Requested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 178 +++++++++++++++++++++---------------------
 1 file changed, 89 insertions(+), 89 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 9e04d969d6..2e531e98b2 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -134,25 +134,25 @@ static const struct cpuidle_state {
  */
 static const struct cpuidle_state nehalem_cstates[] = {
 	{
-		.name = "C1-NHM",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 3,
 		.target_residency = 6,
 	},
 	{
-		.name = "C1E-NHM",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-NHM",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 20,
 		.target_residency = 80,
 	},
 	{
-		.name = "C6-NHM",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 200,
 		.target_residency = 800,
@@ -162,31 +162,31 @@ static const struct cpuidle_state nehalem_cstates[] = {
 
 static const struct cpuidle_state snb_cstates[] = {
 	{
-		.name = "C1-SNB",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-SNB",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-SNB",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 80,
 		.target_residency = 211,
 	},
 	{
-		.name = "C6-SNB",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 104,
 		.target_residency = 345,
 	},
 	{
-		.name = "C7-SNB",
+		.name = "C7",
 		.flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 109,
 		.target_residency = 345,
@@ -196,31 +196,31 @@ static const struct cpuidle_state snb_cstates[] = {
 
 static const struct cpuidle_state byt_cstates[] = {
 	{
-		.name = "C1-BYT",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C6N-BYT",
+		.name = "C6N",
 		.flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 300,
 		.target_residency = 275,
 	},
 	{
-		.name = "C6S-BYT",
+		.name = "C6S",
 		.flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 500,
 		.target_residency = 560,
 	},
 	{
-		.name = "C7-BYT",
+		.name = "C7",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 1200,
 		.target_residency = 4000,
 	},
 	{
-		.name = "C7S-BYT",
+		.name = "C7S",
 		.flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 10000,
 		.target_residency = 20000,
@@ -230,31 +230,31 @@ static const struct cpuidle_state byt_cstates[] = {
 
 static const struct cpuidle_state cht_cstates[] = {
 	{
-		.name = "C1-CHT",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C6N-CHT",
+		.name = "C6N",
 		.flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 80,
 		.target_residency = 275,
 	},
 	{
-		.name = "C6S-CHT",
+		.name = "C6S",
 		.flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 200,
 		.target_residency = 560,
 	},
 	{
-		.name = "C7-CHT",
+		.name = "C7",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 1200,
 		.target_residency = 4000,
 	},
 	{
-		.name = "C7S-CHT",
+		.name = "C7S",
 		.flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 10000,
 		.target_residency = 20000,
@@ -264,31 +264,31 @@ static const struct cpuidle_state cht_cstates[] = {
 
 static const struct cpuidle_state ivb_cstates[] = {
 	{
-		.name = "C1-IVB",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C1E-IVB",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-IVB",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 59,
 		.target_residency = 156,
 	},
 	{
-		.name = "C6-IVB",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 80,
 		.target_residency = 300,
 	},
 	{
-		.name = "C7-IVB",
+		.name = "C7",
 		.flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 87,
 		.target_residency = 300,
@@ -298,25 +298,25 @@ static const struct cpuidle_state ivb_cstates[] = {
 
 static const struct cpuidle_state ivt_cstates[] = {
 	{
-		.name = "C1-IVT",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C1E-IVT",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 80,
 	},
 	{
-		.name = "C3-IVT",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 59,
 		.target_residency = 156,
 	},
 	{
-		.name = "C6-IVT",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 82,
 		.target_residency = 300,
@@ -326,25 +326,25 @@ static const struct cpuidle_state ivt_cstates[] = {
 
 static const struct cpuidle_state ivt_cstates_4s[] = {
 	{
-		.name = "C1-IVT-4S",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C1E-IVT-4S",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 250,
 	},
 	{
-		.name = "C3-IVT-4S",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 59,
 		.target_residency = 300,
 	},
 	{
-		.name = "C6-IVT-4S",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 84,
 		.target_residency = 400,
@@ -354,25 +354,25 @@ static const struct cpuidle_state ivt_cstates_4s[] = {
 
 static const struct cpuidle_state ivt_cstates_8s[] = {
 	{
-		.name = "C1-IVT-8S",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C1E-IVT-8S",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 500,
 	},
 	{
-		.name = "C3-IVT-8S",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 59,
 		.target_residency = 600,
 	},
 	{
-		.name = "C6-IVT-8S",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 88,
 		.target_residency = 700,
@@ -382,49 +382,49 @@ static const struct cpuidle_state ivt_cstates_8s[] = {
 
 static const struct cpuidle_state hsw_cstates[] = {
 	{
-		.name = "C1-HSW",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-HSW",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-HSW",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 33,
 		.target_residency = 100,
 	},
 	{
-		.name = "C6-HSW",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 133,
 		.target_residency = 400,
 	},
 	{
-		.name = "C7s-HSW",
+		.name = "C7s",
 		.flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 166,
 		.target_residency = 500,
 	},
  	{
-		.name = "C8-HSW",
+		.name = "C8",
 		.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 300,
 		.target_residency = 900,
 	},
 	{
-		.name = "C9-HSW",
+		.name = "C9",
 		.flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 600,
 		.target_residency = 1800,
 	},
 	{
-		.name = "C10-HSW",
+		.name = "C10",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 2600,
 		.target_residency = 7700,
@@ -434,49 +434,49 @@ static const struct cpuidle_state hsw_cstates[] = {
 
 static const struct cpuidle_state bdw_cstates[] = {
 	{
-		.name = "C1-BDW",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-BDW",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-BDW",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 40,
 		.target_residency = 100,
 	},
 	{
-		.name = "C6-BDW",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 133,
 		.target_residency = 400,
 	},
 	{
-		.name = "C7s-BDW",
+		.name = "C7s",
 		.flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 166,
 		.target_residency = 500,
 	},
 	{
-		.name = "C8-BDW",
+		.name = "C8",
 		.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 300,
 		.target_residency = 900,
 	},
 	{
-		.name = "C9-BDW",
+		.name = "C9",
 		.flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 600,
 		.target_residency = 1800,
 	},
 	{
-		.name = "C10-BDW",
+		.name = "C10",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 2600,
 		.target_residency = 7700,
@@ -486,49 +486,49 @@ static const struct cpuidle_state bdw_cstates[] = {
 
 static struct cpuidle_state __read_mostly skl_cstates[] = {
 	{
-		.name = "C1-SKL",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-SKL",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-SKL",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 70,
 		.target_residency = 100,
 	},
 	{
-		.name = "C6-SKL",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 85,
 		.target_residency = 200,
 	},
 	{
-		.name = "C7s-SKL",
+		.name = "C7s",
 		.flags = MWAIT2flg(0x33) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 124,
 		.target_residency = 800,
 	},
 	{
-		.name = "C8-SKL",
+		.name = "C8",
 		.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 200,
 		.target_residency = 800,
 	},
 	{
-		.name = "C9-SKL",
+		.name = "C9",
 		.flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 480,
 		.target_residency = 5000,
 	},
 	{
-		.name = "C10-SKL",
+		.name = "C10",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 890,
 		.target_residency = 5000,
@@ -538,19 +538,19 @@ static struct cpuidle_state __read_mostly skl_cstates[] = {
 
 static struct cpuidle_state __read_mostly skx_cstates[] = {
 	{
-		.name = "C1-SKX",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-SKX",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C6-SKX",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 133,
 		.target_residency = 600,
@@ -560,19 +560,19 @@ static struct cpuidle_state __read_mostly skx_cstates[] = {
 
 static const struct cpuidle_state icx_cstates[] = {
        {
-               .name = "C1-ICX",
+               .name = "C1",
                .flags = MWAIT2flg(0x00),
                .exit_latency = 1,
                .target_residency = 1,
        },
        {
-               .name = "C1E-ICX",
+               .name = "C1E",
                .flags = MWAIT2flg(0x01),
                .exit_latency = 4,
                .target_residency = 4,
        },
        {
-               .name = "C6-ICX",
+               .name = "C6",
                .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
                .exit_latency = 170,
                .target_residency = 600,
@@ -582,25 +582,25 @@ static const struct cpuidle_state icx_cstates[] = {
 
 static const struct cpuidle_state atom_cstates[] = {
 	{
-		.name = "C1E-ATM",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C2-ATM",
+		.name = "C2",
 		.flags = MWAIT2flg(0x10),
 		.exit_latency = 20,
 		.target_residency = 80,
 	},
 	{
-		.name = "C4-ATM",
+		.name = "C4",
 		.flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 100,
 		.target_residency = 400,
 	},
 	{
-		.name = "C6-ATM",
+		.name = "C6",
 		.flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 140,
 		.target_residency = 560,
@@ -610,31 +610,31 @@ static const struct cpuidle_state atom_cstates[] = {
 
 static const struct cpuidle_state tangier_cstates[] = {
 	{
-		.name = "C1-TNG",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 4,
 	},
 	{
-		.name = "C4-TNG",
+		.name = "C4",
 		.flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 100,
 		.target_residency = 400,
 	},
 	{
-		.name = "C6-TNG",
+		.name = "C6",
 		.flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 140,
 		.target_residency = 560,
 	},
 	{
-		.name = "C7-TNG",
+		.name = "C7",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 1200,
 		.target_residency = 4000,
 	},
 	{
-		.name = "C9-TNG",
+		.name = "C9",
 		.flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 10000,
 		.target_residency = 20000,
@@ -644,13 +644,13 @@ static const struct cpuidle_state tangier_cstates[] = {
 
 static const struct cpuidle_state avn_cstates[] = {
 	{
-		.name = "C1-AVN",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C6-AVN",
+		.name = "C6",
 		.flags = MWAIT2flg(0x51) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 15,
 		.target_residency = 45,
@@ -660,13 +660,13 @@ static const struct cpuidle_state avn_cstates[] = {
 
 static const struct cpuidle_state knl_cstates[] = {
 	{
-		.name = "C1-KNL",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 2,
 	},
 	{
-		.name = "C6-KNL",
+		.name = "C6",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 120,
 		.target_residency = 500,
@@ -676,43 +676,43 @@ static const struct cpuidle_state knl_cstates[] = {
 
 static struct cpuidle_state __read_mostly bxt_cstates[] = {
 	{
-		.name = "C1-BXT",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-BXT",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C6-BXT",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 133,
 		.target_residency = 133,
 	},
 	{
-		.name = "C7s-BXT",
+		.name = "C7s",
 		.flags = MWAIT2flg(0x31) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 155,
 		.target_residency = 155,
 	},
 	{
-		.name = "C8-BXT",
+		.name = "C8",
 		.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 1000,
 		.target_residency = 1000,
 	},
 	{
-		.name = "C9-BXT",
+		.name = "C9",
 		.flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 2000,
 		.target_residency = 2000,
 	},
 	{
-		.name = "C10-BXT",
+		.name = "C10",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 10000,
 		.target_residency = 10000,
@@ -722,19 +722,19 @@ static struct cpuidle_state __read_mostly bxt_cstates[] = {
 
 static const struct cpuidle_state dnv_cstates[] = {
 	{
-		.name = "C1-DNV",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-DNV",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C6-DNV",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 50,
 		.target_residency = 500,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 07:55:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 07:55:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259719.448200 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuCZ-0005GL-A2; Mon, 24 Jan 2022 07:55:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259719.448200; Mon, 24 Jan 2022 07:55: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 1nBuCZ-0005GD-6j; Mon, 24 Jan 2022 07:55:47 +0000
Received: by outflank-mailman (input) for mailman id 259719;
 Mon, 24 Jan 2022 07:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCX-0005Fx-9f
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCX-0003FT-8n
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCX-0003tD-84
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1bP97UB6srQd6H1DXkr6z+KxTywyuXo+qVzjhyY/tVU=; b=Q0MleKsJfciZbDyDYXmutvYVkr
	cR2aST4rt+8Hp627QV+tSclO/JuQdeIyE644C1KKEf4FBS/hI999YEWxwiWpUUN3V4TTAzl0ek1Qj
	HTonYNw483nrPFVBaG30ycUXpD61U80AzKwK81d02LLTXkZ7Zw1okLW/51w4/dfZpW/Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mwait-idle: switch to using bool
Message-Id: <E1nBuCX-0003tD-84@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 07:55:45 +0000

commit 83512756a158e7470a39875c8e517a91a6afa5d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:43:08 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:43:08 2022 +0100

    x86/mwait-idle: switch to using bool
    
    When the driver was first ported, we didn't have "bool" yet, so
    conversion to bool_t / 0 / 1 was necessary. Undo that conversion, easing
    ports of newer changes as well as tidying things up.
    
    Requested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 2e531e98b2..158741fc71 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -76,7 +76,7 @@
 # define pr_debug(fmt...)
 #endif
 
-static __initdata bool_t opt_mwait_idle = 1;
+static __initdata bool opt_mwait_idle = true;
 boolean_param("mwait-idle", opt_mwait_idle);
 
 static unsigned int mwait_substates;
@@ -93,8 +93,8 @@ struct idle_cpu {
 	 * Indicate which enable bits to clear here.
 	 */
 	unsigned long auto_demotion_disable_flags;
-	bool_t byt_auto_demotion_disable_flag;
-	bool_t disable_promotion_to_c1e;
+	bool byt_auto_demotion_disable_flag;
+	bool disable_promotion_to_c1e;
 };
 
 static const struct idle_cpu *icpu;
@@ -867,7 +867,7 @@ static void c1e_promotion_disable(void *dummy)
 static const struct idle_cpu idle_cpu_nehalem = {
 	.state_table = nehalem_cstates,
 	.auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_atom = {
@@ -885,59 +885,59 @@ static const struct idle_cpu idle_cpu_lincroft = {
 
 static const struct idle_cpu idle_cpu_snb = {
 	.state_table = snb_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_byt = {
 	.state_table = byt_cstates,
-	.disable_promotion_to_c1e = 1,
-	.byt_auto_demotion_disable_flag = 1,
+	.disable_promotion_to_c1e = true,
+	.byt_auto_demotion_disable_flag = true,
 };
 
 static const struct idle_cpu idle_cpu_cht = {
 	.state_table = cht_cstates,
-	.disable_promotion_to_c1e = 1,
-	.byt_auto_demotion_disable_flag = 1,
+	.disable_promotion_to_c1e = true,
+	.byt_auto_demotion_disable_flag = true,
 };
 
 static const struct idle_cpu idle_cpu_ivb = {
 	.state_table = ivb_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_ivt = {
 	.state_table = ivt_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_hsw = {
 	.state_table = hsw_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_bdw = {
 	.state_table = bdw_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_skl = {
 	.state_table = skl_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_skx = {
 	.state_table = skx_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_icx = {
        .state_table = icx_cstates,
-       .disable_promotion_to_c1e = 1,
+       .disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_avn = {
 	.state_table = avn_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_knl = {
@@ -946,12 +946,12 @@ static const struct idle_cpu idle_cpu_knl = {
 
 static const struct idle_cpu idle_cpu_bxt = {
 	.state_table = bxt_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_dnv = {
 	.state_table = dnv_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 #define ICPU(model, cpu) \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 07:55:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 07:55:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259720.448206 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuCj-0005Jd-Di; Mon, 24 Jan 2022 07:55:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259720.448206; Mon, 24 Jan 2022 07:55:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuCj-0005JT-A1; Mon, 24 Jan 2022 07:55:57 +0000
Received: by outflank-mailman (input) for mailman id 259720;
 Mon, 24 Jan 2022 07:55:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCh-0005JB-Cl
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCh-0003Fx-Bu
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCh-0003tz-B9
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wGQVK1HrgZU0Nr38U5VSL6g8C8873ljMBhZRA+XfqEw=; b=EOw23R4vmwzsk4CaNLudLT/QoU
	BJw38sb8r3Lu1UWBMoxkQvdwiJLAcA76NBaYafwUQWW0XPa+Fi+M5gaKZDeFFBHiScWlXs9ZU1o/y
	GIKtcfzhibZdX3i+/c5sP3soNZbn4tq6EZLeCfATL7+xEaZ+e8scjIqB7G+1JKOKijpo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Message-Id: <E1nBuCh-0003tz-B9@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 07:55:55 +0000

commit dd8238a6114f186276293f401aa449aca991c029
Author:     Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
AuthorDate: Mon Jan 24 08:43:44 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:43:44 2022 +0100

    From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    x86/mwait-idle: add SnowRidge C-state table
    
    Add C-state table for the SnowRidge SoC which is found on Intel Jacobsville
    platforms.
    
    The following has been changed.
    
     1. C1E latency changed from 10us to 15us. It was measured using the
        open source "wult" tool (the "nic" method, 15us is the 99.99th
        percentile).
    
     2. C1E power break even changed from 20us to 25us, which may result
        in less C1E residency in some workloads.
    
     3. C6 latency changed from 50us to 130us. Measured the same way as C1E.
    
    The C6 C-state is supported only by some SnowRidge revisions, so add a C-state
    table commentary about this.
    
    On SnowRidge, C6 support is enumerated via the usual mechanism: "mwait" leaf of
    the "cpuid" instruction. The 'intel_idle' driver does check this leaf, so even
    though C6 is present in the table, the driver will only use it if the CPU does
    support it.
    
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: 9cf93f056f783f986c19f40d5304d1bcffa0fc0d]
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 158741fc71..12524eefd4 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -742,6 +742,32 @@ static const struct cpuidle_state dnv_cstates[] = {
 	{}
 };
 
+/*
+ * Note, depending on HW and FW revision, SnowRidge SoC may or may not support
+ * C6, and this is indicated in the CPUID mwait leaf.
+ */
+static const struct cpuidle_state snr_cstates[] = {
+	{
+		.name = "C1",
+		.flags = MWAIT2flg(0x00),
+		.exit_latency = 2,
+		.target_residency = 2,
+	},
+	{
+		.name = "C1E",
+		.flags = MWAIT2flg(0x01),
+		.exit_latency = 15,
+		.target_residency = 25,
+	},
+	{
+		.name = "C6",
+		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
+		.exit_latency = 130,
+		.target_residency = 500,
+	},
+	{}
+};
+
 static void mwait_idle(void)
 {
 	unsigned int cpu = smp_processor_id();
@@ -954,6 +980,11 @@ static const struct idle_cpu idle_cpu_dnv = {
 	.disable_promotion_to_c1e = true,
 };
 
+static const struct idle_cpu idle_cpu_snr = {
+	.state_table = snr_cstates,
+	.disable_promotion_to_c1e = true,
+};
+
 #define ICPU(model, cpu) \
 	{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ALWAYS, &idle_cpu_##cpu}
 
@@ -996,7 +1027,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconstrel = {
 	ICPU(0x5c, bxt),
 	ICPU(0x7a, bxt),
 	ICPU(0x5f, dnv),
-	ICPU(0x86, dnv),
+	ICPU(0x86, snr),
 	{}
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 07:56:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 07:56:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259721.448210 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nBuCt-0005MR-Eu; Mon, 24 Jan 2022 07:56:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259721.448210; Mon, 24 Jan 2022 07:56: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 1nBuCt-0005MJ-Bg; Mon, 24 Jan 2022 07:56:07 +0000
Received: by outflank-mailman (input) for mailman id 259721;
 Mon, 24 Jan 2022 07:56:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCr-0005M4-Fq
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:56:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCr-0003GK-F4
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nBuCr-0003v8-EM
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 07:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+TB7fcf/7td/nHuvee7SeznnKorqz5jdoSRemfNZGBk=; b=5MfrJqK53b7Gy+FRnQ9gDFI1Le
	EuYmtKq8rBXkhkhiGOyrO/MMB9++oCXV0EIXI6zQRbc2iUWaJc7xSjYoKSVvqQSm7l00ZSdO9zskU
	mP2fmc/8N60RUKlRd2zp5g7EGrpe7iwSfHBosYRyXXe0Ji4CJ2m0McyOSqTJKB+GBsMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: drop pmt_scale_r
Message-Id: <E1nBuCr-0003v8-EM@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 07:56:05 +0000

commit ec32910f4f871dce0f0e32dfb36f218fa1a2e869
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:44:39 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:44:39 2022 +0100

    x86/time: drop pmt_scale_r
    
    Its only user, ns_to_acpi_pm_tick(), is unused.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/time.h | 1 -
 xen/arch/x86/time.c             | 7 -------
 2 files changed, 8 deletions(-)

diff --git a/xen/arch/x86/include/asm/time.h b/xen/arch/x86/include/asm/time.h
index f347311cc4..f06f2bfd8b 100644
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -48,7 +48,6 @@ void pit_broadcast_exit(void);
 int pit_broadcast_is_available(void);
 
 uint64_t acpi_pm_tick_to_ns(uint64_t ticks);
-uint64_t ns_to_acpi_pm_tick(uint64_t ns);
 
 uint64_t tsc_ticks2ns(uint64_t ticks);
 
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 7fb760cf55..17f64a6ccd 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -536,12 +536,10 @@ static struct platform_timesource __initdata plt_pmtimer =
 };
 
 static struct time_scale __read_mostly pmt_scale;
-static struct time_scale __read_mostly pmt_scale_r;
 
 static __init int init_pmtmr_scale(void)
 {
     set_time_scale(&pmt_scale, ACPI_PM_FREQUENCY);
-    pmt_scale_r = scale_reciprocal(pmt_scale);
     return 0;
 }
 __initcall(init_pmtmr_scale);
@@ -551,11 +549,6 @@ uint64_t acpi_pm_tick_to_ns(uint64_t ticks)
     return scale_delta(ticks, &pmt_scale);
 }
 
-uint64_t ns_to_acpi_pm_tick(uint64_t ns)
-{
-    return scale_delta(ns, &pmt_scale_r);
-}
-
 /************************************************************
  * PLATFORM TIMER 4: TSC
  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 19:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 19:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259970.448851 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nC5Qe-0003zG-19; Mon, 24 Jan 2022 19:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259970.448851; Mon, 24 Jan 2022 19:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nC5Qd-0003z8-US; Mon, 24 Jan 2022 19:55:03 +0000
Received: by outflank-mailman (input) for mailman id 259970;
 Mon, 24 Jan 2022 19: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 1nC5Qc-0003yz-97
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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 1nC5Qc-0000cf-7N
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5Qc-0008R1-6I
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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=rBTDk+msFJt1uPcoKo/UjYfg6qMnXR9wrTOLfs8vle0=; b=aeblXbGHPtDojDfxk2pHWmqnkt
	XaJpVtvaRwPBL5ALkvb5Q750FiFWPJtKckTdgoBA51qS6k+7XFz4VHtyV6OP3F8+AdJ/GTrMAhjnH
	l6p35kVm5vc4HvqE3IxOoSac5G4EXSnNCmYp1MhBtqMfss7RXBzrdeILT2OS7zGjdfS4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/APIC: no need for timer calibration when using TDT
Message-Id: <E1nC5Qc-0008R1-6I@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 19:55:02 +0000

commit 0731a56c7c72fc117b69982e002954645fc3685b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:38:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:38:55 2022 +0100

    x86/APIC: no need for timer calibration when using TDT
    
    The only global effect of calibrate_APIC_clock() is the setting of
    "bus_scale"; the final __setup_APIC_LVTT(0) is (at best) redundant with
    the immediately following setup_APIC_timer() invocation. Yet "bus_scale"
    isn't used when using TDT. Avoid wasting 100ms for calibration in this
    case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/apic.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index d7d5c15155..5d3e1f3952 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1292,11 +1292,15 @@ void __init setup_boot_APIC_clock(void)
 
     check_deadline_errata();
 
+    if ( !boot_cpu_has(X86_FEATURE_TSC_DEADLINE) )
+        tdt_enable = false;
+
     local_irq_save(flags);
 
-    calibrate_APIC_clock();
+    if ( !tdt_enable || apic_verbosity )
+        calibrate_APIC_clock();
 
-    if ( tdt_enable && boot_cpu_has(X86_FEATURE_TSC_DEADLINE) )
+    if ( tdt_enable )
     {
         printk(KERN_DEBUG "TSC deadline timer enabled\n");
         tdt_enabled = true;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 19:55:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 19:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259971.448856 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nC5Qo-000413-34; Mon, 24 Jan 2022 19:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259971.448856; Mon, 24 Jan 2022 19: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 1nC5Qn-00040v-Vt; Mon, 24 Jan 2022 19:55:13 +0000
Received: by outflank-mailman (input) for mailman id 259971;
 Mon, 24 Jan 2022 19: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 1nC5Qm-00040i-BZ
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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 1nC5Qm-0000cj-Am
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5Qm-0008Rw-9n
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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=JbaR14MX1O9yqdBvSpXQEOh3d4Wnv4byD5y5ph1YwrY=; b=Yx1z7LWOqhpZk5xY+qqOp53fEw
	/axMBtWsuF8Fa9wBfnePNXA7MVoAnGfg+vmncyG1jRvJ3C0g6Y6+TdmBRcmoE5p0FfV3Um7vzAiZC
	P0lVXcEZ5ZtBdgZyTylocAs1V0lEEWK8lqV6O6aNRH85+1xu/cyKC0IyIo3/QBKRqhe8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/APIC: drop 32-bit days remnants
Message-Id: <E1nC5Qm-0008Rw-9n@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 19:55:12 +0000

commit 8593782ace71149339adace3201d3467ae7bf502
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:40:13 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:40:13 2022 +0100

    x86/APIC: drop 32-bit days remnants
    
    Mercury and Neptune were Pentium chipsets - no need to work around their
    errata, even more so that the workaround looks fragile.
    
    Also ditch a Pentium-related and stale part of a comment.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/apic.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 5d3e1f3952..5836561585 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1042,11 +1042,6 @@ static void __init wait_8254_wraparound(void)
     do {
         prev_count = curr_count;
         curr_count = get_8254_timer_count();
-
-        /* workaround for broken Mercury/Neptune */
-        if (prev_count >= curr_count + 0x100)
-            curr_count = get_8254_timer_count();
-        
     } while (prev_count >= curr_count);
 }
 
@@ -1056,9 +1051,6 @@ static void __init wait_8254_wraparound(void)
  * this function twice on the boot CPU, once with a bogus timeout
  * value, second time for real. The other (noncalibrating) CPUs
  * call this function only once, with the real, calibrated value.
- *
- * We do reads before writes even if unnecessary, to get around the
- * P5 APIC double write bug.
  */
 
 #define APIC_DIVISOR 1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 19:55:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 19:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259972.448858 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nC5Qy-00044E-4A; Mon, 24 Jan 2022 19:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259972.448858; Mon, 24 Jan 2022 19: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 1nC5Qy-000446-1B; Mon, 24 Jan 2022 19:55:24 +0000
Received: by outflank-mailman (input) for mailman id 259972;
 Mon, 24 Jan 2022 19: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 1nC5Qw-00043X-F2
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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 1nC5Qw-0000d1-EA
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5Qw-0008Sx-D0
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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=T1Yjg1aX6jP5mw/QmZK3ZSPB3ySpDwA7Cp4IUjMTy3M=; b=HqGjOqpCgFVqg/o3vec3GDtMkZ
	9onkXpQbUV6y1pMgx0O7bQTtjbDR1CNtERkj8jUy31sEklqL9bcxaYMUH3ndDk5Tj5GY3TF6v21h7
	qWeCNiN+nmrt+4fKYggL8YcPvsEBI3CCa7rBqV5ZX4dh7y24O6iUBOr8isVCN+YD8Khw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: minor adjustments to init_pit()
Message-Id: <E1nC5Qw-0008Sx-D0@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 19:55:22 +0000

commit 5e73b2594c540400d8d8510a7e38ab52cc69b243
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:40:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:40:59 2022 +0100

    x86/time: minor adjustments to init_pit()
    
    For one, "using_pit" shouldn't be set ahead of the function's last
    (for now: only) error path. Otherwise "clocksource=pit" on the command
    line can lead to misbehavior when actually taking that error path.
    
    And then make an implicit assumption explicit: CALIBRATE_FRAC cannot,
    for example, simply be changed to 10. The way init_pit() works, the
    upper bound on the calibration period is about 54ms.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/time.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 1daff92dca..7fb760cf55 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -333,8 +333,6 @@ static s64 __init init_pit(struct platform_timesource *pts)
     u64 start, end;
     unsigned long count;
 
-    using_pit = true;
-
     /* Set the Gate high, disable speaker. */
     outb((portb & ~0x02) | 0x01, 0x61);
 
@@ -344,6 +342,7 @@ static s64 __init init_pit(struct platform_timesource *pts)
      * (LSB and MSB) to begin countdown.
      */
 #define CALIBRATE_LATCH CALIBRATE_VALUE(CLOCK_TICK_RATE)
+    BUILD_BUG_ON(CALIBRATE_LATCH >> 16);
     outb(0xb0, PIT_MODE);                  /* binary, mode 0, LSB/MSB, Ch 2 */
     outb(CALIBRATE_LATCH & 0xff, PIT_CH2); /* LSB of count */
     outb(CALIBRATE_LATCH >> 8, PIT_CH2);   /* MSB of count */
@@ -361,6 +360,8 @@ static s64 __init init_pit(struct platform_timesource *pts)
     if ( count == 0 )
         return 0;
 
+    using_pit = true;
+
     return (end - start) * CALIBRATE_FRAC;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 19:55:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 19:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259973.448863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nC5R8-00047U-5s; Mon, 24 Jan 2022 19:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259973.448863; Mon, 24 Jan 2022 19: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 1nC5R8-00047M-2k; Mon, 24 Jan 2022 19:55:34 +0000
Received: by outflank-mailman (input) for mailman id 259973;
 Mon, 24 Jan 2022 19: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 1nC5R6-000478-IF
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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 1nC5R6-0000dC-HN
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5R6-0008Ta-GU
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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=27APPGXrW0xgvaK3cbWF7x0WDnwX0ItpZugVBrnvrjw=; b=vu/EJ2lexad/bbwqwvKxorUtvK
	OFFzYnv4Uq4YkYj+EP9ssnDrZkWHduDP0pNPPyN6wiFmTBycSqSRkf0khrd76QI+4bIKZ7oc5/EGo
	RMnr+rYO7w25YKQo3cNGnUnAzW1ZnvF8hZbEgYjq8PQJxYR0vOeWQMvJ7tGX0gT7u4dE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mwait-idle: stop exposing platform acronyms
Message-Id: <E1nC5R6-0008Ta-GU@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 19:55:32 +0000

commit 73394e18bcbac9c029d524525ccbb53ca2a7d612
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:42:25 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:42:25 2022 +0100

    x86/mwait-idle: stop exposing platform acronyms
    
    This follows Linux commit de09cdd09fa1 ("intel_idle: stop exposing
    platform acronyms in sysfs"), but their main justifications (sysfs
    exposure and similarity with acpi-idle) don't apply to us. The field is
    only used in a single printk() right now, but having the platform tags
    there isn't useful either.
    
    Requested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 178 +++++++++++++++++++++---------------------
 1 file changed, 89 insertions(+), 89 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 9e04d969d6..2e531e98b2 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -134,25 +134,25 @@ static const struct cpuidle_state {
  */
 static const struct cpuidle_state nehalem_cstates[] = {
 	{
-		.name = "C1-NHM",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 3,
 		.target_residency = 6,
 	},
 	{
-		.name = "C1E-NHM",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-NHM",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 20,
 		.target_residency = 80,
 	},
 	{
-		.name = "C6-NHM",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 200,
 		.target_residency = 800,
@@ -162,31 +162,31 @@ static const struct cpuidle_state nehalem_cstates[] = {
 
 static const struct cpuidle_state snb_cstates[] = {
 	{
-		.name = "C1-SNB",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-SNB",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-SNB",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 80,
 		.target_residency = 211,
 	},
 	{
-		.name = "C6-SNB",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 104,
 		.target_residency = 345,
 	},
 	{
-		.name = "C7-SNB",
+		.name = "C7",
 		.flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 109,
 		.target_residency = 345,
@@ -196,31 +196,31 @@ static const struct cpuidle_state snb_cstates[] = {
 
 static const struct cpuidle_state byt_cstates[] = {
 	{
-		.name = "C1-BYT",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C6N-BYT",
+		.name = "C6N",
 		.flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 300,
 		.target_residency = 275,
 	},
 	{
-		.name = "C6S-BYT",
+		.name = "C6S",
 		.flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 500,
 		.target_residency = 560,
 	},
 	{
-		.name = "C7-BYT",
+		.name = "C7",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 1200,
 		.target_residency = 4000,
 	},
 	{
-		.name = "C7S-BYT",
+		.name = "C7S",
 		.flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 10000,
 		.target_residency = 20000,
@@ -230,31 +230,31 @@ static const struct cpuidle_state byt_cstates[] = {
 
 static const struct cpuidle_state cht_cstates[] = {
 	{
-		.name = "C1-CHT",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C6N-CHT",
+		.name = "C6N",
 		.flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 80,
 		.target_residency = 275,
 	},
 	{
-		.name = "C6S-CHT",
+		.name = "C6S",
 		.flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 200,
 		.target_residency = 560,
 	},
 	{
-		.name = "C7-CHT",
+		.name = "C7",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 1200,
 		.target_residency = 4000,
 	},
 	{
-		.name = "C7S-CHT",
+		.name = "C7S",
 		.flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 10000,
 		.target_residency = 20000,
@@ -264,31 +264,31 @@ static const struct cpuidle_state cht_cstates[] = {
 
 static const struct cpuidle_state ivb_cstates[] = {
 	{
-		.name = "C1-IVB",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C1E-IVB",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-IVB",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 59,
 		.target_residency = 156,
 	},
 	{
-		.name = "C6-IVB",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 80,
 		.target_residency = 300,
 	},
 	{
-		.name = "C7-IVB",
+		.name = "C7",
 		.flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 87,
 		.target_residency = 300,
@@ -298,25 +298,25 @@ static const struct cpuidle_state ivb_cstates[] = {
 
 static const struct cpuidle_state ivt_cstates[] = {
 	{
-		.name = "C1-IVT",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C1E-IVT",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 80,
 	},
 	{
-		.name = "C3-IVT",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 59,
 		.target_residency = 156,
 	},
 	{
-		.name = "C6-IVT",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 82,
 		.target_residency = 300,
@@ -326,25 +326,25 @@ static const struct cpuidle_state ivt_cstates[] = {
 
 static const struct cpuidle_state ivt_cstates_4s[] = {
 	{
-		.name = "C1-IVT-4S",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C1E-IVT-4S",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 250,
 	},
 	{
-		.name = "C3-IVT-4S",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 59,
 		.target_residency = 300,
 	},
 	{
-		.name = "C6-IVT-4S",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 84,
 		.target_residency = 400,
@@ -354,25 +354,25 @@ static const struct cpuidle_state ivt_cstates_4s[] = {
 
 static const struct cpuidle_state ivt_cstates_8s[] = {
 	{
-		.name = "C1-IVT-8S",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 1,
 	},
 	{
-		.name = "C1E-IVT-8S",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 500,
 	},
 	{
-		.name = "C3-IVT-8S",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 59,
 		.target_residency = 600,
 	},
 	{
-		.name = "C6-IVT-8S",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 88,
 		.target_residency = 700,
@@ -382,49 +382,49 @@ static const struct cpuidle_state ivt_cstates_8s[] = {
 
 static const struct cpuidle_state hsw_cstates[] = {
 	{
-		.name = "C1-HSW",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-HSW",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-HSW",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 33,
 		.target_residency = 100,
 	},
 	{
-		.name = "C6-HSW",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 133,
 		.target_residency = 400,
 	},
 	{
-		.name = "C7s-HSW",
+		.name = "C7s",
 		.flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 166,
 		.target_residency = 500,
 	},
  	{
-		.name = "C8-HSW",
+		.name = "C8",
 		.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 300,
 		.target_residency = 900,
 	},
 	{
-		.name = "C9-HSW",
+		.name = "C9",
 		.flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 600,
 		.target_residency = 1800,
 	},
 	{
-		.name = "C10-HSW",
+		.name = "C10",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 2600,
 		.target_residency = 7700,
@@ -434,49 +434,49 @@ static const struct cpuidle_state hsw_cstates[] = {
 
 static const struct cpuidle_state bdw_cstates[] = {
 	{
-		.name = "C1-BDW",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-BDW",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-BDW",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 40,
 		.target_residency = 100,
 	},
 	{
-		.name = "C6-BDW",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 133,
 		.target_residency = 400,
 	},
 	{
-		.name = "C7s-BDW",
+		.name = "C7s",
 		.flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 166,
 		.target_residency = 500,
 	},
 	{
-		.name = "C8-BDW",
+		.name = "C8",
 		.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 300,
 		.target_residency = 900,
 	},
 	{
-		.name = "C9-BDW",
+		.name = "C9",
 		.flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 600,
 		.target_residency = 1800,
 	},
 	{
-		.name = "C10-BDW",
+		.name = "C10",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 2600,
 		.target_residency = 7700,
@@ -486,49 +486,49 @@ static const struct cpuidle_state bdw_cstates[] = {
 
 static struct cpuidle_state __read_mostly skl_cstates[] = {
 	{
-		.name = "C1-SKL",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-SKL",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C3-SKL",
+		.name = "C3",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 70,
 		.target_residency = 100,
 	},
 	{
-		.name = "C6-SKL",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 85,
 		.target_residency = 200,
 	},
 	{
-		.name = "C7s-SKL",
+		.name = "C7s",
 		.flags = MWAIT2flg(0x33) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 124,
 		.target_residency = 800,
 	},
 	{
-		.name = "C8-SKL",
+		.name = "C8",
 		.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 200,
 		.target_residency = 800,
 	},
 	{
-		.name = "C9-SKL",
+		.name = "C9",
 		.flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 480,
 		.target_residency = 5000,
 	},
 	{
-		.name = "C10-SKL",
+		.name = "C10",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 890,
 		.target_residency = 5000,
@@ -538,19 +538,19 @@ static struct cpuidle_state __read_mostly skl_cstates[] = {
 
 static struct cpuidle_state __read_mostly skx_cstates[] = {
 	{
-		.name = "C1-SKX",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-SKX",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C6-SKX",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 133,
 		.target_residency = 600,
@@ -560,19 +560,19 @@ static struct cpuidle_state __read_mostly skx_cstates[] = {
 
 static const struct cpuidle_state icx_cstates[] = {
        {
-               .name = "C1-ICX",
+               .name = "C1",
                .flags = MWAIT2flg(0x00),
                .exit_latency = 1,
                .target_residency = 1,
        },
        {
-               .name = "C1E-ICX",
+               .name = "C1E",
                .flags = MWAIT2flg(0x01),
                .exit_latency = 4,
                .target_residency = 4,
        },
        {
-               .name = "C6-ICX",
+               .name = "C6",
                .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
                .exit_latency = 170,
                .target_residency = 600,
@@ -582,25 +582,25 @@ static const struct cpuidle_state icx_cstates[] = {
 
 static const struct cpuidle_state atom_cstates[] = {
 	{
-		.name = "C1E-ATM",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C2-ATM",
+		.name = "C2",
 		.flags = MWAIT2flg(0x10),
 		.exit_latency = 20,
 		.target_residency = 80,
 	},
 	{
-		.name = "C4-ATM",
+		.name = "C4",
 		.flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 100,
 		.target_residency = 400,
 	},
 	{
-		.name = "C6-ATM",
+		.name = "C6",
 		.flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 140,
 		.target_residency = 560,
@@ -610,31 +610,31 @@ static const struct cpuidle_state atom_cstates[] = {
 
 static const struct cpuidle_state tangier_cstates[] = {
 	{
-		.name = "C1-TNG",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 4,
 	},
 	{
-		.name = "C4-TNG",
+		.name = "C4",
 		.flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 100,
 		.target_residency = 400,
 	},
 	{
-		.name = "C6-TNG",
+		.name = "C6",
 		.flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 140,
 		.target_residency = 560,
 	},
 	{
-		.name = "C7-TNG",
+		.name = "C7",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 1200,
 		.target_residency = 4000,
 	},
 	{
-		.name = "C9-TNG",
+		.name = "C9",
 		.flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 10000,
 		.target_residency = 20000,
@@ -644,13 +644,13 @@ static const struct cpuidle_state tangier_cstates[] = {
 
 static const struct cpuidle_state avn_cstates[] = {
 	{
-		.name = "C1-AVN",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C6-AVN",
+		.name = "C6",
 		.flags = MWAIT2flg(0x51) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 15,
 		.target_residency = 45,
@@ -660,13 +660,13 @@ static const struct cpuidle_state avn_cstates[] = {
 
 static const struct cpuidle_state knl_cstates[] = {
 	{
-		.name = "C1-KNL",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 1,
 		.target_residency = 2,
 	},
 	{
-		.name = "C6-KNL",
+		.name = "C6",
 		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 120,
 		.target_residency = 500,
@@ -676,43 +676,43 @@ static const struct cpuidle_state knl_cstates[] = {
 
 static struct cpuidle_state __read_mostly bxt_cstates[] = {
 	{
-		.name = "C1-BXT",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-BXT",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C6-BXT",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 133,
 		.target_residency = 133,
 	},
 	{
-		.name = "C7s-BXT",
+		.name = "C7s",
 		.flags = MWAIT2flg(0x31) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 155,
 		.target_residency = 155,
 	},
 	{
-		.name = "C8-BXT",
+		.name = "C8",
 		.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 1000,
 		.target_residency = 1000,
 	},
 	{
-		.name = "C9-BXT",
+		.name = "C9",
 		.flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 2000,
 		.target_residency = 2000,
 	},
 	{
-		.name = "C10-BXT",
+		.name = "C10",
 		.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 10000,
 		.target_residency = 10000,
@@ -722,19 +722,19 @@ static struct cpuidle_state __read_mostly bxt_cstates[] = {
 
 static const struct cpuidle_state dnv_cstates[] = {
 	{
-		.name = "C1-DNV",
+		.name = "C1",
 		.flags = MWAIT2flg(0x00),
 		.exit_latency = 2,
 		.target_residency = 2,
 	},
 	{
-		.name = "C1E-DNV",
+		.name = "C1E",
 		.flags = MWAIT2flg(0x01),
 		.exit_latency = 10,
 		.target_residency = 20,
 	},
 	{
-		.name = "C6-DNV",
+		.name = "C6",
 		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
 		.exit_latency = 50,
 		.target_residency = 500,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 19:55:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 19:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259974.448866 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nC5RI-0004AB-80; Mon, 24 Jan 2022 19:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259974.448866; Mon, 24 Jan 2022 19: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 1nC5RI-0004A4-4O; Mon, 24 Jan 2022 19:55:44 +0000
Received: by outflank-mailman (input) for mailman id 259974;
 Mon, 24 Jan 2022 19: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 1nC5RG-00049s-LY
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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 1nC5RG-0000dM-Kk
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5RG-0008UH-Jo
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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=yjmvHTZxE7N3lZOtYqM4+JnujIo8hAXeVUQz+do4gYs=; b=Sq+I5nnKJq2ISthKw4VvLicmfz
	hVzGtVs30r1WPEB5bvZR2lV3k4yMMcWg3TUmA0LHWxQzIeXzriMZimoNR/5EkNfOMg2LO0l07OqiU
	W4NBnSpudkX7q48PdbS0aTX5A/eA8ClVPHUC/1C6Q6VuQLyN31VPFFkgHfH/+7TzwhC8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mwait-idle: switch to using bool
Message-Id: <E1nC5RG-0008UH-Jo@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 19:55:42 +0000

commit 83512756a158e7470a39875c8e517a91a6afa5d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:43:08 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:43:08 2022 +0100

    x86/mwait-idle: switch to using bool
    
    When the driver was first ported, we didn't have "bool" yet, so
    conversion to bool_t / 0 / 1 was necessary. Undo that conversion, easing
    ports of newer changes as well as tidying things up.
    
    Requested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 2e531e98b2..158741fc71 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -76,7 +76,7 @@
 # define pr_debug(fmt...)
 #endif
 
-static __initdata bool_t opt_mwait_idle = 1;
+static __initdata bool opt_mwait_idle = true;
 boolean_param("mwait-idle", opt_mwait_idle);
 
 static unsigned int mwait_substates;
@@ -93,8 +93,8 @@ struct idle_cpu {
 	 * Indicate which enable bits to clear here.
 	 */
 	unsigned long auto_demotion_disable_flags;
-	bool_t byt_auto_demotion_disable_flag;
-	bool_t disable_promotion_to_c1e;
+	bool byt_auto_demotion_disable_flag;
+	bool disable_promotion_to_c1e;
 };
 
 static const struct idle_cpu *icpu;
@@ -867,7 +867,7 @@ static void c1e_promotion_disable(void *dummy)
 static const struct idle_cpu idle_cpu_nehalem = {
 	.state_table = nehalem_cstates,
 	.auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_atom = {
@@ -885,59 +885,59 @@ static const struct idle_cpu idle_cpu_lincroft = {
 
 static const struct idle_cpu idle_cpu_snb = {
 	.state_table = snb_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_byt = {
 	.state_table = byt_cstates,
-	.disable_promotion_to_c1e = 1,
-	.byt_auto_demotion_disable_flag = 1,
+	.disable_promotion_to_c1e = true,
+	.byt_auto_demotion_disable_flag = true,
 };
 
 static const struct idle_cpu idle_cpu_cht = {
 	.state_table = cht_cstates,
-	.disable_promotion_to_c1e = 1,
-	.byt_auto_demotion_disable_flag = 1,
+	.disable_promotion_to_c1e = true,
+	.byt_auto_demotion_disable_flag = true,
 };
 
 static const struct idle_cpu idle_cpu_ivb = {
 	.state_table = ivb_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_ivt = {
 	.state_table = ivt_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_hsw = {
 	.state_table = hsw_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_bdw = {
 	.state_table = bdw_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_skl = {
 	.state_table = skl_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_skx = {
 	.state_table = skx_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_icx = {
        .state_table = icx_cstates,
-       .disable_promotion_to_c1e = 1,
+       .disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_avn = {
 	.state_table = avn_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_knl = {
@@ -946,12 +946,12 @@ static const struct idle_cpu idle_cpu_knl = {
 
 static const struct idle_cpu idle_cpu_bxt = {
 	.state_table = bxt_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 static const struct idle_cpu idle_cpu_dnv = {
 	.state_table = dnv_cstates,
-	.disable_promotion_to_c1e = 1,
+	.disable_promotion_to_c1e = true,
 };
 
 #define ICPU(model, cpu) \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 19:55:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 19:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259975.448870 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nC5RS-0004Df-Ay; Mon, 24 Jan 2022 19:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259975.448870; Mon, 24 Jan 2022 19: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 1nC5RS-0004DX-86; Mon, 24 Jan 2022 19:55:54 +0000
Received: by outflank-mailman (input) for mailman id 259975;
 Mon, 24 Jan 2022 19: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 1nC5RQ-0004DA-Oe
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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 1nC5RQ-0000dW-Nt
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5RQ-0008V2-N3
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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=xiORcW37BHqav4OvINlrL4MtwBEFhpLu+SLfC7rCRgI=; b=W3FViJucyW7O/3xozOW44N1ggY
	9PJfAAdRxdVFgGBTyq1XG8v/4hIL6IKsAknnCyKCdeMcf66REyI4GrlFueAEJJ7G9hlHTB2MKKDU/
	sKaOsXea88AHC3qCQqy9xtL5dqdJqxyQCjc4A35YpXqRaVNmMBb0LaAS+GNZ0XwD7aSo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Message-Id: <E1nC5RQ-0008V2-N3@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 19:55:52 +0000

commit dd8238a6114f186276293f401aa449aca991c029
Author:     Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
AuthorDate: Mon Jan 24 08:43:44 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:43:44 2022 +0100

    From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    x86/mwait-idle: add SnowRidge C-state table
    
    Add C-state table for the SnowRidge SoC which is found on Intel Jacobsville
    platforms.
    
    The following has been changed.
    
     1. C1E latency changed from 10us to 15us. It was measured using the
        open source "wult" tool (the "nic" method, 15us is the 99.99th
        percentile).
    
     2. C1E power break even changed from 20us to 25us, which may result
        in less C1E residency in some workloads.
    
     3. C6 latency changed from 50us to 130us. Measured the same way as C1E.
    
    The C6 C-state is supported only by some SnowRidge revisions, so add a C-state
    table commentary about this.
    
    On SnowRidge, C6 support is enumerated via the usual mechanism: "mwait" leaf of
    the "cpuid" instruction. The 'intel_idle' driver does check this leaf, so even
    though C6 is present in the table, the driver will only use it if the CPU does
    support it.
    
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    [Linux commit: 9cf93f056f783f986c19f40d5304d1bcffa0fc0d]
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 158741fc71..12524eefd4 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -742,6 +742,32 @@ static const struct cpuidle_state dnv_cstates[] = {
 	{}
 };
 
+/*
+ * Note, depending on HW and FW revision, SnowRidge SoC may or may not support
+ * C6, and this is indicated in the CPUID mwait leaf.
+ */
+static const struct cpuidle_state snr_cstates[] = {
+	{
+		.name = "C1",
+		.flags = MWAIT2flg(0x00),
+		.exit_latency = 2,
+		.target_residency = 2,
+	},
+	{
+		.name = "C1E",
+		.flags = MWAIT2flg(0x01),
+		.exit_latency = 15,
+		.target_residency = 25,
+	},
+	{
+		.name = "C6",
+		.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
+		.exit_latency = 130,
+		.target_residency = 500,
+	},
+	{}
+};
+
 static void mwait_idle(void)
 {
 	unsigned int cpu = smp_processor_id();
@@ -954,6 +980,11 @@ static const struct idle_cpu idle_cpu_dnv = {
 	.disable_promotion_to_c1e = true,
 };
 
+static const struct idle_cpu idle_cpu_snr = {
+	.state_table = snr_cstates,
+	.disable_promotion_to_c1e = true,
+};
+
 #define ICPU(model, cpu) \
 	{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ALWAYS, &idle_cpu_##cpu}
 
@@ -996,7 +1027,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconstrel = {
 	ICPU(0x5c, bxt),
 	ICPU(0x7a, bxt),
 	ICPU(0x5f, dnv),
-	ICPU(0x86, dnv),
+	ICPU(0x86, snr),
 	{}
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 24 19:56:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Jan 2022 19:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.259976.448875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nC5Rc-0004Gg-Cn; Mon, 24 Jan 2022 19:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 259976.448875; Mon, 24 Jan 2022 19: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 1nC5Rc-0004GY-9b; Mon, 24 Jan 2022 19:56:04 +0000
Received: by outflank-mailman (input) for mailman id 259976;
 Mon, 24 Jan 2022 19:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5Ra-0004GO-Rz
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5Ra-0000e9-R5
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nC5Ra-0008W4-Q9
 for xen-changelog@lists.xenproject.org; Mon, 24 Jan 2022 19: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=7j6AxTWJRzrZ/r/Kh9QTvteAa5sIudIQwrVUidYa7kM=; b=aSaFT3VwN4zBd3ywl8Vj06KOIw
	BFCJ5l/1/bkDhVn2AJUDOMGk+0iroddE1opZZzqLYLII/jmG2aoUpAZC4xA81zm1AJUbM93KqqEVi
	vEugtQmrO8RL+Qjqkz7lSsmN2xZMjfnht5cPhyWSFM24w2RtRM2+Y5eAZZelCXlhOeIs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: drop pmt_scale_r
Message-Id: <E1nC5Ra-0008W4-Q9@xenbits.xenproject.org>
Date: Mon, 24 Jan 2022 19:56:02 +0000

commit ec32910f4f871dce0f0e32dfb36f218fa1a2e869
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 24 08:44:39 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 24 08:44:39 2022 +0100

    x86/time: drop pmt_scale_r
    
    Its only user, ns_to_acpi_pm_tick(), is unused.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/time.h | 1 -
 xen/arch/x86/time.c             | 7 -------
 2 files changed, 8 deletions(-)

diff --git a/xen/arch/x86/include/asm/time.h b/xen/arch/x86/include/asm/time.h
index f347311cc4..f06f2bfd8b 100644
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -48,7 +48,6 @@ void pit_broadcast_exit(void);
 int pit_broadcast_is_available(void);
 
 uint64_t acpi_pm_tick_to_ns(uint64_t ticks);
-uint64_t ns_to_acpi_pm_tick(uint64_t ns);
 
 uint64_t tsc_ticks2ns(uint64_t ticks);
 
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 7fb760cf55..17f64a6ccd 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -536,12 +536,10 @@ static struct platform_timesource __initdata plt_pmtimer =
 };
 
 static struct time_scale __read_mostly pmt_scale;
-static struct time_scale __read_mostly pmt_scale_r;
 
 static __init int init_pmtmr_scale(void)
 {
     set_time_scale(&pmt_scale, ACPI_PM_FREQUENCY);
-    pmt_scale_r = scale_reciprocal(pmt_scale);
     return 0;
 }
 __initcall(init_pmtmr_scale);
@@ -551,11 +549,6 @@ uint64_t acpi_pm_tick_to_ns(uint64_t ticks)
     return scale_delta(ticks, &pmt_scale);
 }
 
-uint64_t ns_to_acpi_pm_tick(uint64_t ns)
-{
-    return scale_delta(ns, &pmt_scale_r);
-}
-
 /************************************************************
  * PLATFORM TIMER 4: TSC
  */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 11:00:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 11:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260059.449066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCJYU-0006CL-VE; Tue, 25 Jan 2022 11:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260059.449066; Tue, 25 Jan 2022 11:00:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCJYU-0006C8-Ro; Tue, 25 Jan 2022 11:00:06 +0000
Received: by outflank-mailman (input) for mailman id 260059;
 Tue, 25 Jan 2022 11:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCJYS-000648-Tz
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 11:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCJYS-0003SA-Rk
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 11:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCJYS-0006AM-Qh
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 11:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6/1rlcXKXp1v/eRFgW9rICEI8hJPEduWzRmcGjJ11Tg=; b=tbvMOyIECorrU+ol5ovxv3zVmT
	c84hYU8CWzsLIoq2NjSzDA647aELQilJ2NMpbxzUG4sop+mMd+xfo1Zj3wJkJC26BT+QbDFO3EKsw
	0veLPJZkTF7XPDUtD5Pqff06/14HEYu5ADsSYqN8NOz49os3IY366HmaNFomRZeJGKOA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pvh: fix population of the low 1MB for dom0
Message-Id: <E1nCJYS-0006AM-Qh@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 11:00:04 +0000

commit 2d5fc9120d556ec3c4b1acf0ab5660a6d3f7ebeb
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jan 24 17:13:12 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 25 10:52:24 2022 +0000

    x86/pvh: fix population of the low 1MB for dom0
    
    RMRRs are setup ahead of populating the p2m and hence the ASSERT when
    populating the low 1MB needs to be relaxed when it finds an existing
    entry: it's either RAM or a RMRR resulting from the IOMMU setup.
    
    Rework the logic a bit and introduce a local mfn variable in order to
    assert that if the gfn is populated and not RAM it is an identity map.
    
    Fixes: 6b4f6a31ac ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/dom0_build.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 43e1bf1248..8048987286 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -465,11 +465,16 @@ static int __init pvh_populate_p2m(struct domain *d)
     for ( i = rc = 0; i < MB1_PAGES; ++i )
     {
         p2m_type_t p2mt;
+        mfn_t mfn = get_gfn_query(d, i, &p2mt);
 
-        if ( mfn_eq(get_gfn_query(d, i, &p2mt), INVALID_MFN) )
+        if ( mfn_eq(mfn, INVALID_MFN) )
             rc = set_mmio_p2m_entry(d, _gfn(i), _mfn(i), PAGE_ORDER_4K);
         else
-            ASSERT(p2mt == p2m_ram_rw);
+            /*
+             * If the p2m entry is already set it must belong to a RMRR and
+             * already be identity mapped, or be a RAM region.
+             */
+            ASSERT(p2mt == p2m_ram_rw || mfn_eq(mfn, _mfn(i)));
         put_gfn(d, i);
         if ( rc )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 11:00:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 11:00:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260060.449070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCJYf-0006Iu-0H; Tue, 25 Jan 2022 11:00:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260060.449070; Tue, 25 Jan 2022 11:00:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCJYe-0006Im-TU; Tue, 25 Jan 2022 11:00:16 +0000
Received: by outflank-mailman (input) for mailman id 260060;
 Tue, 25 Jan 2022 11:00: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 1nCJYd-0006IB-0F
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 11:00: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 1nCJYc-0003SU-Vk
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 11:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCJYc-0006Bv-U8
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 11:00:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MMfBSB6C6K++QhamHjzfjllZzlefMYgAevEWXMuGssA=; b=2ZK0FKKZpcETzmpZpIQdgoa4jh
	hCwFseBt6P1zNO4RjM22zNmt9+ufqT2fQNcnp7d7wyz4cJL6nKMWXCoFf+6twN6Rh1X5dDLtIcqfK
	EPDzuiLZa7r2sn1h77yIV+naYvLvUoWI6GWK/dGWzv0bNswbZb3RjFfGtG21yX4OCUzg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pvh: print dom0 memory map
Message-Id: <E1nCJYc-0006Bv-U8@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 11:00:14 +0000

commit 329b7bed80032fd52904af6a0cac7dd3716d27cf
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Jan 25 11:46:36 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 25 10:52:25 2022 +0000

    x86/pvh: print dom0 memory map
    
    I find it useful for debugging certain issues to have the memory map
    dom0 is using, so print it when using `dom0=verbose` on the command
    line.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/e820.c             | 3 ++-
 xen/arch/x86/hvm/dom0_build.c   | 6 ++++++
 xen/arch/x86/include/asm/e820.h | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index aa602773bb..b653a19c93 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -88,7 +88,8 @@ static void __init add_memory_region(unsigned long long start,
     e820.nr_map++;
 }
 
-static void __init print_e820_memory_map(struct e820entry *map, unsigned int entries)
+void __init print_e820_memory_map(const struct e820entry *map,
+                                  unsigned int entries)
 {
     unsigned int i;
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 8048987286..afba6e7dfd 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1269,6 +1269,12 @@ int __init dom0_construct_pvh(struct domain *d, const module_t *image,
         return rc;
     }
 
+    if ( opt_dom0_verbose )
+    {
+        printk("Dom%u memory map:\n", d->domain_id);
+        print_e820_memory_map(d->arch.e820, d->arch.nr_e820);
+    }
+
     printk("WARNING: PVH is an experimental mode with limited functionality\n");
     return 0;
 }
diff --git a/xen/arch/x86/include/asm/e820.h b/xen/arch/x86/include/asm/e820.h
index 9d8f1ba960..92f5efa4f5 100644
--- a/xen/arch/x86/include/asm/e820.h
+++ b/xen/arch/x86/include/asm/e820.h
@@ -32,6 +32,8 @@ extern int e820_change_range_type(
 extern int e820_add_range(
     struct e820map *, uint64_t s, uint64_t e, uint32_t type);
 extern unsigned long init_e820(const char *, struct e820map *);
+extern void print_e820_memory_map(const struct e820entry *map,
+    unsigned int entries);
 extern struct e820map e820;
 extern struct e820map e820_raw;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:33:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260325.449575 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCL0V-0000ht-12; Tue, 25 Jan 2022 12:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260325.449575; Tue, 25 Jan 2022 12:33: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 1nCL0U-0000hl-UQ; Tue, 25 Jan 2022 12:33:06 +0000
Received: by outflank-mailman (input) for mailman id 260325;
 Tue, 25 Jan 2022 12:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCL0T-0000hf-8q
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33: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 1nCL0T-0005Jc-70
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCL0T-0001A0-5k
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R6Z3qp8JL6vCI9h4YumAsWcSvqS7Xr1d2ILNA+lkot0=; b=dKaIAug+gXjDda0VdZIUUaBuK0
	NBbhCTt6Bg7YK9NP8X8xvlN0DSWhLKIG54VsYzHil2HWDIveDN50g7m+Uerwt8KLNzY+1UGWSyqYE
	AVpdATa4QAfpj8dABhtbwo7FytJPdML/uk86nQvhkkfl2D93ztVM5f5J43+5fZltYVII=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCL0T-0001A0-5k@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:33:05 +0000

commit a428b913a002eb2b7425b48029c20a52eeee1b5a
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Dec 14 09:53:44 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:25:01 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 8b20b43077..fb71fa4c1c 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1016,7 +1016,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:33:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260326.449579 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCL0f-0000kH-2z; Tue, 25 Jan 2022 12:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260326.449579; Tue, 25 Jan 2022 12:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCL0e-0000k9-Vx; Tue, 25 Jan 2022 12:33:16 +0000
Received: by outflank-mailman (input) for mailman id 260326;
 Tue, 25 Jan 2022 12:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCL0d-0000jj-BK
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33: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 1nCL0d-0005K6-AU
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCL0d-0001Au-9Z
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZC+Am7GvVM/4ZKQYw8TAWMS9tc0YsYGzVZtc9zxxzJY=; b=M7LWratcFCU6sgFjGSriXjq2ID
	G0/X98b6CncOYVnKqmNdGy4avtm3w2y4oQ+Nm9yyG/cgitLKm0/7BtPQuTufVhDsTJv29PFwZx7I+
	77hjunuXkqd9fTRpky1dnydRLo6Ii891xZG3qGB7gotjhHBwVlKmxH1wUafAxUhcTd0s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCL0d-0001Au-9Z@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:33:15 +0000

commit 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Nov 19 11:27:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:25:49 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 0262f2c48a..ed1e2fabce 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1488,8 +1488,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:33:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:33:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260327.449583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCL0p-0000o5-4O; Tue, 25 Jan 2022 12:33:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260327.449583; Tue, 25 Jan 2022 12:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCL0p-0000nx-1L; Tue, 25 Jan 2022 12:33:27 +0000
Received: by outflank-mailman (input) for mailman id 260327;
 Tue, 25 Jan 2022 12:33:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCL0n-0000nh-En
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33: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 1nCL0n-0005KJ-Ds
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCL0n-0001Bx-Cp
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LcAnl4iP01/PJzegqbMk8BYOd6lAKAIGzI6/sYFCHaU=; b=spDojVs7i/dRnMAyqwcaGs42pr
	CWpuW/CELOVxBCuTeTqUbsN7G+Z2zwKTDv/qqKf9iqgOGewtQOn44lkeWXHigB2b3gloczZccs7Aj
	DAV0i6DJ2FFaOYulwlHUyKhiaTXTD+x+zIZEj72wlBh+ZAXp7ReZvQqoZsOyTGfaBikc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCL0n-0001Bx-Cp@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:33:25 +0000

commit 9480a1a519cf016623f657dc544cb372a82b5708
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Jan 5 18:09:20 2022 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:27:02 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/x86/hvm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 351daafdc9..0b37cd145b 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -732,7 +732,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260333.449598 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLB9-0002T9-4l; Tue, 25 Jan 2022 12:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260333.449598; Tue, 25 Jan 2022 12:44:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLB9-0002T1-1c; Tue, 25 Jan 2022 12:44:07 +0000
Received: by outflank-mailman (input) for mailman id 260333;
 Tue, 25 Jan 2022 12:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLB7-0002Sp-Gx
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44: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 1nCLB7-0005UK-Du
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLB7-0002Tb-Cw
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=61xj08xX6qpUuYIAVlYAQ5VT948P+q9ySVeI8lpmkfU=; b=2ADXD+SpSe0twROYUF3HcnrrZa
	16IDlF6Yv9weI6qApevyLX0WXuJIOZ1SUKaHOO8wBLzq8gsZ5D5MCGVzY2GHUVjfjY6UhO0GlFxiV
	7XX/G4sGG9lHntYjU7ts2uMYR9lOwuUbX7fCMRMpD6zgyw3jBsFnUM5k+w1sj4P2LdZY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCLB7-0002Tb-Cw@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:44:05 +0000

commit acdb6744460c6264785c031a37d99b8557c56195
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:34:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:34:55 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 8b20b43077..fb71fa4c1c 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1016,7 +1016,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:44:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:44:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260335.449601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBJ-0002XZ-5x; Tue, 25 Jan 2022 12:44:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260335.449601; Tue, 25 Jan 2022 12:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBJ-0002XR-32; Tue, 25 Jan 2022 12:44:17 +0000
Received: by outflank-mailman (input) for mailman id 260335;
 Tue, 25 Jan 2022 12:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBH-0002XB-IO
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44: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 1nCLBH-0005Ul-HT
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBH-0002V0-GR
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rdzntP7CKcYdlwgMpRu0swXM42fG42BDgMWN3RHuX2A=; b=Hs5+iE+F1v5NAXUBSDEqoNXMJF
	euIvt9rfXeSJf1k1l8hm/9RBoW/+aJ5t2s9UvVGXi79t6MiCRVbc9KKAwhVnwtSCiKKDsJICm8sky
	cPiebea3iPZO1cckq19BVGRR84Kf5atqqsy14g228B83pgTLWSmj0pqgqX6VWTp7MdaU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCLBH-0002V0-GR@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:44:15 +0000

commit 965fbc8e801c91938dd7efa831fb9078a78deeb7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:35:08 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:35:08 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 012a74455b..66f8ce7174 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1488,8 +1488,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:44:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:44:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260336.449606 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBT-0002b0-7e; Tue, 25 Jan 2022 12:44:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260336.449606; Tue, 25 Jan 2022 12:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBT-0002as-4U; Tue, 25 Jan 2022 12:44:27 +0000
Received: by outflank-mailman (input) for mailman id 260336;
 Tue, 25 Jan 2022 12:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBR-0002aZ-LM
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44: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 1nCLBR-0005Uw-KZ
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBR-0002Wk-Jf
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XMtoQ+l7C2K5r0JB1Ou2s7j9wnQ675fz0kxdDY3gMLs=; b=ERbNW5Tcws+JH7IWtCeeobT7YR
	e2R9xK5Q1YSf0FIcEhHqOM5qAY1YB5n+85q7CgkIXt5v8Gvm8liUG1QCywZiu4vj3ZNKA5erRzPoK
	dpB5pY0aHJ0uZXgwq2kxL5Op3vJhI5K5tiryIAS031Z07PeETTfRIBueNcDE7it/zyls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCLBR-0002Wk-Jf@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:44:25 +0000

commit 18d0f501596bd55412282aac3db1f0a349a68f50
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:35:23 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:35:23 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 351daafdc9..0b37cd145b 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -732,7 +732,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:44:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:44:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260337.449610 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBd-0002ey-99; Tue, 25 Jan 2022 12:44:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260337.449610; Tue, 25 Jan 2022 12:44:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBd-0002eq-5z; Tue, 25 Jan 2022 12:44:37 +0000
Received: by outflank-mailman (input) for mailman id 260337;
 Tue, 25 Jan 2022 12:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBb-0002eb-OG
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44: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 1nCLBb-0005V6-NT
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBb-0002YD-Mg
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0uxcN151LZxqgek3UT+4lXcNPzu+mMl9vlYYKe3EXoA=; b=wWIzY3Uu/AlOx5bl9S6Llo1ViE
	6tZ/glQZxAVJ7fiNc4i5FxnNsbzqtG5raWtd91S72dWqKN1wxVc9a98KzmM7oxm02EsNbzwyGyguK
	jQhWvhkXsVldhpVsn3pSkMGl/JY2afxxwu0RZgay+MoWcbQUD6E4oljWE6dIkqLsHkz8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/time: use relative counts in calibration loops
Message-Id: <E1nCLBb-0002YD-Mg@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:44:35 +0000

commit 4774d06097e524913fbd4ffcea3307275c5215d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:37:45 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:37:45 2022 +0100

    x86/time: use relative counts in calibration loops
    
    Looping until reaching/exceeding a certain value is error prone: If the
    target value is close enough to the wrapping point, the loop may not
    terminate at all. Switch to using delta values, which then allows to
    fold the two loops each into just one.
    
    Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 467191641d2a2fd2e43b3ae7b80399f89d339980
    master date: 2022-01-13 14:30:18 +0100
---
 xen/arch/x86/time.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a290aba3e8..84b62f2024 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -378,7 +378,7 @@ static u64 read_hpet_count(void)
 static int64_t __init init_hpet(struct platform_timesource *pts)
 {
     uint64_t hpet_rate, start;
-    uint32_t count, target;
+    uint32_t count, target, elapsed;
     /*
      * Allow HPET to be setup, but report a frequency of 0 so it's not selected
      * as a timer source. This is required so it can be used in legacy
@@ -451,11 +451,8 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
 
     count = hpet_read32(HPET_COUNTER);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(hpet_rate);
-    if ( target < count )
-        while ( hpet_read32(HPET_COUNTER) >= count )
-            continue;
-    while ( hpet_read32(HPET_COUNTER) < target )
+    target = CALIBRATE_VALUE(hpet_rate);
+    while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
@@ -493,8 +490,8 @@ static u64 read_pmtimer_count(void)
 
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
-    u64 start;
-    u32 count, target, mask;
+    uint64_t start;
+    uint32_t count, target, mask, elapsed;
 
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -502,13 +499,10 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     pts->counter_bits = pmtmr_width;
     mask = 0xffffffff >> (32 - pmtmr_width);
 
-    count = inl(pmtmr_ioport) & mask;
+    count = inl(pmtmr_ioport);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
-    if ( target < count )
-        while ( (inl(pmtmr_ioport) & mask) >= count )
-            continue;
-    while ( (inl(pmtmr_ioport) & mask) < target )
+    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
+    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:44:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:44:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260338.449614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBn-0002iw-CZ; Tue, 25 Jan 2022 12:44:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260338.449614; Tue, 25 Jan 2022 12:44:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBn-0002io-9h; Tue, 25 Jan 2022 12:44:47 +0000
Received: by outflank-mailman (input) for mailman id 260338;
 Tue, 25 Jan 2022 12:44:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBl-0002iW-RU
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44: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 1nCLBl-0005VZ-Qk
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBl-0002a6-Pf
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kErl6Xx5vKpza5KMlTla1KTu/rKx4Q/rP1ZVYcx2ozE=; b=CwGfBiCHe9dvfyfxZmJT6xBJe9
	l7rL0LcfvrgUbryQdk4Hqk2sdg2OMglNFP8VArVoG4bdxAJDcOtbUALfYUDUXkTCWmloldukizPVF
	yK9JMxBddq9vsFwTAJ+cSmZAa+yq3jX+L0OUrGLzmVsHL1UpHCiCP3R2en6y9HtEJwPg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/time: improve TSC / CPU freq calibration accuracy
Message-Id: <E1nCLBl-0002a6-Pf@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:44:45 +0000

commit fd343ec092f3fac828f82d076ffaaca8ed3b61c9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:37:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:37:59 2022 +0100

    x86/time: improve TSC / CPU freq calibration accuracy
    
    While the problem report was for extreme errors, even smaller ones would
    better be avoided: The calculated period to run calibration loops over
    can (and usually will) be shorter than the actual time elapsed between
    first and last platform timer and TSC reads. Adjust values returned from
    the init functions accordingly.
    
    On a Skylake system I've tested this on accuracy (using HPET) went from
    detecting in some cases more than 220kHz too high a value to about
    ±2kHz. On other systems (or on this system, but with PMTMR) the original
    error range was much smaller, with less (in some cases only very little)
    improvement.
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a5c9a80af34eefcd6e31d0ed2b083f452cd9076d
    master date: 2022-01-13 14:31:52 +0100
---
 xen/arch/x86/time.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 84b62f2024..1daff92dca 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -287,6 +287,23 @@ static char *freq_string(u64 freq)
     return s;
 }
 
+static uint64_t adjust_elapsed(uint64_t elapsed, uint32_t actual,
+                               uint32_t target)
+{
+    if ( likely(actual > target) )
+    {
+        /*
+         * A (perhaps significant) delay before the last timer read (e.g. due
+         * to a SMI or NMI) can lead to (perhaps severe) inaccuracy if not
+         * accounting for the time elapsed beyond the originally calculated
+         * duration of the calibration interval.
+         */
+        elapsed = muldiv64(elapsed, target, actual);
+    }
+
+    return elapsed * CALIBRATE_FRAC;
+}
+
 /************************************************************
  * PLATFORM TIMER 1: PROGRAMMABLE INTERVAL TIMER (LEGACY PIT)
  */
@@ -455,7 +472,7 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
     while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static void resume_hpet(struct platform_timesource *pts)
@@ -505,7 +522,7 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static struct platform_timesource __initdata plt_pmtimer =
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:44:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:44:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260339.449617 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBx-0002m0-EC; Tue, 25 Jan 2022 12:44:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260339.449617; Tue, 25 Jan 2022 12:44:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLBx-0002lr-B7; Tue, 25 Jan 2022 12:44:57 +0000
Received: by outflank-mailman (input) for mailman id 260339;
 Tue, 25 Jan 2022 12:44:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBv-0002ld-Uh
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44: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 1nCLBv-0005Vp-Ts
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLBv-0002c5-T3
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:44:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hc4YYEqFn+pughjKQnEWxoR59bjyliYUWvZXARxjDXA=; b=o/29IuAY+zegxyBNT9uIpiaSYE
	rOuKMcuU/g+6CVWYO8fG06Wv5jdiZd/qG3oSk0Yp+ToPQ7k/oB0tnKFKsz5lc+rZN8FjEa+CqnU49
	Em40cYNfNDThY82OkOJSt/FvXgw9meWIIsF1TCde/yMVcOwop/DYpjePQV2qj2Tt/swo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] libxl/PCI: Fix PV hotplug & stubdom coldplug
Message-Id: <E1nCLBv-0002c5-T3@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:44:55 +0000

commit 8509519268ea6a467a97ca7891a0dca2bfe88cf7
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jan 25 13:38:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:38:14 2022 +0100

    libxl/PCI: Fix PV hotplug & stubdom coldplug
    
    commit 0fdb48ffe7a1 "libxl: Make sure devices added by pci-attach are
    reflected in the config" broken PCI hotplug (xl pci-attach) for PV
    domains when it moved libxl__create_pci_backend() later in the function.
    
    This also broke HVM + stubdom PCI passthrough coldplug.  For that, the
    PCI devices are hotplugged to a running PV stubdom, and then the QEMU
    QMP device_add commands are made to QEMU inside the stubdom.
    
    A running PV domain calls libxl__wait_for_backend().  With the current
    placement of libxl__create_pci_backend(), the path does not exist and
    the call immediately fails:
    libxl: error: libxl_device.c:1388:libxl__wait_for_backend: Backend /local/domain/0/backend/pci/43/0 does not exist
    libxl: error: libxl_pci.c:1764:device_pci_add_done: Domain 42:libxl__device_pci_add failed for PCI device 0:2:0.0 (rc -3)
    libxl: error: libxl_create.c:1857:domcreate_attach_devices: Domain 42:unable to add pci devices
    
    The wait is only relevant when:
    1) The domain is PV
    2) The domain is running
    3) The backend is already present
    
    This is because:
    
    1) xen-pcifront is only used for PV.  It does not load for HVM domains
       where QEMU is used.
    
    2) If the domain is not running (starting), then the frontend state will
       be Initialising.  xen-pciback waits for the frontend to transition to
       at Initialised before attempting to connect.  So a wait for a
       non-running domain is not applicable as the backend will not
       transition to Connected.
    
    3) For presence, num_devs is already used to determine if the backend
       needs to be created.  Re-use num_devs to determine if the backend
       wait is necessary.  The wait is necessary to avoid racing with
       another PCI attachment reconfiguring the front/back or changing to
       some other state like closing.  If we are creating the backend, then
       we don't have to worry about the state since it is being created.
    
    Fixes: 0fdb48ffe7a1 ("libxl: Make sure devices added by pci-attach are
    reflected in the config")
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 73ee2795aaef2cb086ac078bffe1c6b33c0ea91b
    master date: 2022-01-13 14:33:16 +0100
---
 tools/libs/light/libxl_pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 4c2d7aeefb..4bbbfe9f16 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -157,9 +157,11 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc,
     if (domtype == LIBXL_DOMAIN_TYPE_INVALID)
         return ERROR_FAIL;
 
-    if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", XenbusStateConnected)) < 0)
-            return ERROR_FAIL;
+    /* Wait is only needed if the backend already exists (num_devs != NULL) */
+    if (num_devs && !starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
+        rc = libxl__wait_for_backend(gc, be_path,
+                                     GCSPRINTF("%d", XenbusStateConnected));
+        if (rc) return rc;
     }
 
     back = flexarray_make(gc, 16, 1);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:45:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:45:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260340.449622 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLC7-0002p0-Fn; Tue, 25 Jan 2022 12:45:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260340.449622; Tue, 25 Jan 2022 12:45:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLC7-0002os-Ce; Tue, 25 Jan 2022 12:45:07 +0000
Received: by outflank-mailman (input) for mailman id 260340;
 Tue, 25 Jan 2022 12:45:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLC6-0002of-2D
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45: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 1nCLC6-0005WR-1P
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLC6-0002ed-0U
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lCBlDzpmf+iEo6qA9b8DzMwXxTjKNfqivo2ZFiC1xbo=; b=F+1AI+or+/MFEFF0QEnwWc2ea2
	4aNQe9s7IOte8pa4QHVdzOe8fQOTdwnYt86MotqkAGT8v6Q6LGP/19EULzE2KyIP6KwP7wQ71aeOe
	2dY/krTxR7yoa7X4O92lfXHREB6ezllURoEB1Ycd4He3TqoH6LCKLviYvBBOeneo1lgg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/guest: Introduce {get,set}_reg() infrastructure
Message-Id: <E1nCLC6-0002ed-0U@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:45:06 +0000

commit 20b00921f8a62b1b19d893dd468473161706e02d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:38:42 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:38:42 2022 +0100

    x86/guest: Introduce {get,set}_reg() infrastructure
    
    Various registers have per-guest-type or per-vendor locations or access
    requirements.  To support their use from common code, provide accessors which
    allow for per-guest-type behaviour.
    
    For now, just infrastructure handling default cases and expectations.
    Subsequent patches will start handling registers using this infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 88d3ff7ab15da277a85b39735797293fb541c718
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/hvm.c          | 22 ++++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c      | 30 ++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c      | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emulate.c       | 31 +++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h   | 15 +++++++++++++++
 xen/include/asm-x86/pv/domain.h |  4 ++++
 6 files changed, 133 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b680f62892..6820527df0 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3742,6 +3742,28 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_call(hvm_funcs.get_reg, v, reg);
+    }
+}
+
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_vcall(hvm_funcs.set_reg, v, reg, val);
+    }
+}
+
 static bool is_sysdesc_access(const struct x86_emulate_state *state,
                               const struct x86_emulate_ctxt *ctxt)
 {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index f0e10dec04..74b2b0e092 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2469,6 +2469,33 @@ static bool svm_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t svm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
@@ -2518,6 +2545,9 @@ static struct hvm_function_table __initdata svm_function_table = {
     .nhvm_intr_blocked = nsvm_intr_blocked,
     .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
 
+    .get_reg = svm_get_reg,
+    .set_reg = svm_set_reg,
+
     .tsc_scaling = {
         .max_ratio = ~TSC_RATIO_RSVD_BITS,
     },
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d403e2d806..6f81751921 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2404,6 +2404,33 @@ static int vmtrace_reset(struct vcpu *v)
     return 0;
 }
 
+static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2464,6 +2491,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .vmtrace_set_option = vmtrace_set_option,
     .vmtrace_get_option = vmtrace_get_option,
     .vmtrace_reset = vmtrace_reset,
+
+    .get_reg = vmx_get_reg,
+    .set_reg = vmx_set_reg,
+
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e8bb326efd..ae049b60f2 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -90,6 +90,37 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
     }
 }
 
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index bd2cbb0e7b..acc660c001 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -222,6 +222,9 @@ struct hvm_function_table {
     int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
     int (*vmtrace_reset)(struct vcpu *v);
 
+    uint64_t (*get_reg)(struct vcpu *v, unsigned int reg);
+    void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -727,6 +730,18 @@ static inline int hvm_vmtrace_reset(struct vcpu *v)
     return -EOPNOTSUPP;
 }
 
+/*
+ * Accessors for registers which have per-guest-type or per-vendor locations
+ * (e.g. VMCS, msr load/save lists, VMCB, VMLOAD lazy, etc).
+ *
+ * The caller is responsible for all auditing - these accessors do not fail,
+ * but do use domain_crash() for usage errors.
+ *
+ * Must cope with being called in non-current context.
+ */
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg);
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index df9716ff26..3a67816764 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,6 +65,10 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:45:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:45:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260341.449626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLCG-0002rv-HW; Tue, 25 Jan 2022 12:45:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260341.449626; Tue, 25 Jan 2022 12:45:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLCG-0002rn-EE; Tue, 25 Jan 2022 12:45:16 +0000
Received: by outflank-mailman (input) for mailman id 260341;
 Tue, 25 Jan 2022 12:45:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLCG-0002rh-5U
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45: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 1nCLCG-0005Wq-4g
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLCG-0002gv-3r
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M6RqcwiY5Kza0+7egasAC8IZAPZwNFCsep11kb2tb9w=; b=qwU4HaRzbyzergyMIslWs6tIx0
	gCMoYNJxQ+9K8HZPF+PJwgtD9KoT0vWZ45FELsPiMhOlVXfuhUEMXz9N6TqIRChz4SuDY/JLYwxQx
	ZdKAdeMJwz3G0i89K4JYg/d+FTpbHm9HzrefzkL11PGmJxd9BgkSsgTSS44aTNIKqCx4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/msr: Split MSR_SPEC_CTRL handling
Message-Id: <E1nCLCG-0002gv-3r@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:45:16 +0000

commit cc6fe1bb13197ddc79af480c3c74ce6d6ed3ef2c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:39:16 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:39:16 2022 +0100

    x86/msr: Split MSR_SPEC_CTRL handling
    
    In order to fix a VT-x bug, and support MSR_SPEC_CTRL on AMD, move
    MSR_SPEC_CTRL handling into the new {pv,hvm}_{get,set}_reg() infrastructure.
    
    Duplicate the msrs->spec_ctrl.raw accesses in the PV and VT-x paths for now.
    The SVM path is currently unreachable because of the CPUID policy.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6536688439dbca1d08fd6db5be29c39e3917fb2f
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c |  7 +++++++
 xen/arch/x86/msr.c         | 22 +++++++++++++++++-----
 xen/arch/x86/pv/emulate.c  |  9 +++++++++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 6f81751921..b4df456d62 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2410,6 +2410,9 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return v->arch.msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -2424,6 +2427,10 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        v->arch.msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index b834456c7b..71cbfa8ee3 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -28,6 +28,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/pv/domain.h>
 #include <asm/setup.h>
 
 #include <public/hvm/params.h>
@@ -265,8 +266,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_SPEC_CTRL:
         if ( !cp->feat.ibrsb )
             goto gp_fault;
-        *val = msrs->spec_ctrl.raw;
-        break;
+        goto get_reg;
 
     case MSR_INTEL_PLATFORM_INFO:
         *val = mp->platform_info.raw;
@@ -424,6 +424,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     return ret;
 
+ get_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        *val = pv_get_reg(v, msr);
+    else
+        *val = hvm_get_reg(v, msr);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
@@ -513,9 +520,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
         if ( val & rsvd )
             goto gp_fault; /* Rsvd bit set? */
-
-        msrs->spec_ctrl.raw = val;
-        break;
+        goto set_reg;
 
     case MSR_PRED_CMD:
         if ( !cp->feat.ibrsb && !cp->extd.ibpb )
@@ -663,6 +668,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
     return ret;
 
+ set_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        pv_set_reg(v, msr, val);
+    else
+        hvm_set_reg(v, msr, val);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index ae049b60f2..0a7907ec5e 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -92,12 +92,16 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 
 uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -108,12 +112,17 @@ uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 
 void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:45:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:45:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260342.449631 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLCR-0002uq-JU; Tue, 25 Jan 2022 12:45:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260342.449631; Tue, 25 Jan 2022 12:45:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLCR-0002ui-Fr; Tue, 25 Jan 2022 12:45:27 +0000
Received: by outflank-mailman (input) for mailman id 260342;
 Tue, 25 Jan 2022 12:45:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLCQ-0002ua-8G
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45: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 1nCLCQ-0005XH-7V
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLCQ-0002jB-6p
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7uJiIQzkwCKErdtWvMMUgq2SEbrFD/QNBbZ2C3QZJIM=; b=wCzloH91xkoXDE0RKtlInevSkY
	Gcc97VlMXGQZttztkFA9dOWaQs8HqJ+RkqqwTzlRRwFPU3PZ1J7YtXHzhuqxLs8gwsiyo4+XyJZwO
	waJtlYQ6Wmv7bbeMhReBy6zmy5i19zg9Qu881icTasCWsDilFMY9wdqiiEJADkz5K7bI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
Message-Id: <E1nCLCQ-0002jB-6p@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:45:26 +0000

commit 21d70feed10571543061abeaedd21ce8adc60114
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:39:31 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:39:31 2022 +0100

    x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
    
    These were written before Spectre/Meltdown went public, and there was large
    uncertainty in how the protections would evolve.  As it turns out, they're
    very specific to Intel hardware, and not very suitable for AMD.
    
    Drop the macros, opencoding the relevant subset of functionality, and leaving
    grep-fodder to locate the logic.  No change at all for VT-x.
    
    For AMD, the only relevant piece of functionality is DO_OVERWRITE_RSB,
    although we will soon be adding (different) logic to handle MSR_SPEC_CTRL.
    
    This has a marginal improvement of removing an unconditional pile of long-nops
    from the vmentry/exit path.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 95b13fa43e0753b7514bef13abe28253e8614f62
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/svm/entry.S        |  5 +++--
 xen/arch/x86/hvm/vmx/entry.S        |  8 ++++++--
 xen/include/asm-x86/spec_ctrl_asm.h | 19 ++++---------------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index e208a4b32a..276215d36a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -59,7 +59,7 @@ __UNLIKELY_END(nsvm_hap)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
 
         pop  %r15
         pop  %r14
@@ -86,7 +86,8 @@ __UNLIKELY_END(nsvm_hap)
 
         GET_CURRENT(bx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: ac  */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         stgi
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 27c8c5ca49..30139ae58e 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -33,7 +33,9 @@ ENTRY(vmx_asm_vmexit_handler)
         movb $1,VCPU_vmx_launched(%rbx)
         mov  %rax,VCPU_hvm_guest_cr2(%rbx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
+        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -80,7 +82,9 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
 
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index cb34299a86..2b3f123cb5 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -68,14 +68,16 @@
  *
  * The following ASM fragments implement this algorithm.  See their local
  * comments for further details.
- *  - SPEC_CTRL_ENTRY_FROM_HVM
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
  *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
- *  - SPEC_CTRL_EXIT_TO_HVM
+ *
+ * Additionally, the following grep-fodder exists to find the HVM logic.
+ *  - SPEC_CTRL_ENTRY_FROM_{SVM,VMX}
+ *  - SPEC_CTRL_EXIT_TO_{SVM,VMX}
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
@@ -225,12 +227,6 @@
     wrmsr
 .endm
 
-/* Use after a VMEXIT from an HVM guest. */
-#define SPEC_CTRL_ENTRY_FROM_HVM                                        \
-    ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM;           \
-    ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM,                        \
-        X86_FEATURE_SC_MSR_HVM
-
 /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */
 #define SPEC_CTRL_ENTRY_FROM_PV                                         \
     ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_PV;            \
@@ -255,13 +251,6 @@
     ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
         X86_FEATURE_SC_VERW_PV
 
-/* Use when exiting to HVM guest context. */
-#define SPEC_CTRL_EXIT_TO_HVM                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM;             \
-    ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
-        X86_FEATURE_SC_VERW_HVM
-
 /*
  * Use in IST interrupt/exception context.  May interrupt Xen or PV context.
  * Fine grain control of SCF_ist_wrmsr is needed for safety in the S3 resume
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:45:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:45:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260343.449634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLCb-0002yC-M8; Tue, 25 Jan 2022 12:45:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260343.449634; Tue, 25 Jan 2022 12:45:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLCb-0002y4-J5; Tue, 25 Jan 2022 12:45:37 +0000
Received: by outflank-mailman (input) for mailman id 260343;
 Tue, 25 Jan 2022 12:45:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLCa-0002xk-Bt
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45: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 1nCLCa-0005XR-B0
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLCa-0002ki-A3
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:45:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x4gW7RI03RVV1tX0V/7vp3YezjTjQeqN2lprONbXx+s=; b=Kr57NgLMKChm2TMdDooRX7vYwV
	en2vJSKySlwGltc/J8alOqE2Ch4gfwMdI1X3bZURRJcWfz2lNv6stDKaZPrwbVhq8o2uo14Gs3d9F
	id+cyq+dnvF4e/IQNU3ns1YgE0fuk+Fp38Hn3P6TApIBtleo3HVVkMWr1hJC8rZsXdtI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
Message-Id: <E1nCLCa-0002ki-A3@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:45:36 +0000

commit d3cb5470292eeff776e0c95a7f1e1c9e427d6425
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:39:44 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:39:44 2022 +0100

    x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
    
    The logic was based on a mistaken understanding of how NMI blocking on vmexit
    works.  NMIs are only blocked for EXIT_REASON_NMI, and not for general exits.
    Therefore, an NMI can in general hit early in the vmx_asm_vmexit_handler path,
    and the guest's value will be clobbered before it is saved.
    
    Switch to using MSR load/save lists.  This causes the guest value to be saved
    atomically with respect to NMIs/MCEs/etc.
    
    First, update vmx_cpuid_policy_changed() to configure the load/save lists at
    the same time as configuring the intercepts.  This function is always used in
    remote context, so extend the vmx_vmcs_{enter,exit}() block to cover the whole
    function, rather than having multiple remote acquisitions of the same VMCS.
    
    Both of vmx_{add,del}_guest_msr() can fail.  The -ESRCH delete case is fine,
    but all others are fatal to the running of the VM, so handle them using
    domain_crash() - this path is only used during domain construction anyway.
    
    Second, update vmx_{get,set}_reg() to use the MSR load/save lists rather than
    vcpu_msrs, and update the vcpu_msrs comment to describe the new state
    location.
    
    Finally, adjust the entry/exit asm.
    
    Because the guest value is saved and loaded atomically, we do not need to
    manually load the guest value, nor do we need to enable SCF_use_shadow.  This
    lets us remove the use of DO_SPEC_CTRL_EXIT_TO_GUEST.  Additionally,
    SPEC_CTRL_ENTRY_FROM_PV gets removed too, because on an early entry failure,
    we're no longer in the guest MSR_SPEC_CTRL context needing to switch back to
    Xen's context.
    
    The only action remaining is to load Xen's MSR_SPEC_CTRL value on vmexit.  We
    could in principle use the host msr list, but is expected to complicated
    future work.  Delete DO_SPEC_CTRL_ENTRY_FROM_HVM entirely, and use a shorter
    code sequence to simply reload Xen's setting from the top-of-stack block.
    
    Adjust the comment at the top of spec_ctrl_asm.h in light of this bugfix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f0eaadf84d273a6ff8df3660b874a02d0e7677
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/entry.S        | 22 ++++++++++++-------
 xen/arch/x86/hvm/vmx/vmx.c          | 44 ++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/msr.h           | 10 ++++++++-
 xen/include/asm-x86/spec_ctrl_asm.h | 32 ++++-----------------------
 4 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 30139ae58e..7ee3382fd0 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -35,7 +35,14 @@ ENTRY(vmx_asm_vmexit_handler)
 
         /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
-        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
+
+        .macro restore_spec_ctrl
+            mov    $MSR_SPEC_CTRL, %ecx
+            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            xor    %edx, %edx
+            wrmsr
+        .endm
+        ALTERNATIVE "", restore_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -82,8 +89,7 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
-        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: %rsp=regs/cpuinfo              Clob:    */
         ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
@@ -119,12 +125,12 @@ UNLIKELY_END(realmode)
         SAVE_ALL
 
         /*
-         * PV variant needed here as no guest code has executed (so
-         * MSR_SPEC_CTRL can't have changed value), and NMIs/MCEs are liable
-         * to hit (in which case the HVM variant might corrupt things).
+         * SPEC_CTRL_ENTRY notes
+         *
+         * If we end up here, no guest code has executed.  The MSR lists have
+         * not been processed, so we still have Xen's choice of MSR_SPEC_CTRL
+         * in context, and the RSB is unchanged.
          */
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b4df456d62..a555930f8f 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -592,6 +592,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)
 static void vmx_cpuid_policy_changed(struct vcpu *v)
 {
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
+    int rc = 0;
 
     if ( opt_hvm_fep ||
          (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
@@ -601,17 +602,29 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
 
     /*
      * We can safely pass MSR_SPEC_CTRL through to the guest, even if STIBP
      * isn't enumerated in hardware, as SPEC_CTRL_STIBP is ignored.
      */
     if ( cp->feat.ibrsb )
+    {
         vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
+
+        rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
+        if ( rc )
+            goto out;
+    }
     else
+    {
         vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
 
+        rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
+        if ( rc && rc != -ESRCH )
+            goto out;
+        rc = 0; /* Tolerate -ESRCH */
+    }
+
     /* MSR_PRED_CMD is safe to pass through if the guest knows about it. */
     if ( cp->feat.ibrsb || cp->extd.ibpb )
         vmx_clear_msr_intercept(v, MSR_PRED_CMD,  VMX_MSR_RW);
@@ -623,6 +636,15 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
         vmx_clear_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
+
+ out:
+    vmx_vmcs_exit(v);
+
+    if ( rc )
+    {
+        printk(XENLOG_G_ERR "%pv MSR list error: %d", v, rc);
+        domain_crash(v->domain);
+    }
 }
 
 int vmx_guest_x86_mode(struct vcpu *v)
@@ -2407,11 +2429,20 @@ static int vmtrace_reset(struct vcpu *v)
 static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     struct domain *d = v->domain;
+    uint64_t val = 0;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        return v->arch.msrs->spec_ctrl.raw;
+        rc = vmx_read_guest_msr(v, reg, &val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
+        return val;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
@@ -2424,11 +2455,18 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     struct domain *d = v->domain;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        v->arch.msrs->spec_ctrl.raw = val;
+        rc = vmx_write_guest_msr(v, reg, val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
         break;
 
     default:
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 1d3eca9063..10039c2d22 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -287,7 +287,15 @@ extern struct msr_policy     raw_msr_policy,
 /* Container object for per-vCPU MSRs */
 struct vcpu_msrs
 {
-    /* 0x00000048 - MSR_SPEC_CTRL */
+    /*
+     * 0x00000048 - MSR_SPEC_CTRL
+     *
+     * For PV guests, this holds the guest kernel value.  It is accessed on
+     * every entry/exit path.
+     *
+     * For VT-x guests, the guest value is held in the MSR guest load/save
+     * list.
+     */
     struct {
         uint32_t raw;
     } spec_ctrl;
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index 2b3f123cb5..bf82528a12 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -42,9 +42,10 @@
  *     path, or late in the exit path after restoring the guest value.  This
  *     will corrupt the guest value.
  *
- * Factor 1 is dealt with by relying on NMIs/MCEs being blocked immediately
- * after VMEXIT.  The VMEXIT-specific code reads MSR_SPEC_CTRL and updates
- * current before loading Xen's MSR_SPEC_CTRL setting.
+ * Factor 1 is dealt with:
+ *   - On VMX by using MSR load/save lists to have vmentry/exit atomically
+ *     load/save the guest value.  Xen's value is loaded in regular code, and
+ *     there is no need to use the shadow logic (below).
  *
  * Factor 2 is harder.  We maintain a shadow_spec_ctrl value, and a use_shadow
  * boolean in the per cpu spec_ctrl_flags.  The synchronous use is:
@@ -128,31 +129,6 @@
 #endif
 .endm
 
-.macro DO_SPEC_CTRL_ENTRY_FROM_HVM
-/*
- * Requires %rbx=current, %rsp=regs/cpuinfo
- * Clobbers %rax, %rcx, %rdx
- *
- * The common case is that a guest has direct access to MSR_SPEC_CTRL, at
- * which point we need to save the guest value before setting IBRS for Xen.
- * Unilaterally saving the guest value is shorter and faster than checking.
- */
-    mov $MSR_SPEC_CTRL, %ecx
-    rdmsr
-
-    /* Stash the value from hardware. */
-    mov VCPU_arch_msrs(%rbx), %rdx
-    mov %eax, VCPUMSR_spec_ctrl_raw(%rdx)
-    xor %edx, %edx
-
-    /* Clear SPEC_CTRL shadowing *before* loading Xen's value. */
-    andb $~SCF_use_shadow, CPUINFO_spec_ctrl_flags(%rsp)
-
-    /* Load Xen's intended value. */
-    movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-    wrmsr
-.endm
-
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260347.449638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLLm-000411-DM; Tue, 25 Jan 2022 12:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260347.449638; Tue, 25 Jan 2022 12:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLLm-00040t-AD; Tue, 25 Jan 2022 12:55:06 +0000
Received: by outflank-mailman (input) for mailman id 260347;
 Tue, 25 Jan 2022 12:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLLk-00040n-Vl
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55: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 1nCLLk-0005iS-TD
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLLk-0003hy-S5
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FWHQUQ523O6WaXUGryQjrrfPmX5ryaLxJB3ZaoCZP1U=; b=FWpcwnWNb4A4+HD+NF2AmC45nV
	OQZIgujsorlayF3pc5xshzXMD7t/0CITtQraWECbGp34vFMGyffVbZFaVWqCrkTYycaowB7fhP0Ea
	FBurLBMeZoED527CGaveKekDtu0CnsZUabU87E9szs5HRLFOkhIF+9JcajZCZhUBqqGs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCLLk-0003hy-S5@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:55:04 +0000

commit 53220c4f9db70331284424ff5ff5f286dd3fbc16
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:41:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:41:59 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index eaa43c6181..2ddd06801a 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1016,7 +1016,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260348.449642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLLw-00043A-Ep; Tue, 25 Jan 2022 12:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260348.449642; Tue, 25 Jan 2022 12:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLLw-000432-Bk; Tue, 25 Jan 2022 12:55:16 +0000
Received: by outflank-mailman (input) for mailman id 260348;
 Tue, 25 Jan 2022 12:55: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 1nCLLv-00042m-0x
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55: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 1nCLLv-0005iw-08
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLLu-0003jT-Vb
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kgghVkGdcsde9hvvr3P8c/iLKtghcQ9QBVkLFNENtUc=; b=jWTlTNhGreNR+vFght9v+TNGJ2
	1eCMYZzqwtWRqPIajfkFQ9Eab1/YzwRf8r1z5Y0pr4QcTe2PVgqzWa8WSCtq5tzUSA4w7hxMxIOUf
	sTERUQw+prwUnXyo7skQaHC4BJzaexuLovCFkclgLJ0fLOh/SGnC/PPLe6AKbcViqdU8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCLLu-0003jT-Vb@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:55:14 +0000

commit 2700abffa5e42cf04dc1c6eba73faaba670c99df
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:42:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:42:21 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index e2fcb07e27..47b019c750 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1499,8 +1499,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260349.449646 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLM6-00046F-GS; Tue, 25 Jan 2022 12:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260349.449646; Tue, 25 Jan 2022 12:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLM6-000467-DO; Tue, 25 Jan 2022 12:55:26 +0000
Received: by outflank-mailman (input) for mailman id 260349;
 Tue, 25 Jan 2022 12:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLM5-00045r-4e
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLM5-0005j7-3l
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLM5-0003kq-2Z
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55: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=HwH+i/JmJKqeoD83Rp+uIshtNfBdk/jSfmYvZccn9Uo=; b=KP/CguEw7hH0luCax9sMsDeiVb
	VDTkU1wL/G5JPbc4+KZOTUAnihABmEfQnIqQazHpuseBSmYvqT6q6a+TbdglTep98nD/CkH4mKM3P
	87ibD25gkJp5bZmioI70JfI26EfdMBTMfxVCS9S3sR0p+d7IeiB0ft2SCMeI4lMniLZ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCLM5-0003kq-2Z@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:55:25 +0000

commit 13e7fe4c938f92933c6aa89e416e3085b13a22c7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:42:53 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:42:53 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index a6e2863c14..9544f3234e 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -810,7 +810,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:55:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260350.449650 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMG-00049M-Hy; Tue, 25 Jan 2022 12:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260350.449650; Tue, 25 Jan 2022 12:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMG-00049E-Ey; Tue, 25 Jan 2022 12:55:36 +0000
Received: by outflank-mailman (input) for mailman id 260350;
 Tue, 25 Jan 2022 12:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMF-000494-7f
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMF-0005jI-6r
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMF-0003lg-60
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O/XQJe6fUOZeo93Wy0BAhE1LDzZfKu6/r6/elr316EM=; b=x/hUtgf28tB7OMlK/MgiiGXS4H
	KMAHUkxHR/iLTod0QLzHKVLUBUOO2gjQB1L1MWMkeOi2UMj69+QcDtbGACjEY3z4AkvYAsbpXIOUN
	67mPp2pA1EuSQLuYZOp9+lDAlSptyhT9n11w5n5Jv85JTwTkq5/DwWRPgi6GWYaCu78k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/time: use relative counts in calibration loops
Message-Id: <E1nCLMF-0003lg-60@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:55:35 +0000

commit 793d5ca89fdd9e2cdcb05e88c6cd8446e475b15a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:44:42 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:44:42 2022 +0100

    x86/time: use relative counts in calibration loops
    
    Looping until reaching/exceeding a certain value is error prone: If the
    target value is close enough to the wrapping point, the loop may not
    terminate at all. Switch to using delta values, which then allows to
    fold the two loops each into just one.
    
    Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 467191641d2a2fd2e43b3ae7b80399f89d339980
    master date: 2022-01-13 14:30:18 +0100
---
 xen/arch/x86/time.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 6bc1fd11d6..719dc38c7b 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -376,7 +376,7 @@ static u64 read_hpet_count(void)
 static int64_t __init init_hpet(struct platform_timesource *pts)
 {
     uint64_t hpet_rate, start;
-    uint32_t count, target;
+    uint32_t count, target, elapsed;
 
     if ( hpet_address && strcmp(opt_clocksource, pts->id) &&
          cpuidle_using_deep_cstate() )
@@ -414,11 +414,8 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
 
     count = hpet_read32(HPET_COUNTER);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(hpet_rate);
-    if ( target < count )
-        while ( hpet_read32(HPET_COUNTER) >= count )
-            continue;
-    while ( hpet_read32(HPET_COUNTER) < target )
+    target = CALIBRATE_VALUE(hpet_rate);
+    while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
@@ -456,8 +453,8 @@ static u64 read_pmtimer_count(void)
 
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
-    u64 start;
-    u32 count, target, mask;
+    uint64_t start;
+    uint32_t count, target, mask, elapsed;
 
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -465,13 +462,10 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     pts->counter_bits = pmtmr_width;
     mask = 0xffffffff >> (32 - pmtmr_width);
 
-    count = inl(pmtmr_ioport) & mask;
+    count = inl(pmtmr_ioport);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
-    if ( target < count )
-        while ( (inl(pmtmr_ioport) & mask) >= count )
-            continue;
-    while ( (inl(pmtmr_ioport) & mask) < target )
+    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
+    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:55:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260351.449654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMQ-0004Ch-Km; Tue, 25 Jan 2022 12:55:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260351.449654; Tue, 25 Jan 2022 12:55: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 1nCLMQ-0004CZ-Hn; Tue, 25 Jan 2022 12:55:46 +0000
Received: by outflank-mailman (input) for mailman id 260351;
 Tue, 25 Jan 2022 12:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMP-0004CP-B6
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMP-0005jS-AJ
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMP-0003mZ-9H
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XX71XQwPboR322ok55QCLVrS0ociZ/GwQ04A/+iCQyI=; b=aM4DSujS0+rUvwPpUAhji1jbMS
	bKDk1CX+bh+I6ddLYUdc7luHf7JNL+3m72Wa1gQ+Wz2YjZ7KWHqT8JJvuw7l+RdKK+Aw0E19sfuTV
	NvwYwwKtuVcvZ10P/mRowBd1xkvLtZ7R+F8r0LJO0qAOlSyYlDb6Y0q6VxPeYfy6XeMg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/time: improve TSC / CPU freq calibration accuracy
Message-Id: <E1nCLMP-0003mZ-9H@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:55:45 +0000

commit ac71fdd9ec8a54240cc09827203197674353a722
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:44:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:44:55 2022 +0100

    x86/time: improve TSC / CPU freq calibration accuracy
    
    While the problem report was for extreme errors, even smaller ones would
    better be avoided: The calculated period to run calibration loops over
    can (and usually will) be shorter than the actual time elapsed between
    first and last platform timer and TSC reads. Adjust values returned from
    the init functions accordingly.
    
    On a Skylake system I've tested this on accuracy (using HPET) went from
    detecting in some cases more than 220kHz too high a value to about
    ±2kHz. On other systems (or on this system, but with PMTMR) the original
    error range was much smaller, with less (in some cases only very little)
    improvement.
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a5c9a80af34eefcd6e31d0ed2b083f452cd9076d
    master date: 2022-01-13 14:31:52 +0100
---
 xen/arch/x86/time.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 719dc38c7b..0b85b90f55 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -285,6 +285,23 @@ static char *freq_string(u64 freq)
     return s;
 }
 
+static uint64_t adjust_elapsed(uint64_t elapsed, uint32_t actual,
+                               uint32_t target)
+{
+    if ( likely(actual > target) )
+    {
+        /*
+         * A (perhaps significant) delay before the last timer read (e.g. due
+         * to a SMI or NMI) can lead to (perhaps severe) inaccuracy if not
+         * accounting for the time elapsed beyond the originally calculated
+         * duration of the calibration interval.
+         */
+        elapsed = muldiv64(elapsed, target, actual);
+    }
+
+    return elapsed * CALIBRATE_FRAC;
+}
+
 /************************************************************
  * PLATFORM TIMER 1: PROGRAMMABLE INTERVAL TIMER (LEGACY PIT)
  */
@@ -418,7 +435,7 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
     while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static void resume_hpet(struct platform_timesource *pts)
@@ -468,7 +485,7 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static struct platform_timesource __initdata plt_pmtimer =
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:55:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:55:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260352.449658 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMa-0004FO-MH; Tue, 25 Jan 2022 12:55:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260352.449658; Tue, 25 Jan 2022 12:55:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMa-0004FG-JN; Tue, 25 Jan 2022 12:55:56 +0000
Received: by outflank-mailman (input) for mailman id 260352;
 Tue, 25 Jan 2022 12:55:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMZ-0004Er-EY
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMZ-0005jc-Dg
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMZ-0003nV-Ce
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B0tXzKDpLycmHqAka57NXphP3f+eRl9M2ttKtAz6fv4=; b=CzYAvWGN8vNyoWxUP30a0TSxbM
	W5vDxhzKv9iE7vDBBcC+nLHdRfcerkyorXF+bxFzo1YmDuzGoS3G9O+dMUqkTrUqJBuzuSu4nb0Xa
	8E0zcHOe4bbnt+u71buftxhUjDt/bsgKLE/m3GXVC1/fE4U53GzE4znA3FXriQEGi2f0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] libxl/PCI: Fix PV hotplug & stubdom coldplug
Message-Id: <E1nCLMZ-0003nV-Ce@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:55:55 +0000

commit 7ca8706ad53d5967fd15fa94c2dd5ada8d42d812
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jan 25 13:45:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:45:09 2022 +0100

    libxl/PCI: Fix PV hotplug & stubdom coldplug
    
    commit 0fdb48ffe7a1 "libxl: Make sure devices added by pci-attach are
    reflected in the config" broken PCI hotplug (xl pci-attach) for PV
    domains when it moved libxl__create_pci_backend() later in the function.
    
    This also broke HVM + stubdom PCI passthrough coldplug.  For that, the
    PCI devices are hotplugged to a running PV stubdom, and then the QEMU
    QMP device_add commands are made to QEMU inside the stubdom.
    
    A running PV domain calls libxl__wait_for_backend().  With the current
    placement of libxl__create_pci_backend(), the path does not exist and
    the call immediately fails:
    libxl: error: libxl_device.c:1388:libxl__wait_for_backend: Backend /local/domain/0/backend/pci/43/0 does not exist
    libxl: error: libxl_pci.c:1764:device_pci_add_done: Domain 42:libxl__device_pci_add failed for PCI device 0:2:0.0 (rc -3)
    libxl: error: libxl_create.c:1857:domcreate_attach_devices: Domain 42:unable to add pci devices
    
    The wait is only relevant when:
    1) The domain is PV
    2) The domain is running
    3) The backend is already present
    
    This is because:
    
    1) xen-pcifront is only used for PV.  It does not load for HVM domains
       where QEMU is used.
    
    2) If the domain is not running (starting), then the frontend state will
       be Initialising.  xen-pciback waits for the frontend to transition to
       at Initialised before attempting to connect.  So a wait for a
       non-running domain is not applicable as the backend will not
       transition to Connected.
    
    3) For presence, num_devs is already used to determine if the backend
       needs to be created.  Re-use num_devs to determine if the backend
       wait is necessary.  The wait is necessary to avoid racing with
       another PCI attachment reconfiguring the front/back or changing to
       some other state like closing.  If we are creating the backend, then
       we don't have to worry about the state since it is being created.
    
    Fixes: 0fdb48ffe7a1 ("libxl: Make sure devices added by pci-attach are
    reflected in the config")
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 73ee2795aaef2cb086ac078bffe1c6b33c0ea91b
    master date: 2022-01-13 14:33:16 +0100
---
 tools/libs/light/libxl_pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 1a1c263080..92bf86b2be 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -157,9 +157,11 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc,
     if (domtype == LIBXL_DOMAIN_TYPE_INVALID)
         return ERROR_FAIL;
 
-    if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", XenbusStateConnected)) < 0)
-            return ERROR_FAIL;
+    /* Wait is only needed if the backend already exists (num_devs != NULL) */
+    if (num_devs && !starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
+        rc = libxl__wait_for_backend(gc, be_path,
+                                     GCSPRINTF("%d", XenbusStateConnected));
+        if (rc) return rc;
     }
 
     back = flexarray_make(gc, 16, 1);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:56:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:56:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260353.449664 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMk-0004IU-Ol; Tue, 25 Jan 2022 12:56:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260353.449664; Tue, 25 Jan 2022 12:56:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMk-0004IK-L2; Tue, 25 Jan 2022 12:56:06 +0000
Received: by outflank-mailman (input) for mailman id 260353;
 Tue, 25 Jan 2022 12:56:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMj-0004I7-II
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMj-0005jz-HO
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMj-0003or-GY
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xew1gXnovx8tO2WK2O3/YkJ6V4rmEpmzJ65H8/aIuIQ=; b=P6j4Fh310ZN9xt0J/wMRmNX59l
	0jAzVZmnOMJJlZ6PVoWSpmerwYtmbSGMuOXqtaX4PNWIi4QlFofAnBxJFWxTqdBpkay3XDN7SeAU0
	QLs93X2v3PfepupxA+pTZlLzZmeDVCPbMzfidblNOdd9NB04M5GGNGYbQW6igx7jlZhM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/guest: Introduce {get,set}_reg() infrastructure
Message-Id: <E1nCLMj-0003or-GY@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:56:05 +0000

commit ff2ce108699b2e1c49bdadc0fecb8e77cf8b34ae
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:45:33 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:45:33 2022 +0100

    x86/guest: Introduce {get,set}_reg() infrastructure
    
    Various registers have per-guest-type or per-vendor locations or access
    requirements.  To support their use from common code, provide accessors which
    allow for per-guest-type behaviour.
    
    For now, just infrastructure handling default cases and expectations.
    Subsequent patches will start handling registers using this infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 88d3ff7ab15da277a85b39735797293fb541c718
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/hvm.c          | 22 ++++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c      | 30 ++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c      | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emulate.c       | 31 +++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h   | 15 +++++++++++++++
 xen/include/asm-x86/pv/domain.h |  4 ++++
 6 files changed, 133 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5be8aee4bb..f572c68d4d 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3712,6 +3712,28 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_call(hvm_funcs.get_reg, v, reg);
+    }
+}
+
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_vcall(hvm_funcs.set_reg, v, reg, val);
+    }
+}
+
 static bool is_sysdesc_access(const struct x86_emulate_state *state,
                               const struct x86_emulate_ctxt *ctxt)
 {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index c38a7405c9..79ea791b63 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2468,6 +2468,33 @@ static bool svm_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t svm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
@@ -2517,6 +2544,9 @@ static struct hvm_function_table __initdata svm_function_table = {
     .nhvm_intr_blocked = nsvm_intr_blocked,
     .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
 
+    .get_reg = svm_get_reg,
+    .set_reg = svm_set_reg,
+
     .tsc_scaling = {
         .max_ratio = ~TSC_RATIO_RSVD_BITS,
     },
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index fd7b193058..d1814c075d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2410,6 +2410,33 @@ static int vmtrace_reset(struct vcpu *v)
     return 0;
 }
 
+static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2471,6 +2498,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .vmtrace_set_option = vmtrace_set_option,
     .vmtrace_get_option = vmtrace_get_option,
     .vmtrace_reset = vmtrace_reset,
+
+    .get_reg = vmx_get_reg,
+    .set_reg = vmx_set_reg,
+
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e8bb326efd..ae049b60f2 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -90,6 +90,37 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
     }
 }
 
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 4a8fb571de..221d3e6999 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -222,6 +222,9 @@ struct hvm_function_table {
     int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
     int (*vmtrace_reset)(struct vcpu *v);
 
+    uint64_t (*get_reg)(struct vcpu *v, unsigned int reg);
+    void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -712,6 +715,18 @@ static inline int hvm_vmtrace_reset(struct vcpu *v)
     return -EOPNOTSUPP;
 }
 
+/*
+ * Accessors for registers which have per-guest-type or per-vendor locations
+ * (e.g. VMCS, msr load/save lists, VMCB, VMLOAD lazy, etc).
+ *
+ * The caller is responsible for all auditing - these accessors do not fail,
+ * but do use domain_crash() for usage errors.
+ *
+ * Must cope with being called in non-current context.
+ */
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg);
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index df9716ff26..3a67816764 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,6 +65,10 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:56:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:56:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260354.449666 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMu-0004L9-PU; Tue, 25 Jan 2022 12:56:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260354.449666; Tue, 25 Jan 2022 12:56:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLMu-0004L1-Ma; Tue, 25 Jan 2022 12:56:16 +0000
Received: by outflank-mailman (input) for mailman id 260354;
 Tue, 25 Jan 2022 12:56:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMt-0004Ks-Li
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMt-0005lw-Ky
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLMt-0003q3-K4
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oOx2ml5sRFIxuuMQEAtUngJKlfawaNjvkeEaWVp6tDU=; b=n3mR4RjTUEDwJKUhCQKvFvK+ci
	WXsg0aslHlqTOtJf2Va+bke2AJrODc4KnF8R/Wf2E+d2ZhO3NbAfBMXaO3+zpKJovj4HERJst9oYX
	MH6RptlzF2Bfc2APcoQnuLaAAcdhfMRdjbirSePgL6NvU2qzhOTWV/W/fDFtpE8oxKYM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/msr: Split MSR_SPEC_CTRL handling
Message-Id: <E1nCLMt-0003q3-K4@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:56:15 +0000

commit 2e4507eb358b580378b0a7aaa6d357401abbca88
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:45:58 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:45:58 2022 +0100

    x86/msr: Split MSR_SPEC_CTRL handling
    
    In order to fix a VT-x bug, and support MSR_SPEC_CTRL on AMD, move
    MSR_SPEC_CTRL handling into the new {pv,hvm}_{get,set}_reg() infrastructure.
    
    Duplicate the msrs->spec_ctrl.raw accesses in the PV and VT-x paths for now.
    The SVM path is currently unreachable because of the CPUID policy.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6536688439dbca1d08fd6db5be29c39e3917fb2f
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c |  7 +++++++
 xen/arch/x86/msr.c         | 22 +++++++++++++++++-----
 xen/arch/x86/pv/emulate.c  |  9 +++++++++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d1814c075d..8e53a51a17 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2416,6 +2416,9 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return v->arch.msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -2430,6 +2433,10 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        v->arch.msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 75b89777a2..79d40a0074 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -28,6 +28,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/pv/domain.h>
 #include <asm/setup.h>
 
 #include <public/hvm/params.h>
@@ -250,8 +251,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_SPEC_CTRL:
         if ( !cp->feat.ibrsb )
             goto gp_fault;
-        *val = msrs->spec_ctrl.raw;
-        break;
+        goto get_reg;
 
     case MSR_INTEL_PLATFORM_INFO:
         *val = mp->platform_info.raw;
@@ -409,6 +409,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     return ret;
 
+ get_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        *val = pv_get_reg(v, msr);
+    else
+        *val = hvm_get_reg(v, msr);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
@@ -498,9 +505,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
         if ( val & rsvd )
             goto gp_fault; /* Rsvd bit set? */
-
-        msrs->spec_ctrl.raw = val;
-        break;
+        goto set_reg;
 
     case MSR_PRED_CMD:
         if ( !cp->feat.ibrsb && !cp->extd.ibpb )
@@ -648,6 +653,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
     return ret;
 
+ set_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        pv_set_reg(v, msr, val);
+    else
+        hvm_set_reg(v, msr, val);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index ae049b60f2..0a7907ec5e 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -92,12 +92,16 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 
 uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -108,12 +112,17 @@ uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 
 void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:56:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:56:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260355.449670 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLN4-0004O1-Qw; Tue, 25 Jan 2022 12:56:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260355.449670; Tue, 25 Jan 2022 12:56:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLN4-0004Nt-O4; Tue, 25 Jan 2022 12:56:26 +0000
Received: by outflank-mailman (input) for mailman id 260355;
 Tue, 25 Jan 2022 12:56:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLN3-0004Nk-PN
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLN3-0005mC-Oc
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLN3-0003rG-NP
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D1qoyiNJ4FXJ3yxTjJ3K8pCaKWAc5bfPGFkjpelec5I=; b=6pUJJyKgeoHutRfUpLMi9YNJXA
	Ujnd7bh/87WhViGY32AZ4+tOpGkSV3rwdTwUhqagkSGCd+SgxUOTXHkOAMW1PTbk5dvHtsrAOjsrX
	bMSJOyt6KEz+udBjezAO1Cvm3QowhkKF0tZjxFEqXv1Pnd3W6w6MH9vAapDCIOSjh1HU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
Message-Id: <E1nCLN3-0003rG-NP@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:56:25 +0000

commit bffdcc0dc454838e1c75a1e9d98ab140d7aff421
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:46:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:46:14 2022 +0100

    x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
    
    These were written before Spectre/Meltdown went public, and there was large
    uncertainty in how the protections would evolve.  As it turns out, they're
    very specific to Intel hardware, and not very suitable for AMD.
    
    Drop the macros, opencoding the relevant subset of functionality, and leaving
    grep-fodder to locate the logic.  No change at all for VT-x.
    
    For AMD, the only relevant piece of functionality is DO_OVERWRITE_RSB,
    although we will soon be adding (different) logic to handle MSR_SPEC_CTRL.
    
    This has a marginal improvement of removing an unconditional pile of long-nops
    from the vmentry/exit path.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 95b13fa43e0753b7514bef13abe28253e8614f62
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/svm/entry.S        |  5 +++--
 xen/arch/x86/hvm/vmx/entry.S        |  8 ++++++--
 xen/include/asm-x86/spec_ctrl_asm.h | 19 ++++---------------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index e208a4b32a..276215d36a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -59,7 +59,7 @@ __UNLIKELY_END(nsvm_hap)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
 
         pop  %r15
         pop  %r14
@@ -86,7 +86,8 @@ __UNLIKELY_END(nsvm_hap)
 
         GET_CURRENT(bx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: ac  */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         stgi
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 27c8c5ca49..30139ae58e 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -33,7 +33,9 @@ ENTRY(vmx_asm_vmexit_handler)
         movb $1,VCPU_vmx_launched(%rbx)
         mov  %rax,VCPU_hvm_guest_cr2(%rbx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
+        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -80,7 +82,9 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
 
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index cb34299a86..2b3f123cb5 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -68,14 +68,16 @@
  *
  * The following ASM fragments implement this algorithm.  See their local
  * comments for further details.
- *  - SPEC_CTRL_ENTRY_FROM_HVM
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
  *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
- *  - SPEC_CTRL_EXIT_TO_HVM
+ *
+ * Additionally, the following grep-fodder exists to find the HVM logic.
+ *  - SPEC_CTRL_ENTRY_FROM_{SVM,VMX}
+ *  - SPEC_CTRL_EXIT_TO_{SVM,VMX}
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
@@ -225,12 +227,6 @@
     wrmsr
 .endm
 
-/* Use after a VMEXIT from an HVM guest. */
-#define SPEC_CTRL_ENTRY_FROM_HVM                                        \
-    ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM;           \
-    ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM,                        \
-        X86_FEATURE_SC_MSR_HVM
-
 /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */
 #define SPEC_CTRL_ENTRY_FROM_PV                                         \
     ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_PV;            \
@@ -255,13 +251,6 @@
     ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
         X86_FEATURE_SC_VERW_PV
 
-/* Use when exiting to HVM guest context. */
-#define SPEC_CTRL_EXIT_TO_HVM                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM;             \
-    ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
-        X86_FEATURE_SC_VERW_HVM
-
 /*
  * Use in IST interrupt/exception context.  May interrupt Xen or PV context.
  * Fine grain control of SCF_ist_wrmsr is needed for safety in the S3 resume
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:56:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:56:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260356.449674 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLNE-0004RE-Tm; Tue, 25 Jan 2022 12:56:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260356.449674; Tue, 25 Jan 2022 12:56:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLNE-0004R7-Qy; Tue, 25 Jan 2022 12:56:36 +0000
Received: by outflank-mailman (input) for mailman id 260356;
 Tue, 25 Jan 2022 12:56:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLND-0004R0-Sc
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLND-0005mP-Rk
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLND-0003sh-R5
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kylXgXnniycZaR2k2mVKQc31IbomnC+++nFz235NC3A=; b=NkwLoYu0+J8IbS52cG969ANWj/
	6ymqhQ+leKL9M31acs5pNLlVq7o5KCzD1MMdUm5E/omnjpuf8uUV/sT7PKe6Ne53nx4wXctEdRp4O
	PvJc9NbixSjlehVEj//KR0+VZwGp1Y6b6bAj6/gqRiZ9+Y5BRPsWe3NkoCBhNcJ/aKWU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
Message-Id: <E1nCLND-0003sh-R5@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:56:35 +0000

commit bd20d6c87619a6b825478cd5ae0387f9fdaabea0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:46:28 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:46:28 2022 +0100

    x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
    
    The logic was based on a mistaken understanding of how NMI blocking on vmexit
    works.  NMIs are only blocked for EXIT_REASON_NMI, and not for general exits.
    Therefore, an NMI can in general hit early in the vmx_asm_vmexit_handler path,
    and the guest's value will be clobbered before it is saved.
    
    Switch to using MSR load/save lists.  This causes the guest value to be saved
    atomically with respect to NMIs/MCEs/etc.
    
    First, update vmx_cpuid_policy_changed() to configure the load/save lists at
    the same time as configuring the intercepts.  This function is always used in
    remote context, so extend the vmx_vmcs_{enter,exit}() block to cover the whole
    function, rather than having multiple remote acquisitions of the same VMCS.
    
    Both of vmx_{add,del}_guest_msr() can fail.  The -ESRCH delete case is fine,
    but all others are fatal to the running of the VM, so handle them using
    domain_crash() - this path is only used during domain construction anyway.
    
    Second, update vmx_{get,set}_reg() to use the MSR load/save lists rather than
    vcpu_msrs, and update the vcpu_msrs comment to describe the new state
    location.
    
    Finally, adjust the entry/exit asm.
    
    Because the guest value is saved and loaded atomically, we do not need to
    manually load the guest value, nor do we need to enable SCF_use_shadow.  This
    lets us remove the use of DO_SPEC_CTRL_EXIT_TO_GUEST.  Additionally,
    SPEC_CTRL_ENTRY_FROM_PV gets removed too, because on an early entry failure,
    we're no longer in the guest MSR_SPEC_CTRL context needing to switch back to
    Xen's context.
    
    The only action remaining is to load Xen's MSR_SPEC_CTRL value on vmexit.  We
    could in principle use the host msr list, but is expected to complicated
    future work.  Delete DO_SPEC_CTRL_ENTRY_FROM_HVM entirely, and use a shorter
    code sequence to simply reload Xen's setting from the top-of-stack block.
    
    Adjust the comment at the top of spec_ctrl_asm.h in light of this bugfix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f0eaadf84d273a6ff8df3660b874a02d0e7677
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/entry.S        | 22 ++++++++++++-------
 xen/arch/x86/hvm/vmx/vmx.c          | 44 ++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/msr.h           | 10 ++++++++-
 xen/include/asm-x86/spec_ctrl_asm.h | 32 ++++-----------------------
 4 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 30139ae58e..7ee3382fd0 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -35,7 +35,14 @@ ENTRY(vmx_asm_vmexit_handler)
 
         /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
-        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
+
+        .macro restore_spec_ctrl
+            mov    $MSR_SPEC_CTRL, %ecx
+            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            xor    %edx, %edx
+            wrmsr
+        .endm
+        ALTERNATIVE "", restore_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -82,8 +89,7 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
-        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: %rsp=regs/cpuinfo              Clob:    */
         ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
@@ -119,12 +125,12 @@ UNLIKELY_END(realmode)
         SAVE_ALL
 
         /*
-         * PV variant needed here as no guest code has executed (so
-         * MSR_SPEC_CTRL can't have changed value), and NMIs/MCEs are liable
-         * to hit (in which case the HVM variant might corrupt things).
+         * SPEC_CTRL_ENTRY notes
+         *
+         * If we end up here, no guest code has executed.  The MSR lists have
+         * not been processed, so we still have Xen's choice of MSR_SPEC_CTRL
+         * in context, and the RSB is unchanged.
          */
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 8e53a51a17..868151a2e5 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -598,6 +598,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)
 static void vmx_cpuid_policy_changed(struct vcpu *v)
 {
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
+    int rc = 0;
 
     if ( opt_hvm_fep ||
          (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
@@ -607,17 +608,29 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
 
     /*
      * We can safely pass MSR_SPEC_CTRL through to the guest, even if STIBP
      * isn't enumerated in hardware, as SPEC_CTRL_STIBP is ignored.
      */
     if ( cp->feat.ibrsb )
+    {
         vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
+
+        rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
+        if ( rc )
+            goto out;
+    }
     else
+    {
         vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
 
+        rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
+        if ( rc && rc != -ESRCH )
+            goto out;
+        rc = 0; /* Tolerate -ESRCH */
+    }
+
     /* MSR_PRED_CMD is safe to pass through if the guest knows about it. */
     if ( cp->feat.ibrsb || cp->extd.ibpb )
         vmx_clear_msr_intercept(v, MSR_PRED_CMD,  VMX_MSR_RW);
@@ -629,6 +642,15 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
         vmx_clear_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
+
+ out:
+    vmx_vmcs_exit(v);
+
+    if ( rc )
+    {
+        printk(XENLOG_G_ERR "%pv MSR list error: %d", v, rc);
+        domain_crash(v->domain);
+    }
 }
 
 int vmx_guest_x86_mode(struct vcpu *v)
@@ -2413,11 +2435,20 @@ static int vmtrace_reset(struct vcpu *v)
 static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     struct domain *d = v->domain;
+    uint64_t val = 0;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        return v->arch.msrs->spec_ctrl.raw;
+        rc = vmx_read_guest_msr(v, reg, &val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
+        return val;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
@@ -2430,11 +2461,18 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     struct domain *d = v->domain;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        v->arch.msrs->spec_ctrl.raw = val;
+        rc = vmx_write_guest_msr(v, reg, val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
         break;
 
     default:
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 1d3eca9063..10039c2d22 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -287,7 +287,15 @@ extern struct msr_policy     raw_msr_policy,
 /* Container object for per-vCPU MSRs */
 struct vcpu_msrs
 {
-    /* 0x00000048 - MSR_SPEC_CTRL */
+    /*
+     * 0x00000048 - MSR_SPEC_CTRL
+     *
+     * For PV guests, this holds the guest kernel value.  It is accessed on
+     * every entry/exit path.
+     *
+     * For VT-x guests, the guest value is held in the MSR guest load/save
+     * list.
+     */
     struct {
         uint32_t raw;
     } spec_ctrl;
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index 2b3f123cb5..bf82528a12 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -42,9 +42,10 @@
  *     path, or late in the exit path after restoring the guest value.  This
  *     will corrupt the guest value.
  *
- * Factor 1 is dealt with by relying on NMIs/MCEs being blocked immediately
- * after VMEXIT.  The VMEXIT-specific code reads MSR_SPEC_CTRL and updates
- * current before loading Xen's MSR_SPEC_CTRL setting.
+ * Factor 1 is dealt with:
+ *   - On VMX by using MSR load/save lists to have vmentry/exit atomically
+ *     load/save the guest value.  Xen's value is loaded in regular code, and
+ *     there is no need to use the shadow logic (below).
  *
  * Factor 2 is harder.  We maintain a shadow_spec_ctrl value, and a use_shadow
  * boolean in the per cpu spec_ctrl_flags.  The synchronous use is:
@@ -128,31 +129,6 @@
 #endif
 .endm
 
-.macro DO_SPEC_CTRL_ENTRY_FROM_HVM
-/*
- * Requires %rbx=current, %rsp=regs/cpuinfo
- * Clobbers %rax, %rcx, %rdx
- *
- * The common case is that a guest has direct access to MSR_SPEC_CTRL, at
- * which point we need to save the guest value before setting IBRS for Xen.
- * Unilaterally saving the guest value is shorter and faster than checking.
- */
-    mov $MSR_SPEC_CTRL, %ecx
-    rdmsr
-
-    /* Stash the value from hardware. */
-    mov VCPU_arch_msrs(%rbx), %rdx
-    mov %eax, VCPUMSR_spec_ctrl_raw(%rdx)
-    xor %edx, %edx
-
-    /* Clear SPEC_CTRL shadowing *before* loading Xen's value. */
-    andb $~SCF_use_shadow, CPUINFO_spec_ctrl_flags(%rsp)
-
-    /* Load Xen's intended value. */
-    movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-    wrmsr
-.endm
-
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:56:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:56:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260357.449678 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLNP-0004Tz-Vi; Tue, 25 Jan 2022 12:56:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260357.449678; Tue, 25 Jan 2022 12:56:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLNP-0004Tp-Sj; Tue, 25 Jan 2022 12:56:47 +0000
Received: by outflank-mailman (input) for mailman id 260357;
 Tue, 25 Jan 2022 12:56: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 1nCLNO-0004Te-CS
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56: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 1nCLNO-0005mZ-Bc
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNO-0003vH-Ak
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56: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=+imuwrLouiiOHJYD6txIQWq6f0B2ie/Xv+9i9P4zVN4=; b=cV+TpEcw1uON4YJ6egaQ78c8Kh
	i+SmMgxvDWiUizplfHVYZzT2Ponr//djSnBONHU9pCSPN7XbZJnz4wqG0ZZFrQKtyXvDa46nPIOTE
	ZOWwNokIXpCL+24N8UdaUah1i2X2p3M+Nph24N8FNXDGKio9GInUT73l0uIjQZ3YAiVo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCLNO-0003vH-Ak@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:56:46 +0000

commit 861e27398c1da53e1c483c5dde12ad019ced6786
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:49:06 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:49:06 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ac821a9094..2290b7114f 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1008,7 +1008,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:56:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:56:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260358.449682 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLNa-0004YR-1K; Tue, 25 Jan 2022 12:56:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260358.449682; Tue, 25 Jan 2022 12:56: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 1nCLNZ-0004YJ-UE; Tue, 25 Jan 2022 12:56:57 +0000
Received: by outflank-mailman (input) for mailman id 260358;
 Tue, 25 Jan 2022 12:56:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNY-0004Xy-Fh
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNY-0005md-Eu
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNY-0003wI-E9
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:56:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lWEFJbNS1+mwpG12hU2bDpgpPSYm6UpBxLjCej5Z+ng=; b=C1q93Ofn/clkT4Pkl4vTF+bO8S
	IqSG2JX/iWVYYwqkxARtJMAAZ2UpwqD9F/TxEGVZLj+XdhMKt/ZItsEV7ogvJBXScH2CNn+hVh5jC
	ES/7trLV2W75jTtz4k593Q/bUEimQzcePNSxq+boIV2Ovu8JxhLJMbsMTF8F/aQKJnak=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCLNY-0003wI-E9@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:56:56 +0000

commit dbd85c0a8264aa2cd9b011a189ac8b1d90297d80
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:49:26 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:49:26 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 90781e236e..71ee5c6ec5 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1477,8 +1477,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:57:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:57:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260359.449686 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLNk-0004bd-2m; Tue, 25 Jan 2022 12:57:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260359.449686; Tue, 25 Jan 2022 12:57: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 1nCLNj-0004bV-Vr; Tue, 25 Jan 2022 12:57:07 +0000
Received: by outflank-mailman (input) for mailman id 260359;
 Tue, 25 Jan 2022 12:57:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNi-0004bH-Ih
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNi-0005mu-Ht
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNi-0003xR-H7
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7YakEYLnPN0UCGiY/d17nHsHF6Pn0YnGGVw5H8N09eI=; b=R4zrEPAWEFUv79CfpJgGvTpcUo
	/upG++yFddPI9sJj4UU2FDGuPm/Sib+hoNPJr4meEeOHII6mIkb8Oc8DhPpSsIiDfGf7qapoDuJ5O
	K/ZI4Zas0eo1VoQvkzaSAHUkUddo/Q9pYkujcSKDDE4acd/F3SbOidJ6Jg4NMS6IB78U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCLNi-0003xR-H7@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:57:06 +0000

commit 5af939d96a6c7c5a0b4e00f7be3002333959e7e3
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:49:40 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:49:40 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 71eaf2c17e..b6e88ebc86 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -810,7 +810,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:57:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:57:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260360.449690 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLNu-0004fB-4f; Tue, 25 Jan 2022 12:57:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260360.449690; Tue, 25 Jan 2022 12:57: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 1nCLNu-0004f3-1B; Tue, 25 Jan 2022 12:57:18 +0000
Received: by outflank-mailman (input) for mailman id 260360;
 Tue, 25 Jan 2022 12:57:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNs-0004et-Ld
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNs-0005nO-Kw
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLNs-0003yC-K9
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nQNfOcSGbF+sQMjWsuhwruXvMnKiStVBakZAYsE+oxA=; b=opyGDWZGn4jbRnaPdIrezs0VSr
	ijUOXytiy8e1BD/1ucweOcDX1NZ1SobxlE53UjJREbM3ZBjoWyG9p9EiElBjNyrH01YzQBs6ZsvJy
	30O15tP+bt88N1lKAysuavMF90EJYtE5wX545mEYMYXOcbUcii0E+2wapxye4OBbyeqE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/time: use relative counts in calibration loops
Message-Id: <E1nCLNs-0003yC-K9@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:57:16 +0000

commit 6b776749ff7e45c30696235dbb4ecd2b53401cff
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:51:36 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:51:36 2022 +0100

    x86/time: use relative counts in calibration loops
    
    Looping until reaching/exceeding a certain value is error prone: If the
    target value is close enough to the wrapping point, the loop may not
    terminate at all. Switch to using delta values, which then allows to
    fold the two loops each into just one.
    
    Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 467191641d2a2fd2e43b3ae7b80399f89d339980
    master date: 2022-01-13 14:30:18 +0100
---
 xen/arch/x86/time.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 505e54ebd7..22352fa5b1 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -376,7 +376,7 @@ static u64 read_hpet_count(void)
 static int64_t __init init_hpet(struct platform_timesource *pts)
 {
     uint64_t hpet_rate, start;
-    uint32_t count, target;
+    uint32_t count, target, elapsed;
 
     if ( hpet_address && strcmp(opt_clocksource, pts->id) &&
          cpuidle_using_deep_cstate() )
@@ -414,11 +414,8 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
 
     count = hpet_read32(HPET_COUNTER);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(hpet_rate);
-    if ( target < count )
-        while ( hpet_read32(HPET_COUNTER) >= count )
-            continue;
-    while ( hpet_read32(HPET_COUNTER) < target )
+    target = CALIBRATE_VALUE(hpet_rate);
+    while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
@@ -456,8 +453,8 @@ static u64 read_pmtimer_count(void)
 
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
-    u64 start;
-    u32 count, target, mask;
+    uint64_t start;
+    uint32_t count, target, mask, elapsed;
 
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -465,13 +462,10 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     pts->counter_bits = pmtmr_width;
     mask = 0xffffffff >> (32 - pmtmr_width);
 
-    count = inl(pmtmr_ioport) & mask;
+    count = inl(pmtmr_ioport);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
-    if ( target < count )
-        while ( (inl(pmtmr_ioport) & mask) >= count )
-            continue;
-    while ( (inl(pmtmr_ioport) & mask) < target )
+    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
+    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:57:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:57:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260361.449694 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLO4-0004jS-7a; Tue, 25 Jan 2022 12:57:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260361.449694; Tue, 25 Jan 2022 12:57: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 1nCLO4-0004jK-4l; Tue, 25 Jan 2022 12:57:28 +0000
Received: by outflank-mailman (input) for mailman id 260361;
 Tue, 25 Jan 2022 12:57:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLO2-0004io-Ol
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLO2-0005nX-Nz
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLO2-0003yw-NH
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7FmCELoS2quMGsfAlMhS0E0I7gDik5Pwa1tovF2VGDk=; b=igeZZ17xE7aS/GZBWUIJhkErPW
	uBBFeqGgVOLmv1xk6Dy/wo5IaG7Lo1mRNCqc7+7xBWdAEKEi/s06XgOIwBn1/8H+sQTg6B1944iJ6
	iFXqQYi7IjP3R0GUaLPd+om5+1IYd+53+9AIXPN0Sl+fMpNpDoSE1ZwcCFWTb/kEEID4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/time: improve TSC / CPU freq calibration accuracy
Message-Id: <E1nCLO2-0003yw-NH@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:57:26 +0000

commit 0f88870898ae82aa9e7d0e6d1391e598a4aa7af7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:51:49 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:51:49 2022 +0100

    x86/time: improve TSC / CPU freq calibration accuracy
    
    While the problem report was for extreme errors, even smaller ones would
    better be avoided: The calculated period to run calibration loops over
    can (and usually will) be shorter than the actual time elapsed between
    first and last platform timer and TSC reads. Adjust values returned from
    the init functions accordingly.
    
    On a Skylake system I've tested this on accuracy (using HPET) went from
    detecting in some cases more than 220kHz too high a value to about
    ±2kHz. On other systems (or on this system, but with PMTMR) the original
    error range was much smaller, with less (in some cases only very little)
    improvement.
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a5c9a80af34eefcd6e31d0ed2b083f452cd9076d
    master date: 2022-01-13 14:31:52 +0100
---
 xen/arch/x86/time.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 22352fa5b1..3488d21b18 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -285,6 +285,23 @@ static char *freq_string(u64 freq)
     return s;
 }
 
+static uint64_t adjust_elapsed(uint64_t elapsed, uint32_t actual,
+                               uint32_t target)
+{
+    if ( likely(actual > target) )
+    {
+        /*
+         * A (perhaps significant) delay before the last timer read (e.g. due
+         * to a SMI or NMI) can lead to (perhaps severe) inaccuracy if not
+         * accounting for the time elapsed beyond the originally calculated
+         * duration of the calibration interval.
+         */
+        elapsed = muldiv64(elapsed, target, actual);
+    }
+
+    return elapsed * CALIBRATE_FRAC;
+}
+
 /************************************************************
  * PLATFORM TIMER 1: PROGRAMMABLE INTERVAL TIMER (LEGACY PIT)
  */
@@ -418,7 +435,7 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
     while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static void resume_hpet(struct platform_timesource *pts)
@@ -468,7 +485,7 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static struct platform_timesource __initdata plt_pmtimer =
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:57:38 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:57:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260362.449698 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLOE-0004mP-9G; Tue, 25 Jan 2022 12:57:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260362.449698; Tue, 25 Jan 2022 12:57:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLOE-0004mH-6E; Tue, 25 Jan 2022 12:57:38 +0000
Received: by outflank-mailman (input) for mailman id 260362;
 Tue, 25 Jan 2022 12:57:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOC-0004m6-SR
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOC-0005nb-Rh
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOC-0003zf-Qm
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/KxqNuJYV5NWPDM6vYHKrAZKtrswpNfrmmcuyQipzAY=; b=t0Pn9Hn6qBQ9uTi4TislybjM4y
	sxRrCTC7e3+THnJHQHoUIrymWG7OR3mn/4g8ZQylBLOhekI0Pq3zIVC6I8YhyRl7gK4UddS7NozHp
	etEsYPAA58qBwIpQA8P4zhBhTaVl98T4IytLJwvwbmcld+RdVTcJXE+T/8hXwkfWzQiY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/guest: Introduce {get,set}_reg() infrastructure
Message-Id: <E1nCLOC-0003zf-Qm@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:57:36 +0000

commit c45c2c2e09295ef3008a79d78673af0819ff4e4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:52:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:52:07 2022 +0100

    x86/guest: Introduce {get,set}_reg() infrastructure
    
    Various registers have per-guest-type or per-vendor locations or access
    requirements.  To support their use from common code, provide accessors which
    allow for per-guest-type behaviour.
    
    For now, just infrastructure handling default cases and expectations.
    Subsequent patches will start handling registers using this infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 88d3ff7ab15da277a85b39735797293fb541c718
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/hvm.c          | 22 ++++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c      | 30 ++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c      | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emulate.c       | 31 +++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h   | 15 +++++++++++++++
 xen/include/asm-x86/pv/domain.h |  4 ++++
 6 files changed, 133 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 89926a5bf6..0842936862 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3724,6 +3724,28 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_call(hvm_funcs.get_reg, v, reg);
+    }
+}
+
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_vcall(hvm_funcs.set_reg, v, reg, val);
+    }
+}
+
 static bool is_sysdesc_access(const struct x86_emulate_state *state,
                               const struct x86_emulate_ctxt *ctxt)
 {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index bb4a9da27e..ac170b9d53 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2415,6 +2415,33 @@ static bool svm_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t svm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
@@ -2464,6 +2491,9 @@ static struct hvm_function_table __initdata svm_function_table = {
     .nhvm_intr_blocked = nsvm_intr_blocked,
     .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
 
+    .get_reg = svm_get_reg,
+    .set_reg = svm_set_reg,
+
     .tsc_scaling = {
         .max_ratio = ~TSC_RATIO_RSVD_BITS,
     },
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2a29675c1a..e444d84f9c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2240,6 +2240,33 @@ static bool vmx_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2295,6 +2322,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .altp2m_vcpu_update_vmfunc_ve = vmx_vcpu_update_vmfunc_ve,
     .altp2m_vcpu_emulate_ve = vmx_vcpu_emulate_ve,
     .altp2m_vcpu_emulate_vmfunc = vmx_vcpu_emulate_vmfunc,
+
+    .get_reg = vmx_get_reg,
+    .set_reg = vmx_set_reg,
+
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index c0b153e2c5..04eca9e8b3 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -90,6 +90,37 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
     }
 }
 
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 1eb377dd82..e69828e274 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -214,6 +214,9 @@ struct hvm_function_table {
     bool_t (*altp2m_vcpu_emulate_ve)(struct vcpu *v);
     int (*altp2m_vcpu_emulate_vmfunc)(const struct cpu_user_regs *regs);
 
+    uint64_t (*get_reg)(struct vcpu *v, unsigned int reg);
+    void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -655,6 +658,18 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
     return false;
 }
 
+/*
+ * Accessors for registers which have per-guest-type or per-vendor locations
+ * (e.g. VMCS, msr load/save lists, VMCB, VMLOAD lazy, etc).
+ *
+ * The caller is responsible for all auditing - these accessors do not fail,
+ * but do use domain_crash() for usage errors.
+ *
+ * Must cope with being called in non-current context.
+ */
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg);
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index df9716ff26..3a67816764 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,6 +65,10 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:57:48 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:57:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260363.449702 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLOO-0004p4-Ab; Tue, 25 Jan 2022 12:57:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260363.449702; Tue, 25 Jan 2022 12:57: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 1nCLOO-0004ow-7g; Tue, 25 Jan 2022 12:57:48 +0000
Received: by outflank-mailman (input) for mailman id 260363;
 Tue, 25 Jan 2022 12:57:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOM-0004oZ-Vk
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOM-0005nq-V4
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOM-00040i-UG
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3yQVY3JsHhpnc7ldwC7dY3QjGJYY+xaWQNQhXd0RLuU=; b=kTAvvcZGIdpVidhUPEiIylvz6A
	WQKYU8/jAiwWzm2Yj4z/eH24nBS5V9TaHNsG73ACAzQwRRScT+h7Nfm27B0nxgTrO8wt6h3b6TTIs
	PH9zQbaY1DDNNP8HyKuckoUNYcTpnVc+qUw9bVeSSw73P2svLapF0jJXj6Lxo/4TO4Rc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/msr: Split MSR_SPEC_CTRL handling
Message-Id: <E1nCLOM-00040i-UG@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:57:46 +0000

commit 4e25a788d000e57c4d04fdd33c209d7173420580
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:52:30 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:52:30 2022 +0100

    x86/msr: Split MSR_SPEC_CTRL handling
    
    In order to fix a VT-x bug, and support MSR_SPEC_CTRL on AMD, move
    MSR_SPEC_CTRL handling into the new {pv,hvm}_{get,set}_reg() infrastructure.
    
    Duplicate the msrs->spec_ctrl.raw accesses in the PV and VT-x paths for now.
    The SVM path is currently unreachable because of the CPUID policy.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6536688439dbca1d08fd6db5be29c39e3917fb2f
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c |  7 +++++++
 xen/arch/x86/msr.c         | 22 +++++++++++++++++-----
 xen/arch/x86/pv/emulate.c  |  9 +++++++++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index e444d84f9c..06e6d52933 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2246,6 +2246,9 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return v->arch.msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -2260,6 +2263,10 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        v->arch.msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index caef0c6ede..faaa678f84 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -27,6 +27,7 @@
 #include <asm/debugreg.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/pv/domain.h>
 #include <asm/setup.h>
 
 #include <public/hvm/params.h>
@@ -237,8 +238,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_SPEC_CTRL:
         if ( !cp->feat.ibrsb )
             goto gp_fault;
-        *val = msrs->spec_ctrl.raw;
-        break;
+        goto get_reg;
 
     case MSR_INTEL_PLATFORM_INFO:
         *val = mp->platform_info.raw;
@@ -349,6 +349,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     return ret;
 
+ get_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        *val = pv_get_reg(v, msr);
+    else
+        *val = hvm_get_reg(v, msr);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
@@ -447,9 +454,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
         if ( val & rsvd )
             goto gp_fault; /* Rsvd bit set? */
-
-        msrs->spec_ctrl.raw = val;
-        break;
+        goto set_reg;
 
     case MSR_PRED_CMD:
         if ( !cp->feat.ibrsb && !cp->extd.ibpb )
@@ -580,6 +585,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
     return ret;
 
+ set_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        pv_set_reg(v, msr, val);
+    else
+        hvm_set_reg(v, msr, val);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index 04eca9e8b3..cc4df27ddc 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -92,12 +92,16 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 
 uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -108,12 +112,17 @@ uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 
 void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:57:58 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:57:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260364.449706 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLOY-0004s0-CG; Tue, 25 Jan 2022 12:57:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260364.449706; Tue, 25 Jan 2022 12:57: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 1nCLOY-0004rs-98; Tue, 25 Jan 2022 12:57:58 +0000
Received: by outflank-mailman (input) for mailman id 260364;
 Tue, 25 Jan 2022 12:57:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOX-0004ri-2c
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOX-0005o1-1u
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOX-00043E-13
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:57:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Iw4EnRhIu9vQvthKkNl/fwnLT6/+ZndOrqqHZQYB2VE=; b=Ma8HhLcEyXd6NGR8WCKz5J6Gxy
	56ROTNhQDGTC5TlKb6ZHVlISC5cIjnSfltg7aEJyG9j7wliuqq/aksvgIaXukLBrA4GjE/uNy/Mxm
	PBagEC0bM8D84oiHwT3x/YOIcMSA4naM3MrRybwCZKlP9BqR7A6e/Ovuyp2IoImuNK5Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
Message-Id: <E1nCLOX-00043E-13@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:57:57 +0000

commit dbfc6ba03ae091b4d42893dc7133b8c587204d2e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:52:56 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:52:56 2022 +0100

    x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
    
    These were written before Spectre/Meltdown went public, and there was large
    uncertainty in how the protections would evolve.  As it turns out, they're
    very specific to Intel hardware, and not very suitable for AMD.
    
    Drop the macros, opencoding the relevant subset of functionality, and leaving
    grep-fodder to locate the logic.  No change at all for VT-x.
    
    For AMD, the only relevant piece of functionality is DO_OVERWRITE_RSB,
    although we will soon be adding (different) logic to handle MSR_SPEC_CTRL.
    
    This has a marginal improvement of removing an unconditional pile of long-nops
    from the vmentry/exit path.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 95b13fa43e0753b7514bef13abe28253e8614f62
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/svm/entry.S        |  5 +++--
 xen/arch/x86/hvm/vmx/entry.S        |  8 ++++++--
 xen/include/asm-x86/spec_ctrl_asm.h | 19 ++++---------------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 1d2df08e89..fc3d95e4a8 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -63,7 +63,7 @@ __UNLIKELY_END(nsvm_hap)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
 
         pop  %r15
         pop  %r14
@@ -90,7 +90,8 @@ __UNLIKELY_END(nsvm_hap)
 
         GET_CURRENT(bx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: ac  */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         STGI
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 27c8c5ca49..30139ae58e 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -33,7 +33,9 @@ ENTRY(vmx_asm_vmexit_handler)
         movb $1,VCPU_vmx_launched(%rbx)
         mov  %rax,VCPU_hvm_guest_cr2(%rbx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
+        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -80,7 +82,9 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
 
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index cb34299a86..2b3f123cb5 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -68,14 +68,16 @@
  *
  * The following ASM fragments implement this algorithm.  See their local
  * comments for further details.
- *  - SPEC_CTRL_ENTRY_FROM_HVM
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
  *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
- *  - SPEC_CTRL_EXIT_TO_HVM
+ *
+ * Additionally, the following grep-fodder exists to find the HVM logic.
+ *  - SPEC_CTRL_ENTRY_FROM_{SVM,VMX}
+ *  - SPEC_CTRL_EXIT_TO_{SVM,VMX}
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
@@ -225,12 +227,6 @@
     wrmsr
 .endm
 
-/* Use after a VMEXIT from an HVM guest. */
-#define SPEC_CTRL_ENTRY_FROM_HVM                                        \
-    ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM;           \
-    ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM,                        \
-        X86_FEATURE_SC_MSR_HVM
-
 /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */
 #define SPEC_CTRL_ENTRY_FROM_PV                                         \
     ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_PV;            \
@@ -255,13 +251,6 @@
     ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
         X86_FEATURE_SC_VERW_PV
 
-/* Use when exiting to HVM guest context. */
-#define SPEC_CTRL_EXIT_TO_HVM                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM;             \
-    ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
-        X86_FEATURE_SC_VERW_HVM
-
 /*
  * Use in IST interrupt/exception context.  May interrupt Xen or PV context.
  * Fine grain control of SCF_ist_wrmsr is needed for safety in the S3 resume
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 12:58:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 12:58:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260365.449710 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCLOi-0004zG-EY; Tue, 25 Jan 2022 12:58:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260365.449710; Tue, 25 Jan 2022 12:58: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 1nCLOi-0004z8-Aj; Tue, 25 Jan 2022 12:58:08 +0000
Received: by outflank-mailman (input) for mailman id 260365;
 Tue, 25 Jan 2022 12:58: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 1nCLOh-0004yy-69
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:58:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOh-0005oO-5O
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:58:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCLOh-00044G-4a
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 12:58:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ujgb5QHRCUae3jfnyXJTisvgVML9D9etSqD9OG0caXg=; b=vFaXrNa+bbeqNLlA3VBCkyClZG
	eRLGZi5DfcdZz1dLanmSa/XpVLCj/5mHfFywMCxBvSwI6wM1z6Vejx8wsjdeMfoH9ou5FwiJ5ABmJ
	RCcp+CcwLKEN6lYqpQtxtJrJIUt340lehyOI5iIIFh1Gh2IVVPb0KHpgBPmhFkn8aDdo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
Message-Id: <E1nCLOh-00044G-4a@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 12:58:07 +0000

commit 50935b88b4cd7f9cefe9eb2ffc5150d06c501d05
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:53:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:53:14 2022 +0100

    x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
    
    The logic was based on a mistaken understanding of how NMI blocking on vmexit
    works.  NMIs are only blocked for EXIT_REASON_NMI, and not for general exits.
    Therefore, an NMI can in general hit early in the vmx_asm_vmexit_handler path,
    and the guest's value will be clobbered before it is saved.
    
    Switch to using MSR load/save lists.  This causes the guest value to be saved
    atomically with respect to NMIs/MCEs/etc.
    
    First, update vmx_cpuid_policy_changed() to configure the load/save lists at
    the same time as configuring the intercepts.  This function is always used in
    remote context, so extend the vmx_vmcs_{enter,exit}() block to cover the whole
    function, rather than having multiple remote acquisitions of the same VMCS.
    
    Both of vmx_{add,del}_guest_msr() can fail.  The -ESRCH delete case is fine,
    but all others are fatal to the running of the VM, so handle them using
    domain_crash() - this path is only used during domain construction anyway.
    
    Second, update vmx_{get,set}_reg() to use the MSR load/save lists rather than
    vcpu_msrs, and update the vcpu_msrs comment to describe the new state
    location.
    
    Finally, adjust the entry/exit asm.
    
    Because the guest value is saved and loaded atomically, we do not need to
    manually load the guest value, nor do we need to enable SCF_use_shadow.  This
    lets us remove the use of DO_SPEC_CTRL_EXIT_TO_GUEST.  Additionally,
    SPEC_CTRL_ENTRY_FROM_PV gets removed too, because on an early entry failure,
    we're no longer in the guest MSR_SPEC_CTRL context needing to switch back to
    Xen's context.
    
    The only action remaining is to load Xen's MSR_SPEC_CTRL value on vmexit.  We
    could in principle use the host msr list, but is expected to complicated
    future work.  Delete DO_SPEC_CTRL_ENTRY_FROM_HVM entirely, and use a shorter
    code sequence to simply reload Xen's setting from the top-of-stack block.
    
    Adjust the comment at the top of spec_ctrl_asm.h in light of this bugfix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f0eaadf84d273a6ff8df3660b874a02d0e7677
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/entry.S        | 22 ++++++++++++-------
 xen/arch/x86/hvm/vmx/vmx.c          | 44 ++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/msr.h           | 10 ++++++++-
 xen/include/asm-x86/spec_ctrl_asm.h | 32 ++++-----------------------
 4 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 30139ae58e..7ee3382fd0 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -35,7 +35,14 @@ ENTRY(vmx_asm_vmexit_handler)
 
         /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
-        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
+
+        .macro restore_spec_ctrl
+            mov    $MSR_SPEC_CTRL, %ecx
+            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            xor    %edx, %edx
+            wrmsr
+        .endm
+        ALTERNATIVE "", restore_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -82,8 +89,7 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
-        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: %rsp=regs/cpuinfo              Clob:    */
         ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
@@ -119,12 +125,12 @@ UNLIKELY_END(realmode)
         SAVE_ALL
 
         /*
-         * PV variant needed here as no guest code has executed (so
-         * MSR_SPEC_CTRL can't have changed value), and NMIs/MCEs are liable
-         * to hit (in which case the HVM variant might corrupt things).
+         * SPEC_CTRL_ENTRY notes
+         *
+         * If we end up here, no guest code has executed.  The MSR lists have
+         * not been processed, so we still have Xen's choice of MSR_SPEC_CTRL
+         * in context, and the RSB is unchanged.
          */
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 06e6d52933..7adb3a94a4 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -558,6 +558,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)
 static void vmx_cpuid_policy_changed(struct vcpu *v)
 {
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
+    int rc = 0;
 
     if ( opt_hvm_fep ||
          (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
@@ -567,17 +568,29 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
 
     /*
      * We can safely pass MSR_SPEC_CTRL through to the guest, even if STIBP
      * isn't enumerated in hardware, as SPEC_CTRL_STIBP is ignored.
      */
     if ( cp->feat.ibrsb )
+    {
         vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
+
+        rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
+        if ( rc )
+            goto out;
+    }
     else
+    {
         vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
 
+        rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
+        if ( rc && rc != -ESRCH )
+            goto out;
+        rc = 0; /* Tolerate -ESRCH */
+    }
+
     /* MSR_PRED_CMD is safe to pass through if the guest knows about it. */
     if ( cp->feat.ibrsb || cp->extd.ibpb )
         vmx_clear_msr_intercept(v, MSR_PRED_CMD,  VMX_MSR_RW);
@@ -589,6 +602,15 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
         vmx_clear_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
+
+ out:
+    vmx_vmcs_exit(v);
+
+    if ( rc )
+    {
+        printk(XENLOG_G_ERR "%pv MSR list error: %d", v, rc);
+        domain_crash(v->domain);
+    }
 }
 
 int vmx_guest_x86_mode(struct vcpu *v)
@@ -2243,11 +2265,20 @@ static bool vmx_get_pending_event(struct vcpu *v, struct x86_event *info)
 static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     struct domain *d = v->domain;
+    uint64_t val = 0;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        return v->arch.msrs->spec_ctrl.raw;
+        rc = vmx_read_guest_msr(v, reg, &val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
+        return val;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
@@ -2260,11 +2291,18 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     struct domain *d = v->domain;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        v->arch.msrs->spec_ctrl.raw = val;
+        rc = vmx_write_guest_msr(v, reg, val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
         break;
 
     default:
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 5c44c79600..899318840d 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -277,7 +277,15 @@ extern struct msr_policy     raw_msr_policy,
 /* Container object for per-vCPU MSRs */
 struct vcpu_msrs
 {
-    /* 0x00000048 - MSR_SPEC_CTRL */
+    /*
+     * 0x00000048 - MSR_SPEC_CTRL
+     *
+     * For PV guests, this holds the guest kernel value.  It is accessed on
+     * every entry/exit path.
+     *
+     * For VT-x guests, the guest value is held in the MSR guest load/save
+     * list.
+     */
     struct {
         uint32_t raw;
     } spec_ctrl;
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index 2b3f123cb5..bf82528a12 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -42,9 +42,10 @@
  *     path, or late in the exit path after restoring the guest value.  This
  *     will corrupt the guest value.
  *
- * Factor 1 is dealt with by relying on NMIs/MCEs being blocked immediately
- * after VMEXIT.  The VMEXIT-specific code reads MSR_SPEC_CTRL and updates
- * current before loading Xen's MSR_SPEC_CTRL setting.
+ * Factor 1 is dealt with:
+ *   - On VMX by using MSR load/save lists to have vmentry/exit atomically
+ *     load/save the guest value.  Xen's value is loaded in regular code, and
+ *     there is no need to use the shadow logic (below).
  *
  * Factor 2 is harder.  We maintain a shadow_spec_ctrl value, and a use_shadow
  * boolean in the per cpu spec_ctrl_flags.  The synchronous use is:
@@ -128,31 +129,6 @@
 #endif
 .endm
 
-.macro DO_SPEC_CTRL_ENTRY_FROM_HVM
-/*
- * Requires %rbx=current, %rsp=regs/cpuinfo
- * Clobbers %rax, %rcx, %rdx
- *
- * The common case is that a guest has direct access to MSR_SPEC_CTRL, at
- * which point we need to save the guest value before setting IBRS for Xen.
- * Unilaterally saving the guest value is shorter and faster than checking.
- */
-    mov $MSR_SPEC_CTRL, %ecx
-    rdmsr
-
-    /* Stash the value from hardware. */
-    mov VCPU_arch_msrs(%rbx), %rdx
-    mov %eax, VCPUMSR_spec_ctrl_raw(%rdx)
-    xor %edx, %edx
-
-    /* Clear SPEC_CTRL shadowing *before* loading Xen's value. */
-    andb $~SCF_use_shadow, CPUINFO_spec_ctrl_flags(%rsp)
-
-    /* Load Xen's intended value. */
-    movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-    wrmsr
-.endm
-
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 13:55:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 13:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260367.449714 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMHq-0002Na-4d; Tue, 25 Jan 2022 13:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260367.449714; Tue, 25 Jan 2022 13:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMHq-0002NS-1b; Tue, 25 Jan 2022 13:55:06 +0000
Received: by outflank-mailman (input) for mailman id 260367;
 Tue, 25 Jan 2022 13:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMHp-0002NM-4L
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55: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 1nCMHp-0006ob-1o
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMHp-0000ef-0t
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55: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=bsOfeiXbOoTKZ5/GY0RsZiEeJiNfzTNcBRsRcMuXDvM=; b=itjTBrO+yZ7Qy4GPW1Fg7dudcl
	QM+gWL6dfYRLnUM8B7+JoTAA/RVhtWgQkymGrKOdDgZXCmOGBSHCy4rzfVMNEVFR+HKA6AjEPCDE6
	LnOL1RWchAxDSz5h45scCTLWdTzVkM6O99rMvc555W1Ejituxu9IpX28VpUpGSiyXuCc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCMHp-0000ef-0t@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 13:55:05 +0000

commit 2d601a5ca15e02820d08232ad64add8b8374b81c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:44:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:44:21 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ce59f2b503..993fe4ded2 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1012,7 +1012,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 13:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 13:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260368.449717 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMI0-0002PN-60; Tue, 25 Jan 2022 13:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260368.449717; Tue, 25 Jan 2022 13:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMI0-0002PH-35; Tue, 25 Jan 2022 13:55:16 +0000
Received: by outflank-mailman (input) for mailman id 260368;
 Tue, 25 Jan 2022 13:55: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 1nCMHz-0002P0-6C
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55: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 1nCMHz-0006oy-5J
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMHz-0000fN-4E
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55: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=zDteIKgcr1yA61P19jn7T54qrTkk1sCeRIzqIUpeHlo=; b=rUrp9n0yWDBV/By16k/NNMypQe
	5eB2RUZF4P2UvrMmxtlWeMn6EQGoqSusm5ofg4WUcOOjU+g3y8X/IcWMj7S+0hGZeevTGXrv5YwE6
	EggpI5M/LX9B9w6mF4p2CuAspANY4hbbnRzH9+e2ts7WR/CQijy6n+u77YBjOdcg/aTo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCMHz-0000fN-4E@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 13:55:15 +0000

commit e48c7878e54a5f970c00abed2cfd747858f0d592
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:44:47 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:44:47 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 7b775a8c35..cbb2ce17c0 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1438,8 +1438,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 13:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 13:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260370.449734 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMIA-0002jQ-JE; Tue, 25 Jan 2022 13:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260370.449734; Tue, 25 Jan 2022 13:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMIA-0002jG-Fd; Tue, 25 Jan 2022 13:55:26 +0000
Received: by outflank-mailman (input) for mailman id 260370;
 Tue, 25 Jan 2022 13:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMI9-0002T0-9e
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMI9-0006pJ-8g
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMI9-0000gC-7m
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55: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=CDHyT5FdgBWMUXDnviBcaTdOExZZbasvSVVYS+Zg4UQ=; b=tQPN3K2ZIgzdtC415flMJ8A1fr
	xb5T7bB0hnZ4zcB5rFjmnnQo90+uSx5X3rrS7d5NodxtHF+wEqUcb5sm/alemczypujxjw4tZiP31
	MnS0WsdNsUOdDdeGOi4iYN0UpE3Dw38iX9GhaQOe7e3wpfSZZTPpU9zdgCSZJa/SDyEU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCMI9-0000gC-7m@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 13:55:25 +0000

commit ce49a1d6d819f4587436b4ff73334d3676c1aab6
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:45:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:45:07 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 71eaf2c17e..b6e88ebc86 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -810,7 +810,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 13:55:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 13:55:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260371.449737 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMIL-0002qh-KP; Tue, 25 Jan 2022 13:55:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260371.449737; Tue, 25 Jan 2022 13:55: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 1nCMIL-0002qV-H4; Tue, 25 Jan 2022 13:55:37 +0000
Received: by outflank-mailman (input) for mailman id 260371;
 Tue, 25 Jan 2022 13:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMIJ-0002pD-OZ
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMIJ-0006pX-Nl
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMIJ-0000hY-Mi
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lYgTyJ2HfflwrzKBAMzyuC/i8+R/9mMNj0v/3EEJ+gM=; b=Z3x/3YhDzG4y9UTNbwkdrjazsN
	3M+O2gINWA/kKe6AjIvkR6xgdjZ3N2kIB+Wn1QXI6tvrOV92+S4KILAe+JyGoonzr0e9YLBpeubCw
	IyCqK3Zana3eIL7Zs+h6G+GI9XXusRY2j3CJViq6EJlZAKQ69SD61cFPH4eEuRian0HM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCMIJ-0000hY-Mi@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 13:55:35 +0000

commit 98c733b435f938c6d1be33c9f8975ba046fe198b
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:46:50 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:46:50 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 349bd776bb..f059aa7630 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1023,7 +1023,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 13:55:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 13:55:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260373.449741 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMIV-000314-Ln; Tue, 25 Jan 2022 13:55:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260373.449741; Tue, 25 Jan 2022 13:55: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 1nCMIV-00030w-Ih; Tue, 25 Jan 2022 13:55:47 +0000
Received: by outflank-mailman (input) for mailman id 260373;
 Tue, 25 Jan 2022 13:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMIT-00030A-SD
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMIT-0006ph-RK
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMIT-0000ig-QH
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pDa1saKmZ5h54E7craCkSE/SFQIEH3uHpBFlsdjHvN0=; b=kj7IGlnkWVCihFOTfDUvDLGZ6t
	J61o2j9nhPywzucCqWmgaj1BOwDwh+g2SPMazRdhUmc93IOisYYR38eRLRpdjfSiY/ZYKHytftGri
	jBskX69jL63zRhyM5Y+kL6watXRR3M8f8YXbDKG3toKs2d9TvuVSd3wfme+rl+gISUxM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCMIT-0000ig-QH@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 13:55:45 +0000

commit ff626ec7f2777ef7de85f6d485c5e788738af0c3
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:47:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:47:09 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ee5748e74e..61d29df7bd 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1402,7 +1402,12 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    if ( rc == GNTST_okay && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     */
+    if ( put_handle && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jan 25 13:55:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Jan 2022 13:55:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260376.449745 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMIe-0003BV-NL; Tue, 25 Jan 2022 13:55:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260376.449745; Tue, 25 Jan 2022 13:55:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCMIe-0003BN-K6; Tue, 25 Jan 2022 13:55:56 +0000
Received: by outflank-mailman (input) for mailman id 260376;
 Tue, 25 Jan 2022 13:55: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 1nCMId-0003Ab-Vm
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMId-0006pr-Uw
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCMId-0000jd-To
 for xen-changelog@lists.xenproject.org; Tue, 25 Jan 2022 13:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eHy8RejWsMguBLXnGfMi9/vUxYaGXOlKKaWMqcsOtnI=; b=2u52NHXeTIY/Vscc1CMPBIC69O
	O1QyuioXprNmwDpgtVa2nhqxyIp6MAKlC/MCrs7CrUlagxIYSyP/GszGfRXnOGNYswbFouK5G3GUU
	Fj4k9J5ylnfbcIav8Me5prL2XtJCDSST0vHU66bXKV1M89DAP+uaUS/PNaPByHYNtG44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCMId-0000jd-To@xenbits.xenproject.org>
Date: Tue, 25 Jan 2022 13:55:55 +0000

commit 71e9d0c94dd710bf26adf115ee0a2dbee30bb8c1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:47:33 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:47:33 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 4290c7c710..d613d1e049 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -803,7 +803,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 01:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 01:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260633.450463 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCX0d-0007DH-Sz; Wed, 26 Jan 2022 01:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260633.450463; Wed, 26 Jan 2022 01: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 1nCX0d-0007D9-Pz; Wed, 26 Jan 2022 01:22:03 +0000
Received: by outflank-mailman (input) for mailman id 260633;
 Wed, 26 Jan 2022 01: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 1nCX0c-0007D3-Ml
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01: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 1nCX0c-0005CR-Df
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCX0c-0005xG-CH
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01: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=Xwk5u1LaJQRHtyUQU12/S2rIO0O5PUC9xoDZuwZxKDM=; b=SzAHzGP+XYA8M3Y95EaeHDGv8c
	pyA/GmoPutdJrZTTsO8e91XeqX0B1TtD2jqKK/WMboyz0hp8A6NAMj66NLNgOEiz713ql7aVy1PZU
	bSvg9Rb1xylnVQMFT2M07R1JpmBEn+/sNG9Oc1543vZjWqcJC/rKf3x24gCAf0O55h7o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCX0c-0005xG-CH@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 01:22:02 +0000

commit 98c733b435f938c6d1be33c9f8975ba046fe198b
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:46:50 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:46:50 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 349bd776bb..f059aa7630 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1023,7 +1023,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 01:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 01:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260634.450467 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCX0n-0007FY-UT; Wed, 26 Jan 2022 01:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260634.450467; Wed, 26 Jan 2022 01: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 1nCX0n-0007FQ-Rf; Wed, 26 Jan 2022 01:22:13 +0000
Received: by outflank-mailman (input) for mailman id 260634;
 Wed, 26 Jan 2022 01: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 1nCX0m-0007FB-IB
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01: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 1nCX0m-0005CV-HF
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCX0m-0005y6-GC
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01: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=HHmzvoPpbWdLzd4UJh24lkalnwmwAXuT+pFltOJLByA=; b=iI4egQLOgYeP3KhyNANTjiT+py
	JBb2o2yMZfLfZ0jzuASyU1Z8tOGSFpkmbVNraD0cTuPEs6AngELCgVutrW6mq2uZBEsIkNgm2LoN5
	5bPooOxpaN5yUhislD7DM6S232RsF6VuqQJoCySWy0UU2ptPpPsjsNk4v6JXltJ9Xw/0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCX0m-0005y6-GC@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 01:22:12 +0000

commit ff626ec7f2777ef7de85f6d485c5e788738af0c3
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:47:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:47:09 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ee5748e74e..61d29df7bd 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1402,7 +1402,12 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    if ( rc == GNTST_okay && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     */
+    if ( put_handle && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 01:22:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 01:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260635.450471 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCX0y-0007JS-1U; Wed, 26 Jan 2022 01:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260635.450471; Wed, 26 Jan 2022 01:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCX0x-0007JK-Ui; Wed, 26 Jan 2022 01:22:23 +0000
Received: by outflank-mailman (input) for mailman id 260635;
 Wed, 26 Jan 2022 01:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCX0w-0007Ix-LD
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCX0w-0005D8-KL
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCX0w-0005yu-JO
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 01: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=1t2j9hlNMuHXf0IdD+zA5TDcJhzPzwYpZUQGOlYVuwc=; b=bLsg8O+loifjRopTpKrMyd/uhY
	THaxIYPu3pQ6SZHOEoZTXk8o3gQx595OTu+JCAw5vmtxiaeTwpBIYD+4VI8rGPYqdNVAp+1ClWW6W
	hzU3P+GrH0iMEZuWO84BVIDUQiwyGcLhy68b2FcfgPEhpJQCWcncM/IEeNyCGrL+XmIo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCX0w-0005yu-JO@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 01:22:22 +0000

commit 71e9d0c94dd710bf26adf115ee0a2dbee30bb8c1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:47:33 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:47:33 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 4290c7c710..d613d1e049 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -803,7 +803,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 04:00:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 04:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260654.450515 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCZTX-0007hJ-78; Wed, 26 Jan 2022 04:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260654.450515; Wed, 26 Jan 2022 04:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCZTX-0007h9-3S; Wed, 26 Jan 2022 04:00:03 +0000
Received: by outflank-mailman (input) for mailman id 260654;
 Wed, 26 Jan 2022 04:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTW-0007bv-GF
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTW-0008Rq-Dd
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTW-0002bi-CE
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1t66tmibmX6OsRFyxAKrXT8yzxqdfDxfxcuDPHGYm7k=; b=0s6VhtEydI33DsRNjUNc3pEC6j
	fvPemI8T+71GVj+0kI3kPQnszTrmVQYktTOpkDYWqJbs2cZE6XCw1ZbXysxlKOHmuucPhsW+L867G
	J51LgDhUTOJz2H1NAhMSPGcQhQ0tkipLMylxYsT4EsWH344Q7xGvciLnYl/x8ZewchY0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCZTW-0002bi-CE@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 04:00:02 +0000

commit 2d601a5ca15e02820d08232ad64add8b8374b81c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:44:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:44:21 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ce59f2b503..993fe4ded2 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1012,7 +1012,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 04:00:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 04:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260655.450519 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCZTh-0008Jb-8X; Wed, 26 Jan 2022 04:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260655.450519; Wed, 26 Jan 2022 04:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCZTh-0008JS-53; Wed, 26 Jan 2022 04:00:13 +0000
Received: by outflank-mailman (input) for mailman id 260655;
 Wed, 26 Jan 2022 04:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTg-0008JJ-Ij
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTg-0008Ru-Hu
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTg-0002dh-GO
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BwbiX1GTmPthvvuqYGtEfLKoA4/6ewAMTvTx7CohrZM=; b=1B7Dz8nC1sya7ZKq7auz8og22b
	tJc6FZcHXdhaI7c21AzIaCTn5KScpStzBhq2aw2/vJ7EGCwY3UxxqwylyrCDGO7rwBXfSP7h+vC3q
	cRDA6IKPBW/Wd4nyPhTWFg80LyjBW1W8k7iR7ADHwSX0CTb5Kn5xYbTTDs6hrl04VXys=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCZTg-0002dh-GO@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 04:00:12 +0000

commit e48c7878e54a5f970c00abed2cfd747858f0d592
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:44:47 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:44:47 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 7b775a8c35..cbb2ce17c0 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1438,8 +1438,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 04:00:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 04:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260656.450522 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCZTs-0008Mm-9s; Wed, 26 Jan 2022 04:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260656.450522; Wed, 26 Jan 2022 04:00:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCZTs-0008Mc-6i; Wed, 26 Jan 2022 04:00:24 +0000
Received: by outflank-mailman (input) for mailman id 260656;
 Wed, 26 Jan 2022 04:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTq-0008M6-Lo
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTq-0008SX-Kz
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCZTq-0002eu-KE
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 04:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kTzjD25gUyVzDL5bOtU7Za0rpm+ICL3xqeDA0abJ+ac=; b=pWxaBZIhndtAlWAjTsRkwauePh
	v0vVVQXUQNzSdhEbfZhDGe0kqDyGcnnYg+gYNn6qHpe77/7+rDpCwfGCQx8Ts8KF6hj3IybZ3+nLV
	11F53ARxgfg0gnYhlV5umy/tiybM4FKXBLyi0Ksc/nDKvdTUH6p2jsYnjEKOO3SpgXqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCZTq-0002eu-KE@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 04:00:22 +0000

commit ce49a1d6d819f4587436b4ff73334d3676c1aab6
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 14:45:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 14:45:07 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 71eaf2c17e..b6e88ebc86 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -810,7 +810,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 08:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 08:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260696.450611 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCdZ5-0004g4-Og; Wed, 26 Jan 2022 08:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260696.450611; Wed, 26 Jan 2022 08:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCdZ5-0004fw-LV; Wed, 26 Jan 2022 08:22:03 +0000
Received: by outflank-mailman (input) for mailman id 260696;
 Wed, 26 Jan 2022 08:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCdZ4-0004fq-75
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 08:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCdZ3-0005cT-Tn
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 08:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCdZ3-0008WI-Sn
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 08:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H//kl1fVxCTudmwcH08Zj/e9FuPGNNh2pysdJ+K+/NU=; b=C76bkdGgxGLEJCOMdOozh33Man
	K2hhQqvpS91ZOqCEN1h4qshqnKj4KNUdGt5W9uh0i/+LGHVsitBjod2g5uvCRZDVPAABSHcJ+mOle
	vIbgWtSkKekHvpcsn25lgsWE9r1UQaEDOutqUCuW+YVYhXPYsCcCTbLX0gfni1Vky8Kg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pvh: fix population of the low 1MB for dom0
Message-Id: <E1nCdZ3-0008WI-Sn@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 08:22:01 +0000

commit 2d5fc9120d556ec3c4b1acf0ab5660a6d3f7ebeb
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jan 24 17:13:12 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 25 10:52:24 2022 +0000

    x86/pvh: fix population of the low 1MB for dom0
    
    RMRRs are setup ahead of populating the p2m and hence the ASSERT when
    populating the low 1MB needs to be relaxed when it finds an existing
    entry: it's either RAM or a RMRR resulting from the IOMMU setup.
    
    Rework the logic a bit and introduce a local mfn variable in order to
    assert that if the gfn is populated and not RAM it is an identity map.
    
    Fixes: 6b4f6a31ac ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/dom0_build.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 43e1bf1248..8048987286 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -465,11 +465,16 @@ static int __init pvh_populate_p2m(struct domain *d)
     for ( i = rc = 0; i < MB1_PAGES; ++i )
     {
         p2m_type_t p2mt;
+        mfn_t mfn = get_gfn_query(d, i, &p2mt);
 
-        if ( mfn_eq(get_gfn_query(d, i, &p2mt), INVALID_MFN) )
+        if ( mfn_eq(mfn, INVALID_MFN) )
             rc = set_mmio_p2m_entry(d, _gfn(i), _mfn(i), PAGE_ORDER_4K);
         else
-            ASSERT(p2mt == p2m_ram_rw);
+            /*
+             * If the p2m entry is already set it must belong to a RMRR and
+             * already be identity mapped, or be a RAM region.
+             */
+            ASSERT(p2mt == p2m_ram_rw || mfn_eq(mfn, _mfn(i)));
         put_gfn(d, i);
         if ( rc )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 08:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 08:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260697.450615 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCdZF-0004iD-QL; Wed, 26 Jan 2022 08:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260697.450615; Wed, 26 Jan 2022 08:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCdZF-0004i5-Mz; Wed, 26 Jan 2022 08:22:13 +0000
Received: by outflank-mailman (input) for mailman id 260697;
 Wed, 26 Jan 2022 08:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCdZE-0004ht-1f
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 08:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCdZE-0005cl-0h
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 08:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCdZD-00005Y-W3
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 08:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/pwGaF00ofhPD9BCzWvUdsSrPMitOyK4HcKflkMKo9g=; b=jlYANkSHq/uxEv+NKQpRrm3LlJ
	ljiF6nlcioQl/R2stsznqsdmqPYflPzUn0QGp6j6PF5v2Zd9fYEv6/8CfmPiC+WF2c6Gc5VuA9/XC
	dQyHVhlMJCrjifNg+Py68kts9Wn56aEYBWX+lbwAvKtBXaBm0mZwV9wDTEFVenXsiZMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pvh: print dom0 memory map
Message-Id: <E1nCdZD-00005Y-W3@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 08:22:11 +0000

commit 329b7bed80032fd52904af6a0cac7dd3716d27cf
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Jan 25 11:46:36 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jan 25 10:52:25 2022 +0000

    x86/pvh: print dom0 memory map
    
    I find it useful for debugging certain issues to have the memory map
    dom0 is using, so print it when using `dom0=verbose` on the command
    line.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/e820.c             | 3 ++-
 xen/arch/x86/hvm/dom0_build.c   | 6 ++++++
 xen/arch/x86/include/asm/e820.h | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index aa602773bb..b653a19c93 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -88,7 +88,8 @@ static void __init add_memory_region(unsigned long long start,
     e820.nr_map++;
 }
 
-static void __init print_e820_memory_map(struct e820entry *map, unsigned int entries)
+void __init print_e820_memory_map(const struct e820entry *map,
+                                  unsigned int entries)
 {
     unsigned int i;
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 8048987286..afba6e7dfd 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1269,6 +1269,12 @@ int __init dom0_construct_pvh(struct domain *d, const module_t *image,
         return rc;
     }
 
+    if ( opt_dom0_verbose )
+    {
+        printk("Dom%u memory map:\n", d->domain_id);
+        print_e820_memory_map(d->arch.e820, d->arch.nr_e820);
+    }
+
     printk("WARNING: PVH is an experimental mode with limited functionality\n");
     return 0;
 }
diff --git a/xen/arch/x86/include/asm/e820.h b/xen/arch/x86/include/asm/e820.h
index 9d8f1ba960..92f5efa4f5 100644
--- a/xen/arch/x86/include/asm/e820.h
+++ b/xen/arch/x86/include/asm/e820.h
@@ -32,6 +32,8 @@ extern int e820_change_range_type(
 extern int e820_add_range(
     struct e820map *, uint64_t s, uint64_t e, uint32_t type);
 extern unsigned long init_e820(const char *, struct e820map *);
+extern void print_e820_memory_map(const struct e820entry *map,
+    unsigned int entries);
 extern struct e820map e820;
 extern struct e820map e820_raw;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 11:22:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 11:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260816.450931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgNJ-00038t-E3; Wed, 26 Jan 2022 11:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260816.450931; Wed, 26 Jan 2022 11:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgNJ-00038l-B2; Wed, 26 Jan 2022 11:22:05 +0000
Received: by outflank-mailman (input) for mailman id 260816;
 Wed, 26 Jan 2022 11:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgNI-00038f-J3
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgNI-0000VY-G1
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgNI-0006tR-Ep
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fJ9FQwTXow0fnUxtG0jQgLsCtNlcEI9dUIH9M2hm7HI=; b=PDiubI47EIW/J69Po6ZRJgKMvD
	BIiuOzOhtp/veVVfcTq9RAtQyFf3+JpCnqcF/PLFb5ZWz1qoLrqDfzd8a/g1E8GDiRac6GcMigqUe
	0g7QdiU3G3mmJR0wSfkZfGYBP5jOafg/qVIKETFKjm12bahGeByvXNcI5vcb5kKrRnLc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86: Fix build with the get/set_reg() infrastructure
Message-Id: <E1nCgNI-0006tR-Ep@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 11:22:04 +0000

commit fc87b55a3429961eeece0e6f4a103a23700b1ff4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 26 12:17:04 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:17:04 2022 +0100

    x86: Fix build with the get/set_reg() infrastructure
    
    I clearly messed up concluding that the stubs were safe to drop.
    
    The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
    and CONFIG_HVM.  As a result logic of the form `if ( pv/hvm ) ... else ...`
    will always have one side which can't be DCE'd.
    
    While technically only the hvm stubs are needed, due to the use of the
    is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
    avoid leaving a bear trap for future users.
    
    Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13caa585791234fe3e3719c8376f7ea731012451
    master date: 2022-01-21 12:42:11 +0000
---
 xen/include/asm-x86/hvm/hvm.h   | 10 ++++++++++
 xen/include/asm-x86/pv/domain.h | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index acc660c001..45b6ebecdc 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -865,6 +865,16 @@ static inline int hvm_vmtrace_get_option(
     return -EOPNOTSUPP;
 }
 
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, unsigned long cr4);
 /* Create a cr4 value to load into hardware, based on vcpu settings. */
 unsigned long pv_make_cr4(const struct vcpu *v);
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 bool xpti_pcid_enabled(void);
 
 #else  /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; }
 
 static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
 
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #endif	/* CONFIG_PV */
 
 void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 11:22:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 11:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260817.450936 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgNT-0003Bg-I4; Wed, 26 Jan 2022 11:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260817.450936; Wed, 26 Jan 2022 11:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgNT-0003BY-F5; Wed, 26 Jan 2022 11:22:15 +0000
Received: by outflank-mailman (input) for mailman id 260817;
 Wed, 26 Jan 2022 11:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgNS-0003BS-Jm
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgNS-0000Vd-Iy
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgNS-0006uK-I8
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hxoat/cYDEt5gHyebt76n22vdCCpCp4ZhaXxhI1LY8c=; b=4D6ikZQKiqFxgjFJSsLAX6QuZL
	3Ph4UbVEK51VwfmVGTy2yakGx3Af/hRlsdSHVAurwKtJOlAtqytD85Fwhn7iAthmCKSAA7FHxSyzu
	Raw5lr8amgfYSByYLh1dCAJ1JTKrkz1OcjJbWh2SKH4gnNtRJnkHOkZU+on2Am1AJTHY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/pvh: fix population of the low 1MB for dom0
Message-Id: <E1nCgNS-0006uK-I8@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 11:22:14 +0000

commit 8abb345e6b5c11b79d1a032533130ea6c5519435
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jan 26 12:18:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:18:07 2022 +0100

    x86/pvh: fix population of the low 1MB for dom0
    
    RMRRs are setup ahead of populating the p2m and hence the ASSERT when
    populating the low 1MB needs to be relaxed when it finds an existing
    entry: it's either RAM or a RMRR resulting from the IOMMU setup.
    
    Rework the logic a bit and introduce a local mfn variable in order to
    assert that if the gfn is populated and not RAM it is an identity map.
    
    Fixes: 6b4f6a31ac ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2d5fc9120d556ec3c4b1acf0ab5660a6d3f7ebeb
    master date: 2022-01-25 10:52:24 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 43e1bf1248..8048987286 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -465,11 +465,16 @@ static int __init pvh_populate_p2m(struct domain *d)
     for ( i = rc = 0; i < MB1_PAGES; ++i )
     {
         p2m_type_t p2mt;
+        mfn_t mfn = get_gfn_query(d, i, &p2mt);
 
-        if ( mfn_eq(get_gfn_query(d, i, &p2mt), INVALID_MFN) )
+        if ( mfn_eq(mfn, INVALID_MFN) )
             rc = set_mmio_p2m_entry(d, _gfn(i), _mfn(i), PAGE_ORDER_4K);
         else
-            ASSERT(p2mt == p2m_ram_rw);
+            /*
+             * If the p2m entry is already set it must belong to a RMRR and
+             * already be identity mapped, or be a RAM region.
+             */
+            ASSERT(p2mt == p2m_ram_rw || mfn_eq(mfn, _mfn(i)));
         put_gfn(d, i);
         if ( rc )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 11:33:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 11:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260818.450940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgXx-0004Eu-Bo; Wed, 26 Jan 2022 11:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260818.450940; Wed, 26 Jan 2022 11:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgXx-0004Em-8l; Wed, 26 Jan 2022 11:33:05 +0000
Received: by outflank-mailman (input) for mailman id 260818;
 Wed, 26 Jan 2022 11:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgXw-0004Ef-DD
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgXw-0000gP-A1
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgXw-0007g7-8k
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8/yCJSbBLBHE3Csqlu/VhD+os2q4BpMUeMbggM0digU=; b=lcZ50/wTsb9M6sMhUOcY+ryjRc
	B9sUZanpz3CvbO9iDvCbiEtl4Nhoz7+6bNS4vLGimyZujI2YhCSMYN2XBoW7GRMdb6WhT441TY6jZ
	gwmsycQ7AJ7NzcTyi+R+y+E6W4lvr5YJ933PQMtYQUB7p/Oy30zSmILcTo6VIbHkuCMM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86: Fix build with the get/set_reg() infrastructure
Message-Id: <E1nCgXw-0007g7-8k@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 11:33:04 +0000

commit b57b8cb350de4930db1c3ccfa49d04281754cf9a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 26 12:27:32 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:27:32 2022 +0100

    x86: Fix build with the get/set_reg() infrastructure
    
    I clearly messed up concluding that the stubs were safe to drop.
    
    The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
    and CONFIG_HVM.  As a result logic of the form `if ( pv/hvm ) ... else ...`
    will always have one side which can't be DCE'd.
    
    While technically only the hvm stubs are needed, due to the use of the
    is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
    avoid leaving a bear trap for future users.
    
    Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13caa585791234fe3e3719c8376f7ea731012451
    master date: 2022-01-21 12:42:11 +0000
---
 xen/include/asm-x86/hvm/hvm.h   | 10 ++++++++++
 xen/include/asm-x86/pv/domain.h | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 221d3e6999..b8dc445550 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -850,6 +850,16 @@ static inline int hvm_vmtrace_get_option(
     return -EOPNOTSUPP;
 }
 
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, unsigned long cr4);
 /* Create a cr4 value to load into hardware, based on vcpu settings. */
 unsigned long pv_make_cr4(const struct vcpu *v);
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 bool xpti_pcid_enabled(void);
 
 #else  /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; }
 
 static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
 
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #endif	/* CONFIG_PV */
 
 void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 11:33:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 11:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260819.450944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgY7-0004HC-DJ; Wed, 26 Jan 2022 11:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260819.450944; Wed, 26 Jan 2022 11:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgY7-0004H4-AI; Wed, 26 Jan 2022 11:33:15 +0000
Received: by outflank-mailman (input) for mailman id 260819;
 Wed, 26 Jan 2022 11:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgY6-0004Gu-E7
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgY6-0000gd-DJ
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgY6-0007gq-CG
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HMs9JAgJM5hYDcwF89j1rJ3qCd2QM+Q3wQSbRS+pAGo=; b=ax1FBWLJJbWpy23aoMScmP5Iq2
	sX7g3obNINqH9UY/baiiuJZknK6oWbq4Tbfxe1ngzVQ+EF4235UuSyCb38plbVaQcUH792k2RRQ8R
	nTk4nzux+97VgeSRm/uMYb3/jtcUW9Y9tH9YD6NJm74Z1ke4UAOvbloBdI17CWPciY8w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/pvh: fix population of the low 1MB for dom0
Message-Id: <E1nCgY6-0007gq-CG@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 11:33:14 +0000

commit 2a0c6e79dafeafeb1dcf9b87fcb9abc1e47b40e0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jan 26 12:28:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:28:14 2022 +0100

    x86/pvh: fix population of the low 1MB for dom0
    
    RMRRs are setup ahead of populating the p2m and hence the ASSERT when
    populating the low 1MB needs to be relaxed when it finds an existing
    entry: it's either RAM or a RMRR resulting from the IOMMU setup.
    
    Rework the logic a bit and introduce a local mfn variable in order to
    assert that if the gfn is populated and not RAM it is an identity map.
    
    Fixes: 6b4f6a31ac ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2d5fc9120d556ec3c4b1acf0ab5660a6d3f7ebeb
    master date: 2022-01-25 10:52:24 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 01b1356bd2..453f115847 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -465,11 +465,16 @@ static int __init pvh_populate_p2m(struct domain *d)
     for ( i = rc = 0; i < MB1_PAGES; ++i )
     {
         p2m_type_t p2mt;
+        mfn_t mfn = get_gfn_query(d, i, &p2mt);
 
-        if ( mfn_eq(get_gfn_query(d, i, &p2mt), INVALID_MFN) )
+        if ( mfn_eq(mfn, INVALID_MFN) )
             rc = set_mmio_p2m_entry(d, _gfn(i), _mfn(i), PAGE_ORDER_4K);
         else
-            ASSERT(p2mt == p2m_ram_rw);
+            /*
+             * If the p2m entry is already set it must belong to a RMRR and
+             * already be identity mapped, or be a RAM region.
+             */
+            ASSERT(p2mt == p2m_ram_rw || mfn_eq(mfn, _mfn(i)));
         put_gfn(d, i);
         if ( rc )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 11:55:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 11:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260830.450978 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgtG-00071k-DW; Wed, 26 Jan 2022 11:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260830.450978; Wed, 26 Jan 2022 11:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgtG-00071b-A7; Wed, 26 Jan 2022 11:55:06 +0000
Received: by outflank-mailman (input) for mailman id 260830;
 Wed, 26 Jan 2022 11:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgtE-00071V-Ml
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgtE-00014k-KG
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgtE-00013P-JG
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yqEFzAL9lI3Ir+kyhbkzLD6jVrDNJ0XBbXOXfQPdtto=; b=7ANrVxCPa9zflsfzgZ/L/i+yzT
	OtbCuuCuOkiL8chgPp/gank2I3C92NhuV0l7a44UjjenmUZpyfOL9XYTdo/7/xzi+/8Ww5+fK+UCN
	cxE0R0KfAcWBywOVdVKbp6NthtR8Uj7qjcK8aq3NInhg4yVmhjUOt/ZddYfKQyZaMMsI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86: Fix build with the get/set_reg() infrastructure
Message-Id: <E1nCgtE-00013P-JG@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 11:55:04 +0000

commit bdf197d8405e2e64f3d9ad875763790bdb4ecd4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 26 12:51:31 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:51:31 2022 +0100

    x86: Fix build with the get/set_reg() infrastructure
    
    I clearly messed up concluding that the stubs were safe to drop.
    
    The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
    and CONFIG_HVM.  As a result logic of the form `if ( pv/hvm ) ... else ...`
    will always have one side which can't be DCE'd.
    
    While technically only the hvm stubs are needed, due to the use of the
    is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
    avoid leaving a bear trap for future users.
    
    Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13caa585791234fe3e3719c8376f7ea731012451
    master date: 2022-01-21 12:42:11 +0000
---
 xen/include/asm-x86/hvm/hvm.h   | 10 ++++++++++
 xen/include/asm-x86/pv/domain.h | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index e69828e274..6d67ea3b05 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -766,6 +766,16 @@ static inline bool hvm_has_set_descriptor_access_exiting(void)
     return false;
 }
 
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, unsigned long cr4);
 /* Create a cr4 value to load into hardware, based on vcpu settings. */
 unsigned long pv_make_cr4(const struct vcpu *v);
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 bool xpti_pcid_enabled(void);
 
 #else  /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; }
 
 static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
 
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #endif	/* CONFIG_PV */
 
 void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 11:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 11:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260831.450980 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgtQ-00073q-EU; Wed, 26 Jan 2022 11:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260831.450980; Wed, 26 Jan 2022 11:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCgtQ-00073i-Ba; Wed, 26 Jan 2022 11:55:16 +0000
Received: by outflank-mailman (input) for mailman id 260831;
 Wed, 26 Jan 2022 11:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgtO-00073O-OC
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgtO-00014r-NL
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCgtO-00014B-MQ
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 11:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2ffSJRrzInCL8hvfWI3PWF8kh0hJIn3mx+JTzke6sOs=; b=4Db3tsrSAtPahL4yzRvNMquFI1
	Wq2mpI6VEiwc3fIwl6pJmlXp+IDPvkynprxXBnJnzrkP1FTjERQ5fXihkBGDnJzTi24sPMSPOm7bj
	bv2houf/Od1uZBZV+hVnl7Wi4pTaqLJD6/JksmsQBcRxrCLFk94RVWbNZ9r//3xAbSjo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/pvh: fix population of the low 1MB for dom0
Message-Id: <E1nCgtO-00014B-MQ@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 11:55:14 +0000

commit 689734d05d5ec6b52b9e84807806471141088d84
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jan 26 12:52:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:52:09 2022 +0100

    x86/pvh: fix population of the low 1MB for dom0
    
    RMRRs are setup ahead of populating the p2m and hence the ASSERT when
    populating the low 1MB needs to be relaxed when it finds an existing
    entry: it's either RAM or a RMRR resulting from the IOMMU setup.
    
    Rework the logic a bit and introduce a local mfn variable in order to
    assert that if the gfn is populated and not RAM it is an identity map.
    
    Fixes: 6b4f6a31ac ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2d5fc9120d556ec3c4b1acf0ab5660a6d3f7ebeb
    master date: 2022-01-25 10:52:24 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 5ba0c80a89..1052cdf695 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -465,11 +465,16 @@ static int __init pvh_populate_p2m(struct domain *d)
     for ( i = rc = 0; i < MB1_PAGES; ++i )
     {
         p2m_type_t p2mt;
+        mfn_t mfn = get_gfn_query(d, i, &p2mt);
 
-        if ( mfn_eq(get_gfn_query(d, i, &p2mt), INVALID_MFN) )
+        if ( mfn_eq(mfn, INVALID_MFN) )
             rc = set_mmio_p2m_entry(d, _gfn(i), _mfn(i), PAGE_ORDER_4K);
         else
-            ASSERT(p2mt == p2m_ram_rw);
+            /*
+             * If the p2m entry is already set it must belong to a RMRR and
+             * already be identity mapped, or be a RAM region.
+             */
+            ASSERT(p2mt == p2m_ram_rw || mfn_eq(mfn, _mfn(i)));
         put_gfn(d, i);
         if ( rc )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Jan 26 14:44:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Jan 2022 14:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.260963.451322 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCjWm-0004TU-EZ; Wed, 26 Jan 2022 14:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 260963.451322; Wed, 26 Jan 2022 14:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCjWm-0004TM-Ba; Wed, 26 Jan 2022 14:44:04 +0000
Received: by outflank-mailman (input) for mailman id 260963;
 Wed, 26 Jan 2022 14: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 1nCjWk-0004TG-Pf
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 14: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 1nCjWk-0004HR-Ow
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 14:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCjWk-0007HU-Nj
 for xen-changelog@lists.xenproject.org; Wed, 26 Jan 2022 14: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=LiUrTX35PSiPCOqLKpagaUF8swAXcuG8kGS+ooumMgk=; b=CyTBO/F+zEPZUKA5H/rDMRZCX7
	fkSgAbw2fA2ZARkq+4954oICWz1R2zLMoT+MX/0ru7HHOPFXtmFG5AJ+lxjG8fMpNlV8Ygw6HKPfw
	jxkRzS9IDnp2pBIk5IKFNGbFk1ZRVYgIK4O8dMlLCdI0GX0u73aItWstGB1CEBPX0c68=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen-traditional stable-4.14] qemu-trad: remove Xen path dependencies
Message-Id: <E1nCjWk-0007HU-Nj@xenbits.xenproject.org>
Date: Wed, 26 Jan 2022 14:44:02 +0000

commit 3d273dd05e51e5a1ffba3d98c7437ee84e8f8764
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jul 15 10:01:40 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Tue Aug 18 15:54:39 2020 +0100

    qemu-trad: remove Xen path dependencies
    
    xen-hhoks.mak contains hard wired paths for the used libraries of
    qemu-trad. Replace those by the make variables from Xen's Rules.mk,
    which is already included.
    
    This in turn removes the need to add the runtime link paths of the
    libraries the directly used libraries depend on.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 xen-hooks.mak | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/xen-hooks.mak b/xen-hooks.mak
index a68eba3c..2689db0f 100644
--- a/xen-hooks.mak
+++ b/xen-hooks.mak
@@ -1,10 +1,8 @@
-CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/toollog/include
-CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/evtchn/include
-CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/gnttab/include
+XEN_LIBS = evtchn gnttab ctrl guest store
+
 CPPFLAGS+= -DXC_WANT_COMPAT_MAP_FOREIGN_API
 CPPFLAGS+= -DXC_WANT_COMPAT_DEVICEMODEL_API
-CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include
-CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include
+CPPFLAGS += $(foreach lib,$(XEN_LIBS),$(CFLAGS_libxen$(lib)))
 CPPFLAGS+= -I$(XEN_ROOT)/tools/include
 
 SSE2 := $(call cc-option,-msse2,)
@@ -22,15 +20,7 @@ endif
 
 CFLAGS += $(CMDLINE_CFLAGS)
 
-LIBS += -L$(XEN_ROOT)/tools/libs/evtchn -lxenevtchn
-LIBS += -L$(XEN_ROOT)/tools/libs/gnttab -lxengnttab
-LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest
-LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore
-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog
-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toolcore
-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/call
-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/foreignmemory
-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/devicemodel
+LIBS += $(foreach lib,$(XEN_LIBS),$(LDLIBS_libxen$(lib)))
 
 LDFLAGS := $(CFLAGS) $(LDFLAGS)
 
--
generated by git-patchbot for /home/xen/git/qemu-xen-traditional.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 02:00:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 02:00:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261145.451851 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCu4w-0003My-Je; Thu, 27 Jan 2022 02:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261145.451851; Thu, 27 Jan 2022 02:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCu4w-0003Mk-Fq; Thu, 27 Jan 2022 02:00:02 +0000
Received: by outflank-mailman (input) for mailman id 261145;
 Thu, 27 Jan 2022 02:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCu4v-0003CE-Nx
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCu4v-0002PS-M9
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCu4v-0007DE-Kh
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TtJRu5hYeszbdWIBR1Qe1qw5yjKoeMrqPeGAbhg7IMA=; b=YSLV9txF3iQRTAGHLS3EN4CrpQ
	70MbCDL/sU4UK2VVJcPMWPqEoFILS7lkKBhjY9zJdcgvenLt1Z78gijQXRFyHbyl9bG/I7vAPV/pN
	0vEXLpHUugMhApaw87jCEvMpTHd6SALOBSaJ8lHAKstMBqVAeu0zeVXRSa/3EOPFTexA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCu4v-0007DE-Kh@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 02:00:01 +0000

commit a428b913a002eb2b7425b48029c20a52eeee1b5a
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Dec 14 09:53:44 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:25:01 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 8b20b43077..fb71fa4c1c 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1016,7 +1016,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 02:00:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 02:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261146.451854 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCu56-0004LR-Kn; Thu, 27 Jan 2022 02:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261146.451854; Thu, 27 Jan 2022 02:00:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCu56-0004LJ-Ha; Thu, 27 Jan 2022 02:00:12 +0000
Received: by outflank-mailman (input) for mailman id 261146;
 Thu, 27 Jan 2022 02:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCu55-0004LB-QA
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCu55-0002le-PL
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCu55-0007Ew-OU
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KCt8lB7BpcsP1dT0aezOWt3K3n0HzPcOpDKGz+9Nm7k=; b=6st4W5hu6LPZSnVol7a3klDa+O
	iflEZFOsnCZiKHfwGTWYyw5b7BTfnVi+D6kiJkxyqus9I9wfyvzh3FzjuD8YEd3lvomQcW7Xwbekq
	6oKEWiTt3IVwcpqDIBUxVePpySwBOyfu67op68YNaHeei+MUvQ52G0r/yLO+jfkUB6Aw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCu55-0007Ew-OU@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 02:00:11 +0000

commit 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Nov 19 11:27:47 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:25:49 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 0262f2c48a..ed1e2fabce 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1488,8 +1488,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 02:00:22 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 02:00:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261147.451858 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCu5G-0004Ox-MJ; Thu, 27 Jan 2022 02:00:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261147.451858; Thu, 27 Jan 2022 02:00:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCu5G-0004Oo-JI; Thu, 27 Jan 2022 02:00:22 +0000
Received: by outflank-mailman (input) for mailman id 261147;
 Thu, 27 Jan 2022 02:00: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 1nCu5F-0004Oa-TN
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00: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 1nCu5F-0002lu-SZ
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCu5F-0007Fm-RX
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 02:00:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=faHOrqqjp3fC9K5bxb5AROtsQ3h/46Ppj1MpJlDbZHI=; b=YhR66IOLnNPTPjjNGW99QK4gfu
	XLKl4jDccpCWi8jdI3MkFokMguXZZYe/BNfsHPaCg8DOWem0vh/JcpD077J3BH54mo+1iYBkcCUdf
	R/tRHU9e6vp/yChnjvTVnqOBVevoqAWu/ZREKJT0XwarNorwawSW3oBf+t3rCRCjfk3k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCu5F-0007Fm-RX@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 02:00:21 +0000

commit 9480a1a519cf016623f657dc544cb372a82b5708
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Jan 5 18:09:20 2022 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:27:02 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/x86/hvm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 351daafdc9..0b37cd145b 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -732,7 +732,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:00:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261174.451918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxpN-00036Q-4h; Thu, 27 Jan 2022 06:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261174.451918; Thu, 27 Jan 2022 06:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxpN-00036I-1k; Thu, 27 Jan 2022 06:00:13 +0000
Received: by outflank-mailman (input) for mailman id 261174;
 Thu, 27 Jan 2022 06:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpL-00036A-Py
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpL-0007nY-P8
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpL-0008Td-O6
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AEcOxAzkBPyiszMOOekQ6L96Ue57Y/d+b+ry2FAN7sg=; b=H7reEmNNP7T6/KHqpJEzBLL5/G
	XuUVPrdo/R8uZZKpgLSq2ab+e8KM/HZb9MJyrTAhugLFfpavH9bhkvUyYqX5d0P4xRXv5EnxySatn
	pGTA+3KOyC1XFrCoOs+b5MstH9RnPGLPrx4aWGGE/FvW1Tfd6qydg+OxEq7DMUxvNd6U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nCxpL-0008Td-O6@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:00:11 +0000

commit 2700abffa5e42cf04dc1c6eba73faaba670c99df
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:42:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:42:21 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index e2fcb07e27..47b019c750 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1499,8 +1499,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:00:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261173.451914 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxpJ-000359-3T; Thu, 27 Jan 2022 06:00:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261173.451914; Thu, 27 Jan 2022 06:00:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxpJ-000350-0W; Thu, 27 Jan 2022 06:00:09 +0000
Received: by outflank-mailman (input) for mailman id 261173;
 Thu, 27 Jan 2022 06:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpB-0002NN-Oc
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpB-0007nU-LT
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpB-0008Rw-KQ
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ATdcsU9PpLJ9xfKbA7UW3qJgsQmIWskghUKu36+Nagc=; b=x5649rnecuQiefHiUx96L6xQIj
	VOFPfAqC6Eb7EUCmWqjiZoNqBETyl9AUnzOd/0OLT1KsTipT0QB4510P+1N7IizFtMebMxB4MjUPN
	q8ntYtOPmNfACUy7EJppaI9LKoDOBYtmCvXcLnbKIiAs95zf1m3B9OxeA9RiSKo6dA04=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nCxpB-0008Rw-KQ@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:00:01 +0000

commit 53220c4f9db70331284424ff5ff5f286dd3fbc16
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:41:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:41:59 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index eaa43c6181..2ddd06801a 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1016,7 +1016,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:00:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261175.451923 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxpX-00039D-6a; Thu, 27 Jan 2022 06:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261175.451923; Thu, 27 Jan 2022 06:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxpX-000394-3A; Thu, 27 Jan 2022 06:00:23 +0000
Received: by outflank-mailman (input) for mailman id 261175;
 Thu, 27 Jan 2022 06:00: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 1nCxpV-00038o-T8
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00: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 1nCxpV-0007nn-SO
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpV-0008UZ-RO
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZWZKkEEaNL4ehB+/BV4FjB/zwPhAVF7KjkEtes+qKfE=; b=iit3S9eMJ1K7dJACi9wY3BbbvO
	EayvY2CMhKu8xrQYbGxMmmhDp8talq6l7llv3rMHc2fBz7jBUhJEvQ29hRAqA9uR4KW0lzh5VWChP
	6tC3YJz4lbOVmJnKXWoxMAkxxxeo2aL1ttedQ8sKXbdatHLxVoDJYsvOZiT9eBZchboo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nCxpV-0008UZ-RO@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:00:21 +0000

commit 13e7fe4c938f92933c6aa89e416e3085b13a22c7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:42:53 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:42:53 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index a6e2863c14..9544f3234e 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -810,7 +810,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:00:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261176.451926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxph-0003D3-7d; Thu, 27 Jan 2022 06:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261176.451926; Thu, 27 Jan 2022 06:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxph-0003Cv-4o; Thu, 27 Jan 2022 06:00:33 +0000
Received: by outflank-mailman (input) for mailman id 261176;
 Thu, 27 Jan 2022 06:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpg-0003Cl-0G
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpf-0007o3-Vf
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpf-0008VR-Uk
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00: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=44RCiqE+PkbX7OhTSQUrQRYC8i1a5K5C3FkdyTWjYzo=; b=yO0C34+O18S5smcgWAz/Ig8WFD
	uuD/vyuYfjbTmsDoIFYxXqUFOcpBB9GQbWhh+ip993j+5VVryruD8hLK/Eke06OJGc41MZZvl4GNM
	yRotjbdpXVpKYOhrYh48JD5L+w5llw66orylffIF6i+WnfJmBLa1wVmWXE3Wvhkzg8sg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/time: use relative counts in calibration loops
Message-Id: <E1nCxpf-0008VR-Uk@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:00:31 +0000

commit 793d5ca89fdd9e2cdcb05e88c6cd8446e475b15a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:44:42 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:44:42 2022 +0100

    x86/time: use relative counts in calibration loops
    
    Looping until reaching/exceeding a certain value is error prone: If the
    target value is close enough to the wrapping point, the loop may not
    terminate at all. Switch to using delta values, which then allows to
    fold the two loops each into just one.
    
    Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 467191641d2a2fd2e43b3ae7b80399f89d339980
    master date: 2022-01-13 14:30:18 +0100
---
 xen/arch/x86/time.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 6bc1fd11d6..719dc38c7b 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -376,7 +376,7 @@ static u64 read_hpet_count(void)
 static int64_t __init init_hpet(struct platform_timesource *pts)
 {
     uint64_t hpet_rate, start;
-    uint32_t count, target;
+    uint32_t count, target, elapsed;
 
     if ( hpet_address && strcmp(opt_clocksource, pts->id) &&
          cpuidle_using_deep_cstate() )
@@ -414,11 +414,8 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
 
     count = hpet_read32(HPET_COUNTER);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(hpet_rate);
-    if ( target < count )
-        while ( hpet_read32(HPET_COUNTER) >= count )
-            continue;
-    while ( hpet_read32(HPET_COUNTER) < target )
+    target = CALIBRATE_VALUE(hpet_rate);
+    while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
@@ -456,8 +453,8 @@ static u64 read_pmtimer_count(void)
 
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
-    u64 start;
-    u32 count, target, mask;
+    uint64_t start;
+    uint32_t count, target, mask, elapsed;
 
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -465,13 +462,10 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     pts->counter_bits = pmtmr_width;
     mask = 0xffffffff >> (32 - pmtmr_width);
 
-    count = inl(pmtmr_ioport) & mask;
+    count = inl(pmtmr_ioport);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
-    if ( target < count )
-        while ( (inl(pmtmr_ioport) & mask) >= count )
-            continue;
-    while ( (inl(pmtmr_ioport) & mask) < target )
+    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
+    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:00:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261177.451930 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxpr-0003G9-Ag; Thu, 27 Jan 2022 06:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261177.451930; Thu, 27 Jan 2022 06:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxpr-0003G1-7a; Thu, 27 Jan 2022 06:00:43 +0000
Received: by outflank-mailman (input) for mailman id 261177;
 Thu, 27 Jan 2022 06:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpq-0003Fo-3Y
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpq-0007oT-2n
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxpq-0008WS-1n
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F8Llq2T2CCGSSnNb8o2YVaBr9Zj1YDpaTMrSyWHw+KI=; b=CBHzVsY0N39yLCB367mVgWK/ns
	9bBIKZTCxKvQfKpbNcdHW87kNw2tawHdSrbf6OCB0le+NpahwLPIMhOSGyFJ4efjDmQOxnGOb3sp5
	dwUidl3wa3003+w6jIDtO/igWtvcu9jh9gMJjJasNEisFGQKYAISgd7g0mEHWSxb3XTs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/time: improve TSC / CPU freq calibration accuracy
Message-Id: <E1nCxpq-0008WS-1n@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:00:42 +0000

commit ac71fdd9ec8a54240cc09827203197674353a722
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:44:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:44:55 2022 +0100

    x86/time: improve TSC / CPU freq calibration accuracy
    
    While the problem report was for extreme errors, even smaller ones would
    better be avoided: The calculated period to run calibration loops over
    can (and usually will) be shorter than the actual time elapsed between
    first and last platform timer and TSC reads. Adjust values returned from
    the init functions accordingly.
    
    On a Skylake system I've tested this on accuracy (using HPET) went from
    detecting in some cases more than 220kHz too high a value to about
    ±2kHz. On other systems (or on this system, but with PMTMR) the original
    error range was much smaller, with less (in some cases only very little)
    improvement.
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a5c9a80af34eefcd6e31d0ed2b083f452cd9076d
    master date: 2022-01-13 14:31:52 +0100
---
 xen/arch/x86/time.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 719dc38c7b..0b85b90f55 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -285,6 +285,23 @@ static char *freq_string(u64 freq)
     return s;
 }
 
+static uint64_t adjust_elapsed(uint64_t elapsed, uint32_t actual,
+                               uint32_t target)
+{
+    if ( likely(actual > target) )
+    {
+        /*
+         * A (perhaps significant) delay before the last timer read (e.g. due
+         * to a SMI or NMI) can lead to (perhaps severe) inaccuracy if not
+         * accounting for the time elapsed beyond the originally calculated
+         * duration of the calibration interval.
+         */
+        elapsed = muldiv64(elapsed, target, actual);
+    }
+
+    return elapsed * CALIBRATE_FRAC;
+}
+
 /************************************************************
  * PLATFORM TIMER 1: PROGRAMMABLE INTERVAL TIMER (LEGACY PIT)
  */
@@ -418,7 +435,7 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
     while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static void resume_hpet(struct platform_timesource *pts)
@@ -468,7 +485,7 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static struct platform_timesource __initdata plt_pmtimer =
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:00:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:00:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261178.451934 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxq1-0003Jg-C3; Thu, 27 Jan 2022 06:00:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261178.451934; Thu, 27 Jan 2022 06:00: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 1nCxq1-0003JY-90; Thu, 27 Jan 2022 06:00:53 +0000
Received: by outflank-mailman (input) for mailman id 261178;
 Thu, 27 Jan 2022 06:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxq0-0003JJ-7j
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxq0-0007ol-6z
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxq0-00005r-5k
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Uh5vqxE1cGNlmFP1iDyFB5lPmTMfxagvHMWk5fkePSg=; b=N5n/KpYsPaFVi2fImfyGNBFosl
	SGE+UMNHQtj+PyC7gDBRQ1Fm5Xha4f3a20MxeDoOx+07pjw1oZBBO51ckXSMNw52musldiAAR68u6
	JnDdBeF933H61KYvFAdmboEAdAc79FuTTAxiXkzU1Gd2Y/oWECMahvUCvR1Gzt0sfFOI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] libxl/PCI: Fix PV hotplug & stubdom coldplug
Message-Id: <E1nCxq0-00005r-5k@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:00:52 +0000

commit 7ca8706ad53d5967fd15fa94c2dd5ada8d42d812
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jan 25 13:45:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:45:09 2022 +0100

    libxl/PCI: Fix PV hotplug & stubdom coldplug
    
    commit 0fdb48ffe7a1 "libxl: Make sure devices added by pci-attach are
    reflected in the config" broken PCI hotplug (xl pci-attach) for PV
    domains when it moved libxl__create_pci_backend() later in the function.
    
    This also broke HVM + stubdom PCI passthrough coldplug.  For that, the
    PCI devices are hotplugged to a running PV stubdom, and then the QEMU
    QMP device_add commands are made to QEMU inside the stubdom.
    
    A running PV domain calls libxl__wait_for_backend().  With the current
    placement of libxl__create_pci_backend(), the path does not exist and
    the call immediately fails:
    libxl: error: libxl_device.c:1388:libxl__wait_for_backend: Backend /local/domain/0/backend/pci/43/0 does not exist
    libxl: error: libxl_pci.c:1764:device_pci_add_done: Domain 42:libxl__device_pci_add failed for PCI device 0:2:0.0 (rc -3)
    libxl: error: libxl_create.c:1857:domcreate_attach_devices: Domain 42:unable to add pci devices
    
    The wait is only relevant when:
    1) The domain is PV
    2) The domain is running
    3) The backend is already present
    
    This is because:
    
    1) xen-pcifront is only used for PV.  It does not load for HVM domains
       where QEMU is used.
    
    2) If the domain is not running (starting), then the frontend state will
       be Initialising.  xen-pciback waits for the frontend to transition to
       at Initialised before attempting to connect.  So a wait for a
       non-running domain is not applicable as the backend will not
       transition to Connected.
    
    3) For presence, num_devs is already used to determine if the backend
       needs to be created.  Re-use num_devs to determine if the backend
       wait is necessary.  The wait is necessary to avoid racing with
       another PCI attachment reconfiguring the front/back or changing to
       some other state like closing.  If we are creating the backend, then
       we don't have to worry about the state since it is being created.
    
    Fixes: 0fdb48ffe7a1 ("libxl: Make sure devices added by pci-attach are
    reflected in the config")
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 73ee2795aaef2cb086ac078bffe1c6b33c0ea91b
    master date: 2022-01-13 14:33:16 +0100
---
 tools/libs/light/libxl_pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 1a1c263080..92bf86b2be 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -157,9 +157,11 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc,
     if (domtype == LIBXL_DOMAIN_TYPE_INVALID)
         return ERROR_FAIL;
 
-    if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", XenbusStateConnected)) < 0)
-            return ERROR_FAIL;
+    /* Wait is only needed if the backend already exists (num_devs != NULL) */
+    if (num_devs && !starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
+        rc = libxl__wait_for_backend(gc, be_path,
+                                     GCSPRINTF("%d", XenbusStateConnected));
+        if (rc) return rc;
     }
 
     back = flexarray_make(gc, 16, 1);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:01:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:01:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261179.451938 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxqB-0003ME-Dh; Thu, 27 Jan 2022 06:01:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261179.451938; Thu, 27 Jan 2022 06:01: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 1nCxqB-0003M6-AV; Thu, 27 Jan 2022 06:01:03 +0000
Received: by outflank-mailman (input) for mailman id 261179;
 Thu, 27 Jan 2022 06:01:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqA-0003Ln-C9
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqA-0007p8-BO
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqA-000070-AZ
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NTG7r2k7YXCzSc5u7omEDyOce/P7fG6p0kvRvfxjL0Y=; b=W7NUPiOyYAkmk5qI87TRBo39cY
	PqS2A/tgdVKCbUzUImfQHNAd/fWwqbVHJkfGAf4U6CSKV+9s5qR6Zq5cTh8nYvn8jrJSj/G2XeNPR
	q1kAdoX6SX5zxNExHd64HuZAQF00zE6w3i4RkCYMlK8IykTWoIFY4wxazih7nGNNJ0GI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/guest: Introduce {get,set}_reg() infrastructure
Message-Id: <E1nCxqA-000070-AZ@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:01:02 +0000

commit ff2ce108699b2e1c49bdadc0fecb8e77cf8b34ae
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:45:33 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:45:33 2022 +0100

    x86/guest: Introduce {get,set}_reg() infrastructure
    
    Various registers have per-guest-type or per-vendor locations or access
    requirements.  To support their use from common code, provide accessors which
    allow for per-guest-type behaviour.
    
    For now, just infrastructure handling default cases and expectations.
    Subsequent patches will start handling registers using this infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 88d3ff7ab15da277a85b39735797293fb541c718
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/hvm.c          | 22 ++++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c      | 30 ++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c      | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emulate.c       | 31 +++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h   | 15 +++++++++++++++
 xen/include/asm-x86/pv/domain.h |  4 ++++
 6 files changed, 133 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5be8aee4bb..f572c68d4d 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3712,6 +3712,28 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_call(hvm_funcs.get_reg, v, reg);
+    }
+}
+
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_vcall(hvm_funcs.set_reg, v, reg, val);
+    }
+}
+
 static bool is_sysdesc_access(const struct x86_emulate_state *state,
                               const struct x86_emulate_ctxt *ctxt)
 {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index c38a7405c9..79ea791b63 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2468,6 +2468,33 @@ static bool svm_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t svm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
@@ -2517,6 +2544,9 @@ static struct hvm_function_table __initdata svm_function_table = {
     .nhvm_intr_blocked = nsvm_intr_blocked,
     .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
 
+    .get_reg = svm_get_reg,
+    .set_reg = svm_set_reg,
+
     .tsc_scaling = {
         .max_ratio = ~TSC_RATIO_RSVD_BITS,
     },
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index fd7b193058..d1814c075d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2410,6 +2410,33 @@ static int vmtrace_reset(struct vcpu *v)
     return 0;
 }
 
+static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2471,6 +2498,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .vmtrace_set_option = vmtrace_set_option,
     .vmtrace_get_option = vmtrace_get_option,
     .vmtrace_reset = vmtrace_reset,
+
+    .get_reg = vmx_get_reg,
+    .set_reg = vmx_set_reg,
+
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e8bb326efd..ae049b60f2 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -90,6 +90,37 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
     }
 }
 
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 4a8fb571de..221d3e6999 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -222,6 +222,9 @@ struct hvm_function_table {
     int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
     int (*vmtrace_reset)(struct vcpu *v);
 
+    uint64_t (*get_reg)(struct vcpu *v, unsigned int reg);
+    void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -712,6 +715,18 @@ static inline int hvm_vmtrace_reset(struct vcpu *v)
     return -EOPNOTSUPP;
 }
 
+/*
+ * Accessors for registers which have per-guest-type or per-vendor locations
+ * (e.g. VMCS, msr load/save lists, VMCB, VMLOAD lazy, etc).
+ *
+ * The caller is responsible for all auditing - these accessors do not fail,
+ * but do use domain_crash() for usage errors.
+ *
+ * Must cope with being called in non-current context.
+ */
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg);
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index df9716ff26..3a67816764 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,6 +65,10 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:01:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:01:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261180.451942 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxqL-0003P0-Ew; Thu, 27 Jan 2022 06:01:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261180.451942; Thu, 27 Jan 2022 06:01: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 1nCxqL-0003Os-C0; Thu, 27 Jan 2022 06:01:13 +0000
Received: by outflank-mailman (input) for mailman id 261180;
 Thu, 27 Jan 2022 06:01:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqK-0003Oj-G4
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqK-0007qr-FL
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqK-000082-EB
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZO2+gkTH+1F4QAQnGoCAo5dly58eSp7ElYH07jDkYbg=; b=otPyBHm8SUNN/AylS2Juvrr6uC
	HNuHcdHQgoyrt/dF7qg/7AtUsH2zupYxHUkw5B377clDsJDvKcD1Hwe6k5KqFzDoQSr3xgzQQI49W
	7yzDL/PsZHQXc4a+8bvtqyRIl3IxvAEwpte2FlkTaW2U5zagAsc8XUs7tTq9p/nuhdHg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/msr: Split MSR_SPEC_CTRL handling
Message-Id: <E1nCxqK-000082-EB@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:01:12 +0000

commit 2e4507eb358b580378b0a7aaa6d357401abbca88
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:45:58 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:45:58 2022 +0100

    x86/msr: Split MSR_SPEC_CTRL handling
    
    In order to fix a VT-x bug, and support MSR_SPEC_CTRL on AMD, move
    MSR_SPEC_CTRL handling into the new {pv,hvm}_{get,set}_reg() infrastructure.
    
    Duplicate the msrs->spec_ctrl.raw accesses in the PV and VT-x paths for now.
    The SVM path is currently unreachable because of the CPUID policy.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6536688439dbca1d08fd6db5be29c39e3917fb2f
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c |  7 +++++++
 xen/arch/x86/msr.c         | 22 +++++++++++++++++-----
 xen/arch/x86/pv/emulate.c  |  9 +++++++++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d1814c075d..8e53a51a17 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2416,6 +2416,9 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return v->arch.msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -2430,6 +2433,10 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        v->arch.msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 75b89777a2..79d40a0074 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -28,6 +28,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/pv/domain.h>
 #include <asm/setup.h>
 
 #include <public/hvm/params.h>
@@ -250,8 +251,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_SPEC_CTRL:
         if ( !cp->feat.ibrsb )
             goto gp_fault;
-        *val = msrs->spec_ctrl.raw;
-        break;
+        goto get_reg;
 
     case MSR_INTEL_PLATFORM_INFO:
         *val = mp->platform_info.raw;
@@ -409,6 +409,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     return ret;
 
+ get_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        *val = pv_get_reg(v, msr);
+    else
+        *val = hvm_get_reg(v, msr);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
@@ -498,9 +505,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
         if ( val & rsvd )
             goto gp_fault; /* Rsvd bit set? */
-
-        msrs->spec_ctrl.raw = val;
-        break;
+        goto set_reg;
 
     case MSR_PRED_CMD:
         if ( !cp->feat.ibrsb && !cp->extd.ibpb )
@@ -648,6 +653,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
     return ret;
 
+ set_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        pv_set_reg(v, msr, val);
+    else
+        hvm_set_reg(v, msr, val);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index ae049b60f2..0a7907ec5e 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -92,12 +92,16 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 
 uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -108,12 +112,17 @@ uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 
 void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:01:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:01:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261181.451946 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxqV-0003S6-GN; Thu, 27 Jan 2022 06:01:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261181.451946; Thu, 27 Jan 2022 06:01: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 1nCxqV-0003Ry-DV; Thu, 27 Jan 2022 06:01:23 +0000
Received: by outflank-mailman (input) for mailman id 261181;
 Thu, 27 Jan 2022 06:01:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqU-0003Rn-JQ
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqU-0007r6-Ii
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqU-00008w-Hi
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3md2TS9FruKSk04x/CBC5YG2whleQKPubjP0QFAYYkk=; b=3/4ym+HKVuHKfyPATe9Ci18mJ7
	fnOdK2usuNi9tLsDZEQBobDqExuVTFLNPuh9S0dZ84tYv+QDxkZAS9PApEATQBYMeiOPBPD/xaEeZ
	rt3Jj+wHmRePpJ5BgVp2ZFfYQPNoX3NqvXp7++d+l2QsvWnt2Oq80T65xhsAJzP3D63M=;
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: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
Message-Id: <E1nCxqU-00008w-Hi@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:01:22 +0000

commit bffdcc0dc454838e1c75a1e9d98ab140d7aff421
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:46:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:46:14 2022 +0100

    x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
    
    These were written before Spectre/Meltdown went public, and there was large
    uncertainty in how the protections would evolve.  As it turns out, they're
    very specific to Intel hardware, and not very suitable for AMD.
    
    Drop the macros, opencoding the relevant subset of functionality, and leaving
    grep-fodder to locate the logic.  No change at all for VT-x.
    
    For AMD, the only relevant piece of functionality is DO_OVERWRITE_RSB,
    although we will soon be adding (different) logic to handle MSR_SPEC_CTRL.
    
    This has a marginal improvement of removing an unconditional pile of long-nops
    from the vmentry/exit path.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 95b13fa43e0753b7514bef13abe28253e8614f62
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/svm/entry.S        |  5 +++--
 xen/arch/x86/hvm/vmx/entry.S        |  8 ++++++--
 xen/include/asm-x86/spec_ctrl_asm.h | 19 ++++---------------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index e208a4b32a..276215d36a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -59,7 +59,7 @@ __UNLIKELY_END(nsvm_hap)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
 
         pop  %r15
         pop  %r14
@@ -86,7 +86,8 @@ __UNLIKELY_END(nsvm_hap)
 
         GET_CURRENT(bx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: ac  */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         stgi
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 27c8c5ca49..30139ae58e 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -33,7 +33,9 @@ ENTRY(vmx_asm_vmexit_handler)
         movb $1,VCPU_vmx_launched(%rbx)
         mov  %rax,VCPU_hvm_guest_cr2(%rbx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
+        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -80,7 +82,9 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
 
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index cb34299a86..2b3f123cb5 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -68,14 +68,16 @@
  *
  * The following ASM fragments implement this algorithm.  See their local
  * comments for further details.
- *  - SPEC_CTRL_ENTRY_FROM_HVM
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
  *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
- *  - SPEC_CTRL_EXIT_TO_HVM
+ *
+ * Additionally, the following grep-fodder exists to find the HVM logic.
+ *  - SPEC_CTRL_ENTRY_FROM_{SVM,VMX}
+ *  - SPEC_CTRL_EXIT_TO_{SVM,VMX}
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
@@ -225,12 +227,6 @@
     wrmsr
 .endm
 
-/* Use after a VMEXIT from an HVM guest. */
-#define SPEC_CTRL_ENTRY_FROM_HVM                                        \
-    ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM;           \
-    ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM,                        \
-        X86_FEATURE_SC_MSR_HVM
-
 /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */
 #define SPEC_CTRL_ENTRY_FROM_PV                                         \
     ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_PV;            \
@@ -255,13 +251,6 @@
     ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
         X86_FEATURE_SC_VERW_PV
 
-/* Use when exiting to HVM guest context. */
-#define SPEC_CTRL_EXIT_TO_HVM                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM;             \
-    ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
-        X86_FEATURE_SC_VERW_HVM
-
 /*
  * Use in IST interrupt/exception context.  May interrupt Xen or PV context.
  * Fine grain control of SCF_ist_wrmsr is needed for safety in the S3 resume
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:01:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:01:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261182.451950 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxqf-0003VP-JS; Thu, 27 Jan 2022 06:01:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261182.451950; Thu, 27 Jan 2022 06:01: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 1nCxqf-0003VK-GM; Thu, 27 Jan 2022 06:01:33 +0000
Received: by outflank-mailman (input) for mailman id 261182;
 Thu, 27 Jan 2022 06:01:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqe-0003V6-N6
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqe-0007rK-MM
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqe-00009z-LT
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BebO6Xr2KSWMGCLJJ3KGi+NWai89Q15GG5walUgFEYo=; b=NGeLvwgU2Swtxc10U117MatRVx
	VYyflQdwXglY37cfv/ymq1FXkwMcMyuJMaMWpuK5OCcDZgdmtGrQ72AGznRDsgxrTg0ww1x8X6NAt
	f+bUaiC4EclR3fpyX5c8Q5X3SI4chNtGAB4eaNYYtcbTy8MS6UnOTD+tbLbUZoId9KE4=;
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: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
Message-Id: <E1nCxqe-00009z-LT@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:01:32 +0000

commit bd20d6c87619a6b825478cd5ae0387f9fdaabea0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:46:28 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:46:28 2022 +0100

    x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
    
    The logic was based on a mistaken understanding of how NMI blocking on vmexit
    works.  NMIs are only blocked for EXIT_REASON_NMI, and not for general exits.
    Therefore, an NMI can in general hit early in the vmx_asm_vmexit_handler path,
    and the guest's value will be clobbered before it is saved.
    
    Switch to using MSR load/save lists.  This causes the guest value to be saved
    atomically with respect to NMIs/MCEs/etc.
    
    First, update vmx_cpuid_policy_changed() to configure the load/save lists at
    the same time as configuring the intercepts.  This function is always used in
    remote context, so extend the vmx_vmcs_{enter,exit}() block to cover the whole
    function, rather than having multiple remote acquisitions of the same VMCS.
    
    Both of vmx_{add,del}_guest_msr() can fail.  The -ESRCH delete case is fine,
    but all others are fatal to the running of the VM, so handle them using
    domain_crash() - this path is only used during domain construction anyway.
    
    Second, update vmx_{get,set}_reg() to use the MSR load/save lists rather than
    vcpu_msrs, and update the vcpu_msrs comment to describe the new state
    location.
    
    Finally, adjust the entry/exit asm.
    
    Because the guest value is saved and loaded atomically, we do not need to
    manually load the guest value, nor do we need to enable SCF_use_shadow.  This
    lets us remove the use of DO_SPEC_CTRL_EXIT_TO_GUEST.  Additionally,
    SPEC_CTRL_ENTRY_FROM_PV gets removed too, because on an early entry failure,
    we're no longer in the guest MSR_SPEC_CTRL context needing to switch back to
    Xen's context.
    
    The only action remaining is to load Xen's MSR_SPEC_CTRL value on vmexit.  We
    could in principle use the host msr list, but is expected to complicated
    future work.  Delete DO_SPEC_CTRL_ENTRY_FROM_HVM entirely, and use a shorter
    code sequence to simply reload Xen's setting from the top-of-stack block.
    
    Adjust the comment at the top of spec_ctrl_asm.h in light of this bugfix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f0eaadf84d273a6ff8df3660b874a02d0e7677
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/entry.S        | 22 ++++++++++++-------
 xen/arch/x86/hvm/vmx/vmx.c          | 44 ++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/msr.h           | 10 ++++++++-
 xen/include/asm-x86/spec_ctrl_asm.h | 32 ++++-----------------------
 4 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 30139ae58e..7ee3382fd0 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -35,7 +35,14 @@ ENTRY(vmx_asm_vmexit_handler)
 
         /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
-        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
+
+        .macro restore_spec_ctrl
+            mov    $MSR_SPEC_CTRL, %ecx
+            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            xor    %edx, %edx
+            wrmsr
+        .endm
+        ALTERNATIVE "", restore_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -82,8 +89,7 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
-        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: %rsp=regs/cpuinfo              Clob:    */
         ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
@@ -119,12 +125,12 @@ UNLIKELY_END(realmode)
         SAVE_ALL
 
         /*
-         * PV variant needed here as no guest code has executed (so
-         * MSR_SPEC_CTRL can't have changed value), and NMIs/MCEs are liable
-         * to hit (in which case the HVM variant might corrupt things).
+         * SPEC_CTRL_ENTRY notes
+         *
+         * If we end up here, no guest code has executed.  The MSR lists have
+         * not been processed, so we still have Xen's choice of MSR_SPEC_CTRL
+         * in context, and the RSB is unchanged.
          */
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 8e53a51a17..868151a2e5 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -598,6 +598,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)
 static void vmx_cpuid_policy_changed(struct vcpu *v)
 {
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
+    int rc = 0;
 
     if ( opt_hvm_fep ||
          (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
@@ -607,17 +608,29 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
 
     /*
      * We can safely pass MSR_SPEC_CTRL through to the guest, even if STIBP
      * isn't enumerated in hardware, as SPEC_CTRL_STIBP is ignored.
      */
     if ( cp->feat.ibrsb )
+    {
         vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
+
+        rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
+        if ( rc )
+            goto out;
+    }
     else
+    {
         vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
 
+        rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
+        if ( rc && rc != -ESRCH )
+            goto out;
+        rc = 0; /* Tolerate -ESRCH */
+    }
+
     /* MSR_PRED_CMD is safe to pass through if the guest knows about it. */
     if ( cp->feat.ibrsb || cp->extd.ibpb )
         vmx_clear_msr_intercept(v, MSR_PRED_CMD,  VMX_MSR_RW);
@@ -629,6 +642,15 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
         vmx_clear_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
+
+ out:
+    vmx_vmcs_exit(v);
+
+    if ( rc )
+    {
+        printk(XENLOG_G_ERR "%pv MSR list error: %d", v, rc);
+        domain_crash(v->domain);
+    }
 }
 
 int vmx_guest_x86_mode(struct vcpu *v)
@@ -2413,11 +2435,20 @@ static int vmtrace_reset(struct vcpu *v)
 static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     struct domain *d = v->domain;
+    uint64_t val = 0;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        return v->arch.msrs->spec_ctrl.raw;
+        rc = vmx_read_guest_msr(v, reg, &val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
+        return val;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
@@ -2430,11 +2461,18 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     struct domain *d = v->domain;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        v->arch.msrs->spec_ctrl.raw = val;
+        rc = vmx_write_guest_msr(v, reg, val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
         break;
 
     default:
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 1d3eca9063..10039c2d22 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -287,7 +287,15 @@ extern struct msr_policy     raw_msr_policy,
 /* Container object for per-vCPU MSRs */
 struct vcpu_msrs
 {
-    /* 0x00000048 - MSR_SPEC_CTRL */
+    /*
+     * 0x00000048 - MSR_SPEC_CTRL
+     *
+     * For PV guests, this holds the guest kernel value.  It is accessed on
+     * every entry/exit path.
+     *
+     * For VT-x guests, the guest value is held in the MSR guest load/save
+     * list.
+     */
     struct {
         uint32_t raw;
     } spec_ctrl;
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index 2b3f123cb5..bf82528a12 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -42,9 +42,10 @@
  *     path, or late in the exit path after restoring the guest value.  This
  *     will corrupt the guest value.
  *
- * Factor 1 is dealt with by relying on NMIs/MCEs being blocked immediately
- * after VMEXIT.  The VMEXIT-specific code reads MSR_SPEC_CTRL and updates
- * current before loading Xen's MSR_SPEC_CTRL setting.
+ * Factor 1 is dealt with:
+ *   - On VMX by using MSR load/save lists to have vmentry/exit atomically
+ *     load/save the guest value.  Xen's value is loaded in regular code, and
+ *     there is no need to use the shadow logic (below).
  *
  * Factor 2 is harder.  We maintain a shadow_spec_ctrl value, and a use_shadow
  * boolean in the per cpu spec_ctrl_flags.  The synchronous use is:
@@ -128,31 +129,6 @@
 #endif
 .endm
 
-.macro DO_SPEC_CTRL_ENTRY_FROM_HVM
-/*
- * Requires %rbx=current, %rsp=regs/cpuinfo
- * Clobbers %rax, %rcx, %rdx
- *
- * The common case is that a guest has direct access to MSR_SPEC_CTRL, at
- * which point we need to save the guest value before setting IBRS for Xen.
- * Unilaterally saving the guest value is shorter and faster than checking.
- */
-    mov $MSR_SPEC_CTRL, %ecx
-    rdmsr
-
-    /* Stash the value from hardware. */
-    mov VCPU_arch_msrs(%rbx), %rdx
-    mov %eax, VCPUMSR_spec_ctrl_raw(%rdx)
-    xor %edx, %edx
-
-    /* Clear SPEC_CTRL shadowing *before* loading Xen's value. */
-    andb $~SCF_use_shadow, CPUINFO_spec_ctrl_flags(%rsp)
-
-    /* Load Xen's intended value. */
-    movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-    wrmsr
-.endm
-
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:01:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:01:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261183.451954 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxqp-0003Yf-LJ; Thu, 27 Jan 2022 06:01:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261183.451954; Thu, 27 Jan 2022 06:01: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 1nCxqp-0003YR-I2; Thu, 27 Jan 2022 06:01:43 +0000
Received: by outflank-mailman (input) for mailman id 261183;
 Thu, 27 Jan 2022 06:01:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqo-0003YI-QU
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqo-0007rn-Pi
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqo-0000Aq-Ok
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lnAXU0NmJU35+fKm/u+KRfJUsmQHo29XTraEX/VQx0Q=; b=FUNXb3oDNIaPLfGQ/JdOYJFMYL
	hJkNyfkUvK/I1BxhNz6daEh82nYBzBdwX3bECxsxocMsvqRqRkoIBk/l2XGUMduniVfP1V/+nqteC
	BSTHk40Mh7GcdH7RuMPNM1yuCzvYxmgXNxg98M7b9FMQYilVM5qROfWHOAPZj/HrMh8A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86: Fix build with the get/set_reg() infrastructure
Message-Id: <E1nCxqo-0000Aq-Ok@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:01:42 +0000

commit b57b8cb350de4930db1c3ccfa49d04281754cf9a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 26 12:27:32 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:27:32 2022 +0100

    x86: Fix build with the get/set_reg() infrastructure
    
    I clearly messed up concluding that the stubs were safe to drop.
    
    The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
    and CONFIG_HVM.  As a result logic of the form `if ( pv/hvm ) ... else ...`
    will always have one side which can't be DCE'd.
    
    While technically only the hvm stubs are needed, due to the use of the
    is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
    avoid leaving a bear trap for future users.
    
    Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13caa585791234fe3e3719c8376f7ea731012451
    master date: 2022-01-21 12:42:11 +0000
---
 xen/include/asm-x86/hvm/hvm.h   | 10 ++++++++++
 xen/include/asm-x86/pv/domain.h | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 221d3e6999..b8dc445550 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -850,6 +850,16 @@ static inline int hvm_vmtrace_get_option(
     return -EOPNOTSUPP;
 }
 
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, unsigned long cr4);
 /* Create a cr4 value to load into hardware, based on vcpu settings. */
 unsigned long pv_make_cr4(const struct vcpu *v);
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 bool xpti_pcid_enabled(void);
 
 #else  /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; }
 
 static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
 
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #endif	/* CONFIG_PV */
 
 void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 06:01:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 06:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261184.451958 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxr0-0003cu-Mj; Thu, 27 Jan 2022 06:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261184.451958; Thu, 27 Jan 2022 06:01:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nCxr0-0003cm-Jc; Thu, 27 Jan 2022 06:01:54 +0000
Received: by outflank-mailman (input) for mailman id 261184;
 Thu, 27 Jan 2022 06:01: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 1nCxqy-0003cb-Uo
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqy-0007s0-U5
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nCxqy-0000Bg-S7
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 06:01:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Qh8aIPCS0fJRXwYaS9G+c9MRd8xpaMPiCbA8HjNy5WY=; b=Mk7yTh3amgWSnK+ETlVim+AhjE
	1l4SUnOqW+uTkkZUECik/jUTeXzT+mW/JZkWJmsgybfgXdZo02iZhBLKIlBDUX6f3w58ibbnwTDZn
	jPKgEGaUQ0qGdpli2oUaHl+P4M5UvqCfq6Tzel0ytnSYY5fe8s3JBOz3CyOOlyxJfsPw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/pvh: fix population of the low 1MB for dom0
Message-Id: <E1nCxqy-0000Bg-S7@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 06:01:52 +0000

commit 2a0c6e79dafeafeb1dcf9b87fcb9abc1e47b40e0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jan 26 12:28:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:28:14 2022 +0100

    x86/pvh: fix population of the low 1MB for dom0
    
    RMRRs are setup ahead of populating the p2m and hence the ASSERT when
    populating the low 1MB needs to be relaxed when it finds an existing
    entry: it's either RAM or a RMRR resulting from the IOMMU setup.
    
    Rework the logic a bit and introduce a local mfn variable in order to
    assert that if the gfn is populated and not RAM it is an identity map.
    
    Fixes: 6b4f6a31ac ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2d5fc9120d556ec3c4b1acf0ab5660a6d3f7ebeb
    master date: 2022-01-25 10:52:24 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 01b1356bd2..453f115847 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -465,11 +465,16 @@ static int __init pvh_populate_p2m(struct domain *d)
     for ( i = rc = 0; i < MB1_PAGES; ++i )
     {
         p2m_type_t p2mt;
+        mfn_t mfn = get_gfn_query(d, i, &p2mt);
 
-        if ( mfn_eq(get_gfn_query(d, i, &p2mt), INVALID_MFN) )
+        if ( mfn_eq(mfn, INVALID_MFN) )
             rc = set_mmio_p2m_entry(d, _gfn(i), _mfn(i), PAGE_ORDER_4K);
         else
-            ASSERT(p2mt == p2m_ram_rw);
+            /*
+             * If the p2m entry is already set it must belong to a RMRR and
+             * already be identity mapped, or be a RAM region.
+             */
+            ASSERT(p2mt == p2m_ram_rw || mfn_eq(mfn, _mfn(i)));
         put_gfn(d, i);
         if ( rc )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:33:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261375.452472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD19L-0000WL-7e; Thu, 27 Jan 2022 09:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261375.452472; Thu, 27 Jan 2022 09:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD19L-0000WD-4i; Thu, 27 Jan 2022 09:33:03 +0000
Received: by outflank-mailman (input) for mailman id 261375;
 Thu, 27 Jan 2022 09:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD19J-0000W7-Uu
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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 1nD19J-00047L-UA
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD19J-0001ai-TA
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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=KbIkbfK8iiLXo8f4E5CAFlCG2WROlse+ZO9YDefy1bI=; b=Ceun8KfB18ZwpmR77i6sYyRSYR
	6GEx19G0sGwxzx/cMnBuhglvo5WkkpaEL+XFp37jADdxoGR31Gz/0ak7DqnsOU4cOXY71IFrH28tv
	Smlz/1W3YJSUrDuI9osuEJyvb59GL17e87WneSZ7N7meEOFip6+xLawLDXe4JTRTfveQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nD19J-0001ai-TA@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:33:01 +0000

commit acdb6744460c6264785c031a37d99b8557c56195
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:34:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:34:55 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 8b20b43077..fb71fa4c1c 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1016,7 +1016,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261376.452476 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD19V-0000Y8-9M; Thu, 27 Jan 2022 09:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261376.452476; Thu, 27 Jan 2022 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 1nD19V-0000Y0-6E; Thu, 27 Jan 2022 09:33:13 +0000
Received: by outflank-mailman (input) for mailman id 261376;
 Thu, 27 Jan 2022 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 1nD19U-0000Xo-3t
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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 1nD19U-00047P-1F
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD19U-0001bW-0H
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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=V9S6S2qyzMmXxlV2Dm9GII5eEL6uma4KPY+o029hq1I=; b=sAuJ9xo5Wb0Eqp2O95iTvSNYF/
	S+TwwdVzTK1VkUX+yVLXMgWJtDY7S7CgUZ8+XweFMImtCOEJhs2/JRXryL9//QYwYNOXKtO3upIln
	Z224KKjYHacELIecSRuFYsbQ3omOEUeGYj7gKhS7M/9jWDE47Eb6AbBPx6xTct9mwICo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nD19U-0001bW-0H@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:33:12 +0000

commit 965fbc8e801c91938dd7efa831fb9078a78deeb7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:35:08 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:35:08 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 012a74455b..66f8ce7174 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1488,8 +1488,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:33:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261377.452482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD19f-0000cM-EJ; Thu, 27 Jan 2022 09:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261377.452482; Thu, 27 Jan 2022 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 1nD19f-0000c7-94; Thu, 27 Jan 2022 09:33:23 +0000
Received: by outflank-mailman (input) for mailman id 261377;
 Thu, 27 Jan 2022 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 1nD19e-0000bh-5C
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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 1nD19e-00047i-4X
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD19e-0001cK-3Z
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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=ycxeO8KXcFawtZk00w1JLwilopijCS4if6LVrXHujVM=; b=7NNARnvVWG2UFxGmbvzfkzN4/o
	8OtvBvhe5ekZvNM6gsrfEg/8k5KpcqFfzo+QMVYiSkxaVykm5qm2ijOgM6WxSQSU18W07uQXYJlFP
	3hejS3nRjvx8tBHGZKW3d+wfrbyvfgzzGjsBFOTQnweXPzjuttiLzh2kn1T05Bfzb5dc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nD19e-0001cK-3Z@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:33:22 +0000

commit 18d0f501596bd55412282aac3db1f0a349a68f50
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:35:23 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:35:23 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 351daafdc9..0b37cd145b 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -732,7 +732,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:33:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261379.452488 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD19p-0000iM-NJ; Thu, 27 Jan 2022 09:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261379.452488; Thu, 27 Jan 2022 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 1nD19p-0000hp-I6; Thu, 27 Jan 2022 09:33:33 +0000
Received: by outflank-mailman (input) for mailman id 261379;
 Thu, 27 Jan 2022 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 1nD19o-0000fD-8h
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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 1nD19o-00047w-7w
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD19o-0001d3-78
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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=K9Rsot3bUFhUWdfA0xhi/pUHu+wdqSdH+miseTvlaa8=; b=A3gfIfZ6W0JcGJE27FDMCYBz9k
	XV6B2Zvgmxw8RaoKWG8khdqaBLjzyEpu3M0YQrKWU/75BlA5bZ7CCP0biHCsfT155mq1Vog5+BqCX
	UzJW6ht6vUv6aUJRqDDDfTkl2KrU6bzahC5vtD+binb2Ewjo1kQqfZ/AaT7P+TBBvOLM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/time: use relative counts in calibration loops
Message-Id: <E1nD19o-0001d3-78@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:33:32 +0000

commit 4774d06097e524913fbd4ffcea3307275c5215d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:37:45 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:37:45 2022 +0100

    x86/time: use relative counts in calibration loops
    
    Looping until reaching/exceeding a certain value is error prone: If the
    target value is close enough to the wrapping point, the loop may not
    terminate at all. Switch to using delta values, which then allows to
    fold the two loops each into just one.
    
    Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 467191641d2a2fd2e43b3ae7b80399f89d339980
    master date: 2022-01-13 14:30:18 +0100
---
 xen/arch/x86/time.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a290aba3e8..84b62f2024 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -378,7 +378,7 @@ static u64 read_hpet_count(void)
 static int64_t __init init_hpet(struct platform_timesource *pts)
 {
     uint64_t hpet_rate, start;
-    uint32_t count, target;
+    uint32_t count, target, elapsed;
     /*
      * Allow HPET to be setup, but report a frequency of 0 so it's not selected
      * as a timer source. This is required so it can be used in legacy
@@ -451,11 +451,8 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
 
     count = hpet_read32(HPET_COUNTER);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(hpet_rate);
-    if ( target < count )
-        while ( hpet_read32(HPET_COUNTER) >= count )
-            continue;
-    while ( hpet_read32(HPET_COUNTER) < target )
+    target = CALIBRATE_VALUE(hpet_rate);
+    while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
@@ -493,8 +490,8 @@ static u64 read_pmtimer_count(void)
 
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
-    u64 start;
-    u32 count, target, mask;
+    uint64_t start;
+    uint32_t count, target, mask, elapsed;
 
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -502,13 +499,10 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     pts->counter_bits = pmtmr_width;
     mask = 0xffffffff >> (32 - pmtmr_width);
 
-    count = inl(pmtmr_ioport) & mask;
+    count = inl(pmtmr_ioport);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
-    if ( target < count )
-        while ( (inl(pmtmr_ioport) & mask) >= count )
-            continue;
-    while ( (inl(pmtmr_ioport) & mask) < target )
+    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
+    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:33:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261380.452499 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD19z-00011Q-Mu; Thu, 27 Jan 2022 09:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261380.452499; Thu, 27 Jan 2022 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 1nD19z-00011I-JY; Thu, 27 Jan 2022 09:33:43 +0000
Received: by outflank-mailman (input) for mailman id 261380;
 Thu, 27 Jan 2022 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 1nD19y-00010X-C2
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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 1nD19y-00048R-BF
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD19y-0001dk-AL
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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=0AisXBF3U7/MCxOUALKbzoWmSssTAydJxhpl/9JnMu8=; b=hRfxBGDBWkps4eltqn+uo9e7H8
	jpWpoH3D62sLjtiIcX17/cjS8Jm9f28h7hepv2Seq6qMnjZagv7GMoqmLA7sZbt9gU6ab+CIn3pzP
	1vAIomFyW+GhCOmkJ/DuwFZaOlHAOOHwaKLSIE93V9HZeFauEVCbidqodfnnO2ruOr/I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/time: improve TSC / CPU freq calibration accuracy
Message-Id: <E1nD19y-0001dk-AL@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:33:42 +0000

commit fd343ec092f3fac828f82d076ffaaca8ed3b61c9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:37:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:37:59 2022 +0100

    x86/time: improve TSC / CPU freq calibration accuracy
    
    While the problem report was for extreme errors, even smaller ones would
    better be avoided: The calculated period to run calibration loops over
    can (and usually will) be shorter than the actual time elapsed between
    first and last platform timer and TSC reads. Adjust values returned from
    the init functions accordingly.
    
    On a Skylake system I've tested this on accuracy (using HPET) went from
    detecting in some cases more than 220kHz too high a value to about
    ±2kHz. On other systems (or on this system, but with PMTMR) the original
    error range was much smaller, with less (in some cases only very little)
    improvement.
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a5c9a80af34eefcd6e31d0ed2b083f452cd9076d
    master date: 2022-01-13 14:31:52 +0100
---
 xen/arch/x86/time.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 84b62f2024..1daff92dca 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -287,6 +287,23 @@ static char *freq_string(u64 freq)
     return s;
 }
 
+static uint64_t adjust_elapsed(uint64_t elapsed, uint32_t actual,
+                               uint32_t target)
+{
+    if ( likely(actual > target) )
+    {
+        /*
+         * A (perhaps significant) delay before the last timer read (e.g. due
+         * to a SMI or NMI) can lead to (perhaps severe) inaccuracy if not
+         * accounting for the time elapsed beyond the originally calculated
+         * duration of the calibration interval.
+         */
+        elapsed = muldiv64(elapsed, target, actual);
+    }
+
+    return elapsed * CALIBRATE_FRAC;
+}
+
 /************************************************************
  * PLATFORM TIMER 1: PROGRAMMABLE INTERVAL TIMER (LEGACY PIT)
  */
@@ -455,7 +472,7 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
     while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static void resume_hpet(struct platform_timesource *pts)
@@ -505,7 +522,7 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static struct platform_timesource __initdata plt_pmtimer =
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:33:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261382.452503 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1A9-00018d-Om; Thu, 27 Jan 2022 09:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261382.452503; Thu, 27 Jan 2022 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 1nD1A9-00018U-LK; Thu, 27 Jan 2022 09:33:53 +0000
Received: by outflank-mailman (input) for mailman id 261382;
 Thu, 27 Jan 2022 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 1nD1A8-000182-FN
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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 1nD1A8-00048d-EY
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1A8-0001eQ-Dc
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 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=D3IMJq66vX9nJXTuHuYRkRwwFsxBsoWKJev9NOZq1V4=; b=wEhyhHEKdFck6vN5FyalVgyIBn
	XEGOH1+t/qiZy07vlGACndv9VFdR1offnK2Gj/JTV19iMfzQrhQfTqqCQ4QfU4a9ye4TSbUTfdpFw
	yI9oxmPcSui4wQDwBoYyutQIfmAhVbai0zEl+niqfd00cbCUPM+ZB+ZgOYwIYWNzDPCM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] libxl/PCI: Fix PV hotplug & stubdom coldplug
Message-Id: <E1nD1A8-0001eQ-Dc@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:33:52 +0000

commit 8509519268ea6a467a97ca7891a0dca2bfe88cf7
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Jan 25 13:38:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:38:14 2022 +0100

    libxl/PCI: Fix PV hotplug & stubdom coldplug
    
    commit 0fdb48ffe7a1 "libxl: Make sure devices added by pci-attach are
    reflected in the config" broken PCI hotplug (xl pci-attach) for PV
    domains when it moved libxl__create_pci_backend() later in the function.
    
    This also broke HVM + stubdom PCI passthrough coldplug.  For that, the
    PCI devices are hotplugged to a running PV stubdom, and then the QEMU
    QMP device_add commands are made to QEMU inside the stubdom.
    
    A running PV domain calls libxl__wait_for_backend().  With the current
    placement of libxl__create_pci_backend(), the path does not exist and
    the call immediately fails:
    libxl: error: libxl_device.c:1388:libxl__wait_for_backend: Backend /local/domain/0/backend/pci/43/0 does not exist
    libxl: error: libxl_pci.c:1764:device_pci_add_done: Domain 42:libxl__device_pci_add failed for PCI device 0:2:0.0 (rc -3)
    libxl: error: libxl_create.c:1857:domcreate_attach_devices: Domain 42:unable to add pci devices
    
    The wait is only relevant when:
    1) The domain is PV
    2) The domain is running
    3) The backend is already present
    
    This is because:
    
    1) xen-pcifront is only used for PV.  It does not load for HVM domains
       where QEMU is used.
    
    2) If the domain is not running (starting), then the frontend state will
       be Initialising.  xen-pciback waits for the frontend to transition to
       at Initialised before attempting to connect.  So a wait for a
       non-running domain is not applicable as the backend will not
       transition to Connected.
    
    3) For presence, num_devs is already used to determine if the backend
       needs to be created.  Re-use num_devs to determine if the backend
       wait is necessary.  The wait is necessary to avoid racing with
       another PCI attachment reconfiguring the front/back or changing to
       some other state like closing.  If we are creating the backend, then
       we don't have to worry about the state since it is being created.
    
    Fixes: 0fdb48ffe7a1 ("libxl: Make sure devices added by pci-attach are
    reflected in the config")
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 73ee2795aaef2cb086ac078bffe1c6b33c0ea91b
    master date: 2022-01-13 14:33:16 +0100
---
 tools/libs/light/libxl_pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 4c2d7aeefb..4bbbfe9f16 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -157,9 +157,11 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc,
     if (domtype == LIBXL_DOMAIN_TYPE_INVALID)
         return ERROR_FAIL;
 
-    if (!starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
-        if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", XenbusStateConnected)) < 0)
-            return ERROR_FAIL;
+    /* Wait is only needed if the backend already exists (num_devs != NULL) */
+    if (num_devs && !starting && domtype == LIBXL_DOMAIN_TYPE_PV) {
+        rc = libxl__wait_for_backend(gc, be_path,
+                                     GCSPRINTF("%d", XenbusStateConnected));
+        if (rc) return rc;
     }
 
     back = flexarray_make(gc, 16, 1);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:34:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261383.452507 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1AJ-0001J7-QK; Thu, 27 Jan 2022 09:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261383.452507; Thu, 27 Jan 2022 09:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1AJ-0001Iz-Mv; Thu, 27 Jan 2022 09:34:03 +0000
Received: by outflank-mailman (input) for mailman id 261383;
 Thu, 27 Jan 2022 09: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 1nD1AI-0001Ib-Jj
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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 1nD1AI-000491-Iq
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1AI-0001fK-Ht
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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=Qqn2sgNRq5vb1eEObZ09FWlUFUpgD5Jvzvoe3Ne3G9I=; b=tKzqQZUdi/C8YGsfJsDPtP9hCT
	4H8f4+S8IL1XfigkI2PvHKPIEoZBvUMNMHY7EJTLszWby2U+jcK6pHIIuHARjbxiheyCL+8cFhd+O
	uuVBAH1iOqHV/brHorcO0H5JGDXrG59F2Id5JP8BWLtHg78xiWu4caTQbS0SAX6QfofA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/guest: Introduce {get,set}_reg() infrastructure
Message-Id: <E1nD1AI-0001fK-Ht@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:34:02 +0000

commit 20b00921f8a62b1b19d893dd468473161706e02d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:38:42 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:38:42 2022 +0100

    x86/guest: Introduce {get,set}_reg() infrastructure
    
    Various registers have per-guest-type or per-vendor locations or access
    requirements.  To support their use from common code, provide accessors which
    allow for per-guest-type behaviour.
    
    For now, just infrastructure handling default cases and expectations.
    Subsequent patches will start handling registers using this infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 88d3ff7ab15da277a85b39735797293fb541c718
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/hvm.c          | 22 ++++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c      | 30 ++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c      | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emulate.c       | 31 +++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h   | 15 +++++++++++++++
 xen/include/asm-x86/pv/domain.h |  4 ++++
 6 files changed, 133 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b680f62892..6820527df0 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3742,6 +3742,28 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_call(hvm_funcs.get_reg, v, reg);
+    }
+}
+
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_vcall(hvm_funcs.set_reg, v, reg, val);
+    }
+}
+
 static bool is_sysdesc_access(const struct x86_emulate_state *state,
                               const struct x86_emulate_ctxt *ctxt)
 {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index f0e10dec04..74b2b0e092 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2469,6 +2469,33 @@ static bool svm_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t svm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
@@ -2518,6 +2545,9 @@ static struct hvm_function_table __initdata svm_function_table = {
     .nhvm_intr_blocked = nsvm_intr_blocked,
     .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
 
+    .get_reg = svm_get_reg,
+    .set_reg = svm_set_reg,
+
     .tsc_scaling = {
         .max_ratio = ~TSC_RATIO_RSVD_BITS,
     },
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d403e2d806..6f81751921 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2404,6 +2404,33 @@ static int vmtrace_reset(struct vcpu *v)
     return 0;
 }
 
+static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2464,6 +2491,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .vmtrace_set_option = vmtrace_set_option,
     .vmtrace_get_option = vmtrace_get_option,
     .vmtrace_reset = vmtrace_reset,
+
+    .get_reg = vmx_get_reg,
+    .set_reg = vmx_set_reg,
+
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e8bb326efd..ae049b60f2 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -90,6 +90,37 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
     }
 }
 
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index bd2cbb0e7b..acc660c001 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -222,6 +222,9 @@ struct hvm_function_table {
     int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
     int (*vmtrace_reset)(struct vcpu *v);
 
+    uint64_t (*get_reg)(struct vcpu *v, unsigned int reg);
+    void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -727,6 +730,18 @@ static inline int hvm_vmtrace_reset(struct vcpu *v)
     return -EOPNOTSUPP;
 }
 
+/*
+ * Accessors for registers which have per-guest-type or per-vendor locations
+ * (e.g. VMCS, msr load/save lists, VMCB, VMLOAD lazy, etc).
+ *
+ * The caller is responsible for all auditing - these accessors do not fail,
+ * but do use domain_crash() for usage errors.
+ *
+ * Must cope with being called in non-current context.
+ */
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg);
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index df9716ff26..3a67816764 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,6 +65,10 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:34:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:34:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261385.452511 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1AT-0001MH-Rd; Thu, 27 Jan 2022 09:34:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261385.452511; Thu, 27 Jan 2022 09:34:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1AT-0001M9-OX; Thu, 27 Jan 2022 09:34:13 +0000
Received: by outflank-mailman (input) for mailman id 261385;
 Thu, 27 Jan 2022 09: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 1nD1AS-0001Lx-N8
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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 1nD1AS-000495-MK
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1AS-0001gI-LS
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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=7lgQqDKKg/Th7uUprebTzEcEuJWDbcJrM9ZNrh4ytlE=; b=0Vw6kkbXWtDxhXi85yFTo0oZ0T
	8W8M8Y+JOqeIxPSsnJ2rG9ghTrcpVCF6mDDI0vBpwrPofciKBVpHGWMjkEfWqmVEnVf1P2TdThAeV
	T9KVn9wPy2ZENhDM7QkhNOsDgFUGDGHT/EqlXytFdsm1O/Bmnhl1SLNI9f0Jptoj6sdc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/msr: Split MSR_SPEC_CTRL handling
Message-Id: <E1nD1AS-0001gI-LS@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:34:12 +0000

commit cc6fe1bb13197ddc79af480c3c74ce6d6ed3ef2c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:39:16 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:39:16 2022 +0100

    x86/msr: Split MSR_SPEC_CTRL handling
    
    In order to fix a VT-x bug, and support MSR_SPEC_CTRL on AMD, move
    MSR_SPEC_CTRL handling into the new {pv,hvm}_{get,set}_reg() infrastructure.
    
    Duplicate the msrs->spec_ctrl.raw accesses in the PV and VT-x paths for now.
    The SVM path is currently unreachable because of the CPUID policy.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6536688439dbca1d08fd6db5be29c39e3917fb2f
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c |  7 +++++++
 xen/arch/x86/msr.c         | 22 +++++++++++++++++-----
 xen/arch/x86/pv/emulate.c  |  9 +++++++++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 6f81751921..b4df456d62 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2410,6 +2410,9 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return v->arch.msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -2424,6 +2427,10 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        v->arch.msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index b834456c7b..71cbfa8ee3 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -28,6 +28,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/pv/domain.h>
 #include <asm/setup.h>
 
 #include <public/hvm/params.h>
@@ -265,8 +266,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_SPEC_CTRL:
         if ( !cp->feat.ibrsb )
             goto gp_fault;
-        *val = msrs->spec_ctrl.raw;
-        break;
+        goto get_reg;
 
     case MSR_INTEL_PLATFORM_INFO:
         *val = mp->platform_info.raw;
@@ -424,6 +424,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     return ret;
 
+ get_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        *val = pv_get_reg(v, msr);
+    else
+        *val = hvm_get_reg(v, msr);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
@@ -513,9 +520,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
         if ( val & rsvd )
             goto gp_fault; /* Rsvd bit set? */
-
-        msrs->spec_ctrl.raw = val;
-        break;
+        goto set_reg;
 
     case MSR_PRED_CMD:
         if ( !cp->feat.ibrsb && !cp->extd.ibpb )
@@ -663,6 +668,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
     return ret;
 
+ set_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        pv_set_reg(v, msr, val);
+    else
+        hvm_set_reg(v, msr, val);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index ae049b60f2..0a7907ec5e 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -92,12 +92,16 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 
 uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -108,12 +112,17 @@ uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 
 void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:34:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:34:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261386.452515 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1Ad-0001RH-UY; Thu, 27 Jan 2022 09:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261386.452515; Thu, 27 Jan 2022 09: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 1nD1Ad-0001RA-RU; Thu, 27 Jan 2022 09:34:23 +0000
Received: by outflank-mailman (input) for mailman id 261386;
 Thu, 27 Jan 2022 09: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 1nD1Ac-0001Qv-QX
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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 1nD1Ac-00049B-Pl
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1Ac-0001hX-Oq
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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=BiRjcbmKmpvY+DKFarJMspVj5ZtPKaeh4psTLsBfoOo=; b=ci6Y5/lm4kfPxH1bQieqb+O8MC
	Lw05Ho/irYpvRCnYeetR6+likcaw+KWb3OE5jqkrEf2JG7bMrKaxjunltf1lMH4E9Tn1+7t2oWLSo
	nLXoea3UpuJ3GHRyRf9Oan4JIeycCfmjk6ZrQ/bOkneiyvgxjyQU4UyNEoJv5SZmhOPw=;
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: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
Message-Id: <E1nD1Ac-0001hX-Oq@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:34:22 +0000

commit 21d70feed10571543061abeaedd21ce8adc60114
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:39:31 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:39:31 2022 +0100

    x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
    
    These were written before Spectre/Meltdown went public, and there was large
    uncertainty in how the protections would evolve.  As it turns out, they're
    very specific to Intel hardware, and not very suitable for AMD.
    
    Drop the macros, opencoding the relevant subset of functionality, and leaving
    grep-fodder to locate the logic.  No change at all for VT-x.
    
    For AMD, the only relevant piece of functionality is DO_OVERWRITE_RSB,
    although we will soon be adding (different) logic to handle MSR_SPEC_CTRL.
    
    This has a marginal improvement of removing an unconditional pile of long-nops
    from the vmentry/exit path.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 95b13fa43e0753b7514bef13abe28253e8614f62
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/svm/entry.S        |  5 +++--
 xen/arch/x86/hvm/vmx/entry.S        |  8 ++++++--
 xen/include/asm-x86/spec_ctrl_asm.h | 19 ++++---------------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index e208a4b32a..276215d36a 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -59,7 +59,7 @@ __UNLIKELY_END(nsvm_hap)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
 
         pop  %r15
         pop  %r14
@@ -86,7 +86,8 @@ __UNLIKELY_END(nsvm_hap)
 
         GET_CURRENT(bx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: ac  */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         stgi
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 27c8c5ca49..30139ae58e 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -33,7 +33,9 @@ ENTRY(vmx_asm_vmexit_handler)
         movb $1,VCPU_vmx_launched(%rbx)
         mov  %rax,VCPU_hvm_guest_cr2(%rbx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
+        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -80,7 +82,9 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
 
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index cb34299a86..2b3f123cb5 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -68,14 +68,16 @@
  *
  * The following ASM fragments implement this algorithm.  See their local
  * comments for further details.
- *  - SPEC_CTRL_ENTRY_FROM_HVM
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
  *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
- *  - SPEC_CTRL_EXIT_TO_HVM
+ *
+ * Additionally, the following grep-fodder exists to find the HVM logic.
+ *  - SPEC_CTRL_ENTRY_FROM_{SVM,VMX}
+ *  - SPEC_CTRL_EXIT_TO_{SVM,VMX}
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
@@ -225,12 +227,6 @@
     wrmsr
 .endm
 
-/* Use after a VMEXIT from an HVM guest. */
-#define SPEC_CTRL_ENTRY_FROM_HVM                                        \
-    ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM;           \
-    ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM,                        \
-        X86_FEATURE_SC_MSR_HVM
-
 /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */
 #define SPEC_CTRL_ENTRY_FROM_PV                                         \
     ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_PV;            \
@@ -255,13 +251,6 @@
     ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
         X86_FEATURE_SC_VERW_PV
 
-/* Use when exiting to HVM guest context. */
-#define SPEC_CTRL_EXIT_TO_HVM                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM;             \
-    ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
-        X86_FEATURE_SC_VERW_HVM
-
 /*
  * Use in IST interrupt/exception context.  May interrupt Xen or PV context.
  * Fine grain control of SCF_ist_wrmsr is needed for safety in the S3 resume
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:34:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261387.452519 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1Ao-0001Um-0G; Thu, 27 Jan 2022 09:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261387.452519; Thu, 27 Jan 2022 09: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 1nD1An-0001Uc-TG; Thu, 27 Jan 2022 09:34:33 +0000
Received: by outflank-mailman (input) for mailman id 261387;
 Thu, 27 Jan 2022 09:34:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1Am-0001UM-Ty
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1Am-00049L-T7
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1Am-0001ic-SJ
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IIBiGnsFxx+I0RbnYo4zQVbVtoeQQmgXFFYYVfa+Jjs=; b=vIrg4mddKM6EfJKQ5k/2VrzDdt
	KNa3CLFTEITrW8qVDzG/Y3GeAnpq/IObbFvipfNtCV+lXfekPzQtnSaCjTY0lkhvQNOqp1I3zlTeH
	lt3Iv1p2CsxgXIQxmb69Re4EyYzde7OHK3xHecttV6giBM78sKEhwJkBCyc4qbUalM5U=;
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: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
Message-Id: <E1nD1Am-0001ic-SJ@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:34:32 +0000

commit d3cb5470292eeff776e0c95a7f1e1c9e427d6425
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:39:44 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:39:44 2022 +0100

    x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
    
    The logic was based on a mistaken understanding of how NMI blocking on vmexit
    works.  NMIs are only blocked for EXIT_REASON_NMI, and not for general exits.
    Therefore, an NMI can in general hit early in the vmx_asm_vmexit_handler path,
    and the guest's value will be clobbered before it is saved.
    
    Switch to using MSR load/save lists.  This causes the guest value to be saved
    atomically with respect to NMIs/MCEs/etc.
    
    First, update vmx_cpuid_policy_changed() to configure the load/save lists at
    the same time as configuring the intercepts.  This function is always used in
    remote context, so extend the vmx_vmcs_{enter,exit}() block to cover the whole
    function, rather than having multiple remote acquisitions of the same VMCS.
    
    Both of vmx_{add,del}_guest_msr() can fail.  The -ESRCH delete case is fine,
    but all others are fatal to the running of the VM, so handle them using
    domain_crash() - this path is only used during domain construction anyway.
    
    Second, update vmx_{get,set}_reg() to use the MSR load/save lists rather than
    vcpu_msrs, and update the vcpu_msrs comment to describe the new state
    location.
    
    Finally, adjust the entry/exit asm.
    
    Because the guest value is saved and loaded atomically, we do not need to
    manually load the guest value, nor do we need to enable SCF_use_shadow.  This
    lets us remove the use of DO_SPEC_CTRL_EXIT_TO_GUEST.  Additionally,
    SPEC_CTRL_ENTRY_FROM_PV gets removed too, because on an early entry failure,
    we're no longer in the guest MSR_SPEC_CTRL context needing to switch back to
    Xen's context.
    
    The only action remaining is to load Xen's MSR_SPEC_CTRL value on vmexit.  We
    could in principle use the host msr list, but is expected to complicated
    future work.  Delete DO_SPEC_CTRL_ENTRY_FROM_HVM entirely, and use a shorter
    code sequence to simply reload Xen's setting from the top-of-stack block.
    
    Adjust the comment at the top of spec_ctrl_asm.h in light of this bugfix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f0eaadf84d273a6ff8df3660b874a02d0e7677
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/entry.S        | 22 ++++++++++++-------
 xen/arch/x86/hvm/vmx/vmx.c          | 44 ++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/msr.h           | 10 ++++++++-
 xen/include/asm-x86/spec_ctrl_asm.h | 32 ++++-----------------------
 4 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 30139ae58e..7ee3382fd0 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -35,7 +35,14 @@ ENTRY(vmx_asm_vmexit_handler)
 
         /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
-        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
+
+        .macro restore_spec_ctrl
+            mov    $MSR_SPEC_CTRL, %ecx
+            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            xor    %edx, %edx
+            wrmsr
+        .endm
+        ALTERNATIVE "", restore_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -82,8 +89,7 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
-        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: %rsp=regs/cpuinfo              Clob:    */
         ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
@@ -119,12 +125,12 @@ UNLIKELY_END(realmode)
         SAVE_ALL
 
         /*
-         * PV variant needed here as no guest code has executed (so
-         * MSR_SPEC_CTRL can't have changed value), and NMIs/MCEs are liable
-         * to hit (in which case the HVM variant might corrupt things).
+         * SPEC_CTRL_ENTRY notes
+         *
+         * If we end up here, no guest code has executed.  The MSR lists have
+         * not been processed, so we still have Xen's choice of MSR_SPEC_CTRL
+         * in context, and the RSB is unchanged.
          */
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b4df456d62..a555930f8f 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -592,6 +592,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)
 static void vmx_cpuid_policy_changed(struct vcpu *v)
 {
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
+    int rc = 0;
 
     if ( opt_hvm_fep ||
          (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
@@ -601,17 +602,29 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
 
     /*
      * We can safely pass MSR_SPEC_CTRL through to the guest, even if STIBP
      * isn't enumerated in hardware, as SPEC_CTRL_STIBP is ignored.
      */
     if ( cp->feat.ibrsb )
+    {
         vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
+
+        rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
+        if ( rc )
+            goto out;
+    }
     else
+    {
         vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
 
+        rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
+        if ( rc && rc != -ESRCH )
+            goto out;
+        rc = 0; /* Tolerate -ESRCH */
+    }
+
     /* MSR_PRED_CMD is safe to pass through if the guest knows about it. */
     if ( cp->feat.ibrsb || cp->extd.ibpb )
         vmx_clear_msr_intercept(v, MSR_PRED_CMD,  VMX_MSR_RW);
@@ -623,6 +636,15 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
         vmx_clear_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
+
+ out:
+    vmx_vmcs_exit(v);
+
+    if ( rc )
+    {
+        printk(XENLOG_G_ERR "%pv MSR list error: %d", v, rc);
+        domain_crash(v->domain);
+    }
 }
 
 int vmx_guest_x86_mode(struct vcpu *v)
@@ -2407,11 +2429,20 @@ static int vmtrace_reset(struct vcpu *v)
 static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     struct domain *d = v->domain;
+    uint64_t val = 0;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        return v->arch.msrs->spec_ctrl.raw;
+        rc = vmx_read_guest_msr(v, reg, &val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
+        return val;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
@@ -2424,11 +2455,18 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     struct domain *d = v->domain;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        v->arch.msrs->spec_ctrl.raw = val;
+        rc = vmx_write_guest_msr(v, reg, val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
         break;
 
     default:
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 1d3eca9063..10039c2d22 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -287,7 +287,15 @@ extern struct msr_policy     raw_msr_policy,
 /* Container object for per-vCPU MSRs */
 struct vcpu_msrs
 {
-    /* 0x00000048 - MSR_SPEC_CTRL */
+    /*
+     * 0x00000048 - MSR_SPEC_CTRL
+     *
+     * For PV guests, this holds the guest kernel value.  It is accessed on
+     * every entry/exit path.
+     *
+     * For VT-x guests, the guest value is held in the MSR guest load/save
+     * list.
+     */
     struct {
         uint32_t raw;
     } spec_ctrl;
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index 2b3f123cb5..bf82528a12 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -42,9 +42,10 @@
  *     path, or late in the exit path after restoring the guest value.  This
  *     will corrupt the guest value.
  *
- * Factor 1 is dealt with by relying on NMIs/MCEs being blocked immediately
- * after VMEXIT.  The VMEXIT-specific code reads MSR_SPEC_CTRL and updates
- * current before loading Xen's MSR_SPEC_CTRL setting.
+ * Factor 1 is dealt with:
+ *   - On VMX by using MSR load/save lists to have vmentry/exit atomically
+ *     load/save the guest value.  Xen's value is loaded in regular code, and
+ *     there is no need to use the shadow logic (below).
  *
  * Factor 2 is harder.  We maintain a shadow_spec_ctrl value, and a use_shadow
  * boolean in the per cpu spec_ctrl_flags.  The synchronous use is:
@@ -128,31 +129,6 @@
 #endif
 .endm
 
-.macro DO_SPEC_CTRL_ENTRY_FROM_HVM
-/*
- * Requires %rbx=current, %rsp=regs/cpuinfo
- * Clobbers %rax, %rcx, %rdx
- *
- * The common case is that a guest has direct access to MSR_SPEC_CTRL, at
- * which point we need to save the guest value before setting IBRS for Xen.
- * Unilaterally saving the guest value is shorter and faster than checking.
- */
-    mov $MSR_SPEC_CTRL, %ecx
-    rdmsr
-
-    /* Stash the value from hardware. */
-    mov VCPU_arch_msrs(%rbx), %rdx
-    mov %eax, VCPUMSR_spec_ctrl_raw(%rdx)
-    xor %edx, %edx
-
-    /* Clear SPEC_CTRL shadowing *before* loading Xen's value. */
-    andb $~SCF_use_shadow, CPUINFO_spec_ctrl_flags(%rsp)
-
-    /* Load Xen's intended value. */
-    movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-    wrmsr
-.endm
-
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:34:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:34:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261388.452523 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1Az-0001Yd-1q; Thu, 27 Jan 2022 09:34:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261388.452523; Thu, 27 Jan 2022 09: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 1nD1Ay-0001YU-Uy; Thu, 27 Jan 2022 09:34:44 +0000
Received: by outflank-mailman (input) for mailman id 261388;
 Thu, 27 Jan 2022 09: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 1nD1Ax-0001Y4-0o
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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 1nD1Ax-00049x-02
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1Aw-0001jw-VX
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vZCFwpojG/9yXd2VpvVcNpV3/+LHP4zfy7GUtZLJWSY=; b=pdMWL/uZGvlIjlM2Vws6ENfGVt
	ajZo1+nOGXGsGjhURqxO7rahisW8VbLlS/05X0oUDDiQkCSJCDhH24rQEj0vZbPgNAFuEDq2HncdS
	BMl4hytThm18yNSCPIEi8PWi63Rujmarc39Z/9MgCsON/DnCBlpk4gaF5F+q7r3YpGG4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86: Fix build with the get/set_reg() infrastructure
Message-Id: <E1nD1Aw-0001jw-VX@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:34:42 +0000

commit fc87b55a3429961eeece0e6f4a103a23700b1ff4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 26 12:17:04 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:17:04 2022 +0100

    x86: Fix build with the get/set_reg() infrastructure
    
    I clearly messed up concluding that the stubs were safe to drop.
    
    The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
    and CONFIG_HVM.  As a result logic of the form `if ( pv/hvm ) ... else ...`
    will always have one side which can't be DCE'd.
    
    While technically only the hvm stubs are needed, due to the use of the
    is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
    avoid leaving a bear trap for future users.
    
    Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13caa585791234fe3e3719c8376f7ea731012451
    master date: 2022-01-21 12:42:11 +0000
---
 xen/include/asm-x86/hvm/hvm.h   | 10 ++++++++++
 xen/include/asm-x86/pv/domain.h | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index acc660c001..45b6ebecdc 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -865,6 +865,16 @@ static inline int hvm_vmtrace_get_option(
     return -EOPNOTSUPP;
 }
 
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, unsigned long cr4);
 /* Create a cr4 value to load into hardware, based on vcpu settings. */
 unsigned long pv_make_cr4(const struct vcpu *v);
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 bool xpti_pcid_enabled(void);
 
 #else  /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; }
 
 static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
 
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #endif	/* CONFIG_PV */
 
 void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 09:34:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 09:34:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261389.452526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD1B9-0001bU-3H; Thu, 27 Jan 2022 09:34:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261389.452526; Thu, 27 Jan 2022 09: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 1nD1B9-0001bM-0I; Thu, 27 Jan 2022 09:34:55 +0000
Received: by outflank-mailman (input) for mailman id 261389;
 Thu, 27 Jan 2022 09: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 1nD1B7-0001b6-4E
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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 1nD1B7-0004A9-3V
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD1B7-0001l1-2R
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 09: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=Bwsx3m8Orgnp30+ffBJxvf2ZomX9bGcz42ie7b4OtzI=; b=yJeRP1yaUh5EaxopLn8T1BoG+W
	SDNm4tHx6Wc5CerCPeUUfvruSeWGrTakpYM69hb4VX8vm3WO5DpaikGY97IfTq8goxfF1Lqxqf3+c
	FOw9i2kdk07est7BxY/j9J9rLEiNfAcQVlaRSYBelmQmZ+ZjFllNrAc/MZ1dggyWpFCo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/pvh: fix population of the low 1MB for dom0
Message-Id: <E1nD1B7-0001l1-2R@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 09:34:53 +0000

commit 8abb345e6b5c11b79d1a032533130ea6c5519435
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jan 26 12:18:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:18:07 2022 +0100

    x86/pvh: fix population of the low 1MB for dom0
    
    RMRRs are setup ahead of populating the p2m and hence the ASSERT when
    populating the low 1MB needs to be relaxed when it finds an existing
    entry: it's either RAM or a RMRR resulting from the IOMMU setup.
    
    Rework the logic a bit and introduce a local mfn variable in order to
    assert that if the gfn is populated and not RAM it is an identity map.
    
    Fixes: 6b4f6a31ac ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2d5fc9120d556ec3c4b1acf0ab5660a6d3f7ebeb
    master date: 2022-01-25 10:52:24 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 43e1bf1248..8048987286 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -465,11 +465,16 @@ static int __init pvh_populate_p2m(struct domain *d)
     for ( i = rc = 0; i < MB1_PAGES; ++i )
     {
         p2m_type_t p2mt;
+        mfn_t mfn = get_gfn_query(d, i, &p2mt);
 
-        if ( mfn_eq(get_gfn_query(d, i, &p2mt), INVALID_MFN) )
+        if ( mfn_eq(mfn, INVALID_MFN) )
             rc = set_mmio_p2m_entry(d, _gfn(i), _mfn(i), PAGE_ORDER_4K);
         else
-            ASSERT(p2mt == p2m_ram_rw);
+            /*
+             * If the p2m entry is already set it must belong to a RMRR and
+             * already be identity mapped, or be a RAM region.
+             */
+            ASSERT(p2mt == p2m_ram_rw || mfn_eq(mfn, _mfn(i)));
         put_gfn(d, i);
         if ( rc )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:44:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261443.452686 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48E-0001zd-7e; Thu, 27 Jan 2022 12:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261443.452686; Thu, 27 Jan 2022 12:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48E-0001zV-4b; Thu, 27 Jan 2022 12:44:06 +0000
Received: by outflank-mailman (input) for mailman id 261443;
 Thu, 27 Jan 2022 12:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48D-0001zP-B2
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44: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 1nD48D-0007qR-99
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48D-0000Zk-81
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CuIL9uLXPXio8NrQEP7A4sMmH+aQEeoe0LzLJNrm6ok=; b=g5DMQB4wR525pPsSgbo17VNB6u
	apJ+TwrXZr80j05wU4Xu80kfVOL7GwTcaczt1XroEc4l1wr7y4OqFFjya8rhsh9HG6GwYbTJyhfAd
	9xPnSP6t1RrILv6i6ZIOnssg5pqaiQu4DQq48ekRt0cRnc90/VAvwasPTKttE7LVizos=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Remove all unused register definitions
Message-Id: <E1nD48D-0000Zk-81@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:44:05 +0000

commit cf61c9378df6cdd26300d5ecabc2576aeae81c67
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:48 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:18 2022 +0000

    iommu/ipmmu-vmsa: Remove all unused register definitions
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    77cf983892b2e0d40dc256b784930a9ffaad4fc8
    
    Original commit message:
     commit 77cf983892b2e0d40dc256b784930a9ffaad4fc8
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:45 2019 +0900
    
      iommu/ipmmu-vmsa: Remove all unused register definitions
    
      To support different registers memory mapping hardware easily
      in the future, this patch removes all unused register
      definitions.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Although Linux and Xen drivers have a lot in common, the main
    differences are in translation stages (table formats), VMSAv8 modes,
    supported SoC generations, etc, therefore that's why there is
    a slight difference in registers/bits each driver considers unused.
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 59 ++------------------------------
 1 file changed, 2 insertions(+), 57 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 1255b0d4fe..4a8a974442 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -166,15 +166,11 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 
 #define IMCTR                0x0000
 /*
- * These fields are implemented in IPMMU-MM only. So, can be set for
+ * This field is implemented in IPMMU-MM only. So, can be set for
  * Root IPMMU only.
  */
 #define IMCTR_VA64           (1 << 29)
-#define IMCTR_TRE            (1 << 17)
-#define IMCTR_AFE            (1 << 16)
-#define IMCTR_RTSEL_MASK     (3 << 4)
-#define IMCTR_RTSEL_SHIFT    4
-#define IMCTR_TREN           (1 << 3)
+
 /*
  * These fields are common for all IPMMU devices. So, can be set for
  * Cache IPMMUs as well.
@@ -184,42 +180,9 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMCTR_MMUEN          (1 << 0)
 #define IMCTR_COMMON_MASK    (7 << 0)
 
-#define IMCAAR               0x0004
-
 #define IMTTBCR                        0x0008
 #define IMTTBCR_EAE                    (1U << 31)
 #define IMTTBCR_PMB                    (1 << 30)
-#define IMTTBCR_SH1_NON_SHAREABLE      (0 << 28)
-#define IMTTBCR_SH1_OUTER_SHAREABLE    (2 << 28)
-#define IMTTBCR_SH1_INNER_SHAREABLE    (3 << 28)
-#define IMTTBCR_SH1_MASK               (3 << 28)
-#define IMTTBCR_ORGN1_NC               (0 << 26)
-#define IMTTBCR_ORGN1_WB_WA            (1 << 26)
-#define IMTTBCR_ORGN1_WT               (2 << 26)
-#define IMTTBCR_ORGN1_WB               (3 << 26)
-#define IMTTBCR_ORGN1_MASK             (3 << 26)
-#define IMTTBCR_IRGN1_NC               (0 << 24)
-#define IMTTBCR_IRGN1_WB_WA            (1 << 24)
-#define IMTTBCR_IRGN1_WT               (2 << 24)
-#define IMTTBCR_IRGN1_WB               (3 << 24)
-#define IMTTBCR_IRGN1_MASK             (3 << 24)
-#define IMTTBCR_TSZ1_MASK              (0x1f << 16)
-#define IMTTBCR_TSZ1_SHIFT             16
-#define IMTTBCR_SH0_NON_SHAREABLE      (0 << 12)
-#define IMTTBCR_SH0_OUTER_SHAREABLE    (2 << 12)
-#define IMTTBCR_SH0_INNER_SHAREABLE    (3 << 12)
-#define IMTTBCR_SH0_MASK               (3 << 12)
-#define IMTTBCR_ORGN0_NC               (0 << 10)
-#define IMTTBCR_ORGN0_WB_WA            (1 << 10)
-#define IMTTBCR_ORGN0_WT               (2 << 10)
-#define IMTTBCR_ORGN0_WB               (3 << 10)
-#define IMTTBCR_ORGN0_MASK             (3 << 10)
-#define IMTTBCR_IRGN0_NC               (0 << 8)
-#define IMTTBCR_IRGN0_WB_WA            (1 << 8)
-#define IMTTBCR_IRGN0_WT               (2 << 8)
-#define IMTTBCR_IRGN0_WB               (3 << 8)
-#define IMTTBCR_IRGN0_MASK             (3 << 8)
-#define IMTTBCR_SL0_LVL_2              (0 << 6)
 #define IMTTBCR_SL0_LVL_1              (1 << 6)
 #define IMTTBCR_TSZ0_MASK              (0x1f << 0)
 #define IMTTBCR_TSZ0_SHIFT             0
@@ -228,18 +191,8 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMTTLBR0_TTBR_MASK    (0xfffff << 12)
 #define IMTTUBR0              0x0014
 #define IMTTUBR0_TTBR_MASK    (0xff << 0)
-#define IMTTLBR1              0x0018
-#define IMTTLBR1_TTBR_MASK    (0xfffff << 12)
-#define IMTTUBR1              0x001c
-#define IMTTUBR1_TTBR_MASK    (0xff << 0)
 
 #define IMSTR                          0x0020
-#define IMSTR_ERRLVL_MASK              (3 << 12)
-#define IMSTR_ERRLVL_SHIFT             12
-#define IMSTR_ERRCODE_TLB_FORMAT       (1 << 8)
-#define IMSTR_ERRCODE_ACCESS_PERM      (4 << 8)
-#define IMSTR_ERRCODE_SECURE_ACCESS    (5 << 8)
-#define IMSTR_ERRCODE_MASK             (7 << 8)
 #define IMSTR_MHIT                     (1 << 4)
 #define IMSTR_ABORT                    (1 << 2)
 #define IMSTR_PF                       (1 << 1)
@@ -251,11 +204,7 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUCTR(n)              ((n) < 32 ? IMUCTR0(n) : IMUCTR32(n))
 #define IMUCTR0(n)             (0x0300 + ((n) * 16))
 #define IMUCTR32(n)            (0x0600 + (((n) - 32) * 16))
-#define IMUCTR_FIXADDEN        (1U << 31)
-#define IMUCTR_FIXADD_MASK     (0xff << 16)
-#define IMUCTR_FIXADD_SHIFT    16
 #define IMUCTR_TTSEL_MMU(n)    ((n) << 4)
-#define IMUCTR_TTSEL_PMB       (8 << 4)
 #define IMUCTR_TTSEL_MASK      (15 << 4)
 #define IMUCTR_TTSEL_SHIFT     4
 #define IMUCTR_FLUSH           (1 << 1)
@@ -264,10 +213,6 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUASID(n)             ((n) < 32 ? IMUASID0(n) : IMUASID32(n))
 #define IMUASID0(n)            (0x0308 + ((n) * 16))
 #define IMUASID32(n)           (0x0608 + (((n) - 32) * 16))
-#define IMUASID_ASID8_MASK     (0xff << 8)
-#define IMUASID_ASID8_SHIFT    8
-#define IMUASID_ASID0_MASK     (0xff << 0)
-#define IMUASID_ASID0_SHIFT    0
 
 #define IMSAUXCTLR          0x0504
 #define IMSAUXCTLR_S2PTE    (1 << 3)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:44:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261444.452690 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48O-00021Q-8x; Thu, 27 Jan 2022 12:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261444.452690; Thu, 27 Jan 2022 12:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48O-00021I-64; Thu, 27 Jan 2022 12:44:16 +0000
Received: by outflank-mailman (input) for mailman id 261444;
 Thu, 27 Jan 2022 12:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48N-00021A-Dc
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44: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 1nD48N-0007qX-Cp
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48N-0000b2-Ba
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U7SzWDRsuA+bpSXK6UM1JR8o807xyL4yMVqo7cvitZE=; b=vVv85JOn+b027Rci6/tXcsdwZP
	/YaUTtCy5I4n6iNY2O9noUVAGl0cCvDRZ7to48ZSZ/patniQCu21tT1tNOpry027Y978snaBei/gu
	6nXGFMrxlK6zu2sj9sOzNyoUavNRDzJM1PY0A6Q4ykgGHRytC3edrJc6MlEs0Bw57QyM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
Message-Id: <E1nD48N-0000b2-Ba@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:44:15 +0000

commit cbba37c8a3d07ae3b17eee7e4aaadfb23cf4feec
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:49 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:30 2022 +0000

    iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    16d9454f5e0447f9c19cbf350b35ed377b9f64eb
    
    Original commit message:
     commit 16d9454f5e0447f9c19cbf350b35ed377b9f64eb
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:47 2019 +0900
    
      iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
    
      Since we will have changed memory mapping of the IPMMU in the future,
      This patch adds helper functions ipmmu_ctx_{reg,read,write}()
      for MMU "context" registers. No behavior change.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Besides changes done in the original commit, we also need to update
    an extra call sites which Linux driver doesn't have, but Xen driver
    has such as ipmmu_ctx_write_cache(), etc.
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 4a8a974442..ce5c3bc1e0 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -307,18 +307,35 @@ static void ipmmu_write(struct ipmmu_vmsa_device *mmu, uint32_t offset,
     writel(data, mmu->base + offset);
 }
 
+static unsigned int ipmmu_ctx_reg(struct ipmmu_vmsa_device *mmu,
+                                  unsigned int context_id, uint32_t reg)
+{
+    return context_id * IM_CTX_SIZE + reg;
+}
+
+static uint32_t ipmmu_ctx_read(struct ipmmu_vmsa_device *mmu,
+                               unsigned int context_id, uint32_t reg)
+{
+    return ipmmu_read(mmu, ipmmu_ctx_reg(mmu, context_id, reg));
+}
+
+static void ipmmu_ctx_write(struct ipmmu_vmsa_device *mmu,
+                            unsigned int context_id, uint32_t reg,
+                            uint32_t data)
+{
+    ipmmu_write(mmu, ipmmu_ctx_reg(mmu, context_id, reg), data);
+}
+
 static uint32_t ipmmu_ctx_read_root(struct ipmmu_vmsa_domain *domain,
                                     uint32_t reg)
 {
-    return ipmmu_read(domain->mmu->root,
-                      domain->context_id * IM_CTX_SIZE + reg);
+    return ipmmu_ctx_read(domain->mmu->root, domain->context_id, reg);
 }
 
 static void ipmmu_ctx_write_root(struct ipmmu_vmsa_domain *domain,
                                  uint32_t reg, uint32_t data)
 {
-    ipmmu_write(domain->mmu->root,
-                domain->context_id * IM_CTX_SIZE + reg, data);
+    ipmmu_ctx_write(domain->mmu->root, domain->context_id, reg, data);
 }
 
 static void ipmmu_ctx_write_cache(struct ipmmu_vmsa_domain *domain,
@@ -329,8 +346,8 @@ static void ipmmu_ctx_write_cache(struct ipmmu_vmsa_domain *domain,
 
     /* Mask fields which are implemented in IPMMU-MM only. */
     if ( !ipmmu_is_root(domain->mmu) )
-        ipmmu_write(domain->mmu, domain->context_id * IM_CTX_SIZE + reg,
-                    data & IMCTR_COMMON_MASK);
+        ipmmu_ctx_write(domain->mmu, domain->context_id, reg,
+                        data & IMCTR_COMMON_MASK);
 }
 
 /*
@@ -693,7 +710,7 @@ static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
 
     /* Disable all contexts. */
     for ( i = 0; i < mmu->num_ctx; ++i )
-        ipmmu_write(mmu, i * IM_CTX_SIZE + IMCTR, 0);
+        ipmmu_ctx_write(mmu, i, IMCTR, 0);
 }
 
 /* R-Car Gen3 SoCs product and cut information. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:44:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261445.452694 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48Y-00024k-BR; Thu, 27 Jan 2022 12:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261445.452694; Thu, 27 Jan 2022 12:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48Y-00024Z-7s; Thu, 27 Jan 2022 12:44:26 +0000
Received: by outflank-mailman (input) for mailman id 261445;
 Thu, 27 Jan 2022 12:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48X-00024J-HP
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44: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 1nD48X-0007qn-Ge
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48X-0000cI-F7
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+khhnTtyxfbgrBWVzxseASwWVTNHArSIFAR34CbTdJE=; b=wMvKF3NkZoXne3/nG9cGafspGg
	i8rIM2xDzydtBf91cCWzilob/AvCMATpr4z2HJb9OhKtbm+OI3wcDCv8sTSo2neaPzciGOkC/XNAY
	KSIfVpPeDmlAgiHzPcS67DGF68zQnl02lFyEL1ea+D8S0Qy8RDetJ/4lp4VVgxcPB7EE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
Message-Id: <E1nD48X-0000cI-F7@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:44:25 +0000

commit a23e7a88bcf2471704db1b4948a39916886cc899
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:50 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:37 2022 +0000

    iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    3667c9978b2911dc1ded77f5971df477885409c4
    
    Original commit message:
     commit 3667c9978b2911dc1ded77f5971df477885409c4
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:49 2019 +0900
    
      iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
    
      Since we will have changed memory mapping of the IPMMU in the future,
      This patch adds helper functions ipmmu_utlb_reg() and
      ipmmu_imu{asid,ctr}_write() for "uTLB" registers. No behavior change.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Besides changes done in the original commit, we also need to introduce
    ipmmu_imuctr_read() since Xen driver contains an additional logic in
    ipmmu_utlb_enable() to prevent the use cases where devices which use
    the same micro-TLB are assigned to different Xen domains.
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 33 +++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index ce5c3bc1e0..1b94af245f 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -366,6 +366,29 @@ static void ipmmu_ctx_write_all(struct ipmmu_vmsa_domain *domain,
     ipmmu_ctx_write_root(domain, reg, data);
 }
 
+static uint32_t ipmmu_utlb_reg(struct ipmmu_vmsa_device *mmu, uint32_t reg)
+{
+    return reg;
+}
+
+static void ipmmu_imuasid_write(struct ipmmu_vmsa_device *mmu,
+                                unsigned int utlb, uint32_t data)
+{
+    ipmmu_write(mmu, ipmmu_utlb_reg(mmu, IMUASID(utlb)), data);
+}
+
+static void ipmmu_imuctr_write(struct ipmmu_vmsa_device *mmu,
+                               unsigned int utlb, uint32_t data)
+{
+    ipmmu_write(mmu, ipmmu_utlb_reg(mmu, IMUCTR(utlb)), data);
+}
+
+static uint32_t ipmmu_imuctr_read(struct ipmmu_vmsa_device *mmu,
+                                  unsigned int utlb)
+{
+    return ipmmu_read(mmu, ipmmu_utlb_reg(mmu, IMUCTR(utlb)));
+}
+
 /* TLB and micro-TLB Management */
 
 /* Wait for any pending TLB invalidations to complete. */
@@ -413,7 +436,7 @@ static int ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain,
      * context_id for already enabled micro-TLB and prevent different context
      * bank from being set.
      */
-    imuctr = ipmmu_read(mmu, IMUCTR(utlb));
+    imuctr = ipmmu_imuctr_read(mmu, utlb);
     if ( imuctr & IMUCTR_MMUEN )
     {
         unsigned int context_id;
@@ -431,9 +454,9 @@ static int ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain,
      * TODO: Reference-count the micro-TLB as several bus masters can be
      * connected to the same micro-TLB.
      */
-    ipmmu_write(mmu, IMUASID(utlb), 0);
-    ipmmu_write(mmu, IMUCTR(utlb), imuctr |
-                IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_MMUEN);
+    ipmmu_imuasid_write(mmu, utlb, 0);
+    ipmmu_imuctr_write(mmu, utlb, imuctr |
+                       IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_MMUEN);
 
     return 0;
 }
@@ -444,7 +467,7 @@ static void ipmmu_utlb_disable(struct ipmmu_vmsa_domain *domain,
 {
     struct ipmmu_vmsa_device *mmu = domain->mmu;
 
-    ipmmu_write(mmu, IMUCTR(utlb), 0);
+    ipmmu_imuctr_write(mmu, utlb, 0);
 }
 
 /* Domain/Context Management */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:44:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261446.452698 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48i-00027z-CD; Thu, 27 Jan 2022 12:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261446.452698; Thu, 27 Jan 2022 12:44:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48i-00027r-9N; Thu, 27 Jan 2022 12:44:36 +0000
Received: by outflank-mailman (input) for mailman id 261446;
 Thu, 27 Jan 2022 12:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48h-00027l-Ki
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44: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 1nD48h-0007qy-Jx
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48h-0000dZ-Is
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WsWrg69afH02mYrBWDtSCdiElywF1Bq6Z7VNiu2bWig=; b=CIX+L/nR1Z+CHFBlN0kdlXKXI/
	w/WfSmOSOe/IlWMEjeuZeKi7stektf+mzZYn7FdKgeVJZj1PjMXzKo6SU1nQPNyBTefTq7Kcq9/7z
	HxaId75cF44stNvk4DBzS11X5QwzWkR3Hje7I9GFA/+9kMoGciSC3TTN7ISNUnzEFSGw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Add light version of Linux's ipmmu_features
Message-Id: <E1nD48h-0000dZ-Is@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:44:35 +0000

commit ec4add8d1c1a8d01b4ad4c15af41576a0b976cf7
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:51 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:46 2022 +0000

    iommu/ipmmu-vmsa: Add light version of Linux's ipmmu_features
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    We don't need to pull the whole struct and all instances as Xen
    driver doesn't support old Arm32 based Gen2 SoCs, so there is no
    point in keeping all differences between Gen2 and Gen3 here.
    All what we need is a minimal support to be able to operate with
    Gen3 and new S4.
    
    Add Gen3 specific info with only two fields (number_of_contexts and
    num_utlbs) for now, the subsequent patches will add remaining bits.
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 54 +++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 14 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 1b94af245f..369be4c89d 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -71,9 +71,9 @@
  * R-Car Gen3 SoCs make use of up to 8 IPMMU contexts (sets of page table) and
  * these can be managed independently. Each context is mapped to one Xen domain.
  */
-#define IPMMU_CTX_MAX     8
+#define IPMMU_CTX_MAX     8U
 /* R-Car Gen3 SoCs make use of up to 48 micro-TLBs per IPMMU device. */
-#define IPMMU_UTLB_MAX    48
+#define IPMMU_UTLB_MAX    48U
 
 /* IPMMU context supports IPA size up to 40 bit. */
 #define IPMMU_MAX_P2M_IPA_BITS    40
@@ -106,17 +106,22 @@ struct ipmmu_vmsa_xen_device {
     struct ipmmu_vmsa_device *mmu;
 };
 
+struct ipmmu_features {
+    unsigned int number_of_contexts;
+    unsigned int num_utlbs;
+};
+
 /* Root/Cache IPMMU device's information */
 struct ipmmu_vmsa_device {
     struct device *dev;
     void __iomem *base;
     struct ipmmu_vmsa_device *root;
     struct list_head list;
-    unsigned int num_utlbs;
     unsigned int num_ctx;
     spinlock_t lock;    /* Protects ctx and domains[] */
     DECLARE_BITMAP(ctx, IPMMU_CTX_MAX);
     struct ipmmu_vmsa_domain *domains[IPMMU_CTX_MAX];
+    const struct ipmmu_features *features;
 };
 
 /*
@@ -727,6 +732,11 @@ static int ipmmu_init_platform_device(struct device *dev,
     return 0;
 }
 
+static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
+    .number_of_contexts = 8,
+    .num_utlbs = 48,
+};
+
 static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
 {
     unsigned int i;
@@ -798,6 +808,27 @@ static __init bool ipmmu_stage2_supported(void)
     return stage2_supported;
 }
 
+static const struct dt_device_match ipmmu_dt_match[] __initconst =
+{
+    {
+        .compatible = "renesas,ipmmu-r8a7795",
+        .data = &ipmmu_features_rcar_gen3,
+    },
+    {
+        .compatible = "renesas,ipmmu-r8a77965",
+        .data = &ipmmu_features_rcar_gen3,
+    },
+    {
+        .compatible = "renesas,ipmmu-r8a7796",
+        .data = &ipmmu_features_rcar_gen3,
+    },
+    {
+        .compatible = "renesas,ipmmu-r8a77961",
+        .data = &ipmmu_features_rcar_gen3,
+    },
+    { /* sentinel */ },
+};
+
 /*
  * This function relies on the fact that Root IPMMU device is being probed
  * the first. If not the case, it denies further Cache IPMMU device probes
@@ -806,6 +837,7 @@ static __init bool ipmmu_stage2_supported(void)
  */
 static int ipmmu_probe(struct dt_device_node *node)
 {
+    const struct dt_device_match *match;
     struct ipmmu_vmsa_device *mmu;
     uint64_t addr, size;
     int irq, ret;
@@ -817,9 +849,12 @@ static int ipmmu_probe(struct dt_device_node *node)
         return -ENOMEM;
     }
 
+    match = dt_match_node(ipmmu_dt_match, node);
+    ASSERT(match);
+    mmu->features = match->data;
+
     mmu->dev = &node->dev;
-    mmu->num_utlbs = IPMMU_UTLB_MAX;
-    mmu->num_ctx = IPMMU_CTX_MAX;
+    mmu->num_ctx = min(IPMMU_CTX_MAX, mmu->features->number_of_contexts);
     spin_lock_init(&mmu->lock);
     bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
 
@@ -1296,15 +1331,6 @@ static const struct iommu_ops ipmmu_iommu_ops =
     .add_device      = ipmmu_add_device,
 };
 
-static const struct dt_device_match ipmmu_dt_match[] __initconst =
-{
-    DT_MATCH_COMPATIBLE("renesas,ipmmu-r8a7795"),
-    DT_MATCH_COMPATIBLE("renesas,ipmmu-r8a77965"),
-    DT_MATCH_COMPATIBLE("renesas,ipmmu-r8a7796"),
-    DT_MATCH_COMPATIBLE("renesas,ipmmu-r8a77961"),
-    { /* sentinel */ },
-};
-
 static __init int ipmmu_init(struct dt_device_node *node, const void *data)
 {
     int ret;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:44:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261447.452702 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48s-0002Ao-E1; Thu, 27 Jan 2022 12:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261447.452702; Thu, 27 Jan 2022 12:44:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD48s-0002Ag-Ap; Thu, 27 Jan 2022 12:44:46 +0000
Received: by outflank-mailman (input) for mailman id 261447;
 Thu, 27 Jan 2022 12:44:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48r-0002AT-O0
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44: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 1nD48r-0007rT-NC
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD48r-0000en-MD
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qx/QL6o4MFbXdbeoC9kYpQnv6IP1rdSaq32c2SigmkQ=; b=QZsR05AG33f0sKOhgYzh/9f1E9
	RK35TOSxB2BhSTQDw9BHxEdxBAKzgdfCiFdm+gFGCdBWAE9TUIvFu1tXwYA0wnpedr+ogHvS+wUK/
	UCKr/P0ExV0wXnYEnM/xhVJnUQ+SIbylMEMIxeTmiBtXGPHz6iXu80ZL3oTSQALdkQMc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro
Message-Id: <E1nD48r-0000en-MD@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:44:45 +0000

commit 255000e8d7179deed97543fb6fb72c738fd3b2fa
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:52 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:56 2022 +0000

    iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    3dc28d9f59eaae41461542b27afe70339347ebb3
    
    Original commit message:
     commit 3dc28d9f59eaae41461542b27afe70339347ebb3
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:48 2019 +0900
    
      iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro
    
      Since we will have changed memory mapping of the IPMMU in the future,
      this patch uses ipmmu_features values instead of a macro to
      calculate context registers offset. No behavior change.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Almost the same change as original commit makes, but without updating
    struct ipmmu_features_default which Xen driver doesn't have (there is
    no support of old Arm32 based Gen2 SoCs).
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 369be4c89d..ca33456ac2 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -109,6 +109,8 @@ struct ipmmu_vmsa_xen_device {
 struct ipmmu_features {
     unsigned int number_of_contexts;
     unsigned int num_utlbs;
+    unsigned int ctx_offset_base;
+    unsigned int ctx_offset_stride;
 };
 
 /* Root/Cache IPMMU device's information */
@@ -167,8 +169,6 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define TLB_LOOP_TIMEOUT    100 /* 100us */
 
 /* Registers Definition */
-#define IM_CTX_SIZE    0x40
-
 #define IMCTR                0x0000
 /*
  * This field is implemented in IPMMU-MM only. So, can be set for
@@ -315,7 +315,8 @@ static void ipmmu_write(struct ipmmu_vmsa_device *mmu, uint32_t offset,
 static unsigned int ipmmu_ctx_reg(struct ipmmu_vmsa_device *mmu,
                                   unsigned int context_id, uint32_t reg)
 {
-    return context_id * IM_CTX_SIZE + reg;
+    return mmu->features->ctx_offset_base +
+        context_id * mmu->features->ctx_offset_stride + reg;
 }
 
 static uint32_t ipmmu_ctx_read(struct ipmmu_vmsa_device *mmu,
@@ -735,6 +736,8 @@ static int ipmmu_init_platform_device(struct device *dev,
 static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
     .number_of_contexts = 8,
     .num_utlbs = 48,
+    .ctx_offset_base = 0,
+    .ctx_offset_stride = 0x40,
 };
 
 static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:44:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:44:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261448.452705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD493-0002EB-GV; Thu, 27 Jan 2022 12:44:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261448.452705; Thu, 27 Jan 2022 12:44:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD493-0002E3-Dl; Thu, 27 Jan 2022 12:44:57 +0000
Received: by outflank-mailman (input) for mailman id 261448;
 Thu, 27 Jan 2022 12:44:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD491-0002Dv-R2
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44: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 1nD491-0007rf-QI
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD491-0000fy-PT
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:44:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ymHx7WBySqTLZNO0qK7W7CvL9+SFQ1eEfBq3oE83NiU=; b=Or5eIfzPblU0JMQ0MQEIGTcP5v
	Qmd2Z5Tth0YOOCOgZhnjsEM2xcxP3xM92ng8eeiO0mM845XV4FunVgR46hLPohQJV3pHbWZTwcJca
	Z7OW8X3/5glQJaCPUjO8d3BcOCXSAvrXDgP6NmFDr23G3DH4LRLTTOtD/44438a3I4lg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Add utlb_offset_base
Message-Id: <E1nD491-0000fy-PT@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:44:55 +0000

commit 6e94086a86b8f246c754f50cb9f4adcbf02ce1b2
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:53 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:34:05 2022 +0000

    iommu/ipmmu-vmsa: Add utlb_offset_base
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    1289f7f15001c7ed36be6d23cb145c1d5feacdc8
    
    Original commit message:
     commit 1289f7f15001c7ed36be6d23cb145c1d5feacdc8
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:50 2019 +0900
    
      iommu/ipmmu-vmsa: Add utlb_offset_base
    
      Since we will have changed memory mapping of the IPMMU in the future,
      this patch adds a utlb_offset_base into struct ipmmu_features
      for IMUCTR and IMUASID registers. No behavior change.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Almost the same change as original commit makes, but without updating
    struct ipmmu_features_default which Xen driver doesn't have (there is
    no support of old Arm32 based Gen2 SoCs).
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index ca33456ac2..d8f96fcd3d 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -111,6 +111,7 @@ struct ipmmu_features {
     unsigned int num_utlbs;
     unsigned int ctx_offset_base;
     unsigned int ctx_offset_stride;
+    unsigned int utlb_offset_base;
 };
 
 /* Root/Cache IPMMU device's information */
@@ -374,7 +375,7 @@ static void ipmmu_ctx_write_all(struct ipmmu_vmsa_domain *domain,
 
 static uint32_t ipmmu_utlb_reg(struct ipmmu_vmsa_device *mmu, uint32_t reg)
 {
-    return reg;
+    return mmu->features->utlb_offset_base + reg;
 }
 
 static void ipmmu_imuasid_write(struct ipmmu_vmsa_device *mmu,
@@ -738,6 +739,7 @@ static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
     .num_utlbs = 48,
     .ctx_offset_base = 0,
     .ctx_offset_stride = 0x40,
+    .utlb_offset_base = 0,
 };
 
 static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:45:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:45:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261449.452710 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD49D-0002Gw-IU; Thu, 27 Jan 2022 12:45:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261449.452710; Thu, 27 Jan 2022 12:45:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD49D-0002Go-FI; Thu, 27 Jan 2022 12:45:07 +0000
Received: by outflank-mailman (input) for mailman id 261449;
 Thu, 27 Jan 2022 12:45: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 1nD49B-0002GL-UI
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45: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 1nD49B-0007sI-TU
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD49B-0000i3-SY
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=njT34PCspIgvlE8n4MiF+eGp/BoQaueFnGGrtMCDXU8=; b=uR78GiZIZ14MDPln0PNL+rYfY1
	n4v2Zpi1Vs8diEaHmj47Ysbd05SSWxbJ6RDSDHvj6qh69ShRiXP6HAGmzG6vD89dEJZA9oNjTJRuI
	OO+nwGwXjw8sWU3uaBHfQw6vbyfvZ5xGGCWHhDb/2aVyW3Q4hcrgbY+9QgoMydLZJk+k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
Message-Id: <E1nD49B-0000i3-SY@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:45:05 +0000

commit 095d665d775cc33b630e1f80c4f83a14cd3ea1f1
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:54 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:34:14 2022 +0000

    iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
    
    Based on the following Linux upsteam commit:
    7a62ced8ebd0e1b692c9dc4781a8d4ddb0f74792
    
    Original commit message:
     commit 7a62ced8ebd0e1b692c9dc4781a8d4ddb0f74792
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Tue Sep 7 17:30:20 2021 +0900
    
      iommu/ipmmu-vmsa: Add support for r8a779a0
    
      Add support for r8a779a0 (R-Car V3U). The IPMMU hardware design
      of this SoC differs than others. So, add a new ipmmu_features for it.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
      Link: https://lore.kernel.org/r/20210907083020.907648-3-yoshihiro.shimoda.uh@renesas.com
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    The R-Car S4 is an automotive System-on-Chip (SoC) for Car
    Server/Communication Gateway and is one of the first products
    in Renesas’ 4th-generation R-Car Family.
    
    The integrated IOMMU HW is also VMSA-compatible and supports
    stage 2 translation table format, therefore can be used with
    current driver with slight modifications (thanks to the prereq
    work).
    
    In the context of Xen driver the main differences between Gen3
    and Gen4 are the following:
    - HW capacity was enlarged to support up to 16 IPMMU contexts
      (sets of page table) and up to 64 micro-TLBs per IPMMU device
    - the memory mapped registers have different bases and offsets
    
    Please note that Linux upstream doesn't support R-Car S4 SoC
    yet unlike Renesas BSP [1], but it was decided to reuse upstream
    patch for R-Car V3U anyway as the IPMMU HW settings are similar.
    
    [1]
    7003b9f732cf iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
    https://github.com/renesas-rcar/linux-bsp/tree/v5.10.41/rcar-5.1.3.rc5
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/Kconfig          |  6 +--
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 63 +++++++++++++++++++++++---------
 2 files changed, 49 insertions(+), 20 deletions(-)

diff --git a/xen/drivers/passthrough/Kconfig b/xen/drivers/passthrough/Kconfig
index 09505aa983..479d7de57a 100644
--- a/xen/drivers/passthrough/Kconfig
+++ b/xen/drivers/passthrough/Kconfig
@@ -25,14 +25,14 @@ config ARM_SMMU_V3
 	 the ARM SMMUv3 architecture.
 
 config IPMMU_VMSA
-	bool "Renesas IPMMU-VMSA found in R-Car Gen3 SoCs"
+	bool "Renesas IPMMU-VMSA found in R-Car Gen3/Gen4 SoCs"
 	depends on ARM_64
 	---help---
 	  Support for implementations of the Renesas IPMMU-VMSA found
-	  in R-Car Gen3 SoCs.
+	  in R-Car Gen3/Gen4 SoCs.
 
 	  Say Y here if you are using newest R-Car Gen3 SoCs revisions
-	  (H3 ES3.0, M3-W+, etc) which IPMMU hardware supports stage 2
+	  (H3 ES3.0, M3-W+, etc) or Gen4 SoCs which IPMMU hardware supports stage 2
 	  translation table format and is able to use CPU's P2M table as is.
 
 endif
diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index d8f96fcd3d..14848ce857 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -1,15 +1,15 @@
 /*
  * xen/drivers/passthrough/arm/ipmmu-vmsa.c
  *
- * Driver for the Renesas IPMMU-VMSA found in R-Car Gen3 SoCs.
+ * Driver for the Renesas IPMMU-VMSA found in R-Car Gen3/Gen4 SoCs.
  *
  * The IPMMU-VMSA is VMSA-compatible I/O Memory Management Unit (IOMMU)
  * which provides address translation and access protection functionalities
  * to processing units and interconnect networks.
  *
  * Please note, current driver is supposed to work only with newest
- * R-Car Gen3 SoCs revisions which IPMMU hardware supports stage 2 translation
- * table format and is able to use CPU's P2M table as is.
+ * R-Car Gen3/Gen4 SoCs revisions which IPMMU hardware supports stage 2
+ * translation table format and is able to use CPU's P2M table as is.
  *
  * Based on Linux's IPMMU-VMSA driver from Renesas BSP:
  *    drivers/iommu/ipmmu-vmsa.c
@@ -20,9 +20,9 @@
  * and Xen's SMMU driver:
  *    xen/drivers/passthrough/arm/smmu.c
  *
- * Copyright (C) 2014-2019 Renesas Electronics Corporation
+ * Copyright (C) 2014-2021 Renesas Electronics Corporation
  *
- * Copyright (C) 2016-2019 EPAM Systems Inc.
+ * Copyright (C) 2016-2021 EPAM Systems Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms and conditions of the GNU General Public
@@ -68,12 +68,13 @@
     dev_print(dev, XENLOG_ERR, fmt, ## __VA_ARGS__)
 
 /*
- * R-Car Gen3 SoCs make use of up to 8 IPMMU contexts (sets of page table) and
- * these can be managed independently. Each context is mapped to one Xen domain.
+ * R-Car Gen3/Gen4 SoCs make use of up to 16 IPMMU contexts (sets of page table)
+ * and these can be managed independently. Each context is mapped to one Xen
+ * domain.
  */
-#define IPMMU_CTX_MAX     8U
-/* R-Car Gen3 SoCs make use of up to 48 micro-TLBs per IPMMU device. */
-#define IPMMU_UTLB_MAX    48U
+#define IPMMU_CTX_MAX     16U
+/* R-Car Gen3/Gen4 SoCs make use of up to 64 micro-TLBs per IPMMU device. */
+#define IPMMU_UTLB_MAX    64U
 
 /* IPMMU context supports IPA size up to 40 bit. */
 #define IPMMU_MAX_P2M_IPA_BITS    40
@@ -112,6 +113,8 @@ struct ipmmu_features {
     unsigned int ctx_offset_base;
     unsigned int ctx_offset_stride;
     unsigned int utlb_offset_base;
+    unsigned int control_offset_base;
+    unsigned int imuctr_ttsel_mask;
 };
 
 /* Root/Cache IPMMU device's information */
@@ -211,7 +214,6 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUCTR0(n)             (0x0300 + ((n) * 16))
 #define IMUCTR32(n)            (0x0600 + (((n) - 32) * 16))
 #define IMUCTR_TTSEL_MMU(n)    ((n) << 4)
-#define IMUCTR_TTSEL_MASK      (15 << 4)
 #define IMUCTR_TTSEL_SHIFT     4
 #define IMUCTR_FLUSH           (1 << 1)
 #define IMUCTR_MMUEN           (1 << 0)
@@ -316,8 +318,12 @@ static void ipmmu_write(struct ipmmu_vmsa_device *mmu, uint32_t offset,
 static unsigned int ipmmu_ctx_reg(struct ipmmu_vmsa_device *mmu,
                                   unsigned int context_id, uint32_t reg)
 {
-    return mmu->features->ctx_offset_base +
-        context_id * mmu->features->ctx_offset_stride + reg;
+    unsigned int base = mmu->features->ctx_offset_base;
+
+    if ( context_id > 7 )
+        base += 0x800 - 8 * 0x40;
+
+    return base + context_id * mmu->features->ctx_offset_stride + reg;
 }
 
 static uint32_t ipmmu_ctx_read(struct ipmmu_vmsa_device *mmu,
@@ -448,7 +454,8 @@ static int ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain,
     {
         unsigned int context_id;
 
-        context_id = (imuctr & IMUCTR_TTSEL_MASK) >> IMUCTR_TTSEL_SHIFT;
+        context_id = (imuctr & mmu->features->imuctr_ttsel_mask) >>
+            IMUCTR_TTSEL_SHIFT;
         if ( domain->context_id != context_id )
         {
             dev_err(mmu->dev, "Micro-TLB %u already assigned to IPMMU context %u\n",
@@ -740,6 +747,18 @@ static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
     .ctx_offset_base = 0,
     .ctx_offset_stride = 0x40,
     .utlb_offset_base = 0,
+    .control_offset_base = 0,
+    .imuctr_ttsel_mask = (15 << 4),
+};
+
+static const struct ipmmu_features ipmmu_features_rcar_gen4 = {
+    .number_of_contexts = 16,
+    .num_utlbs = 64,
+    .ctx_offset_base = 0x10000,
+    .ctx_offset_stride = 0x1040,
+    .utlb_offset_base = 0x3000,
+    .control_offset_base = 0x1000,
+    .imuctr_ttsel_mask = (31 << 4),
 };
 
 static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
@@ -751,11 +770,12 @@ static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
         ipmmu_ctx_write(mmu, i, IMCTR, 0);
 }
 
-/* R-Car Gen3 SoCs product and cut information. */
+/* R-Car Gen3/Gen4 SoCs product and cut information. */
 #define RCAR_PRODUCT_MASK    0x00007F00
 #define RCAR_PRODUCT_H3      0x00004F00
 #define RCAR_PRODUCT_M3W     0x00005200
 #define RCAR_PRODUCT_M3N     0x00005500
+#define RCAR_PRODUCT_S4      0x00005A00
 #define RCAR_CUT_MASK        0x000000FF
 #define RCAR_CUT_VER30       0x00000020
 
@@ -803,6 +823,10 @@ static __init bool ipmmu_stage2_supported(void)
         stage2_supported = true;
         break;
 
+    case RCAR_PRODUCT_S4:
+        stage2_supported = true;
+        break;
+
     default:
         printk(XENLOG_ERR "ipmmu: Unsupported SoC version\n");
         break;
@@ -831,6 +855,10 @@ static const struct dt_device_match ipmmu_dt_match[] __initconst =
         .compatible = "renesas,ipmmu-r8a77961",
         .data = &ipmmu_features_rcar_gen3,
     },
+    {
+        .compatible = "renesas,ipmmu-r8a779f0",
+        .data = &ipmmu_features_rcar_gen4,
+    },
     { /* sentinel */ },
 };
 
@@ -845,6 +873,7 @@ static int ipmmu_probe(struct dt_device_node *node)
     const struct dt_device_match *match;
     struct ipmmu_vmsa_device *mmu;
     uint64_t addr, size;
+    uint32_t reg;
     int irq, ret;
 
     mmu = xzalloc(struct ipmmu_vmsa_device);
@@ -930,8 +959,8 @@ static int ipmmu_probe(struct dt_device_node *node)
          * Use stage 2 translation table format when stage 2 translation
          * enabled.
          */
-        ipmmu_write(mmu, IMSAUXCTLR,
-                    ipmmu_read(mmu, IMSAUXCTLR) | IMSAUXCTLR_S2PTE);
+        reg = IMSAUXCTLR + mmu->features->control_offset_base;
+        ipmmu_write(mmu, reg, ipmmu_read(mmu, reg) | IMSAUXCTLR_S2PTE);
 
         dev_info(&node->dev, "IPMMU context 0 is reserved\n");
         set_bit(0, mmu->ctx);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:45:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:45:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261450.452714 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD49N-0002Jg-Jy; Thu, 27 Jan 2022 12:45:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261450.452714; Thu, 27 Jan 2022 12:45:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD49N-0002JY-Gs; Thu, 27 Jan 2022 12:45:17 +0000
Received: by outflank-mailman (input) for mailman id 261450;
 Thu, 27 Jan 2022 12:45:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD49M-0002JF-1H
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45: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 1nD49M-0007sR-0R
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD49L-0000jT-Vx
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45: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=1XBCRQwQKeAnSLMooSzKLRA5QFH5+SYUh0vTVEj+PHg=; b=gVYsCL2FfncAgZLYWnZT38KAIG
	0UipiWnsgTd9I1jYfawk49gkcqMI4Um/xr8cRsoBIipPQrrGiz3Ojjj2jSQlsRTjeC0DPhc85o6jC
	l/Fx3xb3WFvNqDXw9yjfeG4Q2bbiXAqFu8B5la8Y8wUcEgMFoNBX2lsLsma7zqt7Dnfs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0
Message-Id: <E1nD49L-0000jT-Vx@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:45:15 +0000

commit 9511120a450420efe8c026b233fe0b3ab7f1bd71
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:55 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:34:24 2022 +0000

    iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0
    
    Based on the following commits from the Renesas BSP:
    8fba83d97cca709a05139c38e29408e81ed4cf62
    a8d93bc07da89a7fcf4d85f34d119a030310efa5
    located at:
    https://github.com/renesas-rcar/linux-bsp/tree/v5.10.41/rcar-5.1.3.rc5
    
    Original commit messages:
     commit 8fba83d97cca709a05139c38e29408e81ed4cf62
     Author: Nam Nguyen <nam.nguyen.yh@renesas.com>
     Date:   Wed Apr 28 18:54:44 2021 +0700
    
      iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0
    
      Need to set bit IMSCTLR_USE_SECGRP to 0
      because H/W initial value is unknown, without this
      dma-transfer cannot be done due to address translation doesn't work.
    
      Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com>
    
     commit a8d93bc07da89a7fcf4d85f34d119a030310efa5
     Author: Nam Nguyen <nam.nguyen.yh@renesas.com>
     Date:   Tue Sep 7 14:46:12 2021 +0700
    
      iommu/ipmmu-vmsa: Update IMSCTLR register offset address for R-Car S4
    
      Update IMSCTLR register offset address to align with R-Car S4 H/W UM.
    
      Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com>
    
    **********
    
    It is still a question whether this really needs to be done in Xen,
    rather in firmware, but better to be on the safe side. After all,
    if firmware already takes care of clearing this bit, nothing bad
    will happen.
    
    Please note the following:
    1. I decided to squash both commits since the first commit adds clearing
    code and only the second one makes it functional on S4. Moreover, this is
    not a direct port. So it would be better to introduce complete solution
    by a single patch.
    2. Although patch indeed does what it claims in the subject,
    the implementation is different in comparison with original changes.
    On Linux the clearing is done at runtime in ipmmu_domain_setup_context().
    On Xen the clearing is done at boot time in ipmmu_probe().
    The IMSCTLR is not a MMU "context" register at all, so I think there is
    no point in performing the clearing each time we initialize the context,
    instead perform the clearing at once during initialization. Also do not
    abuse ctx_offset_stride_adj field for the register's offset calculation,
    instead use recently added control_offset_base field.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 14848ce857..649b9f6362 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -222,6 +222,9 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUASID0(n)            (0x0308 + ((n) * 16))
 #define IMUASID32(n)           (0x0608 + (((n) - 32) * 16))
 
+#define IMSCTLR             0x0500
+#define IMSCTLR_USE_SECGRP  (1 << 28)
+
 #define IMSAUXCTLR          0x0504
 #define IMSAUXCTLR_S2PTE    (1 << 3)
 
@@ -966,6 +969,10 @@ static int ipmmu_probe(struct dt_device_node *node)
         set_bit(0, mmu->ctx);
     }
 
+    /* Do not use security group function. */
+    reg = IMSCTLR + mmu->features->control_offset_base;
+    ipmmu_write(mmu, reg, ipmmu_read(mmu, reg) & ~IMSCTLR_USE_SECGRP);
+
     spin_lock(&ipmmu_devices_lock);
     list_add(&mmu->list, &ipmmu_devices);
     spin_unlock(&ipmmu_devices_lock);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:45:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:45:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261451.452718 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD49X-0002MZ-LK; Thu, 27 Jan 2022 12:45:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261451.452718; Thu, 27 Jan 2022 12:45:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD49X-0002MR-IO; Thu, 27 Jan 2022 12:45:27 +0000
Received: by outflank-mailman (input) for mailman id 261451;
 Thu, 27 Jan 2022 12:45:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD49W-0002MC-4W
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45: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 1nD49W-0007sV-3o
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD49W-0000kR-31
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:45:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yfUqEYdBF/GXQRrXocQGs3rKez+Gm6qTf6iH0GQlFEU=; b=cmHktUzmxtANNBN82oqQyOFgVU
	Clxy8J2S4gd5jD/wW+l92tInwytI6buNQa2ZtbnX+N00wBDt2ud5Bkai8za1XHrjvbO/J0sijofcH
	x5Dw4Ytqp9skQs6kiveTVQspcn8nmBX/wkpBhirZ1+CrPwqe2EzYxaq4lY2huIXPvEGo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Replace arch_mfn_in_directmap() with arch_mfns_in_directmap()
Message-Id: <E1nD49W-0000kR-31@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:45:26 +0000

commit 0a71ca9ab4c2d9a44f972c517bafa332b1622c10
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Jan 26 15:59:19 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:38:31 2022 +0000

    xen: Replace arch_mfn_in_directmap() with arch_mfns_in_directmap()
    
    The name of arch_mfn_in_directmap() suggests that it will check against
    that the passed MFN should be in the directmap.
    
    However, the current callers are passing the next MFN and the
    implementation will return true for up to one MFN past the directmap.
    
    It would be more meaningful to test the exact MFN rather than the
    next one.
    
    That said, the current expectation is the memory will be direct-mapped
    from 0 up to a given MFN. This may not be a valid assumption on all
    the architectures.
    
    For instance, on Arm32 only the xenheap that will be direct-mapped.
    This may not be allocated a the beginning of the RAM.
    
    So take the opportunity to rework the parameters and pass the
    number of pages we want to check. This also requires to rename
    the helper to better match the implementation.
    
    Note that the implementation of the helper on arm32 is left as-is
    for now.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/arm32/mm.h | 2 +-
 xen/arch/arm/include/asm/arm64/mm.h | 2 +-
 xen/arch/x86/include/asm/mm.h       | 6 +++---
 xen/common/page_alloc.c             | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/include/asm/arm32/mm.h b/xen/arch/arm/include/asm/arm32/mm.h
index 68612499bf..6b039d9cea 100644
--- a/xen/arch/arm/include/asm/arm32/mm.h
+++ b/xen/arch/arm/include/asm/arm32/mm.h
@@ -5,7 +5,7 @@
  * Only a limited amount of RAM, called xenheap, is always mapped on ARM32.
  * For convenience always return false.
  */
-static inline bool arch_mfn_in_directmap(unsigned long mfn)
+static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 {
     return false;
 }
diff --git a/xen/arch/arm/include/asm/arm64/mm.h b/xen/arch/arm/include/asm/arm64/mm.h
index d0a3be7e15..aa2adac631 100644
--- a/xen/arch/arm/include/asm/arm64/mm.h
+++ b/xen/arch/arm/include/asm/arm64/mm.h
@@ -5,7 +5,7 @@
  * On ARM64, all the RAM is currently direct mapped in Xen.
  * Hence return always true.
  */
-static inline bool arch_mfn_in_directmap(unsigned long mfn)
+static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 {
     return true;
 }
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 5dbcee8696..9b9de4c6be 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -635,13 +635,13 @@ void write_32bit_pse_identmap(uint32_t *l2);
 
 /*
  * x86 maps part of physical memory via the directmap region.
- * Return whether the input MFN falls in that range.
+ * Return whether the range of MFN falls in the directmap region.
  */
-static inline bool arch_mfn_in_directmap(unsigned long mfn)
+static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 {
     unsigned long eva = min(DIRECTMAP_VIRT_END, HYPERVISOR_VIRT_END);
 
-    return mfn <= (virt_to_mfn(eva - 1) + 1);
+    return (mfn + nr) <= (virt_to_mfn(eva - 1) + 1);
 }
 
 #endif /* __ASM_X86_MM_H__ */
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 38eea879c0..f8749b0787 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -588,7 +588,7 @@ static unsigned long init_node_heap(int node, unsigned long mfn,
         needed = 0;
     }
     else if ( *use_tail && nr >= needed &&
-              arch_mfn_in_directmap(mfn + nr) &&
+              arch_mfns_in_directmap(mfn + nr - needed, needed) &&
               (!xenheap_bits ||
                !((mfn + nr - 1) >> (xenheap_bits - PAGE_SHIFT))) )
     {
@@ -597,7 +597,7 @@ static unsigned long init_node_heap(int node, unsigned long mfn,
                       PAGE_SIZE - sizeof(**avail) * NR_ZONES;
     }
     else if ( nr >= needed &&
-              arch_mfn_in_directmap(mfn + needed) &&
+              arch_mfns_in_directmap(mfn, needed) &&
               (!xenheap_bits ||
                !((mfn + needed - 1) >> (xenheap_bits - PAGE_SHIFT))) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:55:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261460.452744 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD4Ir-0004Ei-1K; Thu, 27 Jan 2022 12:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261460.452744; Thu, 27 Jan 2022 12:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD4Iq-0004EY-UH; Thu, 27 Jan 2022 12:55:04 +0000
Received: by outflank-mailman (input) for mailman id 261460;
 Thu, 27 Jan 2022 12:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD4Iq-0004E1-8W
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD4Iq-00085a-64
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD4Iq-0001Ry-55
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6cBJZxgotI7WINQj6cx0PGexqSUNPNhRyu+1+FRxBMY=; b=fDndk5wEUShj+I90HuSlzQYRGF
	DzRFmLlbaH7T6Lb1rEs+LIE1cObyPeNDcUvIoM/ogmJMTz6HH6tz1YucOtUOI69tN5aOo0ViXDSPH
	VB4Z/vP3ZPcILvqyGmKXOUq23xo+Ab17DNyptBDjC5C0cfMbLEKVtecIkPNb3sUpm7es=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/Intel: IceLake D + Sapphire Rapids Xeons also support PPIN
Message-Id: <E1nD4Iq-0001Ry-55@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:55:04 +0000

commit df6f5cd9e51e742b23dcee99907e97a435716061
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 27 13:50:19 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 27 13:50:19 2022 +0100

    x86/Intel: IceLake D + Sapphire Rapids Xeons also support PPIN
    
    This is as per Linux commits a331f5fdd36d ("x86/mce: Add Xeon Sapphire
    Rapids to list of CPUs that support PPIN") and [tip.git] e464121f2d40
    ("x86/cpu: Add Xeon Icelake-D to list of CPUs that support PPIN"), just
    in case a subsequent change making use of the respective new CPUID bit
    doesn't cover either of these models.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/mcheck/mce_intel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index bb9f3a3ff7..d0161e9d4d 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -872,7 +872,9 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
     case 0x56: /* Broadwell Xeon D */
     case 0x57: /* Knights Landing */
     case 0x6a: /* Icelake X */
+    case 0x6c: /* Icelake D */
     case 0x85: /* Knights Mill */
+    case 0x8f: /* Sapphire Rapids X */
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||
              rdmsr_safe(MSR_PPIN_CTL, val) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 12:55:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 12:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261463.452748 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD4J1-0004QB-3q; Thu, 27 Jan 2022 12:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261463.452748; Thu, 27 Jan 2022 12:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nD4J1-0004Q3-0w; Thu, 27 Jan 2022 12:55:15 +0000
Received: by outflank-mailman (input) for mailman id 261463;
 Thu, 27 Jan 2022 12:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD4J0-0004Ol-A1
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD4J0-00085k-94
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nD4J0-0001Sl-8D
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 12:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M4TXl455P/oKjTv1XiWRGrNaeB+s+RrUzm+alWQwFFo=; b=O8wANOJrBYo3VYFTXtTGlep5GT
	8QGt46nlaWLqzpJoU0Mk1SbQ704bzFEr8Q4nPONFysj/XKY+97hZLxeX2mHTEzRxGHaaGsw/+x0OO
	P8G/S08lDClS93pCPffxIA7KyMrvjFwMwKfxwqBY5gFoYQEycANrZ6BAiTJr7jZs/keU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: force netback to wait for hotplug execution before connecting
Message-Id: <E1nD4J0-0001Sl-8D@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 12:55:14 +0000

commit 0bdc43c8dec993258e930b34855853c22b917519
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Jan 27 13:51:19 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 27 13:51:19 2022 +0100

    libxl: force netback to wait for hotplug execution before connecting
    
    By writing an empty "hotplug-status" xenstore node in the backend path
    libxl can force Linux netback to wait for hotplug script execution
    before proceeding to the 'connected' state.
    
    This is required so that netback doesn't skip state 2 (InitWait) and
    thus blocks libxl waiting for such state in order to launch the
    hotplug script (see libxl__wait_device_connection).
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Tested-by: James Dingwall <james-xen@dingwall.me.uk>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Tested-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Wei Liu <wei.liu@kernel.org>
---
 tools/libs/light/libxl_nic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 0b45469dca..0b9e70c9d1 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -248,6 +248,13 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "mtu");
     flexarray_append(ro_front, GCSPRINTF("%u", nic->mtu));
 
+    /*
+     * Force backend to wait for hotplug script execution before switching to
+     * connected state.
+     */
+    flexarray_append(back, "hotplug-status");
+    flexarray_append(back, "");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:11:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261693.453313 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDAAh-0004bz-3k; Thu, 27 Jan 2022 19:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261693.453313; Thu, 27 Jan 2022 19: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 1nDAAh-0004br-0r; Thu, 27 Jan 2022 19:11:03 +0000
Received: by outflank-mailman (input) for mailman id 261693;
 Thu, 27 Jan 2022 19: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 1nDAAg-0004bl-5B
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDAAf-0007U6-OV
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDAAf-0002rh-NI
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=oFtS5Q9VvhCsywOJYJXmo4sQlQ67H+5gi8nkLqu3MnY=; b=XcmZLxWrZ0QVTW/MUnUOCRkNWX
	JsFFMm9S/rWw1f4c4o0BOPOOXaorvS/l7r+M0QBKvkfw1ojcCXIR/HbM5zT43L4o+nwIua9uTNj5D
	RQSzDAst59Q3443ncVRo46j/0rNEVnYw59KuoHzooJYboMiESmiofcQwu5CufxYuvp7M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] xen/arm: p2m: Always clear the P2M entry when the mapping is removed
Message-Id: <E1nDAAf-0002rh-NI@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:11:01 +0000

commit 861e27398c1da53e1c483c5dde12ad019ced6786
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:49:06 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:49:06 2022 +0100

    xen/arm: p2m: Always clear the P2M entry when the mapping is removed
    
    Commit 2148a125b73b ("xen/arm: Track page accessed between batch of
    Set/Way operations") allowed an entry to be invalid from the CPU PoV
    (lpae_is_valid()) but valid for Xen (p2m_is_valid()). This is useful
    to track which page is accessed and only perform an action on them
    (e.g. clean & invalidate the cache after a set/way instruction).
    
    Unfortunately, __p2m_set_entry() is only zeroing the P2M entry when
    lpae_is_valid() returns true. This means the entry will not be zeroed
    if the entry was valid from Xen PoV but invalid from the CPU PoV for
    tracking purpose.
    
    As a consequence, this will allow a domain to continue to access the
    page after it was removed.
    
    Resolve the issue by always zeroing the entry if it the LPAE bit is
    set or the entry is about to be removed.
    
    This is CVE-2022-23033 / XSA-393.
    
    Reported-by: Dmytro Firsov <Dmytro_Firsov@epam.com>
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way operations")
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    master commit: a428b913a002eb2b7425b48029c20a52eeee1b5a
    master date: 2022-01-25 13:25:01 +0100
---
 xen/arch/arm/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ac821a9094..2290b7114f 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1008,7 +1008,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m,
      * sequence when updating the translation table (D4.7.1 in ARM DDI
      * 0487A.j).
      */
-    if ( lpae_is_valid(orig_pte) )
+    if ( lpae_is_valid(orig_pte) || removing_mapping )
         p2m_remove_pte(entry, p2m->clean_pte);
 
     if ( removing_mapping )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:11:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261694.453317 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDAAr-0004dn-5O; Thu, 27 Jan 2022 19:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261694.453317; Thu, 27 Jan 2022 19: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 1nDAAr-0004df-2L; Thu, 27 Jan 2022 19:11:13 +0000
Received: by outflank-mailman (input) for mailman id 261694;
 Thu, 27 Jan 2022 19: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 1nDAAp-0004dS-T2
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDAAp-0007Vo-SD
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDAAp-0002su-RC
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=rFTGoPJPu0qXgWiY7fpq7NNhgB9fbISaXV+PZx2iA3M=; b=Jr+MM4iUvm8q2Pmja26IW1YFlE
	+VciUEgv7pMb2iSN8WHJbGBFsLgEmp3UUbH2deq5UJ3055taq58FMmhX3y+vmUV5vK4yPb8PXkXL/
	a8eYenpfPgBvgu9+/7hDeEqX4PwVMi53l3gkTpGkV/jrPe3ADySj51OBjwhiuYbp1acs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] xen/grant-table: Only decrement the refcounter when grant is fully unmapped
Message-Id: <E1nDAAp-0002su-RC@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:11:11 +0000

commit dbd85c0a8264aa2cd9b011a189ac8b1d90297d80
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:49:26 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:49:26 2022 +0100

    xen/grant-table: Only decrement the refcounter when grant is fully unmapped
    
    The grant unmapping hypercall (GNTTABOP_unmap_grant_ref) is not a
    simple revert of the changes done by the grant mapping hypercall
    (GNTTABOP_map_grant_ref).
    
    Instead, it is possible to partially (or even not) clear some flags.
    This will leave the grant is mapped until a future call where all
    the flags would be cleared.
    
    XSA-380 introduced a refcounting that is meant to only be dropped
    when the grant is fully unmapped. Unfortunately, unmap_common() will
    decrement the refcount for every successful call.
    
    A consequence is a domain would be able to underflow the refcount
    and trigger a BUG().
    
    Looking at the code, it is not clear to me why a domain would
    want to partially clear some flags in the grant-table. But as
    this is part of the ABI, it is better to not change the behavior
    for now.
    
    Fix it by checking if the maptrack handle has been released before
    decrementing the refcounting.
    
    This is CVE-2022-23034 / XSA-394.
    
    Fixes: 9781b51efde2 ("gnttab: replace mapkind()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 975a8fb45ca186b3476e5656c6ad5dad1122dbfd
    master date: 2022-01-25 13:25:49 +0100
---
 xen/common/grant_table.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 90781e236e..71ee5c6ec5 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1477,8 +1477,15 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    /* See the respective comment in map_grant_ref(). */
-    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
+    /*
+     * map_grant_ref() will only increment the refcount (and update the
+     * IOMMU) once per mapping. So we only want to decrement it once the
+     * maptrack handle has been put, alongside the further IOMMU update.
+     *
+     * For the second and third check, see the respective comment in
+     * map_grant_ref().
+     */
+    if ( put_handle && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         void **slot;
         union maptrack_node node;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:11:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261695.453321 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDAB1-0004gl-76; Thu, 27 Jan 2022 19:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261695.453321; Thu, 27 Jan 2022 19: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 1nDAB1-0004gd-3r; Thu, 27 Jan 2022 19:11:23 +0000
Received: by outflank-mailman (input) for mailman id 261695;
 Thu, 27 Jan 2022 19: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 1nDAAz-0004gG-Vz
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDAAz-0007W8-VC
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDAAz-0002tj-UK
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=q43lzZ3+0g8zJT+3tIY9Fy75bc7+Ot1gLo0CpzPHJyo=; b=5E0Aq4TtXfj1Wtvo7ZHtkHATvx
	NaJOxoDpe2GLZ17YC2V3SrkE9kAXCjIykUKWigNaNTHFMQu4d7aLmCdZLn9AWQ40pOOSml+kKjOng
	WMafcnYVf30eL5fF7g1UWnHf7QnrixUmyDmVRp6qAuHlEfhaV30w5jGf6uc9Xif825+s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] passthrough/x86: stop pirq iteration immediately in case of error
Message-Id: <E1nDAAz-0002tj-UK@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:11:21 +0000

commit 5af939d96a6c7c5a0b4e00f7be3002333959e7e3
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 25 13:49:40 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:49:40 2022 +0100

    passthrough/x86: stop pirq iteration immediately in case of error
    
    pt_pirq_iterate() will iterate in batch over all the PIRQs. The outer
    loop will bail out if 'rc' is non-zero but the inner loop will continue.
    
    This means 'rc' will get clobbered and we may miss any errors (such as
    -ERESTART in the case of the callback pci_clean_dpci_irq()).
    
    This is CVE-2022-23035 / XSA-395.
    
    Fixes: c24536b636f2 ("replace d->nr_pirqs sized arrays with radix tree")
    Fixes: f6dd295381f4 ("dpci: replace tasklet with softirq")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 9480a1a519cf016623f657dc544cb372a82b5708
    master date: 2022-01-25 13:27:02 +0100
---
 xen/drivers/passthrough/io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 71eaf2c17e..b6e88ebc86 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -810,7 +810,11 @@ int pt_pirq_iterate(struct domain *d,
 
             pirq = pirqs[i]->pirq;
             if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+            {
                 rc = cb(d, pirq_dpci, arg);
+                if ( rc )
+                    break;
+            }
         }
     } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:11:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261696.453325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDABB-0004kA-8X; Thu, 27 Jan 2022 19:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261696.453325; Thu, 27 Jan 2022 19: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 1nDABB-0004ju-5P; Thu, 27 Jan 2022 19:11:33 +0000
Received: by outflank-mailman (input) for mailman id 261696;
 Thu, 27 Jan 2022 19: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 1nDABA-0004jf-2f
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDABA-0007WM-25
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDABA-0002uY-15
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=CYReBGwN82RSZOsPmI/5lrl/5ZNqBM5pmz7DoGomoxQ=; b=TOiqx6cyOX4zxekSBOWwX9sufB
	ZH0Om5ZK7ohhFWDjUtYqmOLjRNAMHSj/xpgcfW6RkSy4GUPmnZRQ1ykqS1ExX6jKFItBgVXOUGRjq
	n/NifwGybNzX6clT2NHukxS0RAOe61dUjrG9jQg+xcIH0j+Kq0bnjywLYQeaudP9Z7nk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/time: use relative counts in calibration loops
Message-Id: <E1nDABA-0002uY-15@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:11:32 +0000

commit 6b776749ff7e45c30696235dbb4ecd2b53401cff
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:51:36 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:51:36 2022 +0100

    x86/time: use relative counts in calibration loops
    
    Looping until reaching/exceeding a certain value is error prone: If the
    target value is close enough to the wrapping point, the loop may not
    terminate at all. Switch to using delta values, which then allows to
    fold the two loops each into just one.
    
    Fixes: 93340297802b ("x86/time: calibrate TSC against platform timer")
    Reported-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 467191641d2a2fd2e43b3ae7b80399f89d339980
    master date: 2022-01-13 14:30:18 +0100
---
 xen/arch/x86/time.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 505e54ebd7..22352fa5b1 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -376,7 +376,7 @@ static u64 read_hpet_count(void)
 static int64_t __init init_hpet(struct platform_timesource *pts)
 {
     uint64_t hpet_rate, start;
-    uint32_t count, target;
+    uint32_t count, target, elapsed;
 
     if ( hpet_address && strcmp(opt_clocksource, pts->id) &&
          cpuidle_using_deep_cstate() )
@@ -414,11 +414,8 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
 
     count = hpet_read32(HPET_COUNTER);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(hpet_rate);
-    if ( target < count )
-        while ( hpet_read32(HPET_COUNTER) >= count )
-            continue;
-    while ( hpet_read32(HPET_COUNTER) < target )
+    target = CALIBRATE_VALUE(hpet_rate);
+    while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
@@ -456,8 +453,8 @@ static u64 read_pmtimer_count(void)
 
 static s64 __init init_pmtimer(struct platform_timesource *pts)
 {
-    u64 start;
-    u32 count, target, mask;
+    uint64_t start;
+    uint32_t count, target, mask, elapsed;
 
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -465,13 +462,10 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     pts->counter_bits = pmtmr_width;
     mask = 0xffffffff >> (32 - pmtmr_width);
 
-    count = inl(pmtmr_ioport) & mask;
+    count = inl(pmtmr_ioport);
     start = rdtsc_ordered();
-    target = count + CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
-    if ( target < count )
-        while ( (inl(pmtmr_ioport) & mask) >= count )
-            continue;
-    while ( (inl(pmtmr_ioport) & mask) < target )
+    target = CALIBRATE_VALUE(ACPI_PM_FREQUENCY);
+    while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
     return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:11:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261697.453329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDABL-0004oE-A4; Thu, 27 Jan 2022 19:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261697.453329; Thu, 27 Jan 2022 19: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 1nDABL-0004o6-6x; Thu, 27 Jan 2022 19:11:43 +0000
Received: by outflank-mailman (input) for mailman id 261697;
 Thu, 27 Jan 2022 19: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 1nDABK-0004nv-6H
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDABK-0007WW-5W
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDABK-0002vT-4W
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=NcRvqnSjrEr3mrMn2ipACnGiGtColv6FGEuBO9ZJxQc=; b=VlgveUs5o1k8A777WzTKuf9+VN
	98sm6IuvRvbFafeawdw17xX9+G8JTOIPjjzxujyOKBaUxrzSJlqaG5jaRnhHfQwmTHMy0ouyXaAXe
	O0wFWgNwhgEcL3q++/TX/S43OQvDiGp2IxkiZk4uXiifD96vBRFaGdF5yDFRGMuKFOOw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/time: improve TSC / CPU freq calibration accuracy
Message-Id: <E1nDABK-0002vT-4W@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:11:42 +0000

commit 0f88870898ae82aa9e7d0e6d1391e598a4aa7af7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jan 25 13:51:49 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:51:49 2022 +0100

    x86/time: improve TSC / CPU freq calibration accuracy
    
    While the problem report was for extreme errors, even smaller ones would
    better be avoided: The calculated period to run calibration loops over
    can (and usually will) be shorter than the actual time elapsed between
    first and last platform timer and TSC reads. Adjust values returned from
    the init functions accordingly.
    
    On a Skylake system I've tested this on accuracy (using HPET) went from
    detecting in some cases more than 220kHz too high a value to about
    ±2kHz. On other systems (or on this system, but with PMTMR) the original
    error range was much smaller, with less (in some cases only very little)
    improvement.
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a5c9a80af34eefcd6e31d0ed2b083f452cd9076d
    master date: 2022-01-13 14:31:52 +0100
---
 xen/arch/x86/time.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 22352fa5b1..3488d21b18 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -285,6 +285,23 @@ static char *freq_string(u64 freq)
     return s;
 }
 
+static uint64_t adjust_elapsed(uint64_t elapsed, uint32_t actual,
+                               uint32_t target)
+{
+    if ( likely(actual > target) )
+    {
+        /*
+         * A (perhaps significant) delay before the last timer read (e.g. due
+         * to a SMI or NMI) can lead to (perhaps severe) inaccuracy if not
+         * accounting for the time elapsed beyond the originally calculated
+         * duration of the calibration interval.
+         */
+        elapsed = muldiv64(elapsed, target, actual);
+    }
+
+    return elapsed * CALIBRATE_FRAC;
+}
+
 /************************************************************
  * PLATFORM TIMER 1: PROGRAMMABLE INTERVAL TIMER (LEGACY PIT)
  */
@@ -418,7 +435,7 @@ static int64_t __init init_hpet(struct platform_timesource *pts)
     while ( (elapsed = hpet_read32(HPET_COUNTER) - count) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static void resume_hpet(struct platform_timesource *pts)
@@ -468,7 +485,7 @@ static s64 __init init_pmtimer(struct platform_timesource *pts)
     while ( (elapsed = (inl(pmtmr_ioport) - count) & mask) < target )
         continue;
 
-    return (rdtsc_ordered() - start) * CALIBRATE_FRAC;
+    return adjust_elapsed(rdtsc_ordered() - start, elapsed, target);
 }
 
 static struct platform_timesource __initdata plt_pmtimer =
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:11:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:11:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261698.453333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDABV-0004sU-Bg; Thu, 27 Jan 2022 19:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261698.453333; Thu, 27 Jan 2022 19: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 1nDABV-0004sM-8R; Thu, 27 Jan 2022 19:11:53 +0000
Received: by outflank-mailman (input) for mailman id 261698;
 Thu, 27 Jan 2022 19: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 1nDABU-0004s0-Aj
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDABU-0007Wz-9x
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDABU-0002wY-8j
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=nGWVuydJGR89YyJhdVtVFsannHTPcGHlSeMklGtPoeI=; b=tm4Be1D/CS+jOqi5zrcgARGl7n
	1c8d8aanAT/6x86TLTejxTDlFn4/VOXsHrIUjVD9GVme5MgYjSHj3ucWl8XyjdwIo0F8b7WWIzRLd
	l8trYfnOnab7MygJhYsN58o/ed6wX76duafTqtn6by4FezyuBSdEPqwn4fLD8a4CdODc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/guest: Introduce {get,set}_reg() infrastructure
Message-Id: <E1nDABU-0002wY-8j@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:11:52 +0000

commit c45c2c2e09295ef3008a79d78673af0819ff4e4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:52:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:52:07 2022 +0100

    x86/guest: Introduce {get,set}_reg() infrastructure
    
    Various registers have per-guest-type or per-vendor locations or access
    requirements.  To support their use from common code, provide accessors which
    allow for per-guest-type behaviour.
    
    For now, just infrastructure handling default cases and expectations.
    Subsequent patches will start handling registers using this infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 88d3ff7ab15da277a85b39735797293fb541c718
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/hvm.c          | 22 ++++++++++++++++++++++
 xen/arch/x86/hvm/svm/svm.c      | 30 ++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c      | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emulate.c       | 31 +++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h   | 15 +++++++++++++++
 xen/include/asm-x86/pv/domain.h |  4 ++++
 6 files changed, 133 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 89926a5bf6..0842936862 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3724,6 +3724,28 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_call(hvm_funcs.get_reg, v, reg);
+    }
+}
+
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        return alternative_vcall(hvm_funcs.set_reg, v, reg, val);
+    }
+}
+
 static bool is_sysdesc_access(const struct x86_emulate_state *state,
                               const struct x86_emulate_ctxt *ctxt)
 {
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index bb4a9da27e..ac170b9d53 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2415,6 +2415,33 @@ static bool svm_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t svm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
@@ -2464,6 +2491,9 @@ static struct hvm_function_table __initdata svm_function_table = {
     .nhvm_intr_blocked = nsvm_intr_blocked,
     .nhvm_hap_walk_L1_p2m = nsvm_hap_walk_L1_p2m,
 
+    .get_reg = svm_get_reg,
+    .set_reg = svm_set_reg,
+
     .tsc_scaling = {
         .max_ratio = ~TSC_RATIO_RSVD_BITS,
     },
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2a29675c1a..e444d84f9c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2240,6 +2240,33 @@ static bool vmx_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2295,6 +2322,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .altp2m_vcpu_update_vmfunc_ve = vmx_vcpu_update_vmfunc_ve,
     .altp2m_vcpu_emulate_ve = vmx_vcpu_emulate_ve,
     .altp2m_vcpu_emulate_vmfunc = vmx_vcpu_emulate_vmfunc,
+
+    .get_reg = vmx_get_reg,
+    .set_reg = vmx_set_reg,
+
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index c0b153e2c5..04eca9e8b3 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -90,6 +90,37 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
     }
 }
 
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
+               __func__, v, reg);
+        domain_crash(d);
+        return 0;
+    }
+}
+
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(v == current || !vcpu_runnable(v));
+
+    switch ( reg )
+    {
+    default:
+        printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
+               __func__, v, reg, val);
+        domain_crash(d);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 1eb377dd82..e69828e274 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -214,6 +214,9 @@ struct hvm_function_table {
     bool_t (*altp2m_vcpu_emulate_ve)(struct vcpu *v);
     int (*altp2m_vcpu_emulate_vmfunc)(const struct cpu_user_regs *regs);
 
+    uint64_t (*get_reg)(struct vcpu *v, unsigned int reg);
+    void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -655,6 +658,18 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
     return false;
 }
 
+/*
+ * Accessors for registers which have per-guest-type or per-vendor locations
+ * (e.g. VMCS, msr load/save lists, VMCB, VMLOAD lazy, etc).
+ *
+ * The caller is responsible for all auditing - these accessors do not fail,
+ * but do use domain_crash() for usage errors.
+ *
+ * Must cope with being called in non-current context.
+ */
+uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg);
+void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index df9716ff26..3a67816764 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,6 +65,10 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:12:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261699.453337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDABf-0004vh-EK; Thu, 27 Jan 2022 19:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261699.453337; Thu, 27 Jan 2022 19: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 1nDABf-0004vZ-BG; Thu, 27 Jan 2022 19:12:03 +0000
Received: by outflank-mailman (input) for mailman id 261699;
 Thu, 27 Jan 2022 19: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 1nDABe-0004vQ-Ec
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDABe-0007XM-Dk
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDABe-0002xW-Ce
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=wOssBN5w3GpfowsKjYn77Xx1lTMm/oTNuxZX7/c9oUU=; b=iG+SQUd4lS3D/RfZkiOcT3gFmL
	JRpe7urCbmR86olLH+V55Onld8s6Q/+faGJC4e9IN0GxdbNWZXDGki+aR7cXg3zvG/O6UrNRA7NpH
	YCvvpraKlm/V+u2XivXY8mFiR/ZyC4n4qv7ChaNOn6wYNjplzDNCjUkmnnNEsQwJyVxU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/msr: Split MSR_SPEC_CTRL handling
Message-Id: <E1nDABe-0002xW-Ce@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:12:02 +0000

commit 4e25a788d000e57c4d04fdd33c209d7173420580
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:52:30 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:52:30 2022 +0100

    x86/msr: Split MSR_SPEC_CTRL handling
    
    In order to fix a VT-x bug, and support MSR_SPEC_CTRL on AMD, move
    MSR_SPEC_CTRL handling into the new {pv,hvm}_{get,set}_reg() infrastructure.
    
    Duplicate the msrs->spec_ctrl.raw accesses in the PV and VT-x paths for now.
    The SVM path is currently unreachable because of the CPUID policy.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6536688439dbca1d08fd6db5be29c39e3917fb2f
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c |  7 +++++++
 xen/arch/x86/msr.c         | 22 +++++++++++++++++-----
 xen/arch/x86/pv/emulate.c  |  9 +++++++++
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index e444d84f9c..06e6d52933 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2246,6 +2246,9 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return v->arch.msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -2260,6 +2263,10 @@ static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        v->arch.msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index caef0c6ede..faaa678f84 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -27,6 +27,7 @@
 #include <asm/debugreg.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/pv/domain.h>
 #include <asm/setup.h>
 
 #include <public/hvm/params.h>
@@ -237,8 +238,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_SPEC_CTRL:
         if ( !cp->feat.ibrsb )
             goto gp_fault;
-        *val = msrs->spec_ctrl.raw;
-        break;
+        goto get_reg;
 
     case MSR_INTEL_PLATFORM_INFO:
         *val = mp->platform_info.raw;
@@ -349,6 +349,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     return ret;
 
+ get_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        *val = pv_get_reg(v, msr);
+    else
+        *val = hvm_get_reg(v, msr);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
@@ -447,9 +454,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
         if ( val & rsvd )
             goto gp_fault; /* Rsvd bit set? */
-
-        msrs->spec_ctrl.raw = val;
-        break;
+        goto set_reg;
 
     case MSR_PRED_CMD:
         if ( !cp->feat.ibrsb && !cp->extd.ibpb )
@@ -580,6 +585,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 
     return ret;
 
+ set_reg: /* Delegate register access to per-vm-type logic. */
+    if ( is_pv_domain(d) )
+        pv_set_reg(v, msr, val);
+    else
+        hvm_set_reg(v, msr, val);
+    return X86EMUL_OKAY;
+
  gp_fault:
     return X86EMUL_EXCEPTION;
 }
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index 04eca9e8b3..cc4df27ddc 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -92,12 +92,16 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 
 uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        return msrs->spec_ctrl.raw;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
                __func__, v, reg);
@@ -108,12 +112,17 @@ uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
 
 void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
     switch ( reg )
     {
+    case MSR_SPEC_CTRL:
+        msrs->spec_ctrl.raw = val;
+        break;
+
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:12:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261700.453341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDABq-0004yY-Fz; Thu, 27 Jan 2022 19:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261700.453341; Thu, 27 Jan 2022 19: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 1nDABq-0004yQ-Cu; Thu, 27 Jan 2022 19:12:14 +0000
Received: by outflank-mailman (input) for mailman id 261700;
 Thu, 27 Jan 2022 19: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 1nDABo-0004yF-J3
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDABo-0007XW-IG
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDABo-0002yI-Fv
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=q5onUldBfw7apCjRoVCdm0/jmsbbJQsR6fXmilIq1KU=; b=2MTYQw4AYE2AEkODCHeHACggc6
	sWiweWNvM/jB5zUH50xrqmNWGeful3um9TxSV3hk6FdK5tNIF+/oYMPC7KxrUGZFoyiUU/651/Vwd
	2/FVBrZvQp0H+6sPJOksLXdxdEOmUKFueVtGr4NTJgr2/gWICvzdd508IQHDBOoFQCbg=;
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: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
Message-Id: <E1nDABo-0002yI-Fv@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:12:12 +0000

commit dbfc6ba03ae091b4d42893dc7133b8c587204d2e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:52:56 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:52:56 2022 +0100

    x86/spec-ctrl: Drop SPEC_CTRL_{ENTRY_FROM,EXIT_TO}_HVM
    
    These were written before Spectre/Meltdown went public, and there was large
    uncertainty in how the protections would evolve.  As it turns out, they're
    very specific to Intel hardware, and not very suitable for AMD.
    
    Drop the macros, opencoding the relevant subset of functionality, and leaving
    grep-fodder to locate the logic.  No change at all for VT-x.
    
    For AMD, the only relevant piece of functionality is DO_OVERWRITE_RSB,
    although we will soon be adding (different) logic to handle MSR_SPEC_CTRL.
    
    This has a marginal improvement of removing an unconditional pile of long-nops
    from the vmentry/exit path.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 95b13fa43e0753b7514bef13abe28253e8614f62
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/svm/entry.S        |  5 +++--
 xen/arch/x86/hvm/vmx/entry.S        |  8 ++++++--
 xen/include/asm-x86/spec_ctrl_asm.h | 19 ++++---------------
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 1d2df08e89..fc3d95e4a8 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -63,7 +63,7 @@ __UNLIKELY_END(nsvm_hap)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_SVM   (nothing currently) */
 
         pop  %r15
         pop  %r14
@@ -90,7 +90,8 @@ __UNLIKELY_END(nsvm_hap)
 
         GET_CURRENT(bx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_SVM    Req: b=curr %rsp=regs/cpuinfo, Clob: ac  */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         STGI
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 27c8c5ca49..30139ae58e 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -33,7 +33,9 @@ ENTRY(vmx_asm_vmexit_handler)
         movb $1,VCPU_vmx_launched(%rbx)
         mov  %rax,VCPU_hvm_guest_cr2(%rbx)
 
-        SPEC_CTRL_ENTRY_FROM_HVM    /* Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
+        ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
+        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -80,7 +82,9 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        SPEC_CTRL_EXIT_TO_HVM   /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
+        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
 
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index cb34299a86..2b3f123cb5 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -68,14 +68,16 @@
  *
  * The following ASM fragments implement this algorithm.  See their local
  * comments for further details.
- *  - SPEC_CTRL_ENTRY_FROM_HVM
  *  - SPEC_CTRL_ENTRY_FROM_PV
  *  - SPEC_CTRL_ENTRY_FROM_INTR
  *  - SPEC_CTRL_ENTRY_FROM_INTR_IST
  *  - SPEC_CTRL_EXIT_TO_XEN_IST
  *  - SPEC_CTRL_EXIT_TO_XEN
  *  - SPEC_CTRL_EXIT_TO_PV
- *  - SPEC_CTRL_EXIT_TO_HVM
+ *
+ * Additionally, the following grep-fodder exists to find the HVM logic.
+ *  - SPEC_CTRL_ENTRY_FROM_{SVM,VMX}
+ *  - SPEC_CTRL_EXIT_TO_{SVM,VMX}
  */
 
 .macro DO_OVERWRITE_RSB tmp=rax
@@ -225,12 +227,6 @@
     wrmsr
 .endm
 
-/* Use after a VMEXIT from an HVM guest. */
-#define SPEC_CTRL_ENTRY_FROM_HVM                                        \
-    ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM;           \
-    ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM,                        \
-        X86_FEATURE_SC_MSR_HVM
-
 /* Use after an entry from PV context (syscall/sysenter/int80/int82/etc). */
 #define SPEC_CTRL_ENTRY_FROM_PV                                         \
     ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_PV;            \
@@ -255,13 +251,6 @@
     ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
         X86_FEATURE_SC_VERW_PV
 
-/* Use when exiting to HVM guest context. */
-#define SPEC_CTRL_EXIT_TO_HVM                                           \
-    ALTERNATIVE "",                                                     \
-        DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM;             \
-    ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)),           \
-        X86_FEATURE_SC_VERW_HVM
-
 /*
  * Use in IST interrupt/exception context.  May interrupt Xen or PV context.
  * Fine grain control of SCF_ist_wrmsr is needed for safety in the S3 resume
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:12:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261701.453345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDAC0-00051I-HN; Thu, 27 Jan 2022 19:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261701.453345; Thu, 27 Jan 2022 19: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 1nDAC0-00051B-ER; Thu, 27 Jan 2022 19:12:24 +0000
Received: by outflank-mailman (input) for mailman id 261701;
 Thu, 27 Jan 2022 19: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 1nDABy-00050r-MR
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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 1nDABy-0007Xl-Lh
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDABy-0002zC-Kk
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19: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=hISrec5A4dTjDMYruUKQAGGu/Pl4Hb5x1mwYzcuFP+Q=; b=gLScfv4MGtaGiRehRzU8pxB4d0
	csdsdeTWs82t0XzTcXk5rL3BbUXvhWH5nTqjrK/MNGIUzdze9BbiGwTtppcQ/bu3Bszs9jDdPH+kB
	m1HV8gDnDQaKaiImbYTZNdjahdnGe9/i+lbbZav5v4uP5zctsivBqwXIJEvNv5oflq5k=;
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: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
Message-Id: <E1nDABy-0002zC-Kk@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:12:22 +0000

commit 50935b88b4cd7f9cefe9eb2ffc5150d06c501d05
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 25 13:53:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 25 13:53:14 2022 +0100

    x86/spec-ctrl: Fix NMI race condition with VT-x MSR_SPEC_CTRL handling
    
    The logic was based on a mistaken understanding of how NMI blocking on vmexit
    works.  NMIs are only blocked for EXIT_REASON_NMI, and not for general exits.
    Therefore, an NMI can in general hit early in the vmx_asm_vmexit_handler path,
    and the guest's value will be clobbered before it is saved.
    
    Switch to using MSR load/save lists.  This causes the guest value to be saved
    atomically with respect to NMIs/MCEs/etc.
    
    First, update vmx_cpuid_policy_changed() to configure the load/save lists at
    the same time as configuring the intercepts.  This function is always used in
    remote context, so extend the vmx_vmcs_{enter,exit}() block to cover the whole
    function, rather than having multiple remote acquisitions of the same VMCS.
    
    Both of vmx_{add,del}_guest_msr() can fail.  The -ESRCH delete case is fine,
    but all others are fatal to the running of the VM, so handle them using
    domain_crash() - this path is only used during domain construction anyway.
    
    Second, update vmx_{get,set}_reg() to use the MSR load/save lists rather than
    vcpu_msrs, and update the vcpu_msrs comment to describe the new state
    location.
    
    Finally, adjust the entry/exit asm.
    
    Because the guest value is saved and loaded atomically, we do not need to
    manually load the guest value, nor do we need to enable SCF_use_shadow.  This
    lets us remove the use of DO_SPEC_CTRL_EXIT_TO_GUEST.  Additionally,
    SPEC_CTRL_ENTRY_FROM_PV gets removed too, because on an early entry failure,
    we're no longer in the guest MSR_SPEC_CTRL context needing to switch back to
    Xen's context.
    
    The only action remaining is to load Xen's MSR_SPEC_CTRL value on vmexit.  We
    could in principle use the host msr list, but is expected to complicated
    future work.  Delete DO_SPEC_CTRL_ENTRY_FROM_HVM entirely, and use a shorter
    code sequence to simply reload Xen's setting from the top-of-stack block.
    
    Adjust the comment at the top of spec_ctrl_asm.h in light of this bugfix.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f0eaadf84d273a6ff8df3660b874a02d0e7677
    master date: 2022-01-20 16:32:11 +0000
---
 xen/arch/x86/hvm/vmx/entry.S        | 22 ++++++++++++-------
 xen/arch/x86/hvm/vmx/vmx.c          | 44 ++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/msr.h           | 10 ++++++++-
 xen/include/asm-x86/spec_ctrl_asm.h | 32 ++++-----------------------
 4 files changed, 68 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 30139ae58e..7ee3382fd0 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -35,7 +35,14 @@ ENTRY(vmx_asm_vmexit_handler)
 
         /* SPEC_CTRL_ENTRY_FROM_VMX    Req: b=curr %rsp=regs/cpuinfo, Clob: acd */
         ALTERNATIVE "", DO_OVERWRITE_RSB, X86_FEATURE_SC_RSB_HVM
-        ALTERNATIVE "", DO_SPEC_CTRL_ENTRY_FROM_HVM, X86_FEATURE_SC_MSR_HVM
+
+        .macro restore_spec_ctrl
+            mov    $MSR_SPEC_CTRL, %ecx
+            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            xor    %edx, %edx
+            wrmsr
+        .endm
+        ALTERNATIVE "", restore_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         /* Hardware clears MSR_DEBUGCTL on VMExit.  Reinstate it if debugging Xen. */
@@ -82,8 +89,7 @@ UNLIKELY_END(realmode)
         mov VCPUMSR_spec_ctrl_raw(%rax), %eax
 
         /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */
-        /* SPEC_CTRL_EXIT_TO_VMX   Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */
-        ALTERNATIVE "", DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
+        /* SPEC_CTRL_EXIT_TO_VMX   Req: %rsp=regs/cpuinfo              Clob:    */
         ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), X86_FEATURE_SC_VERW_HVM
 
         mov  VCPU_hvm_guest_cr2(%rbx),%rax
@@ -119,12 +125,12 @@ UNLIKELY_END(realmode)
         SAVE_ALL
 
         /*
-         * PV variant needed here as no guest code has executed (so
-         * MSR_SPEC_CTRL can't have changed value), and NMIs/MCEs are liable
-         * to hit (in which case the HVM variant might corrupt things).
+         * SPEC_CTRL_ENTRY notes
+         *
+         * If we end up here, no guest code has executed.  The MSR lists have
+         * not been processed, so we still have Xen's choice of MSR_SPEC_CTRL
+         * in context, and the RSB is unchanged.
          */
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
 
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 06e6d52933..7adb3a94a4 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -558,6 +558,7 @@ void vmx_update_exception_bitmap(struct vcpu *v)
 static void vmx_cpuid_policy_changed(struct vcpu *v)
 {
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
+    int rc = 0;
 
     if ( opt_hvm_fep ||
          (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
@@ -567,17 +568,29 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
 
     /*
      * We can safely pass MSR_SPEC_CTRL through to the guest, even if STIBP
      * isn't enumerated in hardware, as SPEC_CTRL_STIBP is ignored.
      */
     if ( cp->feat.ibrsb )
+    {
         vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
+
+        rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
+        if ( rc )
+            goto out;
+    }
     else
+    {
         vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
 
+        rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
+        if ( rc && rc != -ESRCH )
+            goto out;
+        rc = 0; /* Tolerate -ESRCH */
+    }
+
     /* MSR_PRED_CMD is safe to pass through if the guest knows about it. */
     if ( cp->feat.ibrsb || cp->extd.ibpb )
         vmx_clear_msr_intercept(v, MSR_PRED_CMD,  VMX_MSR_RW);
@@ -589,6 +602,15 @@ static void vmx_cpuid_policy_changed(struct vcpu *v)
         vmx_clear_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
+
+ out:
+    vmx_vmcs_exit(v);
+
+    if ( rc )
+    {
+        printk(XENLOG_G_ERR "%pv MSR list error: %d", v, rc);
+        domain_crash(v->domain);
+    }
 }
 
 int vmx_guest_x86_mode(struct vcpu *v)
@@ -2243,11 +2265,20 @@ static bool vmx_get_pending_event(struct vcpu *v, struct x86_event *info)
 static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     struct domain *d = v->domain;
+    uint64_t val = 0;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        return v->arch.msrs->spec_ctrl.raw;
+        rc = vmx_read_guest_msr(v, reg, &val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
+        return val;
 
     default:
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x) Bad register\n",
@@ -2260,11 +2291,18 @@ static uint64_t vmx_get_reg(struct vcpu *v, unsigned int reg)
 static void vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     struct domain *d = v->domain;
+    int rc;
 
     switch ( reg )
     {
     case MSR_SPEC_CTRL:
-        v->arch.msrs->spec_ctrl.raw = val;
+        rc = vmx_write_guest_msr(v, reg, val);
+        if ( rc )
+        {
+            printk(XENLOG_G_ERR "%s(%pv, 0x%08x) MSR list error: %d\n",
+                   __func__, v, reg, rc);
+            domain_crash(d);
+        }
         break;
 
     default:
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 5c44c79600..899318840d 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -277,7 +277,15 @@ extern struct msr_policy     raw_msr_policy,
 /* Container object for per-vCPU MSRs */
 struct vcpu_msrs
 {
-    /* 0x00000048 - MSR_SPEC_CTRL */
+    /*
+     * 0x00000048 - MSR_SPEC_CTRL
+     *
+     * For PV guests, this holds the guest kernel value.  It is accessed on
+     * every entry/exit path.
+     *
+     * For VT-x guests, the guest value is held in the MSR guest load/save
+     * list.
+     */
     struct {
         uint32_t raw;
     } spec_ctrl;
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
index 2b3f123cb5..bf82528a12 100644
--- a/xen/include/asm-x86/spec_ctrl_asm.h
+++ b/xen/include/asm-x86/spec_ctrl_asm.h
@@ -42,9 +42,10 @@
  *     path, or late in the exit path after restoring the guest value.  This
  *     will corrupt the guest value.
  *
- * Factor 1 is dealt with by relying on NMIs/MCEs being blocked immediately
- * after VMEXIT.  The VMEXIT-specific code reads MSR_SPEC_CTRL and updates
- * current before loading Xen's MSR_SPEC_CTRL setting.
+ * Factor 1 is dealt with:
+ *   - On VMX by using MSR load/save lists to have vmentry/exit atomically
+ *     load/save the guest value.  Xen's value is loaded in regular code, and
+ *     there is no need to use the shadow logic (below).
  *
  * Factor 2 is harder.  We maintain a shadow_spec_ctrl value, and a use_shadow
  * boolean in the per cpu spec_ctrl_flags.  The synchronous use is:
@@ -128,31 +129,6 @@
 #endif
 .endm
 
-.macro DO_SPEC_CTRL_ENTRY_FROM_HVM
-/*
- * Requires %rbx=current, %rsp=regs/cpuinfo
- * Clobbers %rax, %rcx, %rdx
- *
- * The common case is that a guest has direct access to MSR_SPEC_CTRL, at
- * which point we need to save the guest value before setting IBRS for Xen.
- * Unilaterally saving the guest value is shorter and faster than checking.
- */
-    mov $MSR_SPEC_CTRL, %ecx
-    rdmsr
-
-    /* Stash the value from hardware. */
-    mov VCPU_arch_msrs(%rbx), %rdx
-    mov %eax, VCPUMSR_spec_ctrl_raw(%rdx)
-    xor %edx, %edx
-
-    /* Clear SPEC_CTRL shadowing *before* loading Xen's value. */
-    andb $~SCF_use_shadow, CPUINFO_spec_ctrl_flags(%rsp)
-
-    /* Load Xen's intended value. */
-    movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-    wrmsr
-.endm
-
 .macro DO_SPEC_CTRL_ENTRY maybexen:req
 /*
  * Requires %rsp=regs (also cpuinfo if !maybexen)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:12:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261702.453350 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDACA-000543-Jp; Thu, 27 Jan 2022 19:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261702.453350; Thu, 27 Jan 2022 19:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDACA-00053v-G4; Thu, 27 Jan 2022 19:12:34 +0000
Received: by outflank-mailman (input) for mailman id 261702;
 Thu, 27 Jan 2022 19:12:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDAC8-00053g-Pj
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDAC8-0007Xv-Ou
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDAC8-0002zy-O0
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bpBO/prVRALBt6l51giaSywY8ySRF41Q/WLf0OKbO7A=; b=R24CkflEh5XG1eU6lwAjMc1fpf
	kpWIttYS0DqFk0gnfPeqhVEaGy/TvC+j1fNXwFdPApxyRcYfnjQ6o661rYZaWW5s07xXXG7rJN4sj
	mx54lFNyhHFhQK+UFsuOcDKKK5+c32ONEYv0JzwShn6OBaRQ57lo3cx3v1Iuyob9UeEI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86: Fix build with the get/set_reg() infrastructure
Message-Id: <E1nDAC8-0002zy-O0@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:12:32 +0000

commit bdf197d8405e2e64f3d9ad875763790bdb4ecd4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 26 12:51:31 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:51:31 2022 +0100

    x86: Fix build with the get/set_reg() infrastructure
    
    I clearly messed up concluding that the stubs were safe to drop.
    
    The is_{pv,hvm}_domain() predicates are not symmetrical with both CONFIG_PV
    and CONFIG_HVM.  As a result logic of the form `if ( pv/hvm ) ... else ...`
    will always have one side which can't be DCE'd.
    
    While technically only the hvm stubs are needed, due to the use of the
    is_pv_domain() predicate in guest_{rd,wr}msr(), sort out the pv stubs too to
    avoid leaving a bear trap for future users.
    
    Fixes: 88d3ff7ab15d ("x86/guest: Introduce {get,set}_reg() infrastructure")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 13caa585791234fe3e3719c8376f7ea731012451
    master date: 2022-01-21 12:42:11 +0000
---
 xen/include/asm-x86/hvm/hvm.h   | 10 ++++++++++
 xen/include/asm-x86/pv/domain.h | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index e69828e274..6d67ea3b05 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -766,6 +766,16 @@ static inline bool hvm_has_set_descriptor_access_exiting(void)
     return false;
 }
 
+static inline uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/asm-x86/pv/domain.h
index 3a67816764..6b16da9d18 100644
--- a/xen/include/asm-x86/pv/domain.h
+++ b/xen/include/asm-x86/pv/domain.h
@@ -65,10 +65,6 @@ static inline unsigned long get_pcid_bits(const struct vcpu *v, bool is_xpti)
 #endif
 }
 
-/* See hvm_{get,set}_reg() for description. */
-uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
-void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
-
 #ifdef CONFIG_PV
 
 void pv_vcpu_destroy(struct vcpu *v);
@@ -93,6 +89,10 @@ unsigned long pv_fixup_guest_cr4(const struct vcpu *v, unsigned long cr4);
 /* Create a cr4 value to load into hardware, based on vcpu settings. */
 unsigned long pv_make_cr4(const struct vcpu *v);
 
+/* See hvm_{get,set}_reg() for description. */
+uint64_t pv_get_reg(struct vcpu *v, unsigned int reg);
+void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val);
+
 bool xpti_pcid_enabled(void);
 
 #else  /* !CONFIG_PV */
@@ -106,6 +106,16 @@ static inline int pv_domain_initialise(struct domain *d) { return -EOPNOTSUPP; }
 
 static inline unsigned long pv_make_cr4(const struct vcpu *v) { return ~0ul; }
 
+static inline uint64_t pv_get_reg(struct vcpu *v, unsigned int reg)
+{
+    ASSERT_UNREACHABLE();
+    return 0;
+}
+static inline void pv_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
+{
+    ASSERT_UNREACHABLE();
+}
+
 #endif	/* CONFIG_PV */
 
 void paravirt_ctxt_switch_from(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 19:12:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 19:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261703.453353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDACK-00057J-MT; Thu, 27 Jan 2022 19:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261703.453353; Thu, 27 Jan 2022 19:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDACK-00057A-JW; Thu, 27 Jan 2022 19:12:44 +0000
Received: by outflank-mailman (input) for mailman id 261703;
 Thu, 27 Jan 2022 19:12: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 1nDACI-00056s-TH
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12: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 1nDACI-0007Y5-SJ
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDACI-00030d-RB
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 19:12:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AaGwMb+nJrwWM8WhVe2J+4H9g5qH/V5MXXDzsnD1r/M=; b=A4HnzzRtrkIurijo3YZafy7xAi
	V0VXXIPK/yDylG8KbjFAHCvYSXxNYKxxVAUPJ1ag7vRURflOPmsXFSygwvXxRtHhHau9IDK0IR8x9
	KE+eAPovk2JsjWjrNrHhzc52FKnuzxpI4eF/Gs4DIM3y3AUNR8YqZYsskdzWOrTbzgqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/pvh: fix population of the low 1MB for dom0
Message-Id: <E1nDACI-00030d-RB@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 19:12:42 +0000

commit 689734d05d5ec6b52b9e84807806471141088d84
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jan 26 12:52:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jan 26 12:52:09 2022 +0100

    x86/pvh: fix population of the low 1MB for dom0
    
    RMRRs are setup ahead of populating the p2m and hence the ASSERT when
    populating the low 1MB needs to be relaxed when it finds an existing
    entry: it's either RAM or a RMRR resulting from the IOMMU setup.
    
    Rework the logic a bit and introduce a local mfn variable in order to
    assert that if the gfn is populated and not RAM it is an identity map.
    
    Fixes: 6b4f6a31ac ('x86/PVH: de-duplicate mappings for first Mb of Dom0 memory')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2d5fc9120d556ec3c4b1acf0ab5660a6d3f7ebeb
    master date: 2022-01-25 10:52:24 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 5ba0c80a89..1052cdf695 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -465,11 +465,16 @@ static int __init pvh_populate_p2m(struct domain *d)
     for ( i = rc = 0; i < MB1_PAGES; ++i )
     {
         p2m_type_t p2mt;
+        mfn_t mfn = get_gfn_query(d, i, &p2mt);
 
-        if ( mfn_eq(get_gfn_query(d, i, &p2mt), INVALID_MFN) )
+        if ( mfn_eq(mfn, INVALID_MFN) )
             rc = set_mmio_p2m_entry(d, _gfn(i), _mfn(i), PAGE_ORDER_4K);
         else
-            ASSERT(p2mt == p2m_ram_rw);
+            /*
+             * If the p2m entry is already set it must belong to a RMRR and
+             * already be identity mapped, or be a RAM region.
+             */
+            ASSERT(p2mt == p2m_ram_rw || mfn_eq(mfn, _mfn(i)));
         put_gfn(d, i);
         if ( rc )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 20:22:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 20:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261736.453423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDBHS-0007Av-Gj; Thu, 27 Jan 2022 20:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261736.453423; Thu, 27 Jan 2022 20:22: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 1nDBHS-0007An-Dn; Thu, 27 Jan 2022 20:22:06 +0000
Received: by outflank-mailman (input) for mailman id 261736;
 Thu, 27 Jan 2022 20:22: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 1nDBHR-0007Ah-GH
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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 1nDBHR-0000Rz-BG
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDBHR-0000Gu-8i
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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=DolgshwLHX6d4rq4AtbneORsPsDIe5wncqVDscptI74=; b=gxL6iotaeo9BsJyxQ0btUUeho4
	Gd/6lmWWnPMaok5lOfBUPlpa7swQ8qmKeiUBJ8imN0sjSzFJNpLzL95lcxmgZXVGTUJphASVvgwy/
	KFabWLcS8QqlSmIgD05ijpmOyq/VZvBQSdQq1ZXV7BfO2vW9m/IyWXtfsPnpM8FS+Rk8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vmx: Fold VMCS logic in vmx_{get,set}_segment_register()
Message-Id: <E1nDBHR-0000Gu-8i@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 20:22:05 +0000

commit b4c669fd7eabfdba93aa96a3a3b62829a67a60d5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 21 11:00:09 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:38:15 2022 +0000

    x86/vmx: Fold VMCS logic in vmx_{get,set}_segment_register()
    
    Xen's segment enumeration almost matches the VMCS encoding order, while the
    VMCS encoding order has the system segments immediately following the user
    segments for all relevant attributes.
    
    Use a sneaky xor to hide the difference in encoding order to fold the switch
    statements, dropping 10 __vmread() and 10 __vmwrite() calls.  Bloat-o-meter
    reports:
    
      add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-433 (-433)
      Function                                     old     new   delta
      vmx_set_segment_register                     804     593    -211
      vmx_get_segment_register                     778     556    -222
    
    showing that these wrappers aren't trivial.  In addition, 20 BUGs worth of
    metadata are dropped.
    
    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 | 77 ++++++++++++++++++++--------------------------
 1 file changed, 34 insertions(+), 43 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index c44cf8f5d4..9765cfd90a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -986,6 +986,7 @@ static void vmx_get_segment_register(struct vcpu *v, enum x86_segment seg,
                                      struct segment_register *reg)
 {
     unsigned long attr = 0, sel = 0, limit;
+    unsigned int tmp_seg;
 
     /*
      * We may get here in the context of dump_execstate(), which may have
@@ -1009,34 +1010,34 @@ static void vmx_get_segment_register(struct vcpu *v, enum x86_segment seg,
         return;
     }
 
-    switch ( seg )
+    /*
+     * Xen's x86_seg_* enumeration *almost* matches the VMCS encoding order.
+     *
+     * tr and ldtr are reversed, and other areas of code rely on this, so we
+     * can't just re-enumerate.
+     */
+    BUILD_BUG_ON(x86_seg_tr   != 6);
+    BUILD_BUG_ON(x86_seg_ldtr != 7);
+    BUILD_BUG_ON(x86_seg_gdtr != 8);
+    BUILD_BUG_ON(x86_seg_idtr != 9);
+    switch ( tmp_seg = seg )
     {
-    case x86_seg_es ... x86_seg_gs:
-        __vmread(GUEST_SEG_SELECTOR(seg), &sel);
-        __vmread(GUEST_SEG_LIMIT(seg),    &limit);
-        __vmread(GUEST_SEG_BASE(seg),     &reg->base);
-        __vmread(GUEST_SEG_AR_BYTES(seg), &attr);
-        break;
     case x86_seg_tr:
-        __vmread(GUEST_TR_SELECTOR, &sel);
-        __vmread(GUEST_TR_LIMIT,    &limit);
-        __vmread(GUEST_TR_BASE,     &reg->base);
-        __vmread(GUEST_TR_AR_BYTES, &attr);
-        break;
+    case x86_seg_ldtr:
+        tmp_seg ^= 1; /* Flip tr and ldtr so GUEST_SEG_*() works. */
+        fallthrough;
+
+    case x86_seg_es ... x86_seg_gs:
+        __vmread(GUEST_SEG_SELECTOR(tmp_seg), &sel);
+        __vmread(GUEST_SEG_AR_BYTES(tmp_seg), &attr);
+        fallthrough;
+
     case x86_seg_gdtr:
-        __vmread(GUEST_GDTR_LIMIT, &limit);
-        __vmread(GUEST_GDTR_BASE,  &reg->base);
-        break;
     case x86_seg_idtr:
-        __vmread(GUEST_IDTR_LIMIT, &limit);
-        __vmread(GUEST_IDTR_BASE,  &reg->base);
-        break;
-    case x86_seg_ldtr:
-        __vmread(GUEST_LDTR_SELECTOR, &sel);
-        __vmread(GUEST_LDTR_LIMIT,    &limit);
-        __vmread(GUEST_LDTR_BASE,     &reg->base);
-        __vmread(GUEST_LDTR_AR_BYTES, &attr);
+        __vmread(GUEST_SEG_LIMIT(tmp_seg),    &limit);
+        __vmread(GUEST_SEG_BASE(tmp_seg),     &reg->base);
         break;
+
     default:
         BUG();
         return;
@@ -1150,32 +1151,22 @@ static void vmx_set_segment_register(struct vcpu *v, enum x86_segment seg,
 
     switch ( seg )
     {
+    case x86_seg_tr:
+    case x86_seg_ldtr:
+        seg ^= 1; /* Flip tr and ldtr so GUEST_SEG_*() works. */
+        fallthrough;
+
     case x86_seg_es ... x86_seg_gs:
         __vmwrite(GUEST_SEG_SELECTOR(seg), sel);
-        __vmwrite(GUEST_SEG_LIMIT(seg),    limit);
-        __vmwrite(GUEST_SEG_BASE(seg),     base);
         __vmwrite(GUEST_SEG_AR_BYTES(seg), attr);
-        break;
-    case x86_seg_tr:
-        __vmwrite(GUEST_TR_SELECTOR, sel);
-        __vmwrite(GUEST_TR_LIMIT, limit);
-        __vmwrite(GUEST_TR_BASE, base);
-        __vmwrite(GUEST_TR_AR_BYTES, attr);
-        break;
+        fallthrough;
+
     case x86_seg_gdtr:
-        __vmwrite(GUEST_GDTR_LIMIT, limit);
-        __vmwrite(GUEST_GDTR_BASE, base);
-        break;
     case x86_seg_idtr:
-        __vmwrite(GUEST_IDTR_LIMIT, limit);
-        __vmwrite(GUEST_IDTR_BASE, base);
-        break;
-    case x86_seg_ldtr:
-        __vmwrite(GUEST_LDTR_SELECTOR, sel);
-        __vmwrite(GUEST_LDTR_LIMIT, limit);
-        __vmwrite(GUEST_LDTR_BASE, base);
-        __vmwrite(GUEST_LDTR_AR_BYTES, attr);
+        __vmwrite(GUEST_SEG_LIMIT(seg),    limit);
+        __vmwrite(GUEST_SEG_BASE(seg),     base);
         break;
+
     default:
         BUG();
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 20:22:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 20:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261737.453427 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDBHc-0007Cq-IU; Thu, 27 Jan 2022 20:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261737.453427; Thu, 27 Jan 2022 20:22: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 1nDBHc-0007Ci-FM; Thu, 27 Jan 2022 20:22:16 +0000
Received: by outflank-mailman (input) for mailman id 261737;
 Thu, 27 Jan 2022 20:22: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 1nDBHb-0007CT-FN
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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 1nDBHb-0000S5-EW
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDBHb-0000Hl-DV
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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=AwU0vzfpnScUrGpENSGXVvbZaat65hkgKoQS6NW2NZM=; b=qsTQHE4bAAG8tLw2zI5HadpJsp
	ol9RtXD6M9308iEbCb3MgRX/xnhOVoQ6HlVTXsBG0uLmXVHJwLaNoqGhk+jhfYsRHJT93dJOgW2pA
	J9W4f0TjoT9rJP/Mwm9Hog+RNfWdaZJHMmm5tkLBV4TEmyhhAoFzwdE+5L1HrhKY9NZo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpuid: Disentangle logic for new feature leaves
Message-Id: <E1nDBHb-0000Hl-DV@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 20:22:15 +0000

commit e3662437eb43cc8002bd39be077ef68b131649c5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 27 13:56:04 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:38:15 2022 +0000

    x86/cpuid: Disentangle logic for new feature leaves
    
    Adding a new feature leaf is a reasonable amount of boilerplate and for the
    patch to build, at least one feature from the new leaf needs defining.  This
    typically causes two non-trivial changes to be merged together.
    
    First, have gen-cpuid.py write out some extra placeholder defines:
    
      #define CPUID_BITFIELD_11 bool :1, :1, lfence_dispatch:1, ...
      #define CPUID_BITFIELD_12 uint32_t :32 /* placeholder */
      #define CPUID_BITFIELD_13 uint32_t :32 /* placeholder */
      #define CPUID_BITFIELD_14 uint32_t :32 /* placeholder */
      #define CPUID_BITFIELD_15 uint32_t :32 /* placeholder */
    
    This allows DECL_BITFIELD() to be added to struct cpuid_policy without
    requiring a XEN_CPUFEATURE() declared for the leaf.  The choice of 4 is
    arbitrary, and allows us to add more than one leaf at a time if necessary.
    
    Second, rework generic_identify() to not use specific feature names.
    
    The choice of deriving the index from a feature was to avoid mismatches, but
    its correctness depends on bugs like c/s 249e0f1d8f20 ("x86/cpuid: Fix
    TSXLDTRK definition") not happening.
    
    Switch to using FEATURESET_* just like the policy/featureset helpers.  This
    breaks the cognitive complexity of needing to know which leaf a specifically
    named feature should reside in, and is shorter to write.  It is also far
    easier to identify as correct at a glance, given the correlation with the
    CPUID leaf being read.
    
    In addition, tidy up some other bits of generic_identify()
     * Drop leading zeros from leaf numbers.
     * Don't use a locked update for X86_FEATURE_APERFMPERF.
     * Rework extended_cpuid_level calculation to avoid setting it twice.
     * Use "leaf >= $N" consistently so $N matches with the CPUID input.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c | 54 +++++++++++++++++++++++------------------------
 xen/tools/gen-cpuid.py    |  2 ++
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 4a163afbfc..c6773c85fd 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -379,7 +379,7 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	u32 eax, ebx, ecx, edx, tmp;
 
 	/* Get vendor name */
-	cpuid(0x00000000, &c->cpuid_level, &ebx, &ecx, &edx);
+	cpuid(0, &c->cpuid_level, &ebx, &ecx, &edx);
 	*(u32 *)&c->x86_vendor_id[0] = ebx;
 	*(u32 *)&c->x86_vendor_id[8] = ecx;
 	*(u32 *)&c->x86_vendor_id[4] = edx;
@@ -394,7 +394,7 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	/* Note that the vendor-specific code below might override */
 
 	/* Model and family information. */
-	cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
+	cpuid(1, &eax, &ebx, &ecx, &edx);
 	c->x86 = get_cpu_family(eax, &c->x86_model, &c->x86_mask);
 	c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
 	c->phys_proc_id = c->apicid;
@@ -404,53 +404,53 @@ static void generic_identify(struct cpuinfo_x86 *c)
 
 	/* c_early_init() may have adjusted cpuid levels/features.  Reread. */
 	c->cpuid_level = cpuid_eax(0);
-	cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
-	c->x86_capability[cpufeat_word(X86_FEATURE_FPU)] = edx;
-	c->x86_capability[cpufeat_word(X86_FEATURE_SSE3)] = ecx;
+	cpuid(1, &eax, &ebx,
+	      &c->x86_capability[FEATURESET_1c],
+	      &c->x86_capability[FEATURESET_1d]);
 
 	if ( cpu_has(c, X86_FEATURE_CLFLUSH) )
 		c->x86_clflush_size = ((ebx >> 8) & 0xff) * 8;
 
 	if ( (c->cpuid_level >= CPUID_PM_LEAF) &&
 	     (cpuid_ecx(CPUID_PM_LEAF) & CPUID6_ECX_APERFMPERF_CAPABILITY) )
-		set_bit(X86_FEATURE_APERFMPERF, c->x86_capability);
+		__set_bit(X86_FEATURE_APERFMPERF, c->x86_capability);
+
+	eax = cpuid_eax(0x80000000);
+	if ((eax >> 16) == 0x8000)
+		c->extended_cpuid_level = eax;
 
 	/* AMD-defined flags: level 0x80000001 */
-	c->extended_cpuid_level = cpuid_eax(0x80000000);
-	if ((c->extended_cpuid_level >> 16) != 0x8000)
-		c->extended_cpuid_level = 0;
-	if (c->extended_cpuid_level > 0x80000000)
+	if (c->extended_cpuid_level >= 0x80000001)
 		cpuid(0x80000001, &tmp, &tmp,
-		      &c->x86_capability[cpufeat_word(X86_FEATURE_LAHF_LM)],
-		      &c->x86_capability[cpufeat_word(X86_FEATURE_SYSCALL)]);
+		      &c->x86_capability[FEATURESET_e1c],
+		      &c->x86_capability[FEATURESET_e1d]);
 
 	if (c->extended_cpuid_level >= 0x80000004)
 		get_model_name(c); /* Default name */
 	if (c->extended_cpuid_level >= 0x80000007)
-		c->x86_capability[cpufeat_word(X86_FEATURE_ITSC)]
-			= cpuid_edx(0x80000007);
+		c->x86_capability[FEATURESET_e7d] = cpuid_edx(0x80000007);
 	if (c->extended_cpuid_level >= 0x80000008)
-		c->x86_capability[cpufeat_word(X86_FEATURE_CLZERO)]
-			= cpuid_ebx(0x80000008);
+		c->x86_capability[FEATURESET_e8b] = cpuid_ebx(0x80000008);
 	if (c->extended_cpuid_level >= 0x80000021)
-		c->x86_capability[cpufeat_word(X86_FEATURE_LFENCE_DISPATCH)]
-			= cpuid_eax(0x80000021);
+		c->x86_capability[FEATURESET_e21a] = cpuid_eax(0x80000021);
 
 	/* Intel-defined flags: level 0x00000007 */
-	if ( c->cpuid_level >= 0x00000007 ) {
-		cpuid_count(0x00000007, 0, &eax,
-			    &c->x86_capability[cpufeat_word(X86_FEATURE_FSGSBASE)],
-			    &c->x86_capability[cpufeat_word(X86_FEATURE_PKU)],
-			    &c->x86_capability[cpufeat_word(X86_FEATURE_AVX512_4VNNIW)]);
-		if (eax > 0)
-			cpuid_count(0x00000007, 1,
-				    &c->x86_capability[cpufeat_word(X86_FEATURE_AVX512_BF16)],
+	if (c->cpuid_level >= 7) {
+		uint32_t max_subleaf;
+
+		cpuid_count(7, 0, &max_subleaf,
+			    &c->x86_capability[FEATURESET_7b0],
+			    &c->x86_capability[FEATURESET_7c0],
+			    &c->x86_capability[FEATURESET_7d0]);
+		if (max_subleaf >= 1)
+			cpuid_count(7, 1,
+				    &c->x86_capability[FEATURESET_7a1],
 				    &tmp, &tmp, &tmp);
 	}
 
 	if (c->cpuid_level >= 0xd)
 		cpuid_count(0xd, 1,
-			    &c->x86_capability[cpufeat_word(X86_FEATURE_XSAVEOPT)],
+			    &c->x86_capability[FEATURESET_Da1],
 			    &tmp, &tmp, &tmp);
 }
 
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index b953648b65..470cd76d1c 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -423,6 +423,8 @@ def write_results(state):
 
 """)
 
+    state.bitfields += ["uint32_t :32 /* placeholder */"] * 4
+
     for idx, text in enumerate(state.bitfields):
         state.output.write(
             "#define CPUID_BITFIELD_%d \\\n    %s\n\n"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 20:22:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 20:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261738.453431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDBHm-0007GJ-Jp; Thu, 27 Jan 2022 20:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261738.453431; Thu, 27 Jan 2022 20:22: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 1nDBHm-0007GB-Gu; Thu, 27 Jan 2022 20:22:26 +0000
Received: by outflank-mailman (input) for mailman id 261738;
 Thu, 27 Jan 2022 20:22: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 1nDBHl-0007Fz-Ia
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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 1nDBHl-0000SS-Hl
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDBHl-0000If-Gi
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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=19ViGrSCDDV802QwagfrlGZ9eF1mkIOrEUXEnLchqu8=; b=w0VoHXk44naxn7oYGonktBvQjJ
	GXwsL3CVt3WSthAGqpzDHADcn8WWanJ1rGM/lKkr0jcF4AUhWMqez3NMa30O4p469BG9RlF1etsCK
	Zs+KaPBDIvuqajA1TTYho2WPcc9lpzTfLIQHIKVilYQuE/9TM5S8244w70r1/K5JatoY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpuid: Infrastructure for leaf 7:1.ebx
Message-Id: <E1nDBHl-0000If-Gi@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 20:22:25 +0000

commit e1828e3032ebfe036023cd733adfd2d4ec856688
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 27 12:54:42 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:38:15 2022 +0000

    x86/cpuid: Infrastructure for leaf 7:1.ebx
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xen-cpuid.c                      | 5 +++++
 xen/arch/x86/cpu/common.c                   | 3 ++-
 xen/include/public/arch-x86/cpufeatureset.h | 2 ++
 xen/include/xen/lib/x86/cpuid.h             | 7 +++++++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index a3003245f1..17e67e379f 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -195,6 +195,10 @@ static const char *const str_e21a[32] =
     [ 6] = "nscb",
 };
 
+static const char *const str_7b1[32] =
+{
+};
+
 static const struct {
     const char *name;
     const char *abbr;
@@ -213,6 +217,7 @@ static const struct {
     { "0x00000007:0.edx", "7d0", str_7d0 },
     { "0x00000007:1.eax", "7a1", str_7a1 },
     { "0x80000021.eax",  "e21a", str_e21a },
+    { "0x00000007:1.ebx", "7b1", str_7b1 },
 };
 
 #define COL_ALIGN "18"
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index c6773c85fd..d4f5028fa2 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -445,7 +445,8 @@ static void generic_identify(struct cpuinfo_x86 *c)
 		if (max_subleaf >= 1)
 			cpuid_count(7, 1,
 				    &c->x86_capability[FEATURESET_7a1],
-				    &tmp, &tmp, &tmp);
+				    &c->x86_capability[FEATURESET_7b1],
+				    &tmp, &tmp);
 	}
 
 	if (c->cpuid_level >= 0xd)
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 0b39937556..588f924de5 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -299,6 +299,8 @@ XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
 XEN_CPUFEATURE(LFENCE_DISPATCH,    11*32+ 2) /*A  LFENCE always serializing */
 XEN_CPUFEATURE(NSCB,               11*32+ 6) /*A  Null Selector Clears Base (and limit too) */
 
+/* Intel-defined CPU features, CPUID level 0x00000007:1.ebx, word 12 */
+
 #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 a4d254ea96..e87036b303 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -16,6 +16,7 @@
 #define FEATURESET_7d0    9 /* 0x00000007:0.edx    */
 #define FEATURESET_7a1   10 /* 0x00000007:1.eax    */
 #define FEATURESET_e21a  11 /* 0x80000021.eax      */
+#define FEATURESET_7b1   12 /* 0x00000007:1.ebx    */
 
 struct cpuid_leaf
 {
@@ -188,6 +189,10 @@ struct cpuid_policy
                 uint32_t _7a1;
                 struct { DECL_BITFIELD(7a1); };
             };
+            union {
+                uint32_t _7b1;
+                struct { DECL_BITFIELD(7b1); };
+            };
         };
     } feat;
 
@@ -327,6 +332,7 @@ static inline void cpuid_policy_to_featureset(
     fs[FEATURESET_7d0] = p->feat._7d0;
     fs[FEATURESET_7a1] = p->feat._7a1;
     fs[FEATURESET_e21a] = p->extd.e21a;
+    fs[FEATURESET_7b1] = p->feat._7b1;
 }
 
 /* Fill in a CPUID policy from a featureset bitmap. */
@@ -345,6 +351,7 @@ static inline void cpuid_featureset_to_policy(
     p->feat._7d0  = fs[FEATURESET_7d0];
     p->feat._7a1  = fs[FEATURESET_7a1];
     p->extd.e21a  = fs[FEATURESET_e21a];
+    p->feat._7b1  = fs[FEATURESET_7b1];
 }
 
 static inline uint64_t cpuid_policy_xcr0_max(const struct cpuid_policy *p)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 20:22:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 20:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261739.453435 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDBHw-0007JT-M5; Thu, 27 Jan 2022 20:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261739.453435; Thu, 27 Jan 2022 20:22:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDBHw-0007JL-IW; Thu, 27 Jan 2022 20:22:36 +0000
Received: by outflank-mailman (input) for mailman id 261739;
 Thu, 27 Jan 2022 20:22: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 1nDBHv-0007Iv-M3
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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 1nDBHv-0000Sc-LH
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDBHv-0000JX-KI
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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=WO3Mz41MteNbdAyKnxvodM8gHuCypanIJcYL/tLHrXc=; b=pVpOk2Ici5hy+H1BVy59cBK9p3
	DSeAge+EX+nfVdQoEVzwF+wVReYNwsvpUdFsJdaP7DluJmjE5YQ/7EVwfpDgJurBupJ1q+bTYw0SK
	ELencRqsKmvJdvc2aNVxPav8wInSo5DHiWTE+YgSYQ7QGuDEu3ZxCM++Wdv8J5dAi8IA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/Intel: use CPUID bit to determine PPIN availability
Message-Id: <E1nDBHv-0000JX-KI@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 20:22:35 +0000

commit d940ce8e2a85100223fb8b3ab96407fdcec7f02c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 27 13:54:42 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:38:15 2022 +0000

    x86/Intel: use CPUID bit to determine PPIN availability
    
    As of SDM revision 076 there is a CPUID bit for this functionality. Use
    it to amend the existing model-based logic.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xen-cpuid.c                      |  1 +
 xen/arch/x86/cpu/mcheck/mce_intel.c         | 10 +++++++++-
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 17e67e379f..3c8f3ed1ba 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -197,6 +197,7 @@ static const char *const str_e21a[32] =
 
 static const char *const str_7b1[32] =
 {
+    [ 0] = "ppin",
 };
 
 static const struct {
diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index d0161e9d4d..d63d6083d3 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -859,12 +859,20 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
     /*
      * Even if testing the presence of the MSR would be enough, we don't
      * want to risk the situation where other models reuse this MSR for
-     * other purposes.
+     * other purposes.  Despite the late addition of a CPUID bit (rendering
+     * the MSR architectural), keep using the same detection logic there.
      */
     switch ( c->x86_model )
     {
         uint64_t val;
 
+    default:
+        if ( !cpu_has(c, X86_FEATURE_INTEL_PPIN) )
+        {
+            ppin_msr = 0;
+            return;
+        }
+        fallthrough;
     case 0x3e: /* IvyBridge X */
     case 0x3f: /* Haswell X */
     case 0x4f: /* Broadwell X */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 588f924de5..6e44148a09 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -300,6 +300,7 @@ XEN_CPUFEATURE(LFENCE_DISPATCH,    11*32+ 2) /*A  LFENCE always serializing */
 XEN_CPUFEATURE(NSCB,               11*32+ 6) /*A  Null Selector Clears Base (and limit too) */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1.ebx, word 12 */
+XEN_CPUFEATURE(INTEL_PPIN,         12*32+ 0) /*   Protected Processor Inventory Number */
 
 #endif /* XEN_CPUFEATURE */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jan 27 20:22:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Jan 2022 20:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261740.453439 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDBI6-0007Mr-P1; Thu, 27 Jan 2022 20:22:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261740.453439; Thu, 27 Jan 2022 20:22:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDBI6-0007Mj-Lm; Thu, 27 Jan 2022 20:22:46 +0000
Received: by outflank-mailman (input) for mailman id 261740;
 Thu, 27 Jan 2022 20:22: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 1nDBI5-0007Ma-Pm
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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 1nDBI5-0000T7-P1
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDBI5-0000KR-Nx
 for xen-changelog@lists.xenproject.org; Thu, 27 Jan 2022 20:22: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=S+eSS+/9OSBeFTljF490uRXgcXs+BielSz/narNfMo0=; b=SZI+qYrBQqnAK7YfMjwo6eQZkp
	mkj58xsv8XibOlc5USH9NaX4CuQWngXSzdjn/7oQxSDN5/5/3IeaezRULC32Im2rMq3YR4RIHwM34
	pZdElBNQ2IdW4Dp2Av3f9u3/ocgYV3wKF32Q2tigxKPJzM/w7iFmfthf/uixcIUXYyKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msr: Fix migration compatibility issue with MSR_SPEC_CTRL
Message-Id: <E1nDBI5-0000KR-Nx@xenbits.xenproject.org>
Date: Thu, 27 Jan 2022 20:22:45 +0000

commit 969a57f73f6b011b2ebf4c0ab1715efc65837335
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 19 19:55:02 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:59:18 2022 +0000

    x86/msr: Fix migration compatibility issue with MSR_SPEC_CTRL
    
    This bug existed in early in 2018 between MSR_SPEC_CTRL arriving in microcode,
    and SSBD arriving a few months later.  It went unnoticed presumably because
    everyone was busy rebooting everything.
    
    The same bug will reappear when adding PSFD support.
    
    Clamp the guest MSR_SPEC_CTRL value to that permitted by CPUID on migrate.
    The guest is already playing with reserved bits at this point, and clamping
    the value will prevent a migration to a less capable host from failing.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c         | 25 +++++++++++++++++++++++--
 xen/arch/x86/include/asm/msr.h |  2 ++
 xen/arch/x86/msr.c             | 33 +++++++++++++++++++++------------
 3 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index d7d3299b43..c4ddb8607d 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1340,6 +1340,7 @@ static const uint32_t msrs_to_send[] = {
 
 static int hvm_save_cpu_msrs(struct vcpu *v, hvm_domain_context_t *h)
 {
+    const struct domain *d = v->domain;
     struct hvm_save_descriptor *desc = _p(&h->data[h->cur]);
     struct hvm_msr *ctxt;
     unsigned int i;
@@ -1355,7 +1356,8 @@ static int hvm_save_cpu_msrs(struct vcpu *v, hvm_domain_context_t *h)
     for ( i = 0; i < ARRAY_SIZE(msrs_to_send); ++i )
     {
         uint64_t val;
-        int rc = guest_rdmsr(v, msrs_to_send[i], &val);
+        unsigned int msr = msrs_to_send[i];
+        int rc = guest_rdmsr(v, msr, &val);
 
         /*
          * It is the programmers responsibility to ensure that
@@ -1375,7 +1377,26 @@ static int hvm_save_cpu_msrs(struct vcpu *v, hvm_domain_context_t *h)
         if ( !val )
             continue; /* Skip empty MSRs. */
 
-        ctxt->msr[ctxt->count].index = msrs_to_send[i];
+        /*
+         * Guests are given full access to certain MSRs for performance
+         * reasons.  A consequence is that Xen is unable to enforce that all
+         * bits disallowed by the CPUID policy yield #GP, and an enterprising
+         * guest may be able to set and use a bit it ought to leave alone.
+         *
+         * When migrating from a more capable host to a less capable one, such
+         * bits may be rejected by the destination, and the migration failed.
+         *
+         * Discard such bits here on the source side.  Such bits have reserved
+         * behaviour, and the guest has only itself to blame.
+         */
+        switch ( msr )
+        {
+        case MSR_SPEC_CTRL:
+            val &= msr_spec_ctrl_valid_bits(d->arch.cpuid);
+            break;
+        }
+
+        ctxt->msr[ctxt->count].index = msr;
         ctxt->msr[ctxt->count++].val = val;
     }
 
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 10039c2d22..657a329561 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -277,6 +277,8 @@ static inline void wrmsr_tsc_aux(uint32_t val)
     }
 }
 
+uint64_t msr_spec_ctrl_valid_bits(const struct cpuid_policy *cp);
+
 extern struct msr_policy     raw_msr_policy,
                             host_msr_policy,
                           pv_max_msr_policy,
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 2cc355575d..5e80c8b47c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -435,6 +435,24 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     return X86EMUL_EXCEPTION;
 }
 
+/*
+ * Caller to confirm that MSR_SPEC_CTRL is available.  Intel and AMD have
+ * separate CPUID features for this functionality, but only set will be
+ * active.
+ */
+uint64_t msr_spec_ctrl_valid_bits(const struct cpuid_policy *cp)
+{
+    bool ssbd = cp->feat.ssbd;
+
+    /*
+     * Note: SPEC_CTRL_STIBP is specified as safe to use (i.e. ignored)
+     * when STIBP isn't enumerated in hardware.
+     */
+    return (SPEC_CTRL_IBRS | SPEC_CTRL_STIBP |
+            (ssbd       ? SPEC_CTRL_SSBD       : 0) |
+            0);
+}
+
 int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 {
     const struct vcpu *curr = current;
@@ -508,18 +526,9 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
 
     case MSR_SPEC_CTRL:
-        if ( !cp->feat.ibrsb )
-            goto gp_fault; /* MSR available? */
-
-        /*
-         * Note: SPEC_CTRL_STIBP is specified as safe to use (i.e. ignored)
-         * when STIBP isn't enumerated in hardware.
-         */
-        rsvd = ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP |
-                 (cp->feat.ssbd ? SPEC_CTRL_SSBD : 0));
-
-        if ( val & rsvd )
-            goto gp_fault; /* Rsvd bit set? */
+        if ( !cp->feat.ibrsb ||
+             (val & ~msr_spec_ctrl_valid_bits(cp)) )
+            goto gp_fault;
         goto set_reg;
 
     case MSR_PRED_CMD:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 01:22:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 01:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261816.453575 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDFxm-0004Xj-1Y; Fri, 28 Jan 2022 01:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261816.453575; Fri, 28 Jan 2022 01:22: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 1nDFxl-0004Xb-Uj; Fri, 28 Jan 2022 01:22:05 +0000
Received: by outflank-mailman (input) for mailman id 261816;
 Fri, 28 Jan 2022 01:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDFxk-0004XV-Ib
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 01:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDFxk-0007xp-He
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 01:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDFxk-00087E-Gc
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 01:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tf6L3/LB+z/qWt8wE8q+BScTo9HWeiqkye8vOjwPeZo=; b=rW+r2RDpESeaoWBA7OK2tzcKlH
	DSIBLqtrvSl5WNNkq6ZMGKlUW1eGZb06qB6DE6FoKdT+2+IzkwrULtGuoBqAIZ5Jpqzk50Iz6kN/j
	zO0j854hZsIszrrNd56tPOU2N/t7vTPdEM8hlTA8aLzJXrnIvYZ7qTw4txSS9uKks06E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: remove python-dev from debian unstable build containers
Message-Id: <E1nDFxk-00087E-Gc@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 01:22:04 +0000

commit 2a565f9b40db981a860574be26d86a8665e71c38
Author:     Stefano Stabellini <stefano.stabellini@xilinx.com>
AuthorDate: Tue Jan 25 17:45:28 2022 -0800
Commit:     Stefano Stabellini <stefano.stabellini@xilinx.com>
CommitDate: Thu Jan 27 17:20:50 2022 -0800

    automation: remove python-dev from debian unstable build containers
    
    Debian unstable doesn't have the legacy python-dev package anymore.
    Note: only the arm64v8 container has been rebuilt.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/debian/unstable-arm64v8.dockerfile | 1 -
 automation/build/debian/unstable-i386.dockerfile    | 1 -
 automation/build/debian/unstable.dockerfile         | 1 -
 3 files changed, 3 deletions(-)

diff --git a/automation/build/debian/unstable-arm64v8.dockerfile b/automation/build/debian/unstable-arm64v8.dockerfile
index 4409f596e1..5c73458d9d 100644
--- a/automation/build/debian/unstable-arm64v8.dockerfile
+++ b/automation/build/debian/unstable-arm64v8.dockerfile
@@ -15,7 +15,6 @@ RUN apt-get update && \
         zlib1g-dev \
         libncurses5-dev \
         libssl-dev \
-        python-dev \
         python3-dev \
         xorg-dev \
         uuid-dev \
diff --git a/automation/build/debian/unstable-i386.dockerfile b/automation/build/debian/unstable-i386.dockerfile
index 06ffb97384..6ce54a481b 100644
--- a/automation/build/debian/unstable-i386.dockerfile
+++ b/automation/build/debian/unstable-i386.dockerfile
@@ -17,7 +17,6 @@ RUN apt-get update && \
         zlib1g-dev \
         libncurses5-dev \
         libssl-dev \
-        python-dev \
         python3-dev \
         xorg-dev \
         uuid-dev \
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index bd61cd12c2..9de766d596 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -15,7 +15,6 @@ RUN apt-get update && \
         zlib1g-dev \
         libncurses5-dev \
         libssl-dev \
-        python-dev \
         python3-dev \
         xorg-dev \
         uuid-dev \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261848.453634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKe3-0003xj-9L; Fri, 28 Jan 2022 06:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261848.453634; Fri, 28 Jan 2022 06: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 1nDKe3-0003xb-6N; Fri, 28 Jan 2022 06:22:03 +0000
Received: by outflank-mailman (input) for mailman id 261848;
 Fri, 28 Jan 2022 06: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 1nDKe2-0003xV-HF
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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 1nDKe2-0005o0-Bu
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKe2-0003rh-Ao
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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=aPm1hz4ta1JHsghpLtn7BvSQVqETb1eGQ0IsKZXEKvw=; b=OqbcyQLxV4hkgJjstiTX1OHPm4
	JEbdboISiECCznNG/y0y8B6vfUohzDIzqKJ3Cb09X/V+ElGM2xAujwglue+cIMguOmLUOuR5/YUkl
	lDu4EB82YY3FLWEKCl91drAcD/NEVguSfnY2AG8fCy8YTWNMu2VITYs8G+gNzi0E3gyI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/ipmmu-vmsa: Remove all unused register definitions
Message-Id: <E1nDKe2-0003rh-Ao@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:22:02 +0000

commit cf61c9378df6cdd26300d5ecabc2576aeae81c67
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:48 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:18 2022 +0000

    iommu/ipmmu-vmsa: Remove all unused register definitions
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    77cf983892b2e0d40dc256b784930a9ffaad4fc8
    
    Original commit message:
     commit 77cf983892b2e0d40dc256b784930a9ffaad4fc8
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:45 2019 +0900
    
      iommu/ipmmu-vmsa: Remove all unused register definitions
    
      To support different registers memory mapping hardware easily
      in the future, this patch removes all unused register
      definitions.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Although Linux and Xen drivers have a lot in common, the main
    differences are in translation stages (table formats), VMSAv8 modes,
    supported SoC generations, etc, therefore that's why there is
    a slight difference in registers/bits each driver considers unused.
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 59 ++------------------------------
 1 file changed, 2 insertions(+), 57 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 1255b0d4fe..4a8a974442 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -166,15 +166,11 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 
 #define IMCTR                0x0000
 /*
- * These fields are implemented in IPMMU-MM only. So, can be set for
+ * This field is implemented in IPMMU-MM only. So, can be set for
  * Root IPMMU only.
  */
 #define IMCTR_VA64           (1 << 29)
-#define IMCTR_TRE            (1 << 17)
-#define IMCTR_AFE            (1 << 16)
-#define IMCTR_RTSEL_MASK     (3 << 4)
-#define IMCTR_RTSEL_SHIFT    4
-#define IMCTR_TREN           (1 << 3)
+
 /*
  * These fields are common for all IPMMU devices. So, can be set for
  * Cache IPMMUs as well.
@@ -184,42 +180,9 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMCTR_MMUEN          (1 << 0)
 #define IMCTR_COMMON_MASK    (7 << 0)
 
-#define IMCAAR               0x0004
-
 #define IMTTBCR                        0x0008
 #define IMTTBCR_EAE                    (1U << 31)
 #define IMTTBCR_PMB                    (1 << 30)
-#define IMTTBCR_SH1_NON_SHAREABLE      (0 << 28)
-#define IMTTBCR_SH1_OUTER_SHAREABLE    (2 << 28)
-#define IMTTBCR_SH1_INNER_SHAREABLE    (3 << 28)
-#define IMTTBCR_SH1_MASK               (3 << 28)
-#define IMTTBCR_ORGN1_NC               (0 << 26)
-#define IMTTBCR_ORGN1_WB_WA            (1 << 26)
-#define IMTTBCR_ORGN1_WT               (2 << 26)
-#define IMTTBCR_ORGN1_WB               (3 << 26)
-#define IMTTBCR_ORGN1_MASK             (3 << 26)
-#define IMTTBCR_IRGN1_NC               (0 << 24)
-#define IMTTBCR_IRGN1_WB_WA            (1 << 24)
-#define IMTTBCR_IRGN1_WT               (2 << 24)
-#define IMTTBCR_IRGN1_WB               (3 << 24)
-#define IMTTBCR_IRGN1_MASK             (3 << 24)
-#define IMTTBCR_TSZ1_MASK              (0x1f << 16)
-#define IMTTBCR_TSZ1_SHIFT             16
-#define IMTTBCR_SH0_NON_SHAREABLE      (0 << 12)
-#define IMTTBCR_SH0_OUTER_SHAREABLE    (2 << 12)
-#define IMTTBCR_SH0_INNER_SHAREABLE    (3 << 12)
-#define IMTTBCR_SH0_MASK               (3 << 12)
-#define IMTTBCR_ORGN0_NC               (0 << 10)
-#define IMTTBCR_ORGN0_WB_WA            (1 << 10)
-#define IMTTBCR_ORGN0_WT               (2 << 10)
-#define IMTTBCR_ORGN0_WB               (3 << 10)
-#define IMTTBCR_ORGN0_MASK             (3 << 10)
-#define IMTTBCR_IRGN0_NC               (0 << 8)
-#define IMTTBCR_IRGN0_WB_WA            (1 << 8)
-#define IMTTBCR_IRGN0_WT               (2 << 8)
-#define IMTTBCR_IRGN0_WB               (3 << 8)
-#define IMTTBCR_IRGN0_MASK             (3 << 8)
-#define IMTTBCR_SL0_LVL_2              (0 << 6)
 #define IMTTBCR_SL0_LVL_1              (1 << 6)
 #define IMTTBCR_TSZ0_MASK              (0x1f << 0)
 #define IMTTBCR_TSZ0_SHIFT             0
@@ -228,18 +191,8 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMTTLBR0_TTBR_MASK    (0xfffff << 12)
 #define IMTTUBR0              0x0014
 #define IMTTUBR0_TTBR_MASK    (0xff << 0)
-#define IMTTLBR1              0x0018
-#define IMTTLBR1_TTBR_MASK    (0xfffff << 12)
-#define IMTTUBR1              0x001c
-#define IMTTUBR1_TTBR_MASK    (0xff << 0)
 
 #define IMSTR                          0x0020
-#define IMSTR_ERRLVL_MASK              (3 << 12)
-#define IMSTR_ERRLVL_SHIFT             12
-#define IMSTR_ERRCODE_TLB_FORMAT       (1 << 8)
-#define IMSTR_ERRCODE_ACCESS_PERM      (4 << 8)
-#define IMSTR_ERRCODE_SECURE_ACCESS    (5 << 8)
-#define IMSTR_ERRCODE_MASK             (7 << 8)
 #define IMSTR_MHIT                     (1 << 4)
 #define IMSTR_ABORT                    (1 << 2)
 #define IMSTR_PF                       (1 << 1)
@@ -251,11 +204,7 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUCTR(n)              ((n) < 32 ? IMUCTR0(n) : IMUCTR32(n))
 #define IMUCTR0(n)             (0x0300 + ((n) * 16))
 #define IMUCTR32(n)            (0x0600 + (((n) - 32) * 16))
-#define IMUCTR_FIXADDEN        (1U << 31)
-#define IMUCTR_FIXADD_MASK     (0xff << 16)
-#define IMUCTR_FIXADD_SHIFT    16
 #define IMUCTR_TTSEL_MMU(n)    ((n) << 4)
-#define IMUCTR_TTSEL_PMB       (8 << 4)
 #define IMUCTR_TTSEL_MASK      (15 << 4)
 #define IMUCTR_TTSEL_SHIFT     4
 #define IMUCTR_FLUSH           (1 << 1)
@@ -264,10 +213,6 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUASID(n)             ((n) < 32 ? IMUASID0(n) : IMUASID32(n))
 #define IMUASID0(n)            (0x0308 + ((n) * 16))
 #define IMUASID32(n)           (0x0608 + (((n) - 32) * 16))
-#define IMUASID_ASID8_MASK     (0xff << 8)
-#define IMUASID_ASID8_SHIFT    8
-#define IMUASID_ASID0_MASK     (0xff << 0)
-#define IMUASID_ASID0_SHIFT    0
 
 #define IMSAUXCTLR          0x0504
 #define IMSAUXCTLR_S2PTE    (1 << 3)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:22:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261849.453638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKeD-0003zc-B1; Fri, 28 Jan 2022 06:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261849.453638; Fri, 28 Jan 2022 06: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 1nDKeD-0003zU-7p; Fri, 28 Jan 2022 06:22:13 +0000
Received: by outflank-mailman (input) for mailman id 261849;
 Fri, 28 Jan 2022 06: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 1nDKeC-0003zM-Fu
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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 1nDKeC-0005o5-F8
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKeC-0003sO-E5
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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=RqOgje0zGJuCchxA+9xQk3WRyFVehRxcCf8NAZo/XUw=; b=uhSSDl09pAhZi+p4TqCDbdjBue
	s8Cc6t3baM3Etfh/jIEIpYsAWSz4ae0eJBbk+Ueu2hAL6TX7J6RsNWnMyCqXyElrD9+I4MfI16wEw
	wVbxRmzWMCF22nSb+6Q+30v4MwEyyLx0Hey1m4NW3H43G3YGXGyKpdRNASE8rZEeAHAU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
Message-Id: <E1nDKeC-0003sO-E5@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:22:12 +0000

commit cbba37c8a3d07ae3b17eee7e4aaadfb23cf4feec
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:49 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:30 2022 +0000

    iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    16d9454f5e0447f9c19cbf350b35ed377b9f64eb
    
    Original commit message:
     commit 16d9454f5e0447f9c19cbf350b35ed377b9f64eb
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:47 2019 +0900
    
      iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
    
      Since we will have changed memory mapping of the IPMMU in the future,
      This patch adds helper functions ipmmu_ctx_{reg,read,write}()
      for MMU "context" registers. No behavior change.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Besides changes done in the original commit, we also need to update
    an extra call sites which Linux driver doesn't have, but Xen driver
    has such as ipmmu_ctx_write_cache(), etc.
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 4a8a974442..ce5c3bc1e0 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -307,18 +307,35 @@ static void ipmmu_write(struct ipmmu_vmsa_device *mmu, uint32_t offset,
     writel(data, mmu->base + offset);
 }
 
+static unsigned int ipmmu_ctx_reg(struct ipmmu_vmsa_device *mmu,
+                                  unsigned int context_id, uint32_t reg)
+{
+    return context_id * IM_CTX_SIZE + reg;
+}
+
+static uint32_t ipmmu_ctx_read(struct ipmmu_vmsa_device *mmu,
+                               unsigned int context_id, uint32_t reg)
+{
+    return ipmmu_read(mmu, ipmmu_ctx_reg(mmu, context_id, reg));
+}
+
+static void ipmmu_ctx_write(struct ipmmu_vmsa_device *mmu,
+                            unsigned int context_id, uint32_t reg,
+                            uint32_t data)
+{
+    ipmmu_write(mmu, ipmmu_ctx_reg(mmu, context_id, reg), data);
+}
+
 static uint32_t ipmmu_ctx_read_root(struct ipmmu_vmsa_domain *domain,
                                     uint32_t reg)
 {
-    return ipmmu_read(domain->mmu->root,
-                      domain->context_id * IM_CTX_SIZE + reg);
+    return ipmmu_ctx_read(domain->mmu->root, domain->context_id, reg);
 }
 
 static void ipmmu_ctx_write_root(struct ipmmu_vmsa_domain *domain,
                                  uint32_t reg, uint32_t data)
 {
-    ipmmu_write(domain->mmu->root,
-                domain->context_id * IM_CTX_SIZE + reg, data);
+    ipmmu_ctx_write(domain->mmu->root, domain->context_id, reg, data);
 }
 
 static void ipmmu_ctx_write_cache(struct ipmmu_vmsa_domain *domain,
@@ -329,8 +346,8 @@ static void ipmmu_ctx_write_cache(struct ipmmu_vmsa_domain *domain,
 
     /* Mask fields which are implemented in IPMMU-MM only. */
     if ( !ipmmu_is_root(domain->mmu) )
-        ipmmu_write(domain->mmu, domain->context_id * IM_CTX_SIZE + reg,
-                    data & IMCTR_COMMON_MASK);
+        ipmmu_ctx_write(domain->mmu, domain->context_id, reg,
+                        data & IMCTR_COMMON_MASK);
 }
 
 /*
@@ -693,7 +710,7 @@ static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
 
     /* Disable all contexts. */
     for ( i = 0; i < mmu->num_ctx; ++i )
-        ipmmu_write(mmu, i * IM_CTX_SIZE + IMCTR, 0);
+        ipmmu_ctx_write(mmu, i, IMCTR, 0);
 }
 
 /* R-Car Gen3 SoCs product and cut information. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:22:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261850.453642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKeN-00042l-Cs; Fri, 28 Jan 2022 06:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261850.453642; Fri, 28 Jan 2022 06: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 1nDKeN-00042d-9S; Fri, 28 Jan 2022 06:22:23 +0000
Received: by outflank-mailman (input) for mailman id 261850;
 Fri, 28 Jan 2022 06: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 1nDKeM-00042K-K1
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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 1nDKeM-0005oQ-IM
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKeM-0003t6-HT
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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=Qin5NAV/1E7zWs+g0Z1bXnWYhlrDSI22ewx5w1i/xwk=; b=rntiAsAc5iHjS8T0IdcLDJNp5F
	N/p9TnOYydo91KRU0DbX9+/AmLer2NB/nHheIwAD7rrQrt5C5Rzn/9yJtTa4Ovsz3lHSXJ5p77KOX
	gSDx3bF3u0al4uVXgaC+qaNm6LpqmRibaR4Mak9YtQA/5kLgaPA1zI6P9f424eqHt4Z0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
Message-Id: <E1nDKeM-0003t6-HT@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:22:22 +0000

commit a23e7a88bcf2471704db1b4948a39916886cc899
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:50 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:37 2022 +0000

    iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    3667c9978b2911dc1ded77f5971df477885409c4
    
    Original commit message:
     commit 3667c9978b2911dc1ded77f5971df477885409c4
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:49 2019 +0900
    
      iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
    
      Since we will have changed memory mapping of the IPMMU in the future,
      This patch adds helper functions ipmmu_utlb_reg() and
      ipmmu_imu{asid,ctr}_write() for "uTLB" registers. No behavior change.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Besides changes done in the original commit, we also need to introduce
    ipmmu_imuctr_read() since Xen driver contains an additional logic in
    ipmmu_utlb_enable() to prevent the use cases where devices which use
    the same micro-TLB are assigned to different Xen domains.
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 33 +++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index ce5c3bc1e0..1b94af245f 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -366,6 +366,29 @@ static void ipmmu_ctx_write_all(struct ipmmu_vmsa_domain *domain,
     ipmmu_ctx_write_root(domain, reg, data);
 }
 
+static uint32_t ipmmu_utlb_reg(struct ipmmu_vmsa_device *mmu, uint32_t reg)
+{
+    return reg;
+}
+
+static void ipmmu_imuasid_write(struct ipmmu_vmsa_device *mmu,
+                                unsigned int utlb, uint32_t data)
+{
+    ipmmu_write(mmu, ipmmu_utlb_reg(mmu, IMUASID(utlb)), data);
+}
+
+static void ipmmu_imuctr_write(struct ipmmu_vmsa_device *mmu,
+                               unsigned int utlb, uint32_t data)
+{
+    ipmmu_write(mmu, ipmmu_utlb_reg(mmu, IMUCTR(utlb)), data);
+}
+
+static uint32_t ipmmu_imuctr_read(struct ipmmu_vmsa_device *mmu,
+                                  unsigned int utlb)
+{
+    return ipmmu_read(mmu, ipmmu_utlb_reg(mmu, IMUCTR(utlb)));
+}
+
 /* TLB and micro-TLB Management */
 
 /* Wait for any pending TLB invalidations to complete. */
@@ -413,7 +436,7 @@ static int ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain,
      * context_id for already enabled micro-TLB and prevent different context
      * bank from being set.
      */
-    imuctr = ipmmu_read(mmu, IMUCTR(utlb));
+    imuctr = ipmmu_imuctr_read(mmu, utlb);
     if ( imuctr & IMUCTR_MMUEN )
     {
         unsigned int context_id;
@@ -431,9 +454,9 @@ static int ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain,
      * TODO: Reference-count the micro-TLB as several bus masters can be
      * connected to the same micro-TLB.
      */
-    ipmmu_write(mmu, IMUASID(utlb), 0);
-    ipmmu_write(mmu, IMUCTR(utlb), imuctr |
-                IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_MMUEN);
+    ipmmu_imuasid_write(mmu, utlb, 0);
+    ipmmu_imuctr_write(mmu, utlb, imuctr |
+                       IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_MMUEN);
 
     return 0;
 }
@@ -444,7 +467,7 @@ static void ipmmu_utlb_disable(struct ipmmu_vmsa_domain *domain,
 {
     struct ipmmu_vmsa_device *mmu = domain->mmu;
 
-    ipmmu_write(mmu, IMUCTR(utlb), 0);
+    ipmmu_imuctr_write(mmu, utlb, 0);
 }
 
 /* Domain/Context Management */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:22:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261851.453646 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKeX-00046E-FX; Fri, 28 Jan 2022 06:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261851.453646; Fri, 28 Jan 2022 06: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 1nDKeX-000467-CP; Fri, 28 Jan 2022 06:22:33 +0000
Received: by outflank-mailman (input) for mailman id 261851;
 Fri, 28 Jan 2022 06: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 1nDKeW-00045t-MZ
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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 1nDKeW-0005od-Lh
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKeW-0003tn-Ki
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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=GHj34hAul4Etvvt9dQcwObId7FrBL+fU7tgUPQ9RIbs=; b=6+J7/032bD2/o6tsKh6Q9myI26
	sMM+VUM7T9FCfx8fA56J3+FQU3NSBCyHHlKUO+TGPVPkQO9xnaHPgG39bqhNLN6zCnX72fZXW9B8d
	wYUX5JzzPERBEUYAcsxeskuEPuILOS8kKU7Rp5vvIZ82o2WNqwXFH1kwwQjbcou0c1cE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/ipmmu-vmsa: Add light version of Linux's ipmmu_features
Message-Id: <E1nDKeW-0003tn-Ki@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:22:32 +0000

commit ec4add8d1c1a8d01b4ad4c15af41576a0b976cf7
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:51 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:46 2022 +0000

    iommu/ipmmu-vmsa: Add light version of Linux's ipmmu_features
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    We don't need to pull the whole struct and all instances as Xen
    driver doesn't support old Arm32 based Gen2 SoCs, so there is no
    point in keeping all differences between Gen2 and Gen3 here.
    All what we need is a minimal support to be able to operate with
    Gen3 and new S4.
    
    Add Gen3 specific info with only two fields (number_of_contexts and
    num_utlbs) for now, the subsequent patches will add remaining bits.
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 54 +++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 14 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 1b94af245f..369be4c89d 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -71,9 +71,9 @@
  * R-Car Gen3 SoCs make use of up to 8 IPMMU contexts (sets of page table) and
  * these can be managed independently. Each context is mapped to one Xen domain.
  */
-#define IPMMU_CTX_MAX     8
+#define IPMMU_CTX_MAX     8U
 /* R-Car Gen3 SoCs make use of up to 48 micro-TLBs per IPMMU device. */
-#define IPMMU_UTLB_MAX    48
+#define IPMMU_UTLB_MAX    48U
 
 /* IPMMU context supports IPA size up to 40 bit. */
 #define IPMMU_MAX_P2M_IPA_BITS    40
@@ -106,17 +106,22 @@ struct ipmmu_vmsa_xen_device {
     struct ipmmu_vmsa_device *mmu;
 };
 
+struct ipmmu_features {
+    unsigned int number_of_contexts;
+    unsigned int num_utlbs;
+};
+
 /* Root/Cache IPMMU device's information */
 struct ipmmu_vmsa_device {
     struct device *dev;
     void __iomem *base;
     struct ipmmu_vmsa_device *root;
     struct list_head list;
-    unsigned int num_utlbs;
     unsigned int num_ctx;
     spinlock_t lock;    /* Protects ctx and domains[] */
     DECLARE_BITMAP(ctx, IPMMU_CTX_MAX);
     struct ipmmu_vmsa_domain *domains[IPMMU_CTX_MAX];
+    const struct ipmmu_features *features;
 };
 
 /*
@@ -727,6 +732,11 @@ static int ipmmu_init_platform_device(struct device *dev,
     return 0;
 }
 
+static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
+    .number_of_contexts = 8,
+    .num_utlbs = 48,
+};
+
 static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
 {
     unsigned int i;
@@ -798,6 +808,27 @@ static __init bool ipmmu_stage2_supported(void)
     return stage2_supported;
 }
 
+static const struct dt_device_match ipmmu_dt_match[] __initconst =
+{
+    {
+        .compatible = "renesas,ipmmu-r8a7795",
+        .data = &ipmmu_features_rcar_gen3,
+    },
+    {
+        .compatible = "renesas,ipmmu-r8a77965",
+        .data = &ipmmu_features_rcar_gen3,
+    },
+    {
+        .compatible = "renesas,ipmmu-r8a7796",
+        .data = &ipmmu_features_rcar_gen3,
+    },
+    {
+        .compatible = "renesas,ipmmu-r8a77961",
+        .data = &ipmmu_features_rcar_gen3,
+    },
+    { /* sentinel */ },
+};
+
 /*
  * This function relies on the fact that Root IPMMU device is being probed
  * the first. If not the case, it denies further Cache IPMMU device probes
@@ -806,6 +837,7 @@ static __init bool ipmmu_stage2_supported(void)
  */
 static int ipmmu_probe(struct dt_device_node *node)
 {
+    const struct dt_device_match *match;
     struct ipmmu_vmsa_device *mmu;
     uint64_t addr, size;
     int irq, ret;
@@ -817,9 +849,12 @@ static int ipmmu_probe(struct dt_device_node *node)
         return -ENOMEM;
     }
 
+    match = dt_match_node(ipmmu_dt_match, node);
+    ASSERT(match);
+    mmu->features = match->data;
+
     mmu->dev = &node->dev;
-    mmu->num_utlbs = IPMMU_UTLB_MAX;
-    mmu->num_ctx = IPMMU_CTX_MAX;
+    mmu->num_ctx = min(IPMMU_CTX_MAX, mmu->features->number_of_contexts);
     spin_lock_init(&mmu->lock);
     bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
 
@@ -1296,15 +1331,6 @@ static const struct iommu_ops ipmmu_iommu_ops =
     .add_device      = ipmmu_add_device,
 };
 
-static const struct dt_device_match ipmmu_dt_match[] __initconst =
-{
-    DT_MATCH_COMPATIBLE("renesas,ipmmu-r8a7795"),
-    DT_MATCH_COMPATIBLE("renesas,ipmmu-r8a77965"),
-    DT_MATCH_COMPATIBLE("renesas,ipmmu-r8a7796"),
-    DT_MATCH_COMPATIBLE("renesas,ipmmu-r8a77961"),
-    { /* sentinel */ },
-};
-
 static __init int ipmmu_init(struct dt_device_node *node, const void *data)
 {
     int ret;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:22:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261852.453649 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKeh-00049T-HF; Fri, 28 Jan 2022 06:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261852.453649; Fri, 28 Jan 2022 06: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 1nDKeh-00049I-EC; Fri, 28 Jan 2022 06:22:43 +0000
Received: by outflank-mailman (input) for mailman id 261852;
 Fri, 28 Jan 2022 06: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 1nDKeg-00048t-Pl
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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 1nDKeg-0005oq-Ow
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKeg-0003uc-Nx
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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=ucIPOdX91a2UmoGF1aHDxkOZVBBEfCPVgc1p049l/Zk=; b=USmWz4tefEfFVbn3eCQa2Ug4NB
	+Wqez3bxhpFRlEN/5pxMMcPk3kB4FAH7OtJ1kYHU2R1kQr253fbB0950ddI6OEKmVeteX6eudrNGS
	jrzAFI7b83agWC2n5JCwo4kxVGPBtpvg21VhCyGjFOFiPWmxuqgbgzweH2aohim8v14Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro
Message-Id: <E1nDKeg-0003uc-Nx@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:22:42 +0000

commit 255000e8d7179deed97543fb6fb72c738fd3b2fa
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:52 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:33:56 2022 +0000

    iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    3dc28d9f59eaae41461542b27afe70339347ebb3
    
    Original commit message:
     commit 3dc28d9f59eaae41461542b27afe70339347ebb3
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:48 2019 +0900
    
      iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro
    
      Since we will have changed memory mapping of the IPMMU in the future,
      this patch uses ipmmu_features values instead of a macro to
      calculate context registers offset. No behavior change.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Almost the same change as original commit makes, but without updating
    struct ipmmu_features_default which Xen driver doesn't have (there is
    no support of old Arm32 based Gen2 SoCs).
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 369be4c89d..ca33456ac2 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -109,6 +109,8 @@ struct ipmmu_vmsa_xen_device {
 struct ipmmu_features {
     unsigned int number_of_contexts;
     unsigned int num_utlbs;
+    unsigned int ctx_offset_base;
+    unsigned int ctx_offset_stride;
 };
 
 /* Root/Cache IPMMU device's information */
@@ -167,8 +169,6 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define TLB_LOOP_TIMEOUT    100 /* 100us */
 
 /* Registers Definition */
-#define IM_CTX_SIZE    0x40
-
 #define IMCTR                0x0000
 /*
  * This field is implemented in IPMMU-MM only. So, can be set for
@@ -315,7 +315,8 @@ static void ipmmu_write(struct ipmmu_vmsa_device *mmu, uint32_t offset,
 static unsigned int ipmmu_ctx_reg(struct ipmmu_vmsa_device *mmu,
                                   unsigned int context_id, uint32_t reg)
 {
-    return context_id * IM_CTX_SIZE + reg;
+    return mmu->features->ctx_offset_base +
+        context_id * mmu->features->ctx_offset_stride + reg;
 }
 
 static uint32_t ipmmu_ctx_read(struct ipmmu_vmsa_device *mmu,
@@ -735,6 +736,8 @@ static int ipmmu_init_platform_device(struct device *dev,
 static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
     .number_of_contexts = 8,
     .num_utlbs = 48,
+    .ctx_offset_base = 0,
+    .ctx_offset_stride = 0x40,
 };
 
 static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:22:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261854.453654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKes-0004CF-IO; Fri, 28 Jan 2022 06:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261854.453654; Fri, 28 Jan 2022 06: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 1nDKes-0004C7-Fb; Fri, 28 Jan 2022 06:22:54 +0000
Received: by outflank-mailman (input) for mailman id 261854;
 Fri, 28 Jan 2022 06:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKeq-0004Bq-T2
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKeq-0005pM-SF
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKeq-0003vK-RJ
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MZnB0ljWtOCoC27Mkaz/eo7bON0gPoK6Acos1uHhkKI=; b=eOPM9Xt4BIT8unR9M7bAEtBBMS
	nuw3TlxVRujtej7Iq+gwsKWPu5skxldWd6BSqb3fLAbwCBjpWdkpsIWEzSebcDgniiL5uxp2p9CSs
	9TVnd6ypvMKAd/pn37ME6M+L8vy/bVnuIx5EPIkLw3WYebr9uxNv73ZklF1IOwgNYJWA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/ipmmu-vmsa: Add utlb_offset_base
Message-Id: <E1nDKeq-0003vK-RJ@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:22:52 +0000

commit 6e94086a86b8f246c754f50cb9f4adcbf02ce1b2
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:53 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:34:05 2022 +0000

    iommu/ipmmu-vmsa: Add utlb_offset_base
    
    This is a non-verbatim port of corresponding Linux upsteam commit:
    1289f7f15001c7ed36be6d23cb145c1d5feacdc8
    
    Original commit message:
     commit 1289f7f15001c7ed36be6d23cb145c1d5feacdc8
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Wed Nov 6 11:35:50 2019 +0900
    
      iommu/ipmmu-vmsa: Add utlb_offset_base
    
      Since we will have changed memory mapping of the IPMMU in the future,
      this patch adds a utlb_offset_base into struct ipmmu_features
      for IMUCTR and IMUASID registers. No behavior change.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    This is a prereq work needed to add support for S4 series easily
    in the future.
    
    Almost the same change as original commit makes, but without updating
    struct ipmmu_features_default which Xen driver doesn't have (there is
    no support of old Arm32 based Gen2 SoCs).
    
    No change in behavior.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index ca33456ac2..d8f96fcd3d 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -111,6 +111,7 @@ struct ipmmu_features {
     unsigned int num_utlbs;
     unsigned int ctx_offset_base;
     unsigned int ctx_offset_stride;
+    unsigned int utlb_offset_base;
 };
 
 /* Root/Cache IPMMU device's information */
@@ -374,7 +375,7 @@ static void ipmmu_ctx_write_all(struct ipmmu_vmsa_domain *domain,
 
 static uint32_t ipmmu_utlb_reg(struct ipmmu_vmsa_device *mmu, uint32_t reg)
 {
-    return reg;
+    return mmu->features->utlb_offset_base + reg;
 }
 
 static void ipmmu_imuasid_write(struct ipmmu_vmsa_device *mmu,
@@ -738,6 +739,7 @@ static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
     .num_utlbs = 48,
     .ctx_offset_base = 0,
     .ctx_offset_stride = 0x40,
+    .utlb_offset_base = 0,
 };
 
 static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:23:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261855.453658 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKf2-0004FC-K4; Fri, 28 Jan 2022 06:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261855.453658; Fri, 28 Jan 2022 06: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 1nDKf2-0004F4-H6; Fri, 28 Jan 2022 06:23:04 +0000
Received: by outflank-mailman (input) for mailman id 261855;
 Fri, 28 Jan 2022 06: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 1nDKf1-0004Er-0W
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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 1nDKf0-0005pm-Vs
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKf0-0003xf-Un
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L9moXhMac3in/0wyGw1tCDDftXIRu9xm9ES+NMZLS8w=; b=63zmpz1DC8GBMruDuUnpu9eDFn
	YDGrP2KpzNvoPDzzgDfm3mLETigIi4xvFLjXpkhSjNlNvkeIQQRIZRpzeO2aFnhO1Tk4PLFelgty2
	AKUg0dXWg9vLjR9qpmCZ8dLs68WZUN9ahnXWFeO/gl0VPwkx02SIXovM8irGN2tPLiGM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
Message-Id: <E1nDKf0-0003xf-Un@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:23:02 +0000

commit 095d665d775cc33b630e1f80c4f83a14cd3ea1f1
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:54 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:34:14 2022 +0000

    iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
    
    Based on the following Linux upsteam commit:
    7a62ced8ebd0e1b692c9dc4781a8d4ddb0f74792
    
    Original commit message:
     commit 7a62ced8ebd0e1b692c9dc4781a8d4ddb0f74792
     Author: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
     Date:   Tue Sep 7 17:30:20 2021 +0900
    
      iommu/ipmmu-vmsa: Add support for r8a779a0
    
      Add support for r8a779a0 (R-Car V3U). The IPMMU hardware design
      of this SoC differs than others. So, add a new ipmmu_features for it.
    
      Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
      Link: https://lore.kernel.org/r/20210907083020.907648-3-yoshihiro.shimoda.uh@renesas.com
      Signed-off-by: Joerg Roedel <jroedel@suse.de>
    
    **********
    
    The R-Car S4 is an automotive System-on-Chip (SoC) for Car
    Server/Communication Gateway and is one of the first products
    in Renesas’ 4th-generation R-Car Family.
    
    The integrated IOMMU HW is also VMSA-compatible and supports
    stage 2 translation table format, therefore can be used with
    current driver with slight modifications (thanks to the prereq
    work).
    
    In the context of Xen driver the main differences between Gen3
    and Gen4 are the following:
    - HW capacity was enlarged to support up to 16 IPMMU contexts
      (sets of page table) and up to 64 micro-TLBs per IPMMU device
    - the memory mapped registers have different bases and offsets
    
    Please note that Linux upstream doesn't support R-Car S4 SoC
    yet unlike Renesas BSP [1], but it was decided to reuse upstream
    patch for R-Car V3U anyway as the IPMMU HW settings are similar.
    
    [1]
    7003b9f732cf iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
    https://github.com/renesas-rcar/linux-bsp/tree/v5.10.41/rcar-5.1.3.rc5
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/Kconfig          |  6 +--
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 63 +++++++++++++++++++++++---------
 2 files changed, 49 insertions(+), 20 deletions(-)

diff --git a/xen/drivers/passthrough/Kconfig b/xen/drivers/passthrough/Kconfig
index 09505aa983..479d7de57a 100644
--- a/xen/drivers/passthrough/Kconfig
+++ b/xen/drivers/passthrough/Kconfig
@@ -25,14 +25,14 @@ config ARM_SMMU_V3
 	 the ARM SMMUv3 architecture.
 
 config IPMMU_VMSA
-	bool "Renesas IPMMU-VMSA found in R-Car Gen3 SoCs"
+	bool "Renesas IPMMU-VMSA found in R-Car Gen3/Gen4 SoCs"
 	depends on ARM_64
 	---help---
 	  Support for implementations of the Renesas IPMMU-VMSA found
-	  in R-Car Gen3 SoCs.
+	  in R-Car Gen3/Gen4 SoCs.
 
 	  Say Y here if you are using newest R-Car Gen3 SoCs revisions
-	  (H3 ES3.0, M3-W+, etc) which IPMMU hardware supports stage 2
+	  (H3 ES3.0, M3-W+, etc) or Gen4 SoCs which IPMMU hardware supports stage 2
 	  translation table format and is able to use CPU's P2M table as is.
 
 endif
diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index d8f96fcd3d..14848ce857 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -1,15 +1,15 @@
 /*
  * xen/drivers/passthrough/arm/ipmmu-vmsa.c
  *
- * Driver for the Renesas IPMMU-VMSA found in R-Car Gen3 SoCs.
+ * Driver for the Renesas IPMMU-VMSA found in R-Car Gen3/Gen4 SoCs.
  *
  * The IPMMU-VMSA is VMSA-compatible I/O Memory Management Unit (IOMMU)
  * which provides address translation and access protection functionalities
  * to processing units and interconnect networks.
  *
  * Please note, current driver is supposed to work only with newest
- * R-Car Gen3 SoCs revisions which IPMMU hardware supports stage 2 translation
- * table format and is able to use CPU's P2M table as is.
+ * R-Car Gen3/Gen4 SoCs revisions which IPMMU hardware supports stage 2
+ * translation table format and is able to use CPU's P2M table as is.
  *
  * Based on Linux's IPMMU-VMSA driver from Renesas BSP:
  *    drivers/iommu/ipmmu-vmsa.c
@@ -20,9 +20,9 @@
  * and Xen's SMMU driver:
  *    xen/drivers/passthrough/arm/smmu.c
  *
- * Copyright (C) 2014-2019 Renesas Electronics Corporation
+ * Copyright (C) 2014-2021 Renesas Electronics Corporation
  *
- * Copyright (C) 2016-2019 EPAM Systems Inc.
+ * Copyright (C) 2016-2021 EPAM Systems Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms and conditions of the GNU General Public
@@ -68,12 +68,13 @@
     dev_print(dev, XENLOG_ERR, fmt, ## __VA_ARGS__)
 
 /*
- * R-Car Gen3 SoCs make use of up to 8 IPMMU contexts (sets of page table) and
- * these can be managed independently. Each context is mapped to one Xen domain.
+ * R-Car Gen3/Gen4 SoCs make use of up to 16 IPMMU contexts (sets of page table)
+ * and these can be managed independently. Each context is mapped to one Xen
+ * domain.
  */
-#define IPMMU_CTX_MAX     8U
-/* R-Car Gen3 SoCs make use of up to 48 micro-TLBs per IPMMU device. */
-#define IPMMU_UTLB_MAX    48U
+#define IPMMU_CTX_MAX     16U
+/* R-Car Gen3/Gen4 SoCs make use of up to 64 micro-TLBs per IPMMU device. */
+#define IPMMU_UTLB_MAX    64U
 
 /* IPMMU context supports IPA size up to 40 bit. */
 #define IPMMU_MAX_P2M_IPA_BITS    40
@@ -112,6 +113,8 @@ struct ipmmu_features {
     unsigned int ctx_offset_base;
     unsigned int ctx_offset_stride;
     unsigned int utlb_offset_base;
+    unsigned int control_offset_base;
+    unsigned int imuctr_ttsel_mask;
 };
 
 /* Root/Cache IPMMU device's information */
@@ -211,7 +214,6 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUCTR0(n)             (0x0300 + ((n) * 16))
 #define IMUCTR32(n)            (0x0600 + (((n) - 32) * 16))
 #define IMUCTR_TTSEL_MMU(n)    ((n) << 4)
-#define IMUCTR_TTSEL_MASK      (15 << 4)
 #define IMUCTR_TTSEL_SHIFT     4
 #define IMUCTR_FLUSH           (1 << 1)
 #define IMUCTR_MMUEN           (1 << 0)
@@ -316,8 +318,12 @@ static void ipmmu_write(struct ipmmu_vmsa_device *mmu, uint32_t offset,
 static unsigned int ipmmu_ctx_reg(struct ipmmu_vmsa_device *mmu,
                                   unsigned int context_id, uint32_t reg)
 {
-    return mmu->features->ctx_offset_base +
-        context_id * mmu->features->ctx_offset_stride + reg;
+    unsigned int base = mmu->features->ctx_offset_base;
+
+    if ( context_id > 7 )
+        base += 0x800 - 8 * 0x40;
+
+    return base + context_id * mmu->features->ctx_offset_stride + reg;
 }
 
 static uint32_t ipmmu_ctx_read(struct ipmmu_vmsa_device *mmu,
@@ -448,7 +454,8 @@ static int ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain,
     {
         unsigned int context_id;
 
-        context_id = (imuctr & IMUCTR_TTSEL_MASK) >> IMUCTR_TTSEL_SHIFT;
+        context_id = (imuctr & mmu->features->imuctr_ttsel_mask) >>
+            IMUCTR_TTSEL_SHIFT;
         if ( domain->context_id != context_id )
         {
             dev_err(mmu->dev, "Micro-TLB %u already assigned to IPMMU context %u\n",
@@ -740,6 +747,18 @@ static const struct ipmmu_features ipmmu_features_rcar_gen3 = {
     .ctx_offset_base = 0,
     .ctx_offset_stride = 0x40,
     .utlb_offset_base = 0,
+    .control_offset_base = 0,
+    .imuctr_ttsel_mask = (15 << 4),
+};
+
+static const struct ipmmu_features ipmmu_features_rcar_gen4 = {
+    .number_of_contexts = 16,
+    .num_utlbs = 64,
+    .ctx_offset_base = 0x10000,
+    .ctx_offset_stride = 0x1040,
+    .utlb_offset_base = 0x3000,
+    .control_offset_base = 0x1000,
+    .imuctr_ttsel_mask = (31 << 4),
 };
 
 static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
@@ -751,11 +770,12 @@ static void ipmmu_device_reset(struct ipmmu_vmsa_device *mmu)
         ipmmu_ctx_write(mmu, i, IMCTR, 0);
 }
 
-/* R-Car Gen3 SoCs product and cut information. */
+/* R-Car Gen3/Gen4 SoCs product and cut information. */
 #define RCAR_PRODUCT_MASK    0x00007F00
 #define RCAR_PRODUCT_H3      0x00004F00
 #define RCAR_PRODUCT_M3W     0x00005200
 #define RCAR_PRODUCT_M3N     0x00005500
+#define RCAR_PRODUCT_S4      0x00005A00
 #define RCAR_CUT_MASK        0x000000FF
 #define RCAR_CUT_VER30       0x00000020
 
@@ -803,6 +823,10 @@ static __init bool ipmmu_stage2_supported(void)
         stage2_supported = true;
         break;
 
+    case RCAR_PRODUCT_S4:
+        stage2_supported = true;
+        break;
+
     default:
         printk(XENLOG_ERR "ipmmu: Unsupported SoC version\n");
         break;
@@ -831,6 +855,10 @@ static const struct dt_device_match ipmmu_dt_match[] __initconst =
         .compatible = "renesas,ipmmu-r8a77961",
         .data = &ipmmu_features_rcar_gen3,
     },
+    {
+        .compatible = "renesas,ipmmu-r8a779f0",
+        .data = &ipmmu_features_rcar_gen4,
+    },
     { /* sentinel */ },
 };
 
@@ -845,6 +873,7 @@ static int ipmmu_probe(struct dt_device_node *node)
     const struct dt_device_match *match;
     struct ipmmu_vmsa_device *mmu;
     uint64_t addr, size;
+    uint32_t reg;
     int irq, ret;
 
     mmu = xzalloc(struct ipmmu_vmsa_device);
@@ -930,8 +959,8 @@ static int ipmmu_probe(struct dt_device_node *node)
          * Use stage 2 translation table format when stage 2 translation
          * enabled.
          */
-        ipmmu_write(mmu, IMSAUXCTLR,
-                    ipmmu_read(mmu, IMSAUXCTLR) | IMSAUXCTLR_S2PTE);
+        reg = IMSAUXCTLR + mmu->features->control_offset_base;
+        ipmmu_write(mmu, reg, ipmmu_read(mmu, reg) | IMSAUXCTLR_S2PTE);
 
         dev_info(&node->dev, "IPMMU context 0 is reserved\n");
         set_bit(0, mmu->ctx);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:23:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261856.453662 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKfC-0004Ho-Lz; Fri, 28 Jan 2022 06:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261856.453662; Fri, 28 Jan 2022 06: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 1nDKfC-0004Hg-Im; Fri, 28 Jan 2022 06:23:14 +0000
Received: by outflank-mailman (input) for mailman id 261856;
 Fri, 28 Jan 2022 06: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 1nDKfB-0004HU-3j
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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 1nDKfB-0005pz-2j
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKfB-0003yP-22
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06: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=8tDObCILLitfJE52dSctkiOzGoPu94pKjY9y1eaXmEI=; b=mfed4Hep8M2OIARfe+4cKtC08j
	yEagNbnWwmQBzBe2Z2S5nh3snNFpxWizj2Mwjpqqlp3XL6nCp7PnOY7kdgdBlp5glFqKMe/58Nvrx
	2YwR62lzkrkU5CAxUyDaUh6x81Z943fpGBSS4P2wHJrPTWoZMkDloXGubxs8jTY5k2Zw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0
Message-Id: <E1nDKfB-0003yP-22@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:23:13 +0000

commit 9511120a450420efe8c026b233fe0b3ab7f1bd71
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Mon Dec 20 23:15:55 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:34:24 2022 +0000

    iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0
    
    Based on the following commits from the Renesas BSP:
    8fba83d97cca709a05139c38e29408e81ed4cf62
    a8d93bc07da89a7fcf4d85f34d119a030310efa5
    located at:
    https://github.com/renesas-rcar/linux-bsp/tree/v5.10.41/rcar-5.1.3.rc5
    
    Original commit messages:
     commit 8fba83d97cca709a05139c38e29408e81ed4cf62
     Author: Nam Nguyen <nam.nguyen.yh@renesas.com>
     Date:   Wed Apr 28 18:54:44 2021 +0700
    
      iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0
    
      Need to set bit IMSCTLR_USE_SECGRP to 0
      because H/W initial value is unknown, without this
      dma-transfer cannot be done due to address translation doesn't work.
    
      Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com>
    
     commit a8d93bc07da89a7fcf4d85f34d119a030310efa5
     Author: Nam Nguyen <nam.nguyen.yh@renesas.com>
     Date:   Tue Sep 7 14:46:12 2021 +0700
    
      iommu/ipmmu-vmsa: Update IMSCTLR register offset address for R-Car S4
    
      Update IMSCTLR register offset address to align with R-Car S4 H/W UM.
    
      Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com>
    
    **********
    
    It is still a question whether this really needs to be done in Xen,
    rather in firmware, but better to be on the safe side. After all,
    if firmware already takes care of clearing this bit, nothing bad
    will happen.
    
    Please note the following:
    1. I decided to squash both commits since the first commit adds clearing
    code and only the second one makes it functional on S4. Moreover, this is
    not a direct port. So it would be better to introduce complete solution
    by a single patch.
    2. Although patch indeed does what it claims in the subject,
    the implementation is different in comparison with original changes.
    On Linux the clearing is done at runtime in ipmmu_domain_setup_context().
    On Xen the clearing is done at boot time in ipmmu_probe().
    The IMSCTLR is not a MMU "context" register at all, so I think there is
    no point in performing the clearing each time we initialize the context,
    instead perform the clearing at once during initialization. Also do not
    abuse ctx_offset_stride_adj field for the register's offset calculation,
    instead use recently added control_offset_base field.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 14848ce857..649b9f6362 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -222,6 +222,9 @@ static DEFINE_SPINLOCK(ipmmu_devices_lock);
 #define IMUASID0(n)            (0x0308 + ((n) * 16))
 #define IMUASID32(n)           (0x0608 + (((n) - 32) * 16))
 
+#define IMSCTLR             0x0500
+#define IMSCTLR_USE_SECGRP  (1 << 28)
+
 #define IMSAUXCTLR          0x0504
 #define IMSAUXCTLR_S2PTE    (1 << 3)
 
@@ -966,6 +969,10 @@ static int ipmmu_probe(struct dt_device_node *node)
         set_bit(0, mmu->ctx);
     }
 
+    /* Do not use security group function. */
+    reg = IMSCTLR + mmu->features->control_offset_base;
+    ipmmu_write(mmu, reg, ipmmu_read(mmu, reg) & ~IMSCTLR_USE_SECGRP);
+
     spin_lock(&ipmmu_devices_lock);
     list_add(&mmu->list, &ipmmu_devices);
     spin_unlock(&ipmmu_devices_lock);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:23:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261857.453666 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKfM-0004LJ-Oy; Fri, 28 Jan 2022 06:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261857.453666; Fri, 28 Jan 2022 06:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKfM-0004LB-Lq; Fri, 28 Jan 2022 06:23:24 +0000
Received: by outflank-mailman (input) for mailman id 261857;
 Fri, 28 Jan 2022 06:23: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 1nDKfL-0004L2-6c
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23: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 1nDKfL-0005qB-5u
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKfL-0003zI-54
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+g1UwU5QuHEhg4HFqwDn4yXTG5Qjqx50lNGWHBuDL7I=; b=QXLQ6PR4C59LYvyG3mQcFUufyS
	cSlQvOJJzkrM3qKfgivPkyzCwbu5/uVCzLiVUaKZDrhZ0e+wUHIimYIdm6tbzZ2EZlaEpAiL3MdDs
	pT6Ll2w9Z2ECE2bQcG0193WNXEiECZJhD9SiNxWCc3lazpiwQ5fHSeejjzoakV9H7dys=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Replace arch_mfn_in_directmap() with arch_mfns_in_directmap()
Message-Id: <E1nDKfL-0003zI-54@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:23:23 +0000

commit 0a71ca9ab4c2d9a44f972c517bafa332b1622c10
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Jan 26 15:59:19 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jan 27 12:38:31 2022 +0000

    xen: Replace arch_mfn_in_directmap() with arch_mfns_in_directmap()
    
    The name of arch_mfn_in_directmap() suggests that it will check against
    that the passed MFN should be in the directmap.
    
    However, the current callers are passing the next MFN and the
    implementation will return true for up to one MFN past the directmap.
    
    It would be more meaningful to test the exact MFN rather than the
    next one.
    
    That said, the current expectation is the memory will be direct-mapped
    from 0 up to a given MFN. This may not be a valid assumption on all
    the architectures.
    
    For instance, on Arm32 only the xenheap that will be direct-mapped.
    This may not be allocated a the beginning of the RAM.
    
    So take the opportunity to rework the parameters and pass the
    number of pages we want to check. This also requires to rename
    the helper to better match the implementation.
    
    Note that the implementation of the helper on arm32 is left as-is
    for now.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/arm32/mm.h | 2 +-
 xen/arch/arm/include/asm/arm64/mm.h | 2 +-
 xen/arch/x86/include/asm/mm.h       | 6 +++---
 xen/common/page_alloc.c             | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/include/asm/arm32/mm.h b/xen/arch/arm/include/asm/arm32/mm.h
index 68612499bf..6b039d9cea 100644
--- a/xen/arch/arm/include/asm/arm32/mm.h
+++ b/xen/arch/arm/include/asm/arm32/mm.h
@@ -5,7 +5,7 @@
  * Only a limited amount of RAM, called xenheap, is always mapped on ARM32.
  * For convenience always return false.
  */
-static inline bool arch_mfn_in_directmap(unsigned long mfn)
+static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 {
     return false;
 }
diff --git a/xen/arch/arm/include/asm/arm64/mm.h b/xen/arch/arm/include/asm/arm64/mm.h
index d0a3be7e15..aa2adac631 100644
--- a/xen/arch/arm/include/asm/arm64/mm.h
+++ b/xen/arch/arm/include/asm/arm64/mm.h
@@ -5,7 +5,7 @@
  * On ARM64, all the RAM is currently direct mapped in Xen.
  * Hence return always true.
  */
-static inline bool arch_mfn_in_directmap(unsigned long mfn)
+static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 {
     return true;
 }
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 5dbcee8696..9b9de4c6be 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -635,13 +635,13 @@ void write_32bit_pse_identmap(uint32_t *l2);
 
 /*
  * x86 maps part of physical memory via the directmap region.
- * Return whether the input MFN falls in that range.
+ * Return whether the range of MFN falls in the directmap region.
  */
-static inline bool arch_mfn_in_directmap(unsigned long mfn)
+static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 {
     unsigned long eva = min(DIRECTMAP_VIRT_END, HYPERVISOR_VIRT_END);
 
-    return mfn <= (virt_to_mfn(eva - 1) + 1);
+    return (mfn + nr) <= (virt_to_mfn(eva - 1) + 1);
 }
 
 #endif /* __ASM_X86_MM_H__ */
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 38eea879c0..f8749b0787 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -588,7 +588,7 @@ static unsigned long init_node_heap(int node, unsigned long mfn,
         needed = 0;
     }
     else if ( *use_tail && nr >= needed &&
-              arch_mfn_in_directmap(mfn + nr) &&
+              arch_mfns_in_directmap(mfn + nr - needed, needed) &&
               (!xenheap_bits ||
                !((mfn + nr - 1) >> (xenheap_bits - PAGE_SHIFT))) )
     {
@@ -597,7 +597,7 @@ static unsigned long init_node_heap(int node, unsigned long mfn,
                       PAGE_SIZE - sizeof(**avail) * NR_ZONES;
     }
     else if ( nr >= needed &&
-              arch_mfn_in_directmap(mfn + needed) &&
+              arch_mfns_in_directmap(mfn, needed) &&
               (!xenheap_bits ||
                !((mfn + needed - 1) >> (xenheap_bits - PAGE_SHIFT))) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:23:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261858.453670 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKfW-0004O7-QL; Fri, 28 Jan 2022 06:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261858.453670; Fri, 28 Jan 2022 06:23:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKfW-0004Nz-NR; Fri, 28 Jan 2022 06:23:34 +0000
Received: by outflank-mailman (input) for mailman id 261858;
 Fri, 28 Jan 2022 06:23: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 1nDKfV-0004No-9l
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23: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 1nDKfV-0005qI-94
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKfV-00040N-8C
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h/ouTmW37FI9xAonz/axvtgiFigjuoNTZx2Si0h8X3M=; b=a9NHU6AuijIeI/i5Z4JppsUUHN
	R4hzTLILmb/rzCQDucRE140jvHMH06Y3DYiUkjioMt4K/TO8Z9rCveB/HYc/8zMYSs/g0c4dWTaL6
	ZF8uGyBjbmIys9TnAX+QbAGz2ElofThicAOKpRGyG/y7wFeuQVoKFMAtOeS0MxWvKYIs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/Intel: IceLake D + Sapphire Rapids Xeons also support PPIN
Message-Id: <E1nDKfV-00040N-8C@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:23:33 +0000

commit df6f5cd9e51e742b23dcee99907e97a435716061
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 27 13:50:19 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 27 13:50:19 2022 +0100

    x86/Intel: IceLake D + Sapphire Rapids Xeons also support PPIN
    
    This is as per Linux commits a331f5fdd36d ("x86/mce: Add Xeon Sapphire
    Rapids to list of CPUs that support PPIN") and [tip.git] e464121f2d40
    ("x86/cpu: Add Xeon Icelake-D to list of CPUs that support PPIN"), just
    in case a subsequent change making use of the respective new CPUID bit
    doesn't cover either of these models.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/mcheck/mce_intel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index bb9f3a3ff7..d0161e9d4d 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -872,7 +872,9 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
     case 0x56: /* Broadwell Xeon D */
     case 0x57: /* Knights Landing */
     case 0x6a: /* Icelake X */
+    case 0x6c: /* Icelake D */
     case 0x85: /* Knights Mill */
+    case 0x8f: /* Sapphire Rapids X */
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||
              rdmsr_safe(MSR_PPIN_CTL, val) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 06:23:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 06:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261860.453674 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKfg-0004RF-S7; Fri, 28 Jan 2022 06:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261860.453674; Fri, 28 Jan 2022 06:23:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDKfg-0004R7-P0; Fri, 28 Jan 2022 06:23:44 +0000
Received: by outflank-mailman (input) for mailman id 261860;
 Fri, 28 Jan 2022 06:23: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 1nDKff-0004Qr-Cu
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23: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 1nDKff-0005qM-C9
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDKff-00041Y-BH
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 06:23:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gpRN6CiheKj3PaCsnAwjZImiyWefrAR7lDYI318VoyE=; b=vRnRdMmtSE/l6/rkCxxqk60LIE
	GCe2oxAiUvy8Sa+429137Uc54Dh3BAEH40ZJPh4vvA9DdWjWneVE68Br4IH/IigYyLIn0NlZVA8NU
	Xdx28A7nOfQ9JDWiYzKwMYtrWdrHW5gfYpZb/d7pWdFfUPQPQv0JyyV/iiH7gGnJJfxc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: force netback to wait for hotplug execution before connecting
Message-Id: <E1nDKff-00041Y-BH@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 06:23:43 +0000

commit 0bdc43c8dec993258e930b34855853c22b917519
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Jan 27 13:51:19 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 27 13:51:19 2022 +0100

    libxl: force netback to wait for hotplug execution before connecting
    
    By writing an empty "hotplug-status" xenstore node in the backend path
    libxl can force Linux netback to wait for hotplug script execution
    before proceeding to the 'connected' state.
    
    This is required so that netback doesn't skip state 2 (InitWait) and
    thus blocks libxl waiting for such state in order to launch the
    hotplug script (see libxl__wait_device_connection).
    
    Reported-by: James Dingwall <james-xen@dingwall.me.uk>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Tested-by: James Dingwall <james-xen@dingwall.me.uk>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Tested-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Wei Liu <wei.liu@kernel.org>
---
 tools/libs/light/libxl_nic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 0b45469dca..0b9e70c9d1 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -248,6 +248,13 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "mtu");
     flexarray_append(ro_front, GCSPRINTF("%u", nic->mtu));
 
+    /*
+     * Force backend to wait for hotplug script execution before switching to
+     * connected state.
+     */
+    flexarray_append(back, "hotplug-status");
+    flexarray_append(back, "");
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 10:55:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 10:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261943.453843 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDOuI-0007N9-0b; Fri, 28 Jan 2022 10:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261943.453843; Fri, 28 Jan 2022 10:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDOuH-0007N1-Ti; Fri, 28 Jan 2022 10:55:05 +0000
Received: by outflank-mailman (input) for mailman id 261943;
 Fri, 28 Jan 2022 10:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOuH-0007Mv-2e
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55: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 1nDOuH-0002ri-0r
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOuG-0006pM-W0
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KC61gKwUfGpCH5xNIo6Snd872xcOJJZW6GpZPx1f9Ow=; b=eVuFXVqmYmCltwFCQAh45RAXgM
	k8NRwEveaxNGz/QI7rTbIeyOFcKKBwcVfIdqxtTuocBn390C3sO/T6v6aONLhk9A2JJUDUHaPf0m7
	99/W4w94cqVZD7qVJnDuPSniUrhJ+KNxlrKQ20wLM6cPVpRZrFMzfNSaLGAqmEIb1oVY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: set XEN_BUILD_EFI earlier
Message-Id: <E1nDOuG-0006pM-W0@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 10:55:04 +0000

commit 672f2198f4eb6b14cbbf4abb4e2d27af15578dad
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jan 28 11:41:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 28 11:41:09 2022 +0100

    build: set XEN_BUILD_EFI earlier
    
    We are going to need the variable XEN_BUILD_EFI earlier.
    
    But a side effect of calculating the value of $(XEN_BUILD_EFI) is to
    also to generate "efi/check.o" which is used for further checks.
    Thus the whole chain that check for EFI support is moved to
    "arch.mk".
    
    Some other changes are made to avoid too much duplication:
        - $(efi-check): Used to avoid repeating "efi/check.*". We don't
          set it to the path to the source as it would be wrong as soon
          as we support out-of-tree build.
        - $(LD_PE_check_cmd): As it is called twice, with an updated
          $(EFI_LDFLAGS).
    
    $(nr-fixups) is renamed to $(efi-nr-fixups) as the former might be
    a bit too generic.
    
    In order to avoid exporting MKRELOC, the variable is added to $(MAKE)
    command line. The only modification needed is in target "build", the
    modification target "$(TARGET)" will be needed with a following patch
    "build: avoid re-executing the main Makefile by introducing build.mk".
    
    We can now revert 24b0ce9a5da2, we don't need to override efi-y on
    recursion anymore.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile          |  4 ++--
 xen/arch/x86/Makefile | 46 ++++++----------------------------------------
 xen/arch/x86/arch.mk  | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 42 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 1e10d9f680..f3ff03a717 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -296,7 +296,7 @@ endif # need-config
 .PHONY: build install uninstall clean distclean MAP
 build install uninstall debug clean distclean MAP::
 ifneq ($(XEN_TARGET_ARCH),x86_32)
-	$(MAKE) -f Rules.mk _$@
+	$(MAKE) -f Rules.mk MKRELOC=$(MKRELOC) _$@
 else
 	echo "*** Xen x86/32 target no longer supported!"
 endif
@@ -404,7 +404,7 @@ $(TARGET): FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) include
 	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
+	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) MKRELOC=$(MKRELOC) $@
 
 quiet_cmd_banner = BANNER  $@
 define cmd_banner
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 8db4cb98ed..9fc884813c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -121,44 +121,8 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 		{ echo "No Multiboot2 header found" >&2; false; }
 	mv $(TMP) $(TARGET)
 
-ifneq ($(efi-y),)
-
-# Check if the compiler supports the MS ABI.
-export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 
-# Check if the linker supports PE.
-EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o))
-# If the above failed, it may be merely because of the linker not dealing well
-# with debug info. Try again with stripping it.
-ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
-EFI_LDFLAGS += --strip-debug
-XEN_BUILD_PE := $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o)
-endif
-
-ifeq ($(XEN_BUILD_PE),y)
-
-# Check if the linker produces fixups in PE by default
-nr-fixups := $(shell $(OBJDUMP) -p efi/check.efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
-ifeq ($(nr-fixups),2)
-MKRELOC := :
-relocs-dummy :=
-else
-MKRELOC := efi/mkreloc
-relocs-dummy := efi/relocs-dummy.o
-# If the linker produced fixups but not precisely two of them, we need to
-# disable it doing so.  But if it didn't produce any fixups, it also wouldn't
-# recognize the option.
-ifneq ($(nr-fixups),0)
-EFI_LDFLAGS += --disable-reloc-section
-endif
-endif
-
-endif # $(XEN_BUILD_PE)
-
-endif # $(efi-y)
-
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
 
 ifeq ($(CONFIG_LTO),y)
@@ -182,13 +146,13 @@ $(TARGET)-syms: prelink.o xen.lds
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \
 		>$(@D)/.$(@F).0.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0.o
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \
 		>$(@D)/.$(@F).1.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).1.o
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
@@ -217,8 +181,10 @@ endif
 
 $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p')
 ifeq ($(MKRELOC),:)
+relocs-dummy :=
 $(TARGET).efi: ALT_BASE :=
 else
+relocs-dummy := efi/relocs-dummy.o
 $(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p')
 endif
 
@@ -250,14 +216,14 @@ endif
 	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
 	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -o $(@D)/.$(@F).$(base).1 &&) :
 	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
 	$(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $< \
 	                $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file_option) -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index eea320e618..a93fa6d2e4 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -60,5 +60,47 @@ ifeq ($(CONFIG_UBSAN),y)
 $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
 endif
 
+ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
+
+efi-check := arch/x86/efi/check
+
+# Check if the compiler supports the MS ABI.
+XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(efi-check).c -o $(efi-check).o,y)
+
+# Check if the linker supports PE.
+EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
+LD_PE_check_cmd = $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(efi-check).efi $(efi-check).o)
+XEN_BUILD_PE := $(LD_PE_check_cmd)
+
+# If the above failed, it may be merely because of the linker not dealing well
+# with debug info. Try again with stripping it.
+ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
+EFI_LDFLAGS += --strip-debug
+XEN_BUILD_PE := $(LD_PE_check_cmd)
+endif
+
+ifeq ($(XEN_BUILD_PE),y)
+
+# Check if the linker produces fixups in PE by default
+efi-nr-fixups := $(shell $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+
+ifeq ($(efi-nr-fixups),2)
+MKRELOC := :
+else
+MKRELOC := efi/mkreloc
+# If the linker produced fixups but not precisely two of them, we need to
+# disable it doing so.  But if it didn't produce any fixups, it also wouldn't
+# recognize the option.
+ifneq ($(efi-nr-fixups),0)
+EFI_LDFLAGS += --disable-reloc-section
+endif
+endif
+
+endif # $(XEN_BUILD_PE)
+
+export XEN_BUILD_EFI XEN_BUILD_PE
+export EFI_LDFLAGS
+endif
+
 # Set up the assembler include path properly for older toolchains.
 CFLAGS += -Wa,-I$(BASEDIR)/include
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 10:55:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 10:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261944.453848 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDOuS-0007Pj-2w; Fri, 28 Jan 2022 10:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261944.453848; Fri, 28 Jan 2022 10:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDOuR-0007PZ-VK; Fri, 28 Jan 2022 10:55:15 +0000
Received: by outflank-mailman (input) for mailman id 261944;
 Fri, 28 Jan 2022 10:55: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 1nDOuR-0007PL-4y
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55: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 1nDOuR-0002rn-44
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOuR-0006pu-37
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55: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=tj2VnS13W+9CK8ddt5le0GLq8a1NGRhvIk7U7XmgLMw=; b=KQIxPBz0KVB+5b+47gz/9OIfua
	UUwAExOYHPZjg4hpUFYrBGcEApTr1XEWRttPiLemnFV5tTA7ZyWapQFCvZjGZf69xHXNlpA12gYQv
	6Zb4Q9rufQPkeP8GL3kBxGGzBSUc00g8/8nddkgO4FT7jgh4E16iyB+ZZ+3LIIgsdQxw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: avoid re-executing the main Makefile by introducing build.mk
Message-Id: <E1nDOuR-0006pu-37@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 10:55:15 +0000

commit 7be85daac5acca30bd4d6779ec03982528c35558
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jan 28 11:42:24 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 28 11:42:24 2022 +0100

    build: avoid re-executing the main Makefile by introducing build.mk
    
    Currently, the xen/Makefile is re-parsed several times: once to start
    the build process, and several more time with Rules.mk including it.
    This makes it difficult to work with a Makefile used for several
    purpose, and it actually slow down the build process.
    
    So this patch introduce "build.mk" which Rules.mk will use when
    present instead of the "Makefile" of a directory. (Linux's Kbuild
    named that file "Kbuild".)
    
    We have a few targets to move to "build.mk" identified by them been
    build via "make -f Rules.mk" without changing directory.
    
    As for the main targets like "build", we can have them depends on
    there underscore-prefix targets like "_build" without having to use
    "Rules.mk" while still retaining the check for unsupported
    architecture. (Those main rules are changed to be single-colon as
    there should only be a single recipe for them.)
    
    With nearly everything needed to move to "build.mk" moved, there is a
    single dependency left from "Rules.mk": the variable $(TARGET), so its
    assignement is moved to the main Makefile.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile | 70 ++++++------------------------------------------------------
 xen/Rules.mk |  6 ++----
 xen/build.mk | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 68 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index f3ff03a717..fb37043d08 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -47,6 +47,8 @@ export KCONFIG_CONFIG ?= .config
 
 export CC CXX LD
 
+export TARGET := $(BASEDIR)/xen
+
 .PHONY: default
 default: build
 
@@ -293,11 +295,12 @@ export CFLAGS_UBSAN
 
 endif # need-config
 
-.PHONY: build install uninstall clean distclean MAP
-build install uninstall debug clean distclean MAP::
+main-targets := build install uninstall clean distclean MAP
+.PHONY: $(main-targets)
 ifneq ($(XEN_TARGET_ARCH),x86_32)
-	$(MAKE) -f Rules.mk MKRELOC=$(MKRELOC) _$@
+$(main-targets): %: _% ;
 else
+$(main-targets):
 	echo "*** Xen x86/32 target no longer supported!"
 endif
 
@@ -406,67 +409,6 @@ $(TARGET): FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) MKRELOC=$(MKRELOC) $@
 
-quiet_cmd_banner = BANNER  $@
-define cmd_banner
-    if which figlet >/dev/null 2>&1 ; then \
-	echo " Xen $(XEN_FULLVERSION)" | figlet -f $< > $@.tmp; \
-    else \
-	echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
-    fi; \
-    mv -f $@.tmp $@
-endef
-
-.banner: tools/xen.flf FORCE
-	$(call if_changed,banner)
-targets += .banner
-
-# Don't refresh this files during e.g., 'sudo make install'
-quiet_cmd_compile.h = UPD     $@
-define cmd_compile.h
-    if [ ! -r $@ -o -O $@ ]; then \
-	cat .banner; \
-	sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
-	    -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
-	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
-	    -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
-	    -e 's/@@hostname@@/$(XEN_BUILD_HOST)/g' \
-	    -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) --version 2>&1 | head -1)!g' \
-	    -e 's/@@version@@/$(XEN_VERSION)/g' \
-	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
-	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
-	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
-	    < $< > $(dot-target).tmp; \
-	sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \
-	mv -f $(dot-target).tmp $@; \
-    fi
-endef
-
-include/xen/compile.h: include/xen/compile.h.in .banner FORCE
-	$(if $(filter-out FORCE,$?),$(Q)rm -fv $@)
-	$(call if_changed,compile.h)
-
-targets += include/xen/compile.h
-
-asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
-	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
-	$(call move-if-changed,$@.new,$@)
-
-arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
-	@(set -e; \
-	  echo "/*"; \
-	  echo " * DO NOT MODIFY."; \
-	  echo " *"; \
-	  echo " * This file was auto-generated from $<"; \
-	  echo " *"; \
-	  echo " */"; \
-	  echo ""; \
-	  echo "#ifndef __ASM_OFFSETS_H__"; \
-	  echo "#define __ASM_OFFSETS_H__"; \
-	  echo ""; \
-	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
-	  echo ""; \
-	  echo "#endif") <$< >$@
-
 SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
     ( find include -type f -name '*.h' -print; \
diff --git a/xen/Rules.mk b/xen/Rules.mk
index d21930a7bf..7b8b9047cf 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -8,9 +8,6 @@
 include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
-
-TARGET := $(BASEDIR)/xen
-
 # Note that link order matters!
 ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
@@ -36,7 +33,8 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \
                                             rodata.cst$(a)) \
                          $(foreach r,rel rel.ro,data.$(r).local)
 
-include Makefile
+# The filename build.mk has precedence over Makefile
+include $(firstword $(wildcard build.mk) Makefile)
 
 # Linking
 # ---------------------------------------------------------------------------
diff --git a/xen/build.mk b/xen/build.mk
new file mode 100644
index 0000000000..3d7a91df22
--- /dev/null
+++ b/xen/build.mk
@@ -0,0 +1,61 @@
+quiet_cmd_banner = BANNER  $@
+define cmd_banner
+    if which figlet >/dev/null 2>&1 ; then \
+	echo " Xen $(XEN_FULLVERSION)" | figlet -f $< > $@.tmp; \
+    else \
+	echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
+    fi; \
+    mv -f $@.tmp $@
+endef
+
+.banner: tools/xen.flf FORCE
+	$(call if_changed,banner)
+
+targets += .banner
+
+# Don't refresh this files during e.g., 'sudo make install'
+quiet_cmd_compile.h = UPD     $@
+define cmd_compile.h
+    if [ ! -r $@ -o -O $@ ]; then \
+	cat .banner; \
+	sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
+	    -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
+	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
+	    -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
+	    -e 's/@@hostname@@/$(XEN_BUILD_HOST)/g' \
+	    -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) --version 2>&1 | head -1)!g' \
+	    -e 's/@@version@@/$(XEN_VERSION)/g' \
+	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
+	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
+	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
+	    < $< > $(dot-target).tmp; \
+	sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \
+	mv -f $(dot-target).tmp $@; \
+    fi
+endef
+
+include/xen/compile.h: include/xen/compile.h.in .banner FORCE
+	$(if $(filter-out FORCE,$?),$(Q)rm -fv $@)
+	$(call if_changed,compile.h)
+
+targets += include/xen/compile.h
+
+asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
+	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
+	$(call move-if-changed,$@.new,$@)
+
+arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
+	@(set -e; \
+	  echo "/*"; \
+	  echo " * DO NOT MODIFY."; \
+	  echo " *"; \
+	  echo " * This file was auto-generated from $<"; \
+	  echo " *"; \
+	  echo " */"; \
+	  echo ""; \
+	  echo "#ifndef __ASM_OFFSETS_H__"; \
+	  echo "#define __ASM_OFFSETS_H__"; \
+	  echo ""; \
+	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
+	  echo ""; \
+	  echo "#endif") <$< >$@
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 10:55:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 10:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261945.453851 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDOuc-0007TJ-5U; Fri, 28 Jan 2022 10:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261945.453851; Fri, 28 Jan 2022 10:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDOuc-0007TA-25; Fri, 28 Jan 2022 10:55:26 +0000
Received: by outflank-mailman (input) for mailman id 261945;
 Fri, 28 Jan 2022 10:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOub-0007Sy-8E
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOub-0002s3-7O
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOub-0006qZ-6Q
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55: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=Y6Y+juijfztdf/JR3yPzO5smCutTjtp6ajgGYLvJMMw=; b=o3ASJcpiNqm+eokU6giefUbMu5
	1QMbADW+Ibg/iR4ry4X72+2I+hZvr39xl7cbTfEVHKLTPNjeVqJyY23kmS2iMaLDp/0XiBFePrJsv
	ZmJtw+7LKXrBN8UUSrDR7PS4XIcNefv+pACcBSiVTznRzXd2RMdIQWXGQDevdUji3pQM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: fix exported variable name CFLAGS_stack_boundary
Message-Id: <E1nDOub-0006qZ-6Q@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 10:55:25 +0000

commit aa390d513a67a6ec0a069eea7478e5ecd54a7ea6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jan 28 11:44:33 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 28 11:44:33 2022 +0100

    build: fix exported variable name CFLAGS_stack_boundary
    
    Exporting a variable with a dash doesn't work reliably, they may be
    striped from the environment when calling a sub-make or sub-shell.
    
    CFLAGS-stack-boundary start to be removed from env in patch "build:
    set ALL_OBJS in main Makefile; move prelink.o to main Makefile" when
    running `make "ALL_OBJS=.."` due to the addition of the quote. At
    least in my empirical tests.
    
    Fixes: 2740d96efd ("xen/build: have the root Makefile generates the CFLAGS")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Rules.mk     | 4 ++--
 xen/arch/x86/arch.mk      | 4 ++--
 xen/arch/x86/efi/Makefile | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 56fe22c979..7aef93f5f3 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -6,5 +6,5 @@ object_label_flags = '-D__OBJECT_LABEL__=$(subst $(BASEDIR)/,,$(CURDIR))/$@'
 else
 object_label_flags = '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
 endif
-c_flags += $(object_label_flags) $(CFLAGS-stack-boundary)
-a_flags += $(object_label_flags) $(CFLAGS-stack-boundary)
+c_flags += $(object_label_flags) $(CFLAGS_stack_boundary)
+a_flags += $(object_label_flags) $(CFLAGS_stack_boundary)
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index a93fa6d2e4..fa7cf38443 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -49,8 +49,8 @@ CFLAGS-$(CONFIG_INDIRECT_THUNK) += -fno-jump-tables
 
 # If supported by the compiler, reduce stack alignment to 8 bytes. But allow
 # this to be overridden elsewhere.
-$(call cc-option-add,CFLAGS-stack-boundary,CC,-mpreferred-stack-boundary=3)
-export CFLAGS-stack-boundary
+$(call cc-option-add,CFLAGS_stack_boundary,CC,-mpreferred-stack-boundary=3)
+export CFLAGS_stack_boundary
 
 ifeq ($(CONFIG_UBSAN),y)
 # Don't enable alignment sanitisation.  x86 has efficient unaligned accesses,
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 87b927ed86..abae493bf3 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -12,7 +12,7 @@ EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
-$(EFIOBJ-y): CFLAGS-stack-boundary := $(cflags-stack-boundary)
+$(EFIOBJ-y): CFLAGS_stack_boundary := $(cflags-stack-boundary)
 
 obj-y := stub.o
 obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 10:55:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 10:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.261946.453854 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDOum-0007X7-6U; Fri, 28 Jan 2022 10:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 261946.453854; Fri, 28 Jan 2022 10:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDOum-0007Wz-3f; Fri, 28 Jan 2022 10:55:36 +0000
Received: by outflank-mailman (input) for mailman id 261946;
 Fri, 28 Jan 2022 10:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOul-0007Wq-B5
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOul-0002sK-AK
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDOul-0006rP-9f
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 10:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tXhcrWj4+MWMiadAfF4HV3cjyZo5ix0CTi/MWf5MwUo=; b=6vGg+gpYSifhMWYRhQGPxOVtWr
	bN4QV7cL8DQAlAOtt2Qz6Cu2us2q9l+3+uuGSbLmYJLynOURKCkdegH7PKIyeiLplCVeipgRHh0GN
	65nPD+IgYBCojY7x2JXDUpDbY7Kvt1cDMxcPks1OgHbOi0EHPx6Wg11FMjjATs6ZUe44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] public: add XEN_RING_NR_UNCONSUMED_*() macros to ring.h
Message-Id: <E1nDOul-0006rP-9f@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 10:55:35 +0000

commit 21170a738c11b24815b4afab2151bd3aa2a29acc
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 28 11:47:00 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 28 11:47:00 2022 +0100

    public: add XEN_RING_NR_UNCONSUMED_*() macros to ring.h
    
    Today RING_HAS_UNCONSUMED_*() macros are returning the number of
    unconsumed requests or responses instead of a boolean as the name of
    the macros would imply.
    
    As this "feature" is already being used, rename the macros to
    XEN_RING_NR_UNCONSUMED_*() and define the RING_HAS_UNCONSUMED_*() macros
    by using the new XEN_RING_NR_UNCONSUMED_*() macros. In order to avoid
    future misuse let RING_HAS_UNCONSUMED_*() optionally really return a
    boolean (can be activated by defining XEN_RING_HAS_UNCONSUMED_IS_BOOL).
    
    Note that the known misuses need to be switched to the new
    XEN_RING_NR_UNCONSUMED_*() macros when using the RING_HAS_UNCONSUMED_*()
    variants returning a boolean value.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/io/ring.h | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h
index c486c457e0..277af36e61 100644
--- a/xen/include/public/io/ring.h
+++ b/xen/include/public/io/ring.h
@@ -208,11 +208,11 @@ typedef struct __name##_back_ring __name##_back_ring_t
     (RING_FREE_REQUESTS(_r) == 0)
 
 /* Test if there are outstanding messages to be processed on a ring. */
-#define RING_HAS_UNCONSUMED_RESPONSES(_r)                               \
+#define XEN_RING_NR_UNCONSUMED_RESPONSES(_r)                            \
     ((_r)->sring->rsp_prod - (_r)->rsp_cons)
 
 #ifdef __GNUC__
-#define RING_HAS_UNCONSUMED_REQUESTS(_r) ({                             \
+#define XEN_RING_NR_UNCONSUMED_REQUESTS(_r) ({                          \
     unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;          \
     unsigned int rsp = RING_SIZE(_r) -                                  \
         ((_r)->req_cons - (_r)->rsp_prod_pvt);                          \
@@ -220,13 +220,27 @@ typedef struct __name##_back_ring __name##_back_ring_t
 })
 #else
 /* Same as above, but without the nice GCC ({ ... }) syntax. */
-#define RING_HAS_UNCONSUMED_REQUESTS(_r)                                \
+#define XEN_RING_NR_UNCONSUMED_REQUESTS(_r)                             \
     ((((_r)->sring->req_prod - (_r)->req_cons) <                        \
       (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) ?        \
      ((_r)->sring->req_prod - (_r)->req_cons) :                         \
      (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt)))
 #endif
 
+#ifdef XEN_RING_HAS_UNCONSUMED_IS_BOOL
+/*
+ * These variants should only be used in case no caller is abusing them for
+ * obtaining the number of unconsumed responses/requests.
+ */
+#define RING_HAS_UNCONSUMED_RESPONSES(_r) \
+    (!!XEN_RING_NR_UNCONSUMED_RESPONSES(_r))
+#define RING_HAS_UNCONSUMED_REQUESTS(_r)  \
+    (!!XEN_RING_NR_UNCONSUMED_REQUESTS(_r))
+#else
+#define RING_HAS_UNCONSUMED_RESPONSES(_r) XEN_RING_NR_UNCONSUMED_RESPONSES(_r)
+#define RING_HAS_UNCONSUMED_REQUESTS(_r)  XEN_RING_NR_UNCONSUMED_REQUESTS(_r)
+#endif
+
 /* Direct access to individual ring elements, by index. */
 #define RING_GET_REQUEST(_r, _idx)                                      \
     (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 19:55:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 19:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262124.454234 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXKp-00078e-Ah; Fri, 28 Jan 2022 19:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262124.454234; Fri, 28 Jan 2022 19:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXKp-00078W-6u; Fri, 28 Jan 2022 19:55:03 +0000
Received: by outflank-mailman (input) for mailman id 262124;
 Fri, 28 Jan 2022 19: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 1nDXKo-000785-Cq
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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 1nDXKo-0004l3-C3
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDXKo-0005oN-AL
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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=uoCxWzzS13yCyQ3wLIWJWOYzNZiFXDb5HLpfXGxN8Wo=; b=E8167TxgfjNCtGbkklh7lZEEFG
	bi9AwYXIA+rTcT3AKkmvmupIzdbvrH2U5/szfT/IIlZFd3RzGICcu99zqJad8Evmh2K5C/WWM/NJk
	1wmWlbo+498DNtqAKy+iPcBITDqBwoqnUcKVbgfVAXjOz3Em3yvFCydKJU8ygsV/9AgA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: Fold VMCS logic in vmx_{get,set}_segment_register()
Message-Id: <E1nDXKo-0005oN-AL@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 19:55:02 +0000

commit b4c669fd7eabfdba93aa96a3a3b62829a67a60d5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 21 11:00:09 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:38:15 2022 +0000

    x86/vmx: Fold VMCS logic in vmx_{get,set}_segment_register()
    
    Xen's segment enumeration almost matches the VMCS encoding order, while the
    VMCS encoding order has the system segments immediately following the user
    segments for all relevant attributes.
    
    Use a sneaky xor to hide the difference in encoding order to fold the switch
    statements, dropping 10 __vmread() and 10 __vmwrite() calls.  Bloat-o-meter
    reports:
    
      add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-433 (-433)
      Function                                     old     new   delta
      vmx_set_segment_register                     804     593    -211
      vmx_get_segment_register                     778     556    -222
    
    showing that these wrappers aren't trivial.  In addition, 20 BUGs worth of
    metadata are dropped.
    
    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 | 77 ++++++++++++++++++++--------------------------
 1 file changed, 34 insertions(+), 43 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index c44cf8f5d4..9765cfd90a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -986,6 +986,7 @@ static void vmx_get_segment_register(struct vcpu *v, enum x86_segment seg,
                                      struct segment_register *reg)
 {
     unsigned long attr = 0, sel = 0, limit;
+    unsigned int tmp_seg;
 
     /*
      * We may get here in the context of dump_execstate(), which may have
@@ -1009,34 +1010,34 @@ static void vmx_get_segment_register(struct vcpu *v, enum x86_segment seg,
         return;
     }
 
-    switch ( seg )
+    /*
+     * Xen's x86_seg_* enumeration *almost* matches the VMCS encoding order.
+     *
+     * tr and ldtr are reversed, and other areas of code rely on this, so we
+     * can't just re-enumerate.
+     */
+    BUILD_BUG_ON(x86_seg_tr   != 6);
+    BUILD_BUG_ON(x86_seg_ldtr != 7);
+    BUILD_BUG_ON(x86_seg_gdtr != 8);
+    BUILD_BUG_ON(x86_seg_idtr != 9);
+    switch ( tmp_seg = seg )
     {
-    case x86_seg_es ... x86_seg_gs:
-        __vmread(GUEST_SEG_SELECTOR(seg), &sel);
-        __vmread(GUEST_SEG_LIMIT(seg),    &limit);
-        __vmread(GUEST_SEG_BASE(seg),     &reg->base);
-        __vmread(GUEST_SEG_AR_BYTES(seg), &attr);
-        break;
     case x86_seg_tr:
-        __vmread(GUEST_TR_SELECTOR, &sel);
-        __vmread(GUEST_TR_LIMIT,    &limit);
-        __vmread(GUEST_TR_BASE,     &reg->base);
-        __vmread(GUEST_TR_AR_BYTES, &attr);
-        break;
+    case x86_seg_ldtr:
+        tmp_seg ^= 1; /* Flip tr and ldtr so GUEST_SEG_*() works. */
+        fallthrough;
+
+    case x86_seg_es ... x86_seg_gs:
+        __vmread(GUEST_SEG_SELECTOR(tmp_seg), &sel);
+        __vmread(GUEST_SEG_AR_BYTES(tmp_seg), &attr);
+        fallthrough;
+
     case x86_seg_gdtr:
-        __vmread(GUEST_GDTR_LIMIT, &limit);
-        __vmread(GUEST_GDTR_BASE,  &reg->base);
-        break;
     case x86_seg_idtr:
-        __vmread(GUEST_IDTR_LIMIT, &limit);
-        __vmread(GUEST_IDTR_BASE,  &reg->base);
-        break;
-    case x86_seg_ldtr:
-        __vmread(GUEST_LDTR_SELECTOR, &sel);
-        __vmread(GUEST_LDTR_LIMIT,    &limit);
-        __vmread(GUEST_LDTR_BASE,     &reg->base);
-        __vmread(GUEST_LDTR_AR_BYTES, &attr);
+        __vmread(GUEST_SEG_LIMIT(tmp_seg),    &limit);
+        __vmread(GUEST_SEG_BASE(tmp_seg),     &reg->base);
         break;
+
     default:
         BUG();
         return;
@@ -1150,32 +1151,22 @@ static void vmx_set_segment_register(struct vcpu *v, enum x86_segment seg,
 
     switch ( seg )
     {
+    case x86_seg_tr:
+    case x86_seg_ldtr:
+        seg ^= 1; /* Flip tr and ldtr so GUEST_SEG_*() works. */
+        fallthrough;
+
     case x86_seg_es ... x86_seg_gs:
         __vmwrite(GUEST_SEG_SELECTOR(seg), sel);
-        __vmwrite(GUEST_SEG_LIMIT(seg),    limit);
-        __vmwrite(GUEST_SEG_BASE(seg),     base);
         __vmwrite(GUEST_SEG_AR_BYTES(seg), attr);
-        break;
-    case x86_seg_tr:
-        __vmwrite(GUEST_TR_SELECTOR, sel);
-        __vmwrite(GUEST_TR_LIMIT, limit);
-        __vmwrite(GUEST_TR_BASE, base);
-        __vmwrite(GUEST_TR_AR_BYTES, attr);
-        break;
+        fallthrough;
+
     case x86_seg_gdtr:
-        __vmwrite(GUEST_GDTR_LIMIT, limit);
-        __vmwrite(GUEST_GDTR_BASE, base);
-        break;
     case x86_seg_idtr:
-        __vmwrite(GUEST_IDTR_LIMIT, limit);
-        __vmwrite(GUEST_IDTR_BASE, base);
-        break;
-    case x86_seg_ldtr:
-        __vmwrite(GUEST_LDTR_SELECTOR, sel);
-        __vmwrite(GUEST_LDTR_LIMIT, limit);
-        __vmwrite(GUEST_LDTR_BASE, base);
-        __vmwrite(GUEST_LDTR_AR_BYTES, attr);
+        __vmwrite(GUEST_SEG_LIMIT(seg),    limit);
+        __vmwrite(GUEST_SEG_BASE(seg),     base);
         break;
+
     default:
         BUG();
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 19:55:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 19:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262127.454237 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXKz-0007Fs-CW; Fri, 28 Jan 2022 19:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262127.454237; Fri, 28 Jan 2022 19:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXKz-0007Fg-97; Fri, 28 Jan 2022 19:55:13 +0000
Received: by outflank-mailman (input) for mailman id 262127;
 Fri, 28 Jan 2022 19: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 1nDXKy-0007F5-GD
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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 1nDXKy-0004l7-FR
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDXKy-0005ov-ES
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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=6NrQtK3t+hmV6HE9i6QdxE8lG77wWczrkalkLREAT/w=; b=rGvhNNHh+17MZdxGpoxJ6muw7d
	1D87aybpBlptvEMXEsH3cdcqK4ySwC0hf0P4IvmQnO6LfIyC47Hy+F/d1ZGUMaNY0ShLcW3WjyUjO
	ujxtNFpabKvCokl07Vk5rar619PR6caCUF2iLn3xw7v90rtpBKRFmmaLFmktJAX5qG18=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpuid: Disentangle logic for new feature leaves
Message-Id: <E1nDXKy-0005ov-ES@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 19:55:12 +0000

commit e3662437eb43cc8002bd39be077ef68b131649c5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 27 13:56:04 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:38:15 2022 +0000

    x86/cpuid: Disentangle logic for new feature leaves
    
    Adding a new feature leaf is a reasonable amount of boilerplate and for the
    patch to build, at least one feature from the new leaf needs defining.  This
    typically causes two non-trivial changes to be merged together.
    
    First, have gen-cpuid.py write out some extra placeholder defines:
    
      #define CPUID_BITFIELD_11 bool :1, :1, lfence_dispatch:1, ...
      #define CPUID_BITFIELD_12 uint32_t :32 /* placeholder */
      #define CPUID_BITFIELD_13 uint32_t :32 /* placeholder */
      #define CPUID_BITFIELD_14 uint32_t :32 /* placeholder */
      #define CPUID_BITFIELD_15 uint32_t :32 /* placeholder */
    
    This allows DECL_BITFIELD() to be added to struct cpuid_policy without
    requiring a XEN_CPUFEATURE() declared for the leaf.  The choice of 4 is
    arbitrary, and allows us to add more than one leaf at a time if necessary.
    
    Second, rework generic_identify() to not use specific feature names.
    
    The choice of deriving the index from a feature was to avoid mismatches, but
    its correctness depends on bugs like c/s 249e0f1d8f20 ("x86/cpuid: Fix
    TSXLDTRK definition") not happening.
    
    Switch to using FEATURESET_* just like the policy/featureset helpers.  This
    breaks the cognitive complexity of needing to know which leaf a specifically
    named feature should reside in, and is shorter to write.  It is also far
    easier to identify as correct at a glance, given the correlation with the
    CPUID leaf being read.
    
    In addition, tidy up some other bits of generic_identify()
     * Drop leading zeros from leaf numbers.
     * Don't use a locked update for X86_FEATURE_APERFMPERF.
     * Rework extended_cpuid_level calculation to avoid setting it twice.
     * Use "leaf >= $N" consistently so $N matches with the CPUID input.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c | 54 +++++++++++++++++++++++------------------------
 xen/tools/gen-cpuid.py    |  2 ++
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 4a163afbfc..c6773c85fd 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -379,7 +379,7 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	u32 eax, ebx, ecx, edx, tmp;
 
 	/* Get vendor name */
-	cpuid(0x00000000, &c->cpuid_level, &ebx, &ecx, &edx);
+	cpuid(0, &c->cpuid_level, &ebx, &ecx, &edx);
 	*(u32 *)&c->x86_vendor_id[0] = ebx;
 	*(u32 *)&c->x86_vendor_id[8] = ecx;
 	*(u32 *)&c->x86_vendor_id[4] = edx;
@@ -394,7 +394,7 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	/* Note that the vendor-specific code below might override */
 
 	/* Model and family information. */
-	cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
+	cpuid(1, &eax, &ebx, &ecx, &edx);
 	c->x86 = get_cpu_family(eax, &c->x86_model, &c->x86_mask);
 	c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
 	c->phys_proc_id = c->apicid;
@@ -404,53 +404,53 @@ static void generic_identify(struct cpuinfo_x86 *c)
 
 	/* c_early_init() may have adjusted cpuid levels/features.  Reread. */
 	c->cpuid_level = cpuid_eax(0);
-	cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
-	c->x86_capability[cpufeat_word(X86_FEATURE_FPU)] = edx;
-	c->x86_capability[cpufeat_word(X86_FEATURE_SSE3)] = ecx;
+	cpuid(1, &eax, &ebx,
+	      &c->x86_capability[FEATURESET_1c],
+	      &c->x86_capability[FEATURESET_1d]);
 
 	if ( cpu_has(c, X86_FEATURE_CLFLUSH) )
 		c->x86_clflush_size = ((ebx >> 8) & 0xff) * 8;
 
 	if ( (c->cpuid_level >= CPUID_PM_LEAF) &&
 	     (cpuid_ecx(CPUID_PM_LEAF) & CPUID6_ECX_APERFMPERF_CAPABILITY) )
-		set_bit(X86_FEATURE_APERFMPERF, c->x86_capability);
+		__set_bit(X86_FEATURE_APERFMPERF, c->x86_capability);
+
+	eax = cpuid_eax(0x80000000);
+	if ((eax >> 16) == 0x8000)
+		c->extended_cpuid_level = eax;
 
 	/* AMD-defined flags: level 0x80000001 */
-	c->extended_cpuid_level = cpuid_eax(0x80000000);
-	if ((c->extended_cpuid_level >> 16) != 0x8000)
-		c->extended_cpuid_level = 0;
-	if (c->extended_cpuid_level > 0x80000000)
+	if (c->extended_cpuid_level >= 0x80000001)
 		cpuid(0x80000001, &tmp, &tmp,
-		      &c->x86_capability[cpufeat_word(X86_FEATURE_LAHF_LM)],
-		      &c->x86_capability[cpufeat_word(X86_FEATURE_SYSCALL)]);
+		      &c->x86_capability[FEATURESET_e1c],
+		      &c->x86_capability[FEATURESET_e1d]);
 
 	if (c->extended_cpuid_level >= 0x80000004)
 		get_model_name(c); /* Default name */
 	if (c->extended_cpuid_level >= 0x80000007)
-		c->x86_capability[cpufeat_word(X86_FEATURE_ITSC)]
-			= cpuid_edx(0x80000007);
+		c->x86_capability[FEATURESET_e7d] = cpuid_edx(0x80000007);
 	if (c->extended_cpuid_level >= 0x80000008)
-		c->x86_capability[cpufeat_word(X86_FEATURE_CLZERO)]
-			= cpuid_ebx(0x80000008);
+		c->x86_capability[FEATURESET_e8b] = cpuid_ebx(0x80000008);
 	if (c->extended_cpuid_level >= 0x80000021)
-		c->x86_capability[cpufeat_word(X86_FEATURE_LFENCE_DISPATCH)]
-			= cpuid_eax(0x80000021);
+		c->x86_capability[FEATURESET_e21a] = cpuid_eax(0x80000021);
 
 	/* Intel-defined flags: level 0x00000007 */
-	if ( c->cpuid_level >= 0x00000007 ) {
-		cpuid_count(0x00000007, 0, &eax,
-			    &c->x86_capability[cpufeat_word(X86_FEATURE_FSGSBASE)],
-			    &c->x86_capability[cpufeat_word(X86_FEATURE_PKU)],
-			    &c->x86_capability[cpufeat_word(X86_FEATURE_AVX512_4VNNIW)]);
-		if (eax > 0)
-			cpuid_count(0x00000007, 1,
-				    &c->x86_capability[cpufeat_word(X86_FEATURE_AVX512_BF16)],
+	if (c->cpuid_level >= 7) {
+		uint32_t max_subleaf;
+
+		cpuid_count(7, 0, &max_subleaf,
+			    &c->x86_capability[FEATURESET_7b0],
+			    &c->x86_capability[FEATURESET_7c0],
+			    &c->x86_capability[FEATURESET_7d0]);
+		if (max_subleaf >= 1)
+			cpuid_count(7, 1,
+				    &c->x86_capability[FEATURESET_7a1],
 				    &tmp, &tmp, &tmp);
 	}
 
 	if (c->cpuid_level >= 0xd)
 		cpuid_count(0xd, 1,
-			    &c->x86_capability[cpufeat_word(X86_FEATURE_XSAVEOPT)],
+			    &c->x86_capability[FEATURESET_Da1],
 			    &tmp, &tmp, &tmp);
 }
 
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index b953648b65..470cd76d1c 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -423,6 +423,8 @@ def write_results(state):
 
 """)
 
+    state.bitfields += ["uint32_t :32 /* placeholder */"] * 4
+
     for idx, text in enumerate(state.bitfields):
         state.output.write(
             "#define CPUID_BITFIELD_%d \\\n    %s\n\n"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 19:55:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 19:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262129.454241 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXL9-0007Tl-Dn; Fri, 28 Jan 2022 19:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262129.454241; Fri, 28 Jan 2022 19:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXL9-0007Td-Aj; Fri, 28 Jan 2022 19:55:23 +0000
Received: by outflank-mailman (input) for mailman id 262129;
 Fri, 28 Jan 2022 19: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 1nDXL8-0007TN-JV
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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 1nDXL8-0004lO-Ik
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDXL8-0005pY-Hl
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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=K75JpOyGvJkNejqdTI7dTvCrc1TcE3afpnbTb7wAn/E=; b=IIohqV979Uu50AcyWKo3YZ+oai
	WZrjGflZlC5iW2axhQgPMlF/Aw2HpDQpeJliNQ4UNFD3kfzAxd+gKI5XVQDH714O6j5L96I33uJGn
	+Z+TFNZIPPCxA2nYL9djp0zTPtHL2eRvpmvQ1DAZq/EemB9DcpXTu5xqcAC+sAttn5DA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpuid: Infrastructure for leaf 7:1.ebx
Message-Id: <E1nDXL8-0005pY-Hl@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 19:55:22 +0000

commit e1828e3032ebfe036023cd733adfd2d4ec856688
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 27 12:54:42 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:38:15 2022 +0000

    x86/cpuid: Infrastructure for leaf 7:1.ebx
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xen-cpuid.c                      | 5 +++++
 xen/arch/x86/cpu/common.c                   | 3 ++-
 xen/include/public/arch-x86/cpufeatureset.h | 2 ++
 xen/include/xen/lib/x86/cpuid.h             | 7 +++++++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index a3003245f1..17e67e379f 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -195,6 +195,10 @@ static const char *const str_e21a[32] =
     [ 6] = "nscb",
 };
 
+static const char *const str_7b1[32] =
+{
+};
+
 static const struct {
     const char *name;
     const char *abbr;
@@ -213,6 +217,7 @@ static const struct {
     { "0x00000007:0.edx", "7d0", str_7d0 },
     { "0x00000007:1.eax", "7a1", str_7a1 },
     { "0x80000021.eax",  "e21a", str_e21a },
+    { "0x00000007:1.ebx", "7b1", str_7b1 },
 };
 
 #define COL_ALIGN "18"
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index c6773c85fd..d4f5028fa2 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -445,7 +445,8 @@ static void generic_identify(struct cpuinfo_x86 *c)
 		if (max_subleaf >= 1)
 			cpuid_count(7, 1,
 				    &c->x86_capability[FEATURESET_7a1],
-				    &tmp, &tmp, &tmp);
+				    &c->x86_capability[FEATURESET_7b1],
+				    &tmp, &tmp);
 	}
 
 	if (c->cpuid_level >= 0xd)
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 0b39937556..588f924de5 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -299,6 +299,8 @@ XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
 XEN_CPUFEATURE(LFENCE_DISPATCH,    11*32+ 2) /*A  LFENCE always serializing */
 XEN_CPUFEATURE(NSCB,               11*32+ 6) /*A  Null Selector Clears Base (and limit too) */
 
+/* Intel-defined CPU features, CPUID level 0x00000007:1.ebx, word 12 */
+
 #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 a4d254ea96..e87036b303 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -16,6 +16,7 @@
 #define FEATURESET_7d0    9 /* 0x00000007:0.edx    */
 #define FEATURESET_7a1   10 /* 0x00000007:1.eax    */
 #define FEATURESET_e21a  11 /* 0x80000021.eax      */
+#define FEATURESET_7b1   12 /* 0x00000007:1.ebx    */
 
 struct cpuid_leaf
 {
@@ -188,6 +189,10 @@ struct cpuid_policy
                 uint32_t _7a1;
                 struct { DECL_BITFIELD(7a1); };
             };
+            union {
+                uint32_t _7b1;
+                struct { DECL_BITFIELD(7b1); };
+            };
         };
     } feat;
 
@@ -327,6 +332,7 @@ static inline void cpuid_policy_to_featureset(
     fs[FEATURESET_7d0] = p->feat._7d0;
     fs[FEATURESET_7a1] = p->feat._7a1;
     fs[FEATURESET_e21a] = p->extd.e21a;
+    fs[FEATURESET_7b1] = p->feat._7b1;
 }
 
 /* Fill in a CPUID policy from a featureset bitmap. */
@@ -345,6 +351,7 @@ static inline void cpuid_featureset_to_policy(
     p->feat._7d0  = fs[FEATURESET_7d0];
     p->feat._7a1  = fs[FEATURESET_7a1];
     p->extd.e21a  = fs[FEATURESET_e21a];
+    p->feat._7b1  = fs[FEATURESET_7b1];
 }
 
 static inline uint64_t cpuid_policy_xcr0_max(const struct cpuid_policy *p)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 19:55:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 19:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262132.454245 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXLJ-0007aC-FH; Fri, 28 Jan 2022 19:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262132.454245; Fri, 28 Jan 2022 19:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXLJ-0007a4-CH; Fri, 28 Jan 2022 19:55:33 +0000
Received: by outflank-mailman (input) for mailman id 262132;
 Fri, 28 Jan 2022 19: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 1nDXLI-0007Zq-Mc
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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 1nDXLI-0004la-Ls
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDXLI-0005q9-Kz
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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=Skkm+ci10xzw1YuIIeVR0WMQem3YVtOHLf7TiaSYUjc=; b=qv+i43KJKWZbGbpBPFtz2dI/6L
	vI8z59YoL6D8yLzsw06ByzllOTufgbSCsS2C6uNn9+ovOF0DSmPJMXtTnXWVhn7/OOAjzkord63oz
	uS5yAQeQXLJPh8sbx3wwYT2geJxmp77jPh6JA8KWKpYAAw0QnWDjdMxOSrEgd2YILaLM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/Intel: use CPUID bit to determine PPIN availability
Message-Id: <E1nDXLI-0005q9-Kz@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 19:55:32 +0000

commit d940ce8e2a85100223fb8b3ab96407fdcec7f02c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jan 27 13:54:42 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:38:15 2022 +0000

    x86/Intel: use CPUID bit to determine PPIN availability
    
    As of SDM revision 076 there is a CPUID bit for this functionality. Use
    it to amend the existing model-based logic.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xen-cpuid.c                      |  1 +
 xen/arch/x86/cpu/mcheck/mce_intel.c         | 10 +++++++++-
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 17e67e379f..3c8f3ed1ba 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -197,6 +197,7 @@ static const char *const str_e21a[32] =
 
 static const char *const str_7b1[32] =
 {
+    [ 0] = "ppin",
 };
 
 static const struct {
diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index d0161e9d4d..d63d6083d3 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -859,12 +859,20 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
     /*
      * Even if testing the presence of the MSR would be enough, we don't
      * want to risk the situation where other models reuse this MSR for
-     * other purposes.
+     * other purposes.  Despite the late addition of a CPUID bit (rendering
+     * the MSR architectural), keep using the same detection logic there.
      */
     switch ( c->x86_model )
     {
         uint64_t val;
 
+    default:
+        if ( !cpu_has(c, X86_FEATURE_INTEL_PPIN) )
+        {
+            ppin_msr = 0;
+            return;
+        }
+        fallthrough;
     case 0x3e: /* IvyBridge X */
     case 0x3f: /* Haswell X */
     case 0x4f: /* Broadwell X */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 588f924de5..6e44148a09 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -300,6 +300,7 @@ XEN_CPUFEATURE(LFENCE_DISPATCH,    11*32+ 2) /*A  LFENCE always serializing */
 XEN_CPUFEATURE(NSCB,               11*32+ 6) /*A  Null Selector Clears Base (and limit too) */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1.ebx, word 12 */
+XEN_CPUFEATURE(INTEL_PPIN,         12*32+ 0) /*   Protected Processor Inventory Number */
 
 #endif /* XEN_CPUFEATURE */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 19:55:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 19:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262133.454249 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXLT-0007di-Gv; Fri, 28 Jan 2022 19:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262133.454249; Fri, 28 Jan 2022 19:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXLT-0007da-Ds; Fri, 28 Jan 2022 19:55:43 +0000
Received: by outflank-mailman (input) for mailman id 262133;
 Fri, 28 Jan 2022 19: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 1nDXLS-0007dT-Ps
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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 1nDXLS-0004lk-P4
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDXLS-0005qn-OQ
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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=qFINJoP0ts5ILni48xsPOwY3l6kRe3npXlyhTNCiwhE=; b=4bum9JuZ/i79T6vRMt58pEY9OG
	6rLrMuawK/CAk753VzFSOBbe0amldB27Y7fR00ZbTxcMPLOCVKuWncTZqL/Zqy+kLigeSuqD4hWXz
	ZRL9VXjvrG+21l630Hqtj3YkRwfj+yAorfghj+H01RN3zN6yja/EC0c/YNchALP1ImO0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msr: Fix migration compatibility issue with MSR_SPEC_CTRL
Message-Id: <E1nDXLS-0005qn-OQ@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 19:55:42 +0000

commit 969a57f73f6b011b2ebf4c0ab1715efc65837335
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 19 19:55:02 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 27 17:59:18 2022 +0000

    x86/msr: Fix migration compatibility issue with MSR_SPEC_CTRL
    
    This bug existed in early in 2018 between MSR_SPEC_CTRL arriving in microcode,
    and SSBD arriving a few months later.  It went unnoticed presumably because
    everyone was busy rebooting everything.
    
    The same bug will reappear when adding PSFD support.
    
    Clamp the guest MSR_SPEC_CTRL value to that permitted by CPUID on migrate.
    The guest is already playing with reserved bits at this point, and clamping
    the value will prevent a migration to a less capable host from failing.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c         | 25 +++++++++++++++++++++++--
 xen/arch/x86/include/asm/msr.h |  2 ++
 xen/arch/x86/msr.c             | 33 +++++++++++++++++++++------------
 3 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index d7d3299b43..c4ddb8607d 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1340,6 +1340,7 @@ static const uint32_t msrs_to_send[] = {
 
 static int hvm_save_cpu_msrs(struct vcpu *v, hvm_domain_context_t *h)
 {
+    const struct domain *d = v->domain;
     struct hvm_save_descriptor *desc = _p(&h->data[h->cur]);
     struct hvm_msr *ctxt;
     unsigned int i;
@@ -1355,7 +1356,8 @@ static int hvm_save_cpu_msrs(struct vcpu *v, hvm_domain_context_t *h)
     for ( i = 0; i < ARRAY_SIZE(msrs_to_send); ++i )
     {
         uint64_t val;
-        int rc = guest_rdmsr(v, msrs_to_send[i], &val);
+        unsigned int msr = msrs_to_send[i];
+        int rc = guest_rdmsr(v, msr, &val);
 
         /*
          * It is the programmers responsibility to ensure that
@@ -1375,7 +1377,26 @@ static int hvm_save_cpu_msrs(struct vcpu *v, hvm_domain_context_t *h)
         if ( !val )
             continue; /* Skip empty MSRs. */
 
-        ctxt->msr[ctxt->count].index = msrs_to_send[i];
+        /*
+         * Guests are given full access to certain MSRs for performance
+         * reasons.  A consequence is that Xen is unable to enforce that all
+         * bits disallowed by the CPUID policy yield #GP, and an enterprising
+         * guest may be able to set and use a bit it ought to leave alone.
+         *
+         * When migrating from a more capable host to a less capable one, such
+         * bits may be rejected by the destination, and the migration failed.
+         *
+         * Discard such bits here on the source side.  Such bits have reserved
+         * behaviour, and the guest has only itself to blame.
+         */
+        switch ( msr )
+        {
+        case MSR_SPEC_CTRL:
+            val &= msr_spec_ctrl_valid_bits(d->arch.cpuid);
+            break;
+        }
+
+        ctxt->msr[ctxt->count].index = msr;
         ctxt->msr[ctxt->count++].val = val;
     }
 
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 10039c2d22..657a329561 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -277,6 +277,8 @@ static inline void wrmsr_tsc_aux(uint32_t val)
     }
 }
 
+uint64_t msr_spec_ctrl_valid_bits(const struct cpuid_policy *cp);
+
 extern struct msr_policy     raw_msr_policy,
                             host_msr_policy,
                           pv_max_msr_policy,
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 2cc355575d..5e80c8b47c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -435,6 +435,24 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     return X86EMUL_EXCEPTION;
 }
 
+/*
+ * Caller to confirm that MSR_SPEC_CTRL is available.  Intel and AMD have
+ * separate CPUID features for this functionality, but only set will be
+ * active.
+ */
+uint64_t msr_spec_ctrl_valid_bits(const struct cpuid_policy *cp)
+{
+    bool ssbd = cp->feat.ssbd;
+
+    /*
+     * Note: SPEC_CTRL_STIBP is specified as safe to use (i.e. ignored)
+     * when STIBP isn't enumerated in hardware.
+     */
+    return (SPEC_CTRL_IBRS | SPEC_CTRL_STIBP |
+            (ssbd       ? SPEC_CTRL_SSBD       : 0) |
+            0);
+}
+
 int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
 {
     const struct vcpu *curr = current;
@@ -508,18 +526,9 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
 
     case MSR_SPEC_CTRL:
-        if ( !cp->feat.ibrsb )
-            goto gp_fault; /* MSR available? */
-
-        /*
-         * Note: SPEC_CTRL_STIBP is specified as safe to use (i.e. ignored)
-         * when STIBP isn't enumerated in hardware.
-         */
-        rsvd = ~(SPEC_CTRL_IBRS | SPEC_CTRL_STIBP |
-                 (cp->feat.ssbd ? SPEC_CTRL_SSBD : 0));
-
-        if ( val & rsvd )
-            goto gp_fault; /* Rsvd bit set? */
+        if ( !cp->feat.ibrsb ||
+             (val & ~msr_spec_ctrl_valid_bits(cp)) )
+            goto gp_fault;
         goto set_reg;
 
     case MSR_PRED_CMD:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jan 28 19:55:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Jan 2022 19:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262134.454253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDXLe-0007hc-K3; Fri, 28 Jan 2022 19:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262134.454253; Fri, 28 Jan 2022 19: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 1nDXLe-0007hU-Go; Fri, 28 Jan 2022 19:55:54 +0000
Received: by outflank-mailman (input) for mailman id 262134;
 Fri, 28 Jan 2022 19: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 1nDXLc-0007hH-T2
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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 1nDXLc-0004lt-SB
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDXLc-0005rK-RL
 for xen-changelog@lists.xenproject.org; Fri, 28 Jan 2022 19: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=OyYcWKi3F1LYSx18knQOHcpwo5LWJRVgbcaJLDrIluI=; b=X1ckW5Br/5dMmw1ZSLLBANAkao
	0gq3EvRKH50OYqzUubB1kz7TcZUbeZjhYDp5fuHE/ZEiP1UJEcox19Tj6lkDYOzgAc6UdDgNN1Y9n
	QthDQf73QEXOrZ3xRU2qQi1smyVpyJ7+HIKpJk0gB4YkHgtSGWTUmMYbUVfstaLu7lRo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: remove python-dev from debian unstable build containers
Message-Id: <E1nDXLc-0005rK-RL@xenbits.xenproject.org>
Date: Fri, 28 Jan 2022 19:55:52 +0000

commit 2a565f9b40db981a860574be26d86a8665e71c38
Author:     Stefano Stabellini <stefano.stabellini@xilinx.com>
AuthorDate: Tue Jan 25 17:45:28 2022 -0800
Commit:     Stefano Stabellini <stefano.stabellini@xilinx.com>
CommitDate: Thu Jan 27 17:20:50 2022 -0800

    automation: remove python-dev from debian unstable build containers
    
    Debian unstable doesn't have the legacy python-dev package anymore.
    Note: only the arm64v8 container has been rebuilt.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/debian/unstable-arm64v8.dockerfile | 1 -
 automation/build/debian/unstable-i386.dockerfile    | 1 -
 automation/build/debian/unstable.dockerfile         | 1 -
 3 files changed, 3 deletions(-)

diff --git a/automation/build/debian/unstable-arm64v8.dockerfile b/automation/build/debian/unstable-arm64v8.dockerfile
index 4409f596e1..5c73458d9d 100644
--- a/automation/build/debian/unstable-arm64v8.dockerfile
+++ b/automation/build/debian/unstable-arm64v8.dockerfile
@@ -15,7 +15,6 @@ RUN apt-get update && \
         zlib1g-dev \
         libncurses5-dev \
         libssl-dev \
-        python-dev \
         python3-dev \
         xorg-dev \
         uuid-dev \
diff --git a/automation/build/debian/unstable-i386.dockerfile b/automation/build/debian/unstable-i386.dockerfile
index 06ffb97384..6ce54a481b 100644
--- a/automation/build/debian/unstable-i386.dockerfile
+++ b/automation/build/debian/unstable-i386.dockerfile
@@ -17,7 +17,6 @@ RUN apt-get update && \
         zlib1g-dev \
         libncurses5-dev \
         libssl-dev \
-        python-dev \
         python3-dev \
         xorg-dev \
         uuid-dev \
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index bd61cd12c2..9de766d596 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -15,7 +15,6 @@ RUN apt-get update && \
         zlib1g-dev \
         libncurses5-dev \
         libssl-dev \
-        python-dev \
         python3-dev \
         xorg-dev \
         uuid-dev \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 29 08:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 29 Jan 2022 08:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262223.454400 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDizj-0002pz-Pb; Sat, 29 Jan 2022 08:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262223.454400; Sat, 29 Jan 2022 08:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDizj-0002pr-Me; Sat, 29 Jan 2022 08:22:03 +0000
Received: by outflank-mailman (input) for mailman id 262223;
 Sat, 29 Jan 2022 08:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDizi-0002pl-3m
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDizi-0004hj-2p
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDizi-00015m-1w
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uvkjscvI9FE2/ABlQ1WvyHfNCPUUNb19amZ0j5GyQyI=; b=FU+eCJjcm+F7cdK2RDmnl+lUiW
	KFzXWs7olZsrDACbi2aPvGSucZDvJ/PpFiRD8QwylGc3B5fDcJ31hBy95hJI5lEh5390/+A1HwvWO
	stoOAzQ9J047T8TpLbmdRzReOs6X+aiGU8XKLW0y7SjbR1GksWoffosu1/ESRtII8ZcY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: set XEN_BUILD_EFI earlier
Message-Id: <E1nDizi-00015m-1w@xenbits.xenproject.org>
Date: Sat, 29 Jan 2022 08:22:02 +0000

commit 672f2198f4eb6b14cbbf4abb4e2d27af15578dad
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jan 28 11:41:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 28 11:41:09 2022 +0100

    build: set XEN_BUILD_EFI earlier
    
    We are going to need the variable XEN_BUILD_EFI earlier.
    
    But a side effect of calculating the value of $(XEN_BUILD_EFI) is to
    also to generate "efi/check.o" which is used for further checks.
    Thus the whole chain that check for EFI support is moved to
    "arch.mk".
    
    Some other changes are made to avoid too much duplication:
        - $(efi-check): Used to avoid repeating "efi/check.*". We don't
          set it to the path to the source as it would be wrong as soon
          as we support out-of-tree build.
        - $(LD_PE_check_cmd): As it is called twice, with an updated
          $(EFI_LDFLAGS).
    
    $(nr-fixups) is renamed to $(efi-nr-fixups) as the former might be
    a bit too generic.
    
    In order to avoid exporting MKRELOC, the variable is added to $(MAKE)
    command line. The only modification needed is in target "build", the
    modification target "$(TARGET)" will be needed with a following patch
    "build: avoid re-executing the main Makefile by introducing build.mk".
    
    We can now revert 24b0ce9a5da2, we don't need to override efi-y on
    recursion anymore.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile          |  4 ++--
 xen/arch/x86/Makefile | 46 ++++++----------------------------------------
 xen/arch/x86/arch.mk  | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 42 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 1e10d9f680..f3ff03a717 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -296,7 +296,7 @@ endif # need-config
 .PHONY: build install uninstall clean distclean MAP
 build install uninstall debug clean distclean MAP::
 ifneq ($(XEN_TARGET_ARCH),x86_32)
-	$(MAKE) -f Rules.mk _$@
+	$(MAKE) -f Rules.mk MKRELOC=$(MKRELOC) _$@
 else
 	echo "*** Xen x86/32 target no longer supported!"
 endif
@@ -404,7 +404,7 @@ $(TARGET): FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) include
 	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
+	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) MKRELOC=$(MKRELOC) $@
 
 quiet_cmd_banner = BANNER  $@
 define cmd_banner
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 8db4cb98ed..9fc884813c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -121,44 +121,8 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 		{ echo "No Multiboot2 header found" >&2; false; }
 	mv $(TMP) $(TARGET)
 
-ifneq ($(efi-y),)
-
-# Check if the compiler supports the MS ABI.
-export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 
-# Check if the linker supports PE.
-EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o))
-# If the above failed, it may be merely because of the linker not dealing well
-# with debug info. Try again with stripping it.
-ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
-EFI_LDFLAGS += --strip-debug
-XEN_BUILD_PE := $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o)
-endif
-
-ifeq ($(XEN_BUILD_PE),y)
-
-# Check if the linker produces fixups in PE by default
-nr-fixups := $(shell $(OBJDUMP) -p efi/check.efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
-ifeq ($(nr-fixups),2)
-MKRELOC := :
-relocs-dummy :=
-else
-MKRELOC := efi/mkreloc
-relocs-dummy := efi/relocs-dummy.o
-# If the linker produced fixups but not precisely two of them, we need to
-# disable it doing so.  But if it didn't produce any fixups, it also wouldn't
-# recognize the option.
-ifneq ($(nr-fixups),0)
-EFI_LDFLAGS += --disable-reloc-section
-endif
-endif
-
-endif # $(XEN_BUILD_PE)
-
-endif # $(efi-y)
-
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
 
 ifeq ($(CONFIG_LTO),y)
@@ -182,13 +146,13 @@ $(TARGET)-syms: prelink.o xen.lds
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \
 		>$(@D)/.$(@F).0.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0.o
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \
 		>$(@D)/.$(@F).1.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).1.o
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
@@ -217,8 +181,10 @@ endif
 
 $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p')
 ifeq ($(MKRELOC),:)
+relocs-dummy :=
 $(TARGET).efi: ALT_BASE :=
 else
+relocs-dummy := efi/relocs-dummy.o
 $(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p')
 endif
 
@@ -250,14 +216,14 @@ endif
 	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
 	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -o $(@D)/.$(@F).$(base).1 &&) :
 	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
+	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
 	$(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $< \
 	                $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file_option) -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index eea320e618..a93fa6d2e4 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -60,5 +60,47 @@ ifeq ($(CONFIG_UBSAN),y)
 $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
 endif
 
+ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
+
+efi-check := arch/x86/efi/check
+
+# Check if the compiler supports the MS ABI.
+XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(efi-check).c -o $(efi-check).o,y)
+
+# Check if the linker supports PE.
+EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
+LD_PE_check_cmd = $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(efi-check).efi $(efi-check).o)
+XEN_BUILD_PE := $(LD_PE_check_cmd)
+
+# If the above failed, it may be merely because of the linker not dealing well
+# with debug info. Try again with stripping it.
+ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
+EFI_LDFLAGS += --strip-debug
+XEN_BUILD_PE := $(LD_PE_check_cmd)
+endif
+
+ifeq ($(XEN_BUILD_PE),y)
+
+# Check if the linker produces fixups in PE by default
+efi-nr-fixups := $(shell $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+
+ifeq ($(efi-nr-fixups),2)
+MKRELOC := :
+else
+MKRELOC := efi/mkreloc
+# If the linker produced fixups but not precisely two of them, we need to
+# disable it doing so.  But if it didn't produce any fixups, it also wouldn't
+# recognize the option.
+ifneq ($(efi-nr-fixups),0)
+EFI_LDFLAGS += --disable-reloc-section
+endif
+endif
+
+endif # $(XEN_BUILD_PE)
+
+export XEN_BUILD_EFI XEN_BUILD_PE
+export EFI_LDFLAGS
+endif
+
 # Set up the assembler include path properly for older toolchains.
 CFLAGS += -Wa,-I$(BASEDIR)/include
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 29 08:22:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 29 Jan 2022 08:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262224.454404 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDizs-0002ru-R9; Sat, 29 Jan 2022 08:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262224.454404; Sat, 29 Jan 2022 08:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDizs-0002rm-O9; Sat, 29 Jan 2022 08:22:12 +0000
Received: by outflank-mailman (input) for mailman id 262224;
 Sat, 29 Jan 2022 08:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDizs-0002rg-6y
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDizs-0004iH-67
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDizs-00016k-5F
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4iDbXslf9O1FjuOfF5MBt2whGj6udQykl9xvo3uFSWU=; b=u90t6zxQs1uCQDZ+MnaG5+jCh6
	Pd7FtT8eisuPD7dbOksMLz8c3HZ6wP3tlGeYAwE0E4wfrcXD+G+5aVh8vfEKcTmg085dATG33wu0c
	vJbtt4gF7Ux+OlbWvKiBD4joeVOQ6kqOc+Li+LljK4iPdlHEefQHKuqwjJM1dWK63vKw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: avoid re-executing the main Makefile by introducing build.mk
Message-Id: <E1nDizs-00016k-5F@xenbits.xenproject.org>
Date: Sat, 29 Jan 2022 08:22:12 +0000

commit 7be85daac5acca30bd4d6779ec03982528c35558
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jan 28 11:42:24 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 28 11:42:24 2022 +0100

    build: avoid re-executing the main Makefile by introducing build.mk
    
    Currently, the xen/Makefile is re-parsed several times: once to start
    the build process, and several more time with Rules.mk including it.
    This makes it difficult to work with a Makefile used for several
    purpose, and it actually slow down the build process.
    
    So this patch introduce "build.mk" which Rules.mk will use when
    present instead of the "Makefile" of a directory. (Linux's Kbuild
    named that file "Kbuild".)
    
    We have a few targets to move to "build.mk" identified by them been
    build via "make -f Rules.mk" without changing directory.
    
    As for the main targets like "build", we can have them depends on
    there underscore-prefix targets like "_build" without having to use
    "Rules.mk" while still retaining the check for unsupported
    architecture. (Those main rules are changed to be single-colon as
    there should only be a single recipe for them.)
    
    With nearly everything needed to move to "build.mk" moved, there is a
    single dependency left from "Rules.mk": the variable $(TARGET), so its
    assignement is moved to the main Makefile.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Makefile | 70 ++++++------------------------------------------------------
 xen/Rules.mk |  6 ++----
 xen/build.mk | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 68 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index f3ff03a717..fb37043d08 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -47,6 +47,8 @@ export KCONFIG_CONFIG ?= .config
 
 export CC CXX LD
 
+export TARGET := $(BASEDIR)/xen
+
 .PHONY: default
 default: build
 
@@ -293,11 +295,12 @@ export CFLAGS_UBSAN
 
 endif # need-config
 
-.PHONY: build install uninstall clean distclean MAP
-build install uninstall debug clean distclean MAP::
+main-targets := build install uninstall clean distclean MAP
+.PHONY: $(main-targets)
 ifneq ($(XEN_TARGET_ARCH),x86_32)
-	$(MAKE) -f Rules.mk MKRELOC=$(MKRELOC) _$@
+$(main-targets): %: _% ;
 else
+$(main-targets):
 	echo "*** Xen x86/32 target no longer supported!"
 endif
 
@@ -406,67 +409,6 @@ $(TARGET): FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) MKRELOC=$(MKRELOC) $@
 
-quiet_cmd_banner = BANNER  $@
-define cmd_banner
-    if which figlet >/dev/null 2>&1 ; then \
-	echo " Xen $(XEN_FULLVERSION)" | figlet -f $< > $@.tmp; \
-    else \
-	echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
-    fi; \
-    mv -f $@.tmp $@
-endef
-
-.banner: tools/xen.flf FORCE
-	$(call if_changed,banner)
-targets += .banner
-
-# Don't refresh this files during e.g., 'sudo make install'
-quiet_cmd_compile.h = UPD     $@
-define cmd_compile.h
-    if [ ! -r $@ -o -O $@ ]; then \
-	cat .banner; \
-	sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
-	    -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
-	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
-	    -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
-	    -e 's/@@hostname@@/$(XEN_BUILD_HOST)/g' \
-	    -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) --version 2>&1 | head -1)!g' \
-	    -e 's/@@version@@/$(XEN_VERSION)/g' \
-	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
-	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
-	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
-	    < $< > $(dot-target).tmp; \
-	sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \
-	mv -f $(dot-target).tmp $@; \
-    fi
-endef
-
-include/xen/compile.h: include/xen/compile.h.in .banner FORCE
-	$(if $(filter-out FORCE,$?),$(Q)rm -fv $@)
-	$(call if_changed,compile.h)
-
-targets += include/xen/compile.h
-
-asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
-	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
-	$(call move-if-changed,$@.new,$@)
-
-arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
-	@(set -e; \
-	  echo "/*"; \
-	  echo " * DO NOT MODIFY."; \
-	  echo " *"; \
-	  echo " * This file was auto-generated from $<"; \
-	  echo " *"; \
-	  echo " */"; \
-	  echo ""; \
-	  echo "#ifndef __ASM_OFFSETS_H__"; \
-	  echo "#define __ASM_OFFSETS_H__"; \
-	  echo ""; \
-	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
-	  echo ""; \
-	  echo "#endif") <$< >$@
-
 SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
     ( find include -type f -name '*.h' -print; \
diff --git a/xen/Rules.mk b/xen/Rules.mk
index d21930a7bf..7b8b9047cf 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -8,9 +8,6 @@
 include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
-
-TARGET := $(BASEDIR)/xen
-
 # Note that link order matters!
 ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
@@ -36,7 +33,8 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \
                                             rodata.cst$(a)) \
                          $(foreach r,rel rel.ro,data.$(r).local)
 
-include Makefile
+# The filename build.mk has precedence over Makefile
+include $(firstword $(wildcard build.mk) Makefile)
 
 # Linking
 # ---------------------------------------------------------------------------
diff --git a/xen/build.mk b/xen/build.mk
new file mode 100644
index 0000000000..3d7a91df22
--- /dev/null
+++ b/xen/build.mk
@@ -0,0 +1,61 @@
+quiet_cmd_banner = BANNER  $@
+define cmd_banner
+    if which figlet >/dev/null 2>&1 ; then \
+	echo " Xen $(XEN_FULLVERSION)" | figlet -f $< > $@.tmp; \
+    else \
+	echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
+    fi; \
+    mv -f $@.tmp $@
+endef
+
+.banner: tools/xen.flf FORCE
+	$(call if_changed,banner)
+
+targets += .banner
+
+# Don't refresh this files during e.g., 'sudo make install'
+quiet_cmd_compile.h = UPD     $@
+define cmd_compile.h
+    if [ ! -r $@ -o -O $@ ]; then \
+	cat .banner; \
+	sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
+	    -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
+	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
+	    -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
+	    -e 's/@@hostname@@/$(XEN_BUILD_HOST)/g' \
+	    -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) --version 2>&1 | head -1)!g' \
+	    -e 's/@@version@@/$(XEN_VERSION)/g' \
+	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
+	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
+	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
+	    < $< > $(dot-target).tmp; \
+	sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \
+	mv -f $(dot-target).tmp $@; \
+    fi
+endef
+
+include/xen/compile.h: include/xen/compile.h.in .banner FORCE
+	$(if $(filter-out FORCE,$?),$(Q)rm -fv $@)
+	$(call if_changed,compile.h)
+
+targets += include/xen/compile.h
+
+asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
+	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
+	$(call move-if-changed,$@.new,$@)
+
+arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
+	@(set -e; \
+	  echo "/*"; \
+	  echo " * DO NOT MODIFY."; \
+	  echo " *"; \
+	  echo " * This file was auto-generated from $<"; \
+	  echo " *"; \
+	  echo " */"; \
+	  echo ""; \
+	  echo "#ifndef __ASM_OFFSETS_H__"; \
+	  echo "#define __ASM_OFFSETS_H__"; \
+	  echo ""; \
+	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
+	  echo ""; \
+	  echo "#endif") <$< >$@
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 29 08:22:22 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 29 Jan 2022 08:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262225.454408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDj02-0002vB-SX; Sat, 29 Jan 2022 08:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262225.454408; Sat, 29 Jan 2022 08:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDj02-0002v3-Pg; Sat, 29 Jan 2022 08:22:22 +0000
Received: by outflank-mailman (input) for mailman id 262225;
 Sat, 29 Jan 2022 08:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDj02-0002ut-AI
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDj02-0004iZ-9N
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDj02-00017b-8V
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QNePYYo8Y5cuTUIOENhBVheMrKjoC68+gF8iy9N2TGE=; b=c3wmHfsg543oni2U1vFQsZjIGf
	M613N2UEJ/W1MQT5nFGtr1RFd1YQEUptHB7FQt1c9CRnxvrmkCYQ424Kv2GcraLxWB4cZthpz6ZJh
	50ZPlvB5PUyhlEBGd++FISwxOuHmfR23guDdmLQ3obNPmXRqxUC1CGydLn2e4VmHDP5M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: fix exported variable name CFLAGS_stack_boundary
Message-Id: <E1nDj02-00017b-8V@xenbits.xenproject.org>
Date: Sat, 29 Jan 2022 08:22:22 +0000

commit aa390d513a67a6ec0a069eea7478e5ecd54a7ea6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jan 28 11:44:33 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 28 11:44:33 2022 +0100

    build: fix exported variable name CFLAGS_stack_boundary
    
    Exporting a variable with a dash doesn't work reliably, they may be
    striped from the environment when calling a sub-make or sub-shell.
    
    CFLAGS-stack-boundary start to be removed from env in patch "build:
    set ALL_OBJS in main Makefile; move prelink.o to main Makefile" when
    running `make "ALL_OBJS=.."` due to the addition of the quote. At
    least in my empirical tests.
    
    Fixes: 2740d96efd ("xen/build: have the root Makefile generates the CFLAGS")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Rules.mk     | 4 ++--
 xen/arch/x86/arch.mk      | 4 ++--
 xen/arch/x86/efi/Makefile | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 56fe22c979..7aef93f5f3 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -6,5 +6,5 @@ object_label_flags = '-D__OBJECT_LABEL__=$(subst $(BASEDIR)/,,$(CURDIR))/$@'
 else
 object_label_flags = '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
 endif
-c_flags += $(object_label_flags) $(CFLAGS-stack-boundary)
-a_flags += $(object_label_flags) $(CFLAGS-stack-boundary)
+c_flags += $(object_label_flags) $(CFLAGS_stack_boundary)
+a_flags += $(object_label_flags) $(CFLAGS_stack_boundary)
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index a93fa6d2e4..fa7cf38443 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -49,8 +49,8 @@ CFLAGS-$(CONFIG_INDIRECT_THUNK) += -fno-jump-tables
 
 # If supported by the compiler, reduce stack alignment to 8 bytes. But allow
 # this to be overridden elsewhere.
-$(call cc-option-add,CFLAGS-stack-boundary,CC,-mpreferred-stack-boundary=3)
-export CFLAGS-stack-boundary
+$(call cc-option-add,CFLAGS_stack_boundary,CC,-mpreferred-stack-boundary=3)
+export CFLAGS_stack_boundary
 
 ifeq ($(CONFIG_UBSAN),y)
 # Don't enable alignment sanitisation.  x86 has efficient unaligned accesses,
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 87b927ed86..abae493bf3 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -12,7 +12,7 @@ EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
-$(EFIOBJ-y): CFLAGS-stack-boundary := $(cflags-stack-boundary)
+$(EFIOBJ-y): CFLAGS_stack_boundary := $(cflags-stack-boundary)
 
 obj-y := stub.o
 obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jan 29 08:22:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 29 Jan 2022 08:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262226.454413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDj0C-0002yD-VB; Sat, 29 Jan 2022 08:22:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262226.454413; Sat, 29 Jan 2022 08:22:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nDj0C-0002y4-RF; Sat, 29 Jan 2022 08:22:32 +0000
Received: by outflank-mailman (input) for mailman id 262226;
 Sat, 29 Jan 2022 08: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 1nDj0C-0002xt-Eg
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08: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 1nDj0C-0004il-CY
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nDj0C-00018X-Ba
 for xen-changelog@lists.xenproject.org; Sat, 29 Jan 2022 08:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jDxYl60fqsVpwdrnoC0rii70cX5+XTR8O3NWAmASjbQ=; b=Hiyb0TVzTDvPOc4xdB00Ype7B8
	PMCjeuKwDbT4n96skC/JlHozKR6QswHBOWO/odRcgwwQrFxvcTI3eIjQjEWRXX0y6xl5HCiK3I7Ti
	ngtM5O+rO3VK7sGlsOt3mcJMwULb799M7LBbmXrn+aUhbkXMkEKh4pake7NMJ65XN3Cc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] public: add XEN_RING_NR_UNCONSUMED_*() macros to ring.h
Message-Id: <E1nDj0C-00018X-Ba@xenbits.xenproject.org>
Date: Sat, 29 Jan 2022 08:22:32 +0000

commit 21170a738c11b24815b4afab2151bd3aa2a29acc
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 28 11:47:00 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 28 11:47:00 2022 +0100

    public: add XEN_RING_NR_UNCONSUMED_*() macros to ring.h
    
    Today RING_HAS_UNCONSUMED_*() macros are returning the number of
    unconsumed requests or responses instead of a boolean as the name of
    the macros would imply.
    
    As this "feature" is already being used, rename the macros to
    XEN_RING_NR_UNCONSUMED_*() and define the RING_HAS_UNCONSUMED_*() macros
    by using the new XEN_RING_NR_UNCONSUMED_*() macros. In order to avoid
    future misuse let RING_HAS_UNCONSUMED_*() optionally really return a
    boolean (can be activated by defining XEN_RING_HAS_UNCONSUMED_IS_BOOL).
    
    Note that the known misuses need to be switched to the new
    XEN_RING_NR_UNCONSUMED_*() macros when using the RING_HAS_UNCONSUMED_*()
    variants returning a boolean value.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/io/ring.h | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h
index c486c457e0..277af36e61 100644
--- a/xen/include/public/io/ring.h
+++ b/xen/include/public/io/ring.h
@@ -208,11 +208,11 @@ typedef struct __name##_back_ring __name##_back_ring_t
     (RING_FREE_REQUESTS(_r) == 0)
 
 /* Test if there are outstanding messages to be processed on a ring. */
-#define RING_HAS_UNCONSUMED_RESPONSES(_r)                               \
+#define XEN_RING_NR_UNCONSUMED_RESPONSES(_r)                            \
     ((_r)->sring->rsp_prod - (_r)->rsp_cons)
 
 #ifdef __GNUC__
-#define RING_HAS_UNCONSUMED_REQUESTS(_r) ({                             \
+#define XEN_RING_NR_UNCONSUMED_REQUESTS(_r) ({                          \
     unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;          \
     unsigned int rsp = RING_SIZE(_r) -                                  \
         ((_r)->req_cons - (_r)->rsp_prod_pvt);                          \
@@ -220,13 +220,27 @@ typedef struct __name##_back_ring __name##_back_ring_t
 })
 #else
 /* Same as above, but without the nice GCC ({ ... }) syntax. */
-#define RING_HAS_UNCONSUMED_REQUESTS(_r)                                \
+#define XEN_RING_NR_UNCONSUMED_REQUESTS(_r)                             \
     ((((_r)->sring->req_prod - (_r)->req_cons) <                        \
       (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) ?        \
      ((_r)->sring->req_prod - (_r)->req_cons) :                         \
      (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt)))
 #endif
 
+#ifdef XEN_RING_HAS_UNCONSUMED_IS_BOOL
+/*
+ * These variants should only be used in case no caller is abusing them for
+ * obtaining the number of unconsumed responses/requests.
+ */
+#define RING_HAS_UNCONSUMED_RESPONSES(_r) \
+    (!!XEN_RING_NR_UNCONSUMED_RESPONSES(_r))
+#define RING_HAS_UNCONSUMED_REQUESTS(_r)  \
+    (!!XEN_RING_NR_UNCONSUMED_REQUESTS(_r))
+#else
+#define RING_HAS_UNCONSUMED_RESPONSES(_r) XEN_RING_NR_UNCONSUMED_RESPONSES(_r)
+#define RING_HAS_UNCONSUMED_REQUESTS(_r)  XEN_RING_NR_UNCONSUMED_REQUESTS(_r)
+#endif
+
 /* Direct access to individual ring elements, by index. */
 #define RING_GET_REQUEST(_r, _idx)                                      \
     (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 09:44:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 09:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262864.455274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETED-0005U6-Jo; Mon, 31 Jan 2022 09:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262864.455274; Mon, 31 Jan 2022 09:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETED-0005Tx-Gi; Mon, 31 Jan 2022 09:44:05 +0000
Received: by outflank-mailman (input) for mailman id 262864;
 Mon, 31 Jan 2022 09:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETEC-0005Tr-Ki
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 09:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETEC-00072j-Jt
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 09:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETEC-0002vm-Iq
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 09:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t2U/7yOusM2IUmP1HuotMWhpG++Eu4wzRV57TA1g2ME=; b=JZKsaHxqdfKq+8PKiUYfJyyX+Q
	KpzRHMUJeu34vHHvgQxsQZHxURSbv22sXtjqFOvj8R/6tgZ74vz20XgQKCi7OUY2yTcpKqdnLYl0G
	qbLW665Z/xIPp/8si4/DOpzwgB/H65FEQwB/s0XTPD/PNclJH7jg3aiLwSOTR44Ijw2s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] update Xen version to 4.15.2
Message-Id: <E1nETEC-0002vm-Iq@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 09:44:04 +0000

commit 32dcef072fb37d432fd45c7916383472f3fcbc5e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 31 10:42:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 31 10:42:09 2022 +0100

    update Xen version to 4.15.2
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 84817f47a1..f467b43beb 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,15 +245,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= a3741780fe3535e19e02efa869a7cac481891129
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.15.1
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.15.1
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.15.2
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.15.2
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.15.1
+QEMU_TRADITIONAL_REVISION ?= xen-4.15.2
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index 251fed79f0..e446b232df 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 15
-export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 09:55:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 09:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262878.455300 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETOr-0007dE-1V; Mon, 31 Jan 2022 09:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262878.455300; Mon, 31 Jan 2022 09:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETOq-0007d6-Uj; Mon, 31 Jan 2022 09:55:04 +0000
Received: by outflank-mailman (input) for mailman id 262878;
 Mon, 31 Jan 2022 09:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETOq-0007cy-Al
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 09:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETOq-0007GG-90
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 09:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETOq-0003g9-7Q
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 09:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j2j2grX7h9pylRnljzcDVMxkOq74MdFHtGAM0srNxfo=; b=sECL7AzA8/3TpuElJaBVGZ4Lz8
	zwvMQlHdvRnYQc8/Gzw108EeraO5CNbibbyBcFRJGGIgtkX7qfpUtLsm46UUEjwUuT5FshZETRk3U
	J83ceV8XRZkmY03Fd9uYK381u6T0tDjfCrfHNfV7ZLPrh5K28CEFUusd52cf+g8rdwJc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] update Xen version to 4.14.4
Message-Id: <E1nETOq-0003g9-7Q@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 09:55:04 +0000

commit b636efa6cc88a27366a4e75eea68f0a8019c0906
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 31 10:44:39 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 31 10:44:39 2022 +0100

    update Xen version to 4.14.4
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 0dab3b75d9..1356e6e151 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,15 +245,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 20d2e5a125e34fc8501026613a71549b2a1a3e54
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.3
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.3
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.4
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.4
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.14.3
+QEMU_TRADITIONAL_REVISION ?= xen-4.14.4
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index e20d61b5e4..6995bf01d9 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 14
-export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 10:00:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 10:00:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262887.455315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETTh-0000aH-Q5; Mon, 31 Jan 2022 10:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262887.455315; Mon, 31 Jan 2022 10:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETTh-0000Zn-Mp; Mon, 31 Jan 2022 10:00:05 +0000
Received: by outflank-mailman (input) for mailman id 262887;
 Mon, 31 Jan 2022 10:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETTg-0000TU-T0
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETTg-0007S1-SE
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETTg-00049g-Qs
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=voVFpQLmT0zGOkwxxeMIvYuxkPxNmndejaoyUipZsKU=; b=z1orpR/ZW97VNkX8DnpcQPQBm8
	YtZqHCJYrGRm8k9KKkXY+btlimXaFwDDEOENCRM3u55vxbHLQtrNk8i7Dt+1QYLtTmgq1xwJ383/O
	sVO0ds4IJROnGZv0ypZqRsmACn+PvuojrTHAM6019fEcEMVlphdn0TytIotNmxgNoSOY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: sync VM-exit perf counters with known VM-exit reasons
Message-Id: <E1nETTg-00049g-Qs@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 10:00:04 +0000

commit c5539e6e7b9e9f8e12d4e05b5f6db97ca94539e7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 31 10:56:28 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 31 10:56:28 2022 +0100

    VMX: sync VM-exit perf counters with known VM-exit reasons
    
    This has gone out of sync over time. Introduce a simplistic mechanism to
    hopefully keep things in sync going forward.
    
    Also limit the array index to just the "basic exit reason" part, which is
    what the pseudo-enumeration covers.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c             | 2 +-
 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 1 +
 xen/arch/x86/include/asm/perfc_defn.h  | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 9765cfd90a..36c8a12cfe 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3928,7 +3928,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
     else
         HVMTRACE_ND(VMEXIT, 0, 1/*cycles*/, exit_reason, regs->eip);
 
-    perfc_incra(vmexits, exit_reason);
+    perfc_incra(vmexits, (uint16_t)exit_reason);
 
     /* Handle the interrupt we missed before allowing any more in. */
     switch ( (uint16_t)exit_reason )
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 85530d2e0e..97e7652aa1 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -219,6 +219,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
+/* Remember to also update VMX_PERF_EXIT_REASON_SIZE! */
 
 /*
  * Interruption-information format
diff --git a/xen/arch/x86/include/asm/perfc_defn.h b/xen/arch/x86/include/asm/perfc_defn.h
index a98df515d9..896c5397f5 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 56
+#define VMX_PERF_EXIT_REASON_SIZE 65
 #define VMX_PERF_VECTOR_SIZE 0x20
 PERFCOUNTER_ARRAY(vmexits,              "vmexits", VMX_PERF_EXIT_REASON_SIZE)
 PERFCOUNTER_ARRAY(cause_vector,         "cause vector", VMX_PERF_VECTOR_SIZE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 10:00:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 10:00:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262888.455319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETTr-0000rQ-SF; Mon, 31 Jan 2022 10:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262888.455319; Mon, 31 Jan 2022 10:00:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETTr-0000rB-OS; Mon, 31 Jan 2022 10:00:15 +0000
Received: by outflank-mailman (input) for mailman id 262888;
 Mon, 31 Jan 2022 10:00: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 1nETTr-0000qz-0Y
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00: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 1nETTq-0007SC-Vj
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETTq-0004B5-UZ
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qzCe1ypdX5yd9/wIvO4uLnoio1KqSlHUgljgnzV+7tU=; b=ZWm/8hOFyvRXsGlRMdC8laCBr0
	cz0XJ5eeMoTNhjPW68f3q/d6BToiNOCuKVKnWDNQFynkYOPWUdtJkgNLswEzb3VbaH/2G7JiRnZE1
	iYZ5v4HjPNB828rEqeI7ngaQHXbaLTMJ7FU1aTEnbKbkHnrMM31moHTeqDgwxETwbPLI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] IOMMU/x86: switch to alternatives-call patching in further instances
Message-Id: <E1nETTq-0004B5-UZ@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 10:00:14 +0000

commit f66e3d6afcc1315a34475fbee5f46e7110397950
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 31 10:57:27 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 31 10:57:27 2022 +0100

    IOMMU/x86: switch to alternatives-call patching in further instances
    
    This is, once again, to limit the number of indirect calls as much as
    possible. The only hook invocation which isn't sensible to convert is
    setup(). And of course Arm-only use sites are left alone as well.
    
    Note regarding the introduction / use of local variables in pci.c:
    struct pci_dev's involved fields are const. This const propagates, via
    typeof(), to the local helper variables in the altcall macros. These
    helper variables are, however, used as outputs (and hence can't be
    const). In iommu_get_device_group() make use of the new local variables
    to also simplify some adjacent code.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/iommu.c     |  8 +++----
 xen/drivers/passthrough/pci.c       | 47 ++++++++++++++++++++-----------------
 xen/drivers/passthrough/x86/iommu.c |  4 ++--
 3 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 6334370109..fc18f63bd4 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -198,7 +198,7 @@ int iommu_domain_init(struct domain *d, unsigned int opts)
         return ret;
 
     hd->platform_ops = iommu_get_ops();
-    ret = hd->platform_ops->init(d);
+    ret = iommu_call(hd->platform_ops, init, d);
     if ( ret || is_system_domain(d) )
         return ret;
 
@@ -233,7 +233,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
 
     register_keyhandler('o', &iommu_dump_page_tables, "dump iommu page tables", 0);
 
-    hd->platform_ops->hwdom_init(d);
+    iommu_vcall(hd->platform_ops, hwdom_init, d);
 }
 
 static void iommu_teardown(struct domain *d)
@@ -576,7 +576,7 @@ int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt)
     if ( !ops->get_reserved_device_memory )
         return 0;
 
-    return ops->get_reserved_device_memory(func, ctxt);
+    return iommu_call(ops, get_reserved_device_memory, func, ctxt);
 }
 
 bool_t iommu_has_feature(struct domain *d, enum iommu_feature feature)
@@ -603,7 +603,7 @@ static void iommu_dump_page_tables(unsigned char key)
             continue;
         }
 
-        dom_iommu(d)->platform_ops->dump_page_tables(d);
+        iommu_vcall(dom_iommu(d)->platform_ops, dump_page_tables, d);
     }
 
     rcu_read_unlock(&domlist_read_lock);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 0d8ab2e716..1fad80362f 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -861,15 +861,15 @@ static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus,
         devfn += pdev->phantom_stride;
         if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) )
             break;
-        ret = hd->platform_ops->reassign_device(d, target, devfn,
-                                                pci_to_dev(pdev));
+        ret = iommu_call(hd->platform_ops, reassign_device, d, target, devfn,
+                         pci_to_dev(pdev));
         if ( ret )
             goto out;
     }
 
     devfn = pdev->devfn;
-    ret = hd->platform_ops->reassign_device(d, target, devfn,
-                                            pci_to_dev(pdev));
+    ret = iommu_call(hd->platform_ops, reassign_device, d, target, devfn,
+                     pci_to_dev(pdev));
     if ( ret )
         goto out;
 
@@ -1300,7 +1300,7 @@ static int iommu_add_device(struct pci_dev *pdev)
 {
     const struct domain_iommu *hd;
     int rc;
-    u8 devfn;
+    unsigned int devfn = pdev->devfn;
 
     if ( !pdev->domain )
         return -EINVAL;
@@ -1311,16 +1311,16 @@ static int iommu_add_device(struct pci_dev *pdev)
     if ( !is_iommu_enabled(pdev->domain) )
         return 0;
 
-    rc = hd->platform_ops->add_device(pdev->devfn, pci_to_dev(pdev));
+    rc = iommu_call(hd->platform_ops, add_device, devfn, pci_to_dev(pdev));
     if ( rc || !pdev->phantom_stride )
         return rc;
 
-    for ( devfn = pdev->devfn ; ; )
+    for ( ; ; )
     {
         devfn += pdev->phantom_stride;
         if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) )
             return 0;
-        rc = hd->platform_ops->add_device(devfn, pci_to_dev(pdev));
+        rc = iommu_call(hd->platform_ops, add_device, devfn, pci_to_dev(pdev));
         if ( rc )
             printk(XENLOG_WARNING "IOMMU: add %pp failed (%d)\n",
                    &pdev->sbdf, rc);
@@ -1341,7 +1341,7 @@ static int iommu_enable_device(struct pci_dev *pdev)
          !hd->platform_ops->enable_device )
         return 0;
 
-    return hd->platform_ops->enable_device(pci_to_dev(pdev));
+    return iommu_call(hd->platform_ops, enable_device, pci_to_dev(pdev));
 }
 
 static int iommu_remove_device(struct pci_dev *pdev)
@@ -1363,7 +1363,8 @@ static int iommu_remove_device(struct pci_dev *pdev)
         devfn += pdev->phantom_stride;
         if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) )
             break;
-        rc = hd->platform_ops->remove_device(devfn, pci_to_dev(pdev));
+        rc = iommu_call(hd->platform_ops, remove_device, devfn,
+                        pci_to_dev(pdev));
         if ( !rc )
             continue;
 
@@ -1371,7 +1372,9 @@ static int iommu_remove_device(struct pci_dev *pdev)
         return rc;
     }
 
-    return hd->platform_ops->remove_device(pdev->devfn, pci_to_dev(pdev));
+    devfn = pdev->devfn;
+
+    return iommu_call(hd->platform_ops, remove_device, devfn, pci_to_dev(pdev));
 }
 
 static int device_assigned(u16 seg, u8 bus, u8 devfn)
@@ -1421,7 +1424,8 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
 
     pdev->fault.count = 0;
 
-    if ( (rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag)) )
+    if ( (rc = iommu_call(hd->platform_ops, assign_device, d, devfn,
+                          pci_to_dev(pdev), flag)) )
         goto done;
 
     for ( ; pdev->phantom_stride; rc = 0 )
@@ -1429,7 +1433,8 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
         devfn += pdev->phantom_stride;
         if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) )
             break;
-        rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag);
+        rc = iommu_call(hd->platform_ops, assign_device, d, devfn,
+                        pci_to_dev(pdev), flag);
     }
 
  done:
@@ -1457,24 +1462,24 @@ static int iommu_get_device_group(
     if ( !is_iommu_enabled(d) || !ops->get_device_group_id )
         return 0;
 
-    group_id = ops->get_device_group_id(seg, bus, devfn);
+    group_id = iommu_call(ops, get_device_group_id, seg, bus, devfn);
 
     pcidevs_lock();
     for_each_pdev( d, pdev )
     {
-        if ( (pdev->seg != seg) ||
-             ((pdev->bus == bus) && (pdev->devfn == devfn)) )
+        unsigned int b = pdev->bus;
+        unsigned int df = pdev->devfn;
+
+        if ( (pdev->seg != seg) || ((b == bus) && (df == devfn)) )
             continue;
 
-        if ( xsm_get_device_group(XSM_HOOK, (seg << 16) | (pdev->bus << 8) | pdev->devfn) )
+        if ( xsm_get_device_group(XSM_HOOK, (seg << 16) | (b << 8) | df) )
             continue;
 
-        sdev_id = ops->get_device_group_id(seg, pdev->bus, pdev->devfn);
+        sdev_id = iommu_call(ops, get_device_group_id, seg, b, df);
         if ( (sdev_id == group_id) && (i < max_sdevs) )
         {
-            bdf = 0;
-            bdf |= (pdev->bus & 0xff) << 16;
-            bdf |= (pdev->devfn & 0xff) << 8;
+            bdf = (b << 16) | (df << 8);
 
             if ( unlikely(copy_to_guest_offset(buf, i, &bdf, 1)) )
             {
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index f11280f4b2..583abed9bd 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -145,7 +145,7 @@ unsigned int iommu_read_apic_from_ire(unsigned int apic, unsigned int reg)
 int __init iommu_setup_hpet_msi(struct msi_desc *msi)
 {
     const struct iommu_ops *ops = iommu_get_ops();
-    return ops->setup_hpet_msi ? ops->setup_hpet_msi(msi) : -ENODEV;
+    return ops->setup_hpet_msi ? iommu_call(ops, setup_hpet_msi, msi) : -ENODEV;
 }
 
 void __hwdom_init arch_iommu_check_autotranslated_hwdom(struct domain *d)
@@ -406,7 +406,7 @@ int iommu_free_pgtables(struct domain *d)
      * Pages will be moved to the free list below. So we want to
      * clear the root page-table to avoid any potential use after-free.
      */
-    hd->platform_ops->clear_root_pgtable(d);
+    iommu_vcall(hd->platform_ops, clear_root_pgtable, d);
 
     while ( (pg = page_list_remove_head(&hd->arch.pgtables.list)) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 10:00:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 10:00:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262889.455323 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETU1-0000ua-Sq; Mon, 31 Jan 2022 10:00:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262889.455323; Mon, 31 Jan 2022 10:00:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETU1-0000uT-Pv; Mon, 31 Jan 2022 10:00:25 +0000
Received: by outflank-mailman (input) for mailman id 262889;
 Mon, 31 Jan 2022 10:00: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 1nETU1-0000uC-56
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00: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 1nETU1-0007SM-4N
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETU1-0004Br-26
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00: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=MYnwRggwYJZlHuAL4A93aMzdWtvcewVi9c6Ji7EOjzU=; b=DWfxgk406c96teQZA4qmc1F9Rw
	TyHp0q3XUFSwngS1vanX8NcZi4VL8ov/AU2Tun6l2SAS19ddX7JGCPpV4C1kaCwdWSiIx6cV41fA9
	DIwAialTkr0EZvHbrVPE+JAiTMqk4sWFKV+OqP1FcvcMwyHxluNmBlE16nw8cfYHuydw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/light: don't touch nr_vcpus_out if listing vcpus and returning NULL
Message-Id: <E1nETU1-0004Br-26@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 10:00:25 +0000

commit d9d3496e817ace919092d70d4730257b37c2e743
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Mon Jan 31 10:58:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 31 10:58:07 2022 +0100

    tools/libs/light: don't touch nr_vcpus_out if listing vcpus and returning NULL
    
    If we are in libxl_list_vcpu() and we are returning NULL, let's avoid
    touching the output parameter *nr_vcpus_out, which the caller should
    have initialized to 0.
    
    The current behavior could be problematic if are creating a domain and,
    in the meantime, an existing one is destroyed when we have already done
    some steps of the loop. At which point, we'd return a NULL list of vcpus
    but with something different than 0 as the number of vcpus in that list.
    And this can cause troubles in the callers (e.g., nr_vcpus_on_nodes()),
    when they do a libxl_vcpuinfo_list_free().
    
    Crashes due to this are rare and difficult to reproduce, but have been
    observed, with stack traces looking like this one:
    
    #0  libxl_bitmap_dispose (map=map@entry=0x50) at libxl_utils.c:626
    #1  0x00007fe72c993a32 in libxl_vcpuinfo_dispose (p=p@entry=0x38) at _libxl_types.c:692
    #2  0x00007fe72c94e3c4 in libxl_vcpuinfo_list_free (list=0x0, nr=<optimized out>) at libxl_utils.c:1059
    #3  0x00007fe72c9528bf in nr_vcpus_on_nodes (vcpus_on_node=0x7fe71000eb60, suitable_cpumap=0x7fe721df0d38, tinfo_elements=48, tinfo=0x7fe7101b3900, gc=0x7fe7101bbfa0) at libxl_numa.c:258
    #4  libxl__get_numa_candidate (gc=gc@entry=0x7fe7100033a0, min_free_memkb=4233216, min_cpus=4, min_nodes=min_nodes@entry=0, max_nodes=max_nodes@entry=0, suitable_cpumap=suitable_cpumap@entry=0x7fe721df0d38, numa_cmpf=0x7fe72c940110 <numa_cmpf>, cndt_out=0x7fe721df0cf0, cndt_found=0x7fe721df0cb4) at libxl_numa.c:394
    #5  0x00007fe72c94152b in numa_place_domain (d_config=0x7fe721df11b0, domid=975, gc=0x7fe7100033a0) at libxl_dom.c:209
    #6  libxl__build_pre (gc=gc@entry=0x7fe7100033a0, domid=domid@entry=975, d_config=d_config@entry=0x7fe721df11b0, state=state@entry=0x7fe710077700) at libxl_dom.c:436
    #7  0x00007fe72c92c4a5 in libxl__domain_build (gc=0x7fe7100033a0, d_config=d_config@entry=0x7fe721df11b0, domid=975, state=0x7fe710077700) at libxl_create.c:444
    #8  0x00007fe72c92de8b in domcreate_bootloader_done (egc=0x7fe721df0f60, bl=0x7fe7100778c0, rc=<optimized out>) at libxl_create.c:1222
    #9  0x00007fe72c980425 in libxl__bootloader_run (egc=egc@entry=0x7fe721df0f60, bl=bl@entry=0x7fe7100778c0) at libxl_bootloader.c:403
    #10 0x00007fe72c92f281 in initiate_domain_create (egc=egc@entry=0x7fe721df0f60, dcs=dcs@entry=0x7fe7100771b0) at libxl_create.c:1159
    #11 0x00007fe72c92f456 in do_domain_create (ctx=ctx@entry=0x7fe71001c840, d_config=d_config@entry=0x7fe721df11b0, domid=domid@entry=0x7fe721df10a8, restore_fd=restore_fd@entry=-1, send_back_fd=send_back_fd@entry=-1, params=params@entry=0x0, ao_how=0x0, aop_console_how=0x7fe721df10f0) at libxl_create.c:1856
    #12 0x00007fe72c92f776 in libxl_domain_create_new (ctx=0x7fe71001c840, d_config=d_config@entry=0x7fe721df11b0, domid=domid@entry=0x7fe721df10a8, ao_how=ao_how@entry=0x0, aop_console_how=aop_console_how@entry=0x7fe721df10f0) at libxl_create.c:2075
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Tested-by: James Fehlig <jfehlig@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_domain.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
index 544a9bf59d..d438232117 100644
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -1661,6 +1661,7 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
     libxl_vcpuinfo *ptr, *ret;
     xc_domaininfo_t domaininfo;
     xc_vcpuinfo_t vcpuinfo;
+    unsigned int nr_vcpus;
 
     if (xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo) != 1) {
         LOGED(ERROR, domid, "Getting infolist");
@@ -1677,33 +1678,34 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
     ret = ptr = libxl__calloc(NOGC, domaininfo.max_vcpu_id + 1,
                               sizeof(libxl_vcpuinfo));
 
-    for (*nr_vcpus_out = 0;
-         *nr_vcpus_out <= domaininfo.max_vcpu_id;
-         ++*nr_vcpus_out, ++ptr) {
+    for (nr_vcpus = 0;
+         nr_vcpus <= domaininfo.max_vcpu_id;
+         ++nr_vcpus, ++ptr) {
         libxl_bitmap_init(&ptr->cpumap);
         if (libxl_cpu_bitmap_alloc(ctx, &ptr->cpumap, 0))
             goto err;
         libxl_bitmap_init(&ptr->cpumap_soft);
         if (libxl_cpu_bitmap_alloc(ctx, &ptr->cpumap_soft, 0))
             goto err;
-        if (xc_vcpu_getinfo(ctx->xch, domid, *nr_vcpus_out, &vcpuinfo) == -1) {
+        if (xc_vcpu_getinfo(ctx->xch, domid, nr_vcpus, &vcpuinfo) == -1) {
             LOGED(ERROR, domid, "Getting vcpu info");
             goto err;
         }
 
-        if (xc_vcpu_getaffinity(ctx->xch, domid, *nr_vcpus_out,
+        if (xc_vcpu_getaffinity(ctx->xch, domid, nr_vcpus,
                                 ptr->cpumap.map, ptr->cpumap_soft.map,
                                 XEN_VCPUAFFINITY_SOFT|XEN_VCPUAFFINITY_HARD) == -1) {
             LOGED(ERROR, domid, "Getting vcpu affinity");
             goto err;
         }
-        ptr->vcpuid = *nr_vcpus_out;
+        ptr->vcpuid = nr_vcpus;
         ptr->cpu = vcpuinfo.cpu;
         ptr->online = !!vcpuinfo.online;
         ptr->blocked = !!vcpuinfo.blocked;
         ptr->running = !!vcpuinfo.running;
         ptr->vcpu_time = vcpuinfo.cpu_time;
     }
+    *nr_vcpus_out = nr_vcpus;
     GC_FREE;
     return ret;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 10:00:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 10:00:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.262890.455327 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nETUD-0000yH-15; Mon, 31 Jan 2022 10:00:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 262890.455327; Mon, 31 Jan 2022 10:00: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 1nETUC-0000y4-TF; Mon, 31 Jan 2022 10:00:36 +0000
Received: by outflank-mailman (input) for mailman id 262890;
 Mon, 31 Jan 2022 10:00: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 1nETUB-0000xp-8Q
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00: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 1nETUB-0007SY-7h
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nETUB-0004Cv-6f
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 10:00: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=IQhGvlWLC3iuMNs7rRjP/rB7UwFdva+4zJuoLuINlhc=; b=dlotn62RZcrwyw7htQOe6ZMVCd
	0J2pYxc4/SJlzeCaLdAAcbeB9Suu1FeqyRr9d60dnQ3nOmTQxCL6IgcQYSnB7S5JY+mKf8elcMlG/
	CNz/ZmqSHMxwtMaZlOMW/VoLbAenv32i1MxoKXxBJ0YiBiSL18ZegoOQjxJJBwgzoutA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] gitignore: remove stale entries
Message-Id: <E1nETUB-0004Cv-6f@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 10:00:35 +0000

commit c78901ab09bd0c469649f4ecbd325a6edb953592
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Jan 31 10:58:24 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 31 10:58:24 2022 +0100

    gitignore: remove stale entries
    
    The entries referring to tools/security have become stale more than
    10 years ago. Remove them.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 .gitignore | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 3f9d55ba87..1f53b0320e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -252,9 +252,6 @@ tools/qemu-xen-build
 tools/xentrace/xenalyze
 tools/pygrub/build/*
 tools/python/build/*
-tools/security/secpol_tool
-tools/security/xen/*
-tools/security/xensec_tool
 tools/tests/depriv/depriv-fd-checker
 tools/tests/x86_emulator/*.bin
 tools/tests/x86_emulator/*.tmp
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 16:55:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 16:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.263228.455871 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nEZxH-0000YP-I1; Mon, 31 Jan 2022 16:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 263228.455871; Mon, 31 Jan 2022 16: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 1nEZxH-0000YH-El; Mon, 31 Jan 2022 16:55:03 +0000
Received: by outflank-mailman (input) for mailman id 263228;
 Mon, 31 Jan 2022 16:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEZxG-0000Y9-2f
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 16:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEZxF-0007JN-SE
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 16:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEZxF-0006Cx-Ps
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 16:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XlXAaKWFxHghe9RV0HVBJvlTq5wvMfGVRbTFTyZVeO0=; b=pU/9fqYnsua2iMz90IHlckrVRm
	6d5kOHP17kPlFvB8t0IKrovRCo6mukfqXe1NxXxdFQGHARXKDgrkggSsx0Zs+sbBq0109wUSNtr0U
	ae6jjjvT2koa7iG5IKa8JcnqPOnixjK1zswHi/BZR+WdGv1xeHeHsSxaehd77bq/FWX8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] update Xen version to 4.14.4
Message-Id: <E1nEZxF-0006Cx-Ps@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 16:55:01 +0000

commit b636efa6cc88a27366a4e75eea68f0a8019c0906
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 31 10:44:39 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 31 10:44:39 2022 +0100

    update Xen version to 4.14.4
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 0dab3b75d9..1356e6e151 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,15 +245,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 20d2e5a125e34fc8501026613a71549b2a1a3e54
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.3
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.3
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.4
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.4
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.14.3
+QEMU_TRADITIONAL_REVISION ?= xen-4.14.4
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index e20d61b5e4..6995bf01d9 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 14
-export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 18:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 18:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.263268.455929 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nEben-000527-UB; Mon, 31 Jan 2022 18:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 263268.455929; Mon, 31 Jan 2022 18:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nEben-00051z-RO; Mon, 31 Jan 2022 18:44:05 +0000
Received: by outflank-mailman (input) for mailman id 263268;
 Mon, 31 Jan 2022 18:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEbem-00051t-Ko
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 18:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEbem-0000ww-Hw
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 18:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEbem-00083K-Gk
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 18:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ARA630+4Dpod8yYB/94lPpvWRfWSU3VVov2Eb/ACs5g=; b=RPxUNp7161L23Fn4vxnkmJ/B71
	uSq94ukUbdi8BfsY0Dk542WZwjia8ACjjnoD8amnTrdqR7fas4wXnDTXN1fww/b9o/AqXjBeGPxaf
	4y/MYt29LFYEuiDDugZ6HSK5BoaEeTjwaZLkMNEJ3XZk2/uBckYDf86TGjSj2YoEBvmQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/ipmmu-vmsa: Use refcount for the micro-TLBs
Message-Id: <E1nEbem-00083K-Gk@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 18:44:04 +0000

commit c52af96fdcac9eff31465f39c0ffcceadca9ac9f
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Thu Jan 27 21:55:51 2022 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Jan 31 18:33:20 2022 +0000

    iommu/ipmmu-vmsa: Use refcount for the micro-TLBs
    
    Reference-count the micro-TLBs as several bus masters can be
    connected to the same micro-TLB (and drop TODO comment).
    This wasn't an issue so far, since the platform devices
    (this driver deals with) get assigned/deassigned together during
    domain creation/destruction. But, in order to support PCI devices
    (which are hot-pluggable) in the near future we will need to
    take care of.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index 649b9f6362..c912120411 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -127,6 +127,7 @@ struct ipmmu_vmsa_device {
     spinlock_t lock;    /* Protects ctx and domains[] */
     DECLARE_BITMAP(ctx, IPMMU_CTX_MAX);
     struct ipmmu_vmsa_domain *domains[IPMMU_CTX_MAX];
+    unsigned int utlb_refcount[IPMMU_UTLB_MAX];
     const struct ipmmu_features *features;
 };
 
@@ -468,12 +469,17 @@ static int ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain,
     }
 
     /*
-     * TODO: Reference-count the micro-TLB as several bus masters can be
-     * connected to the same micro-TLB.
+     * Reference-count the micro-TLBs as several bus masters can be connected
+     * to the same micro-TLB. The platform devices get assigned/deassigned
+     * together during domain creation/destruction. The PCI devices which use
+     * the same micro-TLB must also be hot-(un)plugged together.
      */
-    ipmmu_imuasid_write(mmu, utlb, 0);
-    ipmmu_imuctr_write(mmu, utlb, imuctr |
-                       IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_MMUEN);
+    if ( mmu->utlb_refcount[utlb]++ == 0 )
+    {
+        ipmmu_imuasid_write(mmu, utlb, 0);
+        ipmmu_imuctr_write(mmu, utlb, imuctr |
+                           IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_MMUEN);
+    }
 
     return 0;
 }
@@ -484,7 +490,10 @@ static void ipmmu_utlb_disable(struct ipmmu_vmsa_domain *domain,
 {
     struct ipmmu_vmsa_device *mmu = domain->mmu;
 
-    ipmmu_imuctr_write(mmu, utlb, 0);
+    ASSERT(mmu->utlb_refcount[utlb] > 0);
+
+    if ( --mmu->utlb_refcount[utlb] == 0 )
+        ipmmu_imuctr_write(mmu, utlb, 0);
 }
 
 /* Domain/Context Management */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 18:44:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 18:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.263269.455933 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nEbex-000548-W0; Mon, 31 Jan 2022 18:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 263269.455933; Mon, 31 Jan 2022 18:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nEbex-00053z-Sr; Mon, 31 Jan 2022 18:44:15 +0000
Received: by outflank-mailman (input) for mailman id 263269;
 Mon, 31 Jan 2022 18:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEbew-00053m-MQ
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 18:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEbew-0000xV-LV
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 18:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEbew-00084e-Kf
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 18:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UpUnJjwqDrwTbAug8zPt6ziolR4oNlJ8TsD2V9c1zFU=; b=b+jqpyB4kkXBVdEcyoYqZ7s2qj
	gJUp1ycl6TlvAZG/rwqXMEieSqE7AL457NHRcHahBeDnUinul3RCBSrS1uDrDZtwrSol7Kc62ZdiT
	yZ4IYDJ7ikkb9m9npoNj0p7mw5eTC9eY9jOwFbtOHCzM0l792v8biqjAyLcJY8m0bcZw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/arm: Remove code duplication in all IOMMU drivers
Message-Id: <E1nEbew-00084e-Kf@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 18:44:14 +0000

commit 481ee6125aa1d5751f52eda677c7bab4719c0ad0
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Thu Jan 27 21:55:52 2022 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Jan 31 18:33:31 2022 +0000

    iommu/arm: Remove code duplication in all IOMMU drivers
    
    All IOMMU drivers on Arm perform almost the same generic actions in
    hwdom_init callback. Move this code to common arch_iommu_hwdom_init()
    in order to get rid of code duplication.
    
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/iommu.c      |  7 +++++++
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 15 +--------------
 xen/drivers/passthrough/arm/smmu-v3.c    | 17 +----------------
 xen/drivers/passthrough/arm/smmu.c       | 17 +----------------
 4 files changed, 10 insertions(+), 46 deletions(-)

diff --git a/xen/drivers/passthrough/arm/iommu.c b/xen/drivers/passthrough/arm/iommu.c
index ee653a9c48..fc453180f0 100644
--- a/xen/drivers/passthrough/arm/iommu.c
+++ b/xen/drivers/passthrough/arm/iommu.c
@@ -134,6 +134,13 @@ void arch_iommu_domain_destroy(struct domain *d)
 
 void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
 {
+    /* Set to false options not supported on ARM. */
+    if ( iommu_hwdom_inclusive )
+        printk(XENLOG_WARNING "map-inclusive dom0-iommu option is not supported on ARM\n");
+    iommu_hwdom_inclusive = false;
+    if ( iommu_hwdom_reserved == 1 )
+        printk(XENLOG_WARNING "map-reserved dom0-iommu option is not supported on ARM\n");
+    iommu_hwdom_reserved = 0;
 }
 
 /*
diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index c912120411..d2572bcd30 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -1329,19 +1329,6 @@ static int ipmmu_iommu_domain_init(struct domain *d)
     return 0;
 }
 
-static void __hwdom_init ipmmu_iommu_hwdom_init(struct domain *d)
-{
-    /* Set to false options not supported on ARM. */
-    if ( iommu_hwdom_inclusive )
-        printk(XENLOG_WARNING "ipmmu: map-inclusive dom0-iommu option is not supported on ARM\n");
-    iommu_hwdom_inclusive = false;
-    if ( iommu_hwdom_reserved == 1 )
-        printk(XENLOG_WARNING "ipmmu: map-reserved dom0-iommu option is not supported on ARM\n");
-    iommu_hwdom_reserved = 0;
-
-    arch_iommu_hwdom_init(d);
-}
-
 static void ipmmu_iommu_domain_teardown(struct domain *d)
 {
     struct ipmmu_vmsa_xen_domain *xen_domain = dom_iommu(d)->arch.priv;
@@ -1369,7 +1356,7 @@ static void ipmmu_iommu_domain_teardown(struct domain *d)
 static const struct iommu_ops ipmmu_iommu_ops =
 {
     .init            = ipmmu_iommu_domain_init,
-    .hwdom_init      = ipmmu_iommu_hwdom_init,
+    .hwdom_init      = arch_iommu_hwdom_init,
     .teardown        = ipmmu_iommu_domain_teardown,
     .iotlb_flush     = ipmmu_iotlb_flush,
     .iotlb_flush_all = ipmmu_iotlb_flush_all,
diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index d115df7320..71b022fe7f 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -3402,21 +3402,6 @@ static int arm_smmu_iommu_xen_domain_init(struct domain *d)
 
 }
 
-static void __hwdom_init arm_smmu_iommu_hwdom_init(struct domain *d)
-{
-	/* Set to false options not supported on ARM. */
-	if (iommu_hwdom_inclusive)
-		printk(XENLOG_WARNING
-		"map-inclusive dom0-iommu option is not supported on ARM\n");
-	iommu_hwdom_inclusive = false;
-	if (iommu_hwdom_reserved == 1)
-		printk(XENLOG_WARNING
-		"map-reserved dom0-iommu option is not supported on ARM\n");
-	iommu_hwdom_reserved = 0;
-
-	arch_iommu_hwdom_init(d);
-}
-
 static void arm_smmu_iommu_xen_domain_teardown(struct domain *d)
 {
 	struct arm_smmu_xen_domain *xen_domain = dom_iommu(d)->arch.priv;
@@ -3427,7 +3412,7 @@ static void arm_smmu_iommu_xen_domain_teardown(struct domain *d)
 
 static const struct iommu_ops arm_smmu_iommu_ops = {
 	.init		= arm_smmu_iommu_xen_domain_init,
-	.hwdom_init		= arm_smmu_iommu_hwdom_init,
+	.hwdom_init		= arch_iommu_hwdom_init,
 	.teardown		= arm_smmu_iommu_xen_domain_teardown,
 	.iotlb_flush		= arm_smmu_iotlb_flush,
 	.iotlb_flush_all	= arm_smmu_iotlb_flush_all,
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index c9dfc4caa0..b186c28dff 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -2849,21 +2849,6 @@ static int arm_smmu_iommu_domain_init(struct domain *d)
 	return 0;
 }
 
-static void __hwdom_init arm_smmu_iommu_hwdom_init(struct domain *d)
-{
-	/* Set to false options not supported on ARM. */
-	if ( iommu_hwdom_inclusive )
-		printk(XENLOG_WARNING
-		"map-inclusive dom0-iommu option is not supported on ARM\n");
-	iommu_hwdom_inclusive = false;
-	if ( iommu_hwdom_reserved == 1 )
-		printk(XENLOG_WARNING
-		"map-reserved dom0-iommu option is not supported on ARM\n");
-	iommu_hwdom_reserved = 0;
-
-	arch_iommu_hwdom_init(d);
-}
-
 static void arm_smmu_iommu_domain_teardown(struct domain *d)
 {
 	struct arm_smmu_xen_domain *xen_domain = dom_iommu(d)->arch.priv;
@@ -2874,7 +2859,7 @@ static void arm_smmu_iommu_domain_teardown(struct domain *d)
 
 static const struct iommu_ops arm_smmu_iommu_ops = {
     .init = arm_smmu_iommu_domain_init,
-    .hwdom_init = arm_smmu_iommu_hwdom_init,
+    .hwdom_init = arch_iommu_hwdom_init,
     .add_device = arm_smmu_dt_add_device_generic,
     .teardown = arm_smmu_iommu_domain_teardown,
     .iotlb_flush = arm_smmu_iotlb_flush,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jan 31 22:00:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Jan 2022 22:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.263325.456014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nEeiR-0001Jc-DB; Mon, 31 Jan 2022 22:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 263325.456014; Mon, 31 Jan 2022 22:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1nEeiR-0001JN-9v; Mon, 31 Jan 2022 22:00:03 +0000
Received: by outflank-mailman (input) for mailman id 263325;
 Mon, 31 Jan 2022 22:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEeiP-00019F-Tu
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 22:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEeiP-0004Yn-T4
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 22:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1nEeiP-00049E-Rk
 for xen-changelog@lists.xenproject.org; Mon, 31 Jan 2022 22:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NxQfmu58cYGZ1zeq0nXKgl2gkRBMyBaMhJiMss94el0=; b=ofWuFT80TECivW3BGlPtyDdg3b
	cHXL4pqOcC14TQTiQbSustOPkrQ/L9H/3DbwMg0D5tmxi71E14ew/PxPqdRSNnynx/wmbiARViYQl
	afE9NP50C+nlSlNvAhL8R1F/NOu4GzHS4F0SK1xx9gq1D+r08RiDiDyRPd6h8HSO2u1Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] update Xen version to 4.15.2
Message-Id: <E1nEeiP-00049E-Rk@xenbits.xenproject.org>
Date: Mon, 31 Jan 2022 22:00:01 +0000

commit 32dcef072fb37d432fd45c7916383472f3fcbc5e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jan 31 10:42:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 31 10:42:09 2022 +0100

    update Xen version to 4.15.2
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 84817f47a1..f467b43beb 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,15 +245,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= a3741780fe3535e19e02efa869a7cac481891129
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.15.1
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.15.1
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.15.2
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.15.2
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.15.1
+QEMU_TRADITIONAL_REVISION ?= xen-4.15.2
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index 251fed79f0..e446b232df 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 15
-export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


