From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:33:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17064.41858 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3B2-0002Sy-Ru; Sun, 01 Nov 2020 02:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17064.41858; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3B2-0002Sp-Od; Sun, 01 Nov 2020 02:33:04 +0000
Received: by outflank-mailman (input) for mailman id 17064;
 Sun, 01 Nov 2020 02:33:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3B1-0002Sj-KU
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:03 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f57fef62-0f82-4eea-90bc-b40ccd362771;
 Sun, 01 Nov 2020 02:33:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3B0-0005iu-D3
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3B0-0002uJ-Ah
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3B1-0002Sj-KU
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:03 +0000
X-Inumbo-ID: f57fef62-0f82-4eea-90bc-b40ccd362771
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id f57fef62-0f82-4eea-90bc-b40ccd362771;
	Sun, 01 Nov 2020 02:33:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HgheqJyhMJoRSDlKRutrXwsTrvSqIfttlmKr0BpD8W4=; b=YO34gs7dU5Q+dkP2X0yowsxuqt
	0JmpeJrPLzEwLdP2IjpEhbTqnO5KS4UhzASxihpdKN8KbRA85YAkRvkB44rc+dpo8PhfUnWH32fwz
	2JLSjEHIyeVhLztq81cUBQ+aCt4roxdeIJ/G7f1s3gUPvhdIjh3bTndUiArPVr07s7Xs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3B0-0005iu-D3
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3B0-0002uJ-Ah
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: don't open-code l<N>e_to_mfn()
Message-Id: <E1kZ3B0-0002uJ-Ah@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:33:02 +0000

commit 33d2badc3a1f64d1c425f0758d4948d38a011511
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 29 14:42:37 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 29 14:42:37 2020 +0100

    x86: don't open-code l<N>e_to_mfn()
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/mm/p2m-pt.c   | 8 ++++----
 xen/include/asm-x86/page.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 3af51be78e..c04a015e2c 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -779,9 +779,9 @@ pod_retry_l3:
         }
         if ( flags & _PAGE_PSE )
         {
-            mfn = _mfn(l3e_get_pfn(*l3e) +
-                       l2_table_offset(addr) * L1_PAGETABLE_ENTRIES +
-                       l1_table_offset(addr));
+            mfn = mfn_add(l3e_get_mfn(*l3e),
+                          l2_table_offset(addr) * L1_PAGETABLE_ENTRIES +
+                          l1_table_offset(addr));
             *t = p2m_recalc_type(recalc || _needs_recalc(flags),
                                  p2m_flags_to_type(flags), p2m, gfn);
             unmap_domain_page(l3e);
@@ -820,7 +820,7 @@ pod_retry_l2:
     }
     if ( flags & _PAGE_PSE )
     {
-        mfn = _mfn(l2e_get_pfn(*l2e) + l1_table_offset(addr));
+        mfn = mfn_add(l2e_get_mfn(*l2e), l1_table_offset(addr));
         *t = p2m_recalc_type(recalc || _needs_recalc(flags),
                              p2m_flags_to_type(flags), p2m, gfn);
         unmap_domain_page(l2e);
diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h
index f632affaef..7a771baf7c 100644
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -291,7 +291,7 @@ void copy_page_sse2(void *, const void *);
 #define pfn_to_paddr(pfn)   __pfn_to_paddr(pfn)
 #define paddr_to_pfn(pa)    __paddr_to_pfn(pa)
 #define paddr_to_pdx(pa)    pfn_to_pdx(paddr_to_pfn(pa))
-#define vmap_to_mfn(va)     _mfn(l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va))))
+#define vmap_to_mfn(va)     l1e_get_mfn(*virt_to_xen_l1e((unsigned long)(va)))
 #define vmap_to_page(va)    mfn_to_page(vmap_to_mfn(va))
 
 #endif /* !defined(__ASSEMBLY__) */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17065.41864 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3BC-0002Ts-VN; Sun, 01 Nov 2020 02:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17065.41864; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3BC-0002Td-Q6; Sun, 01 Nov 2020 02:33:14 +0000
Received: by outflank-mailman (input) for mailman id 17065;
 Sun, 01 Nov 2020 02:33:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3BB-0002TW-Nq
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:13 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fa339ee8-f0f2-488b-851f-003d4a7f3c92;
 Sun, 01 Nov 2020 02:33:13 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3BA-0005ix-Hw
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3BA-0002ux-Fj
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:12 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3BB-0002TW-Nq
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:13 +0000
X-Inumbo-ID: fa339ee8-f0f2-488b-851f-003d4a7f3c92
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id fa339ee8-f0f2-488b-851f-003d4a7f3c92;
	Sun, 01 Nov 2020 02:33:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vZZbSqxiQE6vmQOep1W8ttQ80KvhrRyY4NZUdmCWcw4=; b=w02o73b4U9CjobaqVwjF7Ln+KQ
	W+YuGu6tcdHcTMw2C0Grqt8beIJVKeCwDSbzo1oHmpJYv5LVPCQ/wb57fr3hho5c3FGOeluMf67W2
	tuFU4WpQCDQNLj7S4oa8TjJndvEMbUgnWrXEspN62UMei5C/oBOSNUb6ALTewLSjWn/E=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3BA-0005ix-Hw
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3BA-0002ux-Fj
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: don't open-code vmap_to_mfn()
Message-Id: <E1kZ3BA-0002ux-Fj@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:33:12 +0000

commit 1fd1d4bafdf6f9f8fe5ca9b947f016a7aae92a74
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 29 14:44:02 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 29 14:44:02 2020 +0100

    x86: don't open-code vmap_to_mfn()
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/domain_page.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/domain_page.c b/xen/arch/x86/domain_page.c
index b03728e18e..eac5e3304f 100644
--- a/xen/arch/x86/domain_page.c
+++ b/xen/arch/x86/domain_page.c
@@ -333,21 +333,14 @@ void unmap_domain_page_global(const void *ptr)
 mfn_t domain_page_map_to_mfn(const void *ptr)
 {
     unsigned long va = (unsigned long)ptr;
-    const l1_pgentry_t *pl1e;
 
     if ( va >= DIRECTMAP_VIRT_START )
         return _mfn(virt_to_mfn(ptr));
 
     if ( va >= VMAP_VIRT_START && va < VMAP_VIRT_END )
-    {
-        pl1e = virt_to_xen_l1e(va);
-        BUG_ON(!pl1e);
-    }
-    else
-    {
-        ASSERT(va >= MAPCACHE_VIRT_START && va < MAPCACHE_VIRT_END);
-        pl1e = &__linear_l1_table[l1_linear_offset(va)];
-    }
+        return vmap_to_mfn(va);
+
+    ASSERT(va >= MAPCACHE_VIRT_START && va < MAPCACHE_VIRT_END);
 
-    return l1e_get_mfn(*pl1e);
+    return l1e_get_mfn(__linear_l1_table[l1_linear_offset(va)]);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:33:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17066.41865 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3BM-0002Vo-UT; Sun, 01 Nov 2020 02:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17066.41865; Sun, 01 Nov 2020 02:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3BM-0002Vg-Rc; Sun, 01 Nov 2020 02:33:24 +0000
Received: by outflank-mailman (input) for mailman id 17066;
 Sun, 01 Nov 2020 02:33:23 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3BL-0002VV-Iq
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:23 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c32bbc72-803b-4a8c-97c6-e8b02389c213;
 Sun, 01 Nov 2020 02:33:22 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3BK-0005j6-M4
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3BK-0002vR-KX
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:22 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3BL-0002VV-Iq
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:23 +0000
X-Inumbo-ID: c32bbc72-803b-4a8c-97c6-e8b02389c213
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id c32bbc72-803b-4a8c-97c6-e8b02389c213;
	Sun, 01 Nov 2020 02:33:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+eZQsbHdItFUMNHXe3ToXlaEuKej187whzdZlJ9zLj4=; b=h4bgAWIPKP//Fxq4w+yL1n1Ojg
	jNfELntpdf/4XHoJg4XQ4vBhrubx7gf/WbLWlVmb+IzVciJui3vKoAGrTiz4A36M7q1DmzZqS1FdM
	uu9RzGOUCt+A4OMruvYh7TpWUOBMgR/+seDSxeipZbIo1PY66YBcSOhRrzBcW3eiPcGg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3BK-0005j6-M4
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3BK-0002vR-KX
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Drop stale comment in dom0_construct_pv()
Message-Id: <E1kZ3BK-0002vR-KX@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:33:22 +0000

commit 26a8fa494f2f323622b6928bd15921b41818f180
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 29 12:03:43 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 29 19:21:53 2020 +0000

    x86/pv: Drop stale comment in dom0_construct_pv()
    
    This comment was introduced by c/s 22a857bde9b8 in 2003, and became stale with
    c/s 99db02d50976 also in 2003.  Both of these predate the introduction of
    struct vcpu, when the processor field moved object.
    
    17 years is long enough for this comment to be mis-informing people reading
    the code.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/dom0_build.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index d79503d6a9..f7165309a2 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -616,7 +616,6 @@ int __init dom0_construct_pv(struct domain *d,
         v->arch.pv.event_callback_cs    = FLAT_COMPAT_KERNEL_CS;
     }
 
-    /* WARNING: The new domain must have its 'processor' field filled in! */
     if ( !is_pv_32bit_domain(d) )
     {
         maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l4_page_table;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:33:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17067.41872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3BX-0002XR-0N; Sun, 01 Nov 2020 02:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17067.41872; Sun, 01 Nov 2020 02:33:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3BW-0002XF-T5; Sun, 01 Nov 2020 02:33:34 +0000
Received: by outflank-mailman (input) for mailman id 17067;
 Sun, 01 Nov 2020 02:33:33 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3BV-0002X5-Ko
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:33 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b0e704d5-7b9c-412f-aa72-36a7d0164f0e;
 Sun, 01 Nov 2020 02:33:33 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3BU-0005jj-Pd
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3BU-0002w1-Oa
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:32 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3BV-0002X5-Ko
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:33 +0000
X-Inumbo-ID: b0e704d5-7b9c-412f-aa72-36a7d0164f0e
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id b0e704d5-7b9c-412f-aa72-36a7d0164f0e;
	Sun, 01 Nov 2020 02:33:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JOg5HU81MIrfq9d0Lpj2hso/tF7Ws7G4mV9/w/aVdoE=; b=pCEppY2pZzN45MhzzQpKLz+mxP
	OatHHSBSB3xvGT0T5tW3Zt3tgNcJdmslQApwpYZxPqNXCrAUsZCx5ucjxSDX16RVFyLUYeUZqZ3U/
	o1na9DQ6brsf5zoDmnn0/e/qXHAUdzJ+hKK3wt9VnrZ7ua0yNzabUIyAPnIu2gr+v8s0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3BU-0005jj-Pd
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3BU-0002w1-Oa
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: use printk_once for errata warning prints
Message-Id: <E1kZ3BU-0002w1-Oa@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:33:32 +0000

commit f9179d21e864c1f3ae1834f727a8c9f9137ccbbf
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Mon Oct 26 16:21:31 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Oct 29 14:02:59 2020 -0700

    xen/arm: use printk_once for errata warning prints
    
    Replace usage of warning_add by printk_once with a **** prefix and
    suffix for errata related warnings.
    
    This prevents the need for the assert which is not secure enough to
    protect this print against wrong usage.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/cpuerrata.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 0c63dfa779..0430069a84 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -157,7 +157,6 @@ extern char __smccc_workaround_1_smc_start[], __smccc_workaround_1_smc_end[];
 static int enable_smccc_arch_workaround_1(void *data)
 {
     struct arm_smccc_res res;
-    static bool warned = false;
     const struct arm_cpu_capabilities *entry = data;
 
     /*
@@ -182,13 +181,8 @@ static int enable_smccc_arch_workaround_1(void *data)
                                      "call ARM_SMCCC_ARCH_WORKAROUND_1");
 
 warn:
-    if ( !warned )
-    {
-        ASSERT(system_state < SYS_STATE_active);
-        warning_add("No support for ARM_SMCCC_ARCH_WORKAROUND_1.\n"
-                    "Please update your firmware.\n");
-        warned = true;
-    }
+    printk_once("**** No support for ARM_SMCCC_ARCH_WORKAROUND_1. ****\n"
+                "**** Please update your firmware.                ****\n");
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:33:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:33:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17068.41874 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Bh-0002Yd-1N; Sun, 01 Nov 2020 02:33:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17068.41874; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Bg-0002YU-UY; Sun, 01 Nov 2020 02:33:44 +0000
Received: by outflank-mailman (input) for mailman id 17068;
 Sun, 01 Nov 2020 02:33:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3Bf-0002YM-W7
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:44 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id dcd736bc-4e72-477a-8342-46cc5550b14d;
 Sun, 01 Nov 2020 02:33:43 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Be-0005jp-Sx
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Be-0002wb-S5
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:42 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3Bf-0002YM-W7
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:44 +0000
X-Inumbo-ID: dcd736bc-4e72-477a-8342-46cc5550b14d
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id dcd736bc-4e72-477a-8342-46cc5550b14d;
	Sun, 01 Nov 2020 02:33:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kzvOV9z4mRV18eG4wuso8plx+SWUuwMuCJHPjbGGAOA=; b=KGnl2NZ09czY/lzJe9KjXKOt6/
	7vvI97zcJ4c1lWc2oC3wLr12TgXvB0OGak6Ifcdm3XmHbaTgFV1rBslTLQB+ZEP/VrjZPmFUGHBL3
	1FBwXmeUtlkseAAhIiy68eNOW6EsOHmnzFIWmMxleEUQn+zqbPRLSRwyRaZ//muGZU3w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Be-0005jp-Sx
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Be-0002wb-S5
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Add an unsecure Taint type
Message-Id: <E1kZ3Be-0002wb-S5@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:33:42 +0000

commit 82c0d3d491ccb183cf12c87775086b68531b8444
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Mon Oct 26 16:21:32 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Oct 29 14:03:00 2020 -0700

    xen: Add an unsecure Taint type
    
    Define a new Unsecure taint type to be used to signal a system tainted
    due to an unsecure configuration or hardware feature/errata.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/kernel.c   | 4 +++-
 xen/include/xen/lib.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index c3a943f077..7a345ae45e 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -326,6 +326,7 @@ unsigned int tainted;
  *  'E' - An error (e.g. a machine check exceptions) has been injected.
  *  'H' - HVM forced emulation prefix is permitted.
  *  'M' - Machine had a machine check experience.
+ *  'U' - Platform is unsecure (usually due to an errata on the platform).
  *
  *      The string is overwritten by the next call to print_taint().
  */
@@ -333,7 +334,8 @@ char *print_tainted(char *str)
 {
     if ( tainted )
     {
-        snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c",
+        snprintf(str, TAINT_STRING_MAX_LEN, "Tainted: %c%c%c%c%c",
+                 tainted & TAINT_MACHINE_UNSECURE ? 'U' : ' ',
                  tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
                  tainted & TAINT_SYNC_CONSOLE ? 'C' : ' ',
                  tainted & TAINT_ERROR_INJECT ? 'E' : ' ',
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 1983bd6b86..a9679c913d 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -193,6 +193,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
 #define TAINT_MACHINE_CHECK             (1u << 1)
 #define TAINT_ERROR_INJECT              (1u << 2)
 #define TAINT_HVM_FEP                   (1u << 3)
+#define TAINT_MACHINE_UNSECURE          (1u << 4)
 extern unsigned int tainted;
 #define TAINT_STRING_MAX_LEN            20
 extern char *print_tainted(char *str);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:33:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:33:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17069.41877 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Br-0002a1-2o; Sun, 01 Nov 2020 02:33:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17069.41877; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Bq-0002Zu-W8; Sun, 01 Nov 2020 02:33:54 +0000
Received: by outflank-mailman (input) for mailman id 17069;
 Sun, 01 Nov 2020 02:33:53 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3Bp-0002Zi-MH
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:53 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d8c5fbf7-b5d9-4bb9-8a22-b3aa74298c1d;
 Sun, 01 Nov 2020 02:33:53 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Bp-0005k6-0t
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Bo-0002xB-VV
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:52 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3Bp-0002Zi-MH
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:53 +0000
X-Inumbo-ID: d8c5fbf7-b5d9-4bb9-8a22-b3aa74298c1d
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id d8c5fbf7-b5d9-4bb9-8a22-b3aa74298c1d;
	Sun, 01 Nov 2020 02:33:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=urGg5bMUYZgtogravubmq3Pbq59tFGOBO3UJ5Gkueqw=; b=xBKI7z+zVj6Fv2ezFme8V12UrK
	0Do65HFcJeKtaCpPnrEbrvSyQPQ5xlzlbgz76bN9PsuCjpv4Gykm0ahrrYxk/eU33gZcctbJW5jr6
	3Z9+2Q6MoXWc6kmzboooxgjngWWiOBuT9kdgwI9uKZAxUXSZqVCg2WF74s2p2q4uI8y0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Bp-0005k6-0t
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Bo-0002xB-VV
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:33:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Warn user on cpu errata 832075
Message-Id: <E1kZ3Bo-0002xB-VV@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:33:52 +0000

commit 6e2ee3dfd660d9fde96243da7d565244b4d2f164
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Mon Oct 26 16:21:33 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Oct 29 14:09:38 2020 -0700

    xen/arm: Warn user on cpu errata 832075
    
    When a Cortex A57 processor is affected by CPU errata 832075, a guest
    not implementing the workaround for it could deadlock the system.
    Add a warning during boot informing the user that only trusted guests
    should be executed on the system.
    An equivalent warning is already given to the user by KVM on cores
    affected by this errata.
    
    Also taint the hypervisor as unsecure when this errata applies and
    mention Cortex A57 r0p0 - r1p2 as not security supported in SUPPORT.md
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    [fix SUPPORT.md style, 3 printk lines instead of 4]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
 SUPPORT.md               |  3 +++
 xen/arch/arm/cpuerrata.c | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 5fbe5fc444..88d4bc7384 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -38,6 +38,9 @@ supported in this document.
 ### ARM v8
 
     Status: Supported
+    Status, Cortex A57 r0p0-r1p1: Supported, not security supported
+
+For the Cortex A57 r0p0 - r1p1, see Errata 832075.
 
 ## Host hardware support
 
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 0430069a84..6731d873e8 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -503,6 +503,18 @@ void check_local_cpu_errata(void)
 void __init enable_errata_workarounds(void)
 {
     enable_cpu_capabilities(arm_errata);
+
+#ifdef CONFIG_ARM64_ERRATUM_832075
+    if ( cpus_have_cap(ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE) )
+    {
+        printk_once("**** This CPU is affected by the errata 832075.                      ****\n"
+                    "**** Guests without CPU erratum workarounds can deadlock the system! ****\n"
+                    "**** Only trusted guests should be used.                             ****\n");
+
+        /* Taint the machine has being insecure */
+        add_taint(TAINT_MACHINE_UNSECURE);
+    }
+#endif
 }
 
 static int cpu_errata_callback(struct notifier_block *nfb,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:34:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:34:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17070.41882 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3C2-0002bY-5G; Sun, 01 Nov 2020 02:34:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17070.41882; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3C2-0002bP-1g; Sun, 01 Nov 2020 02:34:06 +0000
Received: by outflank-mailman (input) for mailman id 17070;
 Sun, 01 Nov 2020 02:34:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3C0-0002bB-FN
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8e72cc20-57b3-47a5-8b4b-c963e3297ce9;
 Sun, 01 Nov 2020 02:34:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Bz-0005kR-5g
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Bz-0002xw-3y
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3C0-0002bB-FN
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:04 +0000
X-Inumbo-ID: 8e72cc20-57b3-47a5-8b4b-c963e3297ce9
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 8e72cc20-57b3-47a5-8b4b-c963e3297ce9;
	Sun, 01 Nov 2020 02:34:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EvmE1NHN6vWxYpPhz9QaxXZUQrZv4EcVZVaFOsR6ma0=; b=h2ZMHuCSLolAYxvaLXMuZrwAO2
	jZ+D/tRr8WgdQowmo7pgYYAiOI2ZqjBwrrM6olwCuHOpAi410JdBdZMO8QfYE3f3WA1YK48uvYgNK
	zW0+mo0RaxtDGK3OS6b5hTblbW4ReejUGSR/1uyZxLFlMLYCED/ecAAB57DEjegG7kFo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Bz-0005kR-5g
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Bz-0002xw-3y
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: refactor shadow_vram_{get,put}_l1e()
Message-Id: <E1kZ3Bz-0002xw-3y@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:34:03 +0000

commit 8ac7e452a6e9fb3c8314fe92b2e1ebb0937fa0dd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Oct 30 14:25:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Oct 30 14:25:42 2020 +0100

    x86/shadow: refactor shadow_vram_{get,put}_l1e()
    
    By passing the functions an MFN and flags, only a single instance of
    each is needed; they were pretty large for being inline functions
    anyway.
    
    While moving the code, also adjust coding style and add const where
    sensible / possible.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/hvm.c     |  98 +++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/multi.c   | 130 +++++----------------------------------
 xen/arch/x86/mm/shadow/private.h |   8 +++
 3 files changed, 123 insertions(+), 113 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index b832272c10..967c1a6a04 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -903,6 +903,104 @@ int shadow_track_dirty_vram(struct domain *d,
     return rc;
 }
 
+void shadow_vram_get_mfn(mfn_t mfn, unsigned int l1f,
+                         mfn_t sl1mfn, const void *sl1e,
+                         const struct domain *d)
+{
+    unsigned long gfn;
+    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
+
+    ASSERT(is_hvm_domain(d));
+
+    if ( !dirty_vram /* tracking disabled? */ ||
+         !(l1f & _PAGE_RW) /* read-only mapping? */ ||
+         !mfn_valid(mfn) /* mfn can be invalid in mmio_direct */)
+        return;
+
+    gfn = gfn_x(mfn_to_gfn(d, mfn));
+    /* Page sharing not supported on shadow PTs */
+    BUG_ON(SHARED_M2P(gfn));
+
+    if ( (gfn >= dirty_vram->begin_pfn) && (gfn < dirty_vram->end_pfn) )
+    {
+        unsigned long i = gfn - dirty_vram->begin_pfn;
+        const struct page_info *page = mfn_to_page(mfn);
+
+        if ( (page->u.inuse.type_info & PGT_count_mask) == 1 )
+            /* Initial guest reference, record it */
+            dirty_vram->sl1ma[i] = mfn_to_maddr(sl1mfn) |
+                                   PAGE_OFFSET(sl1e);
+    }
+}
+
+void shadow_vram_put_mfn(mfn_t mfn, unsigned int l1f,
+                         mfn_t sl1mfn, const void *sl1e,
+                         const struct domain *d)
+{
+    unsigned long gfn;
+    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
+
+    ASSERT(is_hvm_domain(d));
+
+    if ( !dirty_vram /* tracking disabled? */ ||
+         !(l1f & _PAGE_RW) /* read-only mapping? */ ||
+         !mfn_valid(mfn) /* mfn can be invalid in mmio_direct */)
+        return;
+
+    gfn = gfn_x(mfn_to_gfn(d, mfn));
+    /* Page sharing not supported on shadow PTs */
+    BUG_ON(SHARED_M2P(gfn));
+
+    if ( (gfn >= dirty_vram->begin_pfn) && (gfn < dirty_vram->end_pfn) )
+    {
+        unsigned long i = gfn - dirty_vram->begin_pfn;
+        const struct page_info *page = mfn_to_page(mfn);
+        bool dirty = false;
+        paddr_t sl1ma = mfn_to_maddr(sl1mfn) | PAGE_OFFSET(sl1e);
+
+        if ( (page->u.inuse.type_info & PGT_count_mask) == 1 )
+        {
+            /* Last reference */
+            if ( dirty_vram->sl1ma[i] == INVALID_PADDR )
+            {
+                /* We didn't know it was that one, let's say it is dirty */
+                dirty = true;
+            }
+            else
+            {
+                ASSERT(dirty_vram->sl1ma[i] == sl1ma);
+                dirty_vram->sl1ma[i] = INVALID_PADDR;
+                if ( l1f & _PAGE_DIRTY )
+                    dirty = true;
+            }
+        }
+        else
+        {
+            /* We had more than one reference, just consider the page dirty. */
+            dirty = true;
+            /* Check that it's not the one we recorded. */
+            if ( dirty_vram->sl1ma[i] == sl1ma )
+            {
+                /* Too bad, we remembered the wrong one... */
+                dirty_vram->sl1ma[i] = INVALID_PADDR;
+            }
+            else
+            {
+                /*
+                 * Ok, our recorded sl1e is still pointing to this page, let's
+                 * just hope it will remain.
+                 */
+            }
+        }
+
+        if ( dirty )
+        {
+            dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8);
+            dirty_vram->last_dirty = NOW();
+        }
+    }
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 225082fc2f..04be86e422 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -1047,107 +1047,6 @@ static int shadow_set_l2e(struct domain *d,
     return flags;
 }
 
-static inline void shadow_vram_get_l1e(shadow_l1e_t new_sl1e,
-                                       shadow_l1e_t *sl1e,
-                                       mfn_t sl1mfn,
-                                       struct domain *d)
-{
-#ifdef CONFIG_HVM
-    mfn_t mfn = shadow_l1e_get_mfn(new_sl1e);
-    int flags = shadow_l1e_get_flags(new_sl1e);
-    unsigned long gfn;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
-
-    if ( !is_hvm_domain(d) || !dirty_vram /* tracking disabled? */
-         || !(flags & _PAGE_RW) /* read-only mapping? */
-         || !mfn_valid(mfn) )   /* mfn can be invalid in mmio_direct */
-        return;
-
-    gfn = gfn_x(mfn_to_gfn(d, mfn));
-    /* Page sharing not supported on shadow PTs */
-    BUG_ON(SHARED_M2P(gfn));
-
-    if ( (gfn >= dirty_vram->begin_pfn) && (gfn < dirty_vram->end_pfn) )
-    {
-        unsigned long i = gfn - dirty_vram->begin_pfn;
-        struct page_info *page = mfn_to_page(mfn);
-
-        if ( (page->u.inuse.type_info & PGT_count_mask) == 1 )
-            /* Initial guest reference, record it */
-            dirty_vram->sl1ma[i] = mfn_to_maddr(sl1mfn)
-                | ((unsigned long)sl1e & ~PAGE_MASK);
-    }
-#endif
-}
-
-static inline void shadow_vram_put_l1e(shadow_l1e_t old_sl1e,
-                                       shadow_l1e_t *sl1e,
-                                       mfn_t sl1mfn,
-                                       struct domain *d)
-{
-#ifdef CONFIG_HVM
-    mfn_t mfn = shadow_l1e_get_mfn(old_sl1e);
-    int flags = shadow_l1e_get_flags(old_sl1e);
-    unsigned long gfn;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
-
-    if ( !is_hvm_domain(d) || !dirty_vram /* tracking disabled? */
-         || !(flags & _PAGE_RW) /* read-only mapping? */
-         || !mfn_valid(mfn) )   /* mfn can be invalid in mmio_direct */
-        return;
-
-    gfn = gfn_x(mfn_to_gfn(d, mfn));
-    /* Page sharing not supported on shadow PTs */
-    BUG_ON(SHARED_M2P(gfn));
-
-    if ( (gfn >= dirty_vram->begin_pfn) && (gfn < dirty_vram->end_pfn) )
-    {
-        unsigned long i = gfn - dirty_vram->begin_pfn;
-        struct page_info *page = mfn_to_page(mfn);
-        int dirty = 0;
-        paddr_t sl1ma = mfn_to_maddr(sl1mfn)
-            | ((unsigned long)sl1e & ~PAGE_MASK);
-
-        if ( (page->u.inuse.type_info & PGT_count_mask) == 1 )
-        {
-            /* Last reference */
-            if ( dirty_vram->sl1ma[i] == INVALID_PADDR ) {
-                /* We didn't know it was that one, let's say it is dirty */
-                dirty = 1;
-            }
-            else
-            {
-                ASSERT(dirty_vram->sl1ma[i] == sl1ma);
-                dirty_vram->sl1ma[i] = INVALID_PADDR;
-                if ( flags & _PAGE_DIRTY )
-                    dirty = 1;
-            }
-        }
-        else
-        {
-            /* We had more than one reference, just consider the page dirty. */
-            dirty = 1;
-            /* Check that it's not the one we recorded. */
-            if ( dirty_vram->sl1ma[i] == sl1ma )
-            {
-                /* Too bad, we remembered the wrong one... */
-                dirty_vram->sl1ma[i] = INVALID_PADDR;
-            }
-            else
-            {
-                /* Ok, our recorded sl1e is still pointing to this page, let's
-                 * just hope it will remain. */
-            }
-        }
-        if ( dirty )
-        {
-            dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8);
-            dirty_vram->last_dirty = NOW();
-        }
-    }
-#endif
-}
-
 static int shadow_set_l1e(struct domain *d,
                           shadow_l1e_t *sl1e,
                           shadow_l1e_t new_sl1e,
@@ -1156,6 +1055,7 @@ static int shadow_set_l1e(struct domain *d,
 {
     int flags = 0;
     shadow_l1e_t old_sl1e;
+    unsigned int old_sl1f;
 #if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
     mfn_t new_gmfn = shadow_l1e_get_mfn(new_sl1e);
 #endif
@@ -1194,7 +1094,9 @@ static int shadow_set_l1e(struct domain *d,
                 new_sl1e = shadow_l1e_flip_flags(new_sl1e, rc);
                 /* fall through */
             case 0:
-                shadow_vram_get_l1e(new_sl1e, sl1e, sl1mfn, d);
+                shadow_vram_get_mfn(shadow_l1e_get_mfn(new_sl1e),
+                                    shadow_l1e_get_flags(new_sl1e),
+                                    sl1mfn, sl1e, d);
                 break;
             }
 #undef PAGE_FLIPPABLE
@@ -1205,20 +1107,19 @@ static int shadow_set_l1e(struct domain *d,
     shadow_write_entries(sl1e, &new_sl1e, 1, sl1mfn);
     flags |= SHADOW_SET_CHANGED;
 
-    if ( (shadow_l1e_get_flags(old_sl1e) & _PAGE_PRESENT)
-         && !sh_l1e_is_magic(old_sl1e) )
+    old_sl1f = shadow_l1e_get_flags(old_sl1e);
+    if ( (old_sl1f & _PAGE_PRESENT) && !sh_l1e_is_magic(old_sl1e) &&
+         shadow_mode_refcounts(d) )
     {
         /* We lost a reference to an old mfn. */
         /* N.B. Unlike higher-level sets, never need an extra flush
          * when writing an l1e.  Because it points to the same guest frame
          * as the guest l1e did, it's the guest's responsibility to
          * trigger a flush later. */
-        if ( shadow_mode_refcounts(d) )
-        {
-            shadow_vram_put_l1e(old_sl1e, sl1e, sl1mfn, d);
-            shadow_put_page_from_l1e(old_sl1e, d);
-            TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_PUT_REF);
-        }
+        shadow_vram_put_mfn(shadow_l1e_get_mfn(old_sl1e), old_sl1f,
+                            sl1mfn, sl1e, d);
+        shadow_put_page_from_l1e(old_sl1e, d);
+        TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_PUT_REF);
     }
     return flags;
 }
@@ -1944,9 +1845,12 @@ void sh_destroy_l1_shadow(struct domain *d, mfn_t smfn)
         /* Decrement refcounts of all the old entries */
         mfn_t sl1mfn = smfn;
         SHADOW_FOREACH_L1E(sl1mfn, sl1e, 0, 0, {
-            if ( (shadow_l1e_get_flags(*sl1e) & _PAGE_PRESENT)
-                 && !sh_l1e_is_magic(*sl1e) ) {
-                shadow_vram_put_l1e(*sl1e, sl1e, sl1mfn, d);
+            unsigned int sl1f = shadow_l1e_get_flags(*sl1e);
+
+            if ( (sl1f & _PAGE_PRESENT) && !sh_l1e_is_magic(*sl1e) )
+            {
+                shadow_vram_put_mfn(shadow_l1e_get_mfn(*sl1e), sl1f,
+                                    sl1mfn, sl1e, d);
                 shadow_put_page_from_l1e(*sl1e, d);
             }
         });
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 992461d4bc..5372fdc253 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -410,6 +410,14 @@ void shadow_update_paging_modes(struct vcpu *v);
  * With user_only == 1, unhooks only the user-mode mappings. */
 void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only);
 
+/* VRAM dirty tracking helpers. */
+void shadow_vram_get_mfn(mfn_t mfn, unsigned int l1f,
+                         mfn_t sl1mfn, const void *sl1e,
+                         const struct domain *d);
+void shadow_vram_put_mfn(mfn_t mfn, unsigned int l1f,
+                         mfn_t sl1mfn, const void *sl1e,
+                         const struct domain *d);
+
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
 /* Allow a shadowed page to go out of sync */
 int sh_unsync(struct vcpu *v, mfn_t gmfn);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:34:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:34:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17071.41886 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3CB-0002dF-8J; Sun, 01 Nov 2020 02:34:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17071.41886; Sun, 01 Nov 2020 02:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3CB-0002d7-5M; Sun, 01 Nov 2020 02:34:15 +0000
Received: by outflank-mailman (input) for mailman id 17071;
 Sun, 01 Nov 2020 02:34:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3C9-0002cy-WF
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:14 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d7497fb0-e0d3-43bd-a762-cf0dc5fd4d30;
 Sun, 01 Nov 2020 02:34:13 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3C9-0005kX-9h
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3C9-0002yY-8k
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:13 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3C9-0002cy-WF
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:14 +0000
X-Inumbo-ID: d7497fb0-e0d3-43bd-a762-cf0dc5fd4d30
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id d7497fb0-e0d3-43bd-a762-cf0dc5fd4d30;
	Sun, 01 Nov 2020 02:34:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4wtxJhHE12TaK0FLKNI7QW6ofEOkaS2pFxYzanrJnUA=; b=Wj6uWJzZ25dIkIEup5UbCTwgAa
	L5OEOZFbiqWmPDZIGUEe1lO4eBVEvcFmF1Q4fnyEOtx/NVwqUTDtuOJF3Y7NQXIEZXDrp0Ms6kehj
	6zMKf56MJ2EZMLr+X8X9ojemg0H9Sdo/zaK44n3RpBe+dcjLivRsDA29fzQ+vd8p1wF0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3C9-0005kX-9h
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3C9-0002yY-8k
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: sh_{make,destroy}_monitor_table() are "even more" HVM-only
Message-Id: <E1kZ3C9-0002yY-8k@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:34:13 +0000

commit 0b841314dacecc94376be22f514da0665055fa3b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Oct 30 14:26:46 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Oct 30 14:26:46 2020 +0100

    x86/shadow: sh_{make,destroy}_monitor_table() are "even more" HVM-only
    
    With them depending on just the number of shadow levels, there's no need
    for more than one instance of them, and hence no need for any hook (IOW
    452219e24648 ["x86/shadow: monitor table is HVM-only"] didn't go quite
    far enough). Move the functions to hvm.c while dropping the dead
    is_pv_32bit_domain() code paths.
    
    While moving the code, replace a stale comment reference to
    sh_install_xen_entries_in_l4(). Doing so made me notice the function
    also didn't have its prototype dropped in 8d7b633adab7 ("x86/mm:
    Consolidate all Xen L4 slot writing into init_xen_l4_slots()"), which
    gets done here as well.
    
    Also make their first parameters const.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  |  14 +++--
 xen/arch/x86/mm/shadow/hvm.c     |  82 ++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/multi.c   | 124 ---------------------------------------
 xen/arch/x86/mm/shadow/private.h |  11 +++-
 xen/arch/x86/mm/shadow/types.h   |   9 ---
 xen/include/asm-x86/paging.h     |   2 -
 6 files changed, 100 insertions(+), 142 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 6182313a0e..0d59dea6ad 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2467,7 +2467,9 @@ static void sh_update_paging_modes(struct vcpu *v)
 
         if ( pagetable_is_null(v->arch.hvm.monitor_table) )
         {
-            mfn_t mmfn = v->arch.paging.mode->shadow.make_monitor_table(v);
+            mfn_t mmfn = sh_make_monitor_table(
+                             v, v->arch.paging.mode->shadow.shadow_levels);
+
             v->arch.hvm.monitor_table = pagetable_from_mfn(mmfn);
             make_cr3(v, mmfn);
             hvm_update_host_cr3(v);
@@ -2504,7 +2506,8 @@ static void sh_update_paging_modes(struct vcpu *v)
 
                 old_mfn = pagetable_get_mfn(v->arch.hvm.monitor_table);
                 v->arch.hvm.monitor_table = pagetable_null();
-                new_mfn = v->arch.paging.mode->shadow.make_monitor_table(v);
+                new_mfn = sh_make_monitor_table(
+                              v, v->arch.paging.mode->shadow.shadow_levels);
                 v->arch.hvm.monitor_table = pagetable_from_mfn(new_mfn);
                 SHADOW_PRINTK("new monitor table %"PRI_mfn "\n",
                                mfn_x(new_mfn));
@@ -2516,7 +2519,8 @@ static void sh_update_paging_modes(struct vcpu *v)
                 if ( v == current )
                     write_ptbase(v);
                 hvm_update_host_cr3(v);
-                old_mode->shadow.destroy_monitor_table(v, old_mfn);
+                sh_destroy_monitor_table(v, old_mfn,
+                                         old_mode->shadow.shadow_levels);
             }
         }
 
@@ -2801,7 +2805,9 @@ void shadow_teardown(struct domain *d, bool *preempted)
                     mfn_t mfn = pagetable_get_mfn(v->arch.hvm.monitor_table);
 
                     if ( mfn_valid(mfn) && (mfn_x(mfn) != 0) )
-                        v->arch.paging.mode->shadow.destroy_monitor_table(v, mfn);
+                        sh_destroy_monitor_table(
+                            v, mfn,
+                            v->arch.paging.mode->shadow.shadow_levels);
                     v->arch.hvm.monitor_table = pagetable_null();
                 }
 #endif /* CONFIG_HVM */
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 967c1a6a04..87fc57704f 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -691,6 +691,88 @@ static void sh_emulate_unmap_dest(struct vcpu *v, void *addr,
     atomic_inc(&v->domain->arch.paging.shadow.gtable_dirty_version);
 }
 
+mfn_t sh_make_monitor_table(const struct vcpu *v, unsigned int shadow_levels)
+{
+    struct domain *d = v->domain;
+    mfn_t m4mfn;
+    l4_pgentry_t *l4e;
+
+    ASSERT(!pagetable_get_pfn(v->arch.hvm.monitor_table));
+
+    /* Guarantee we can get the memory we need */
+    shadow_prealloc(d, SH_type_monitor_table, CONFIG_PAGING_LEVELS);
+    m4mfn = shadow_alloc(d, SH_type_monitor_table, 0);
+    mfn_to_page(m4mfn)->shadow_flags = 4;
+
+    l4e = map_domain_page(m4mfn);
+
+    /*
+     * Create a self-linear mapping, but no shadow-linear mapping.  A
+     * shadow-linear mapping will either be inserted below when creating
+     * lower level monitor tables, or later in sh_update_cr3().
+     */
+    init_xen_l4_slots(l4e, m4mfn, d, INVALID_MFN, false);
+
+    if ( shadow_levels < 4 )
+    {
+        mfn_t m3mfn, m2mfn;
+        l3_pgentry_t *l3e;
+
+        /*
+         * Install an l3 table and an l2 table that will hold the shadow
+         * linear map entries.  This overrides the empty entry that was
+         * installed by init_xen_l4_slots().
+         */
+        m3mfn = shadow_alloc(d, SH_type_monitor_table, 0);
+        mfn_to_page(m3mfn)->shadow_flags = 3;
+        l4e[l4_table_offset(SH_LINEAR_PT_VIRT_START)]
+            = l4e_from_mfn(m3mfn, __PAGE_HYPERVISOR_RW);
+
+        m2mfn = shadow_alloc(d, SH_type_monitor_table, 0);
+        mfn_to_page(m2mfn)->shadow_flags = 2;
+        l3e = map_domain_page(m3mfn);
+        l3e[0] = l3e_from_mfn(m2mfn, __PAGE_HYPERVISOR_RW);
+        unmap_domain_page(l3e);
+    }
+
+    unmap_domain_page(l4e);
+
+    return m4mfn;
+}
+
+void sh_destroy_monitor_table(const struct vcpu *v, mfn_t mmfn,
+                              unsigned int shadow_levels)
+{
+    struct domain *d = v->domain;
+
+    ASSERT(mfn_to_page(mmfn)->u.sh.type == SH_type_monitor_table);
+
+    if ( shadow_levels < 4 )
+    {
+        mfn_t m3mfn;
+        l4_pgentry_t *l4e = map_domain_page(mmfn);
+        l3_pgentry_t *l3e;
+        unsigned int linear_slot = l4_table_offset(SH_LINEAR_PT_VIRT_START);
+
+        /*
+         * Need to destroy the l3 and l2 monitor pages used
+         * for the linear map.
+         */
+        ASSERT(l4e_get_flags(l4e[linear_slot]) & _PAGE_PRESENT);
+        m3mfn = l4e_get_mfn(l4e[linear_slot]);
+        l3e = map_domain_page(m3mfn);
+        ASSERT(l3e_get_flags(l3e[0]) & _PAGE_PRESENT);
+        shadow_free(d, l3e_get_mfn(l3e[0]));
+        unmap_domain_page(l3e);
+        shadow_free(d, m3mfn);
+
+        unmap_domain_page(l4e);
+    }
+
+    /* Put the memory back in the pool */
+    shadow_free(d, mmfn);
+}
+
 /**************************************************************************/
 /* VRAM dirty tracking support */
 int shadow_track_dirty_vram(struct domain *d,
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 04be86e422..eba5164a27 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -1405,84 +1405,6 @@ make_fl1_shadow(struct domain *d, gfn_t gfn)
 }
 
 
-#if SHADOW_PAGING_LEVELS == GUEST_PAGING_LEVELS && defined(CONFIG_HVM)
-mfn_t
-sh_make_monitor_table(struct vcpu *v)
-{
-    struct domain *d = v->domain;
-
-    ASSERT(pagetable_get_pfn(v->arch.hvm.monitor_table) == 0);
-
-    /* Guarantee we can get the memory we need */
-    shadow_prealloc(d, SH_type_monitor_table, CONFIG_PAGING_LEVELS);
-
-    {
-        mfn_t m4mfn;
-        l4_pgentry_t *l4e;
-
-        m4mfn = shadow_alloc(d, SH_type_monitor_table, 0);
-        mfn_to_page(m4mfn)->shadow_flags = 4;
-
-        l4e = map_domain_page(m4mfn);
-
-        /*
-         * Create a self-linear mapping, but no shadow-linear mapping.  A
-         * shadow-linear mapping will either be inserted below when creating
-         * lower level monitor tables, or later in sh_update_cr3().
-         */
-        init_xen_l4_slots(l4e, m4mfn, d, INVALID_MFN, false);
-
-#if SHADOW_PAGING_LEVELS < 4
-        {
-            mfn_t m3mfn, m2mfn;
-            l3_pgentry_t *l3e;
-            /* Install an l3 table and an l2 table that will hold the shadow
-             * linear map entries.  This overrides the linear map entry that
-             * was installed by sh_install_xen_entries_in_l4. */
-
-            m3mfn = shadow_alloc(d, SH_type_monitor_table, 0);
-            mfn_to_page(m3mfn)->shadow_flags = 3;
-            l4e[shadow_l4_table_offset(SH_LINEAR_PT_VIRT_START)]
-                = l4e_from_mfn(m3mfn, __PAGE_HYPERVISOR_RW);
-
-            m2mfn = shadow_alloc(d, SH_type_monitor_table, 0);
-            mfn_to_page(m2mfn)->shadow_flags = 2;
-            l3e = map_domain_page(m3mfn);
-            l3e[0] = l3e_from_mfn(m2mfn, __PAGE_HYPERVISOR_RW);
-            unmap_domain_page(l3e);
-
-            if ( is_pv_32bit_domain(d) )
-            {
-                l2_pgentry_t *l2t;
-
-                /* For 32-bit PV guests, we need to map the 32-bit Xen
-                 * area into its usual VAs in the monitor tables */
-                m3mfn = shadow_alloc(d, SH_type_monitor_table, 0);
-                mfn_to_page(m3mfn)->shadow_flags = 3;
-                l4e[0] = l4e_from_mfn(m3mfn, __PAGE_HYPERVISOR_RW);
-
-                m2mfn = shadow_alloc(d, SH_type_monitor_table, 0);
-                mfn_to_page(m2mfn)->shadow_flags = 2;
-                l3e = map_domain_page(m3mfn);
-                l3e[3] = l3e_from_mfn(m2mfn, _PAGE_PRESENT);
-
-                l2t = map_domain_page(m2mfn);
-                init_xen_pae_l2_slots(l2t, d);
-                unmap_domain_page(l2t);
-
-                unmap_domain_page(l3e);
-            }
-
-        }
-#endif /* SHADOW_PAGING_LEVELS < 4 */
-
-        unmap_domain_page(l4e);
-
-        return m4mfn;
-    }
-}
-#endif /* SHADOW_PAGING_LEVELS == GUEST_PAGING_LEVELS */
-
 /**************************************************************************/
 /* These functions also take a virtual address and return the level-N
  * shadow table mfn and entry, but they create the shadow pagetables if
@@ -1860,50 +1782,6 @@ void sh_destroy_l1_shadow(struct domain *d, mfn_t smfn)
     shadow_free(d, smfn);
 }
 
-#if SHADOW_PAGING_LEVELS == GUEST_PAGING_LEVELS && defined(CONFIG_HVM)
-void sh_destroy_monitor_table(struct vcpu *v, mfn_t mmfn)
-{
-    struct domain *d = v->domain;
-    ASSERT(mfn_to_page(mmfn)->u.sh.type == SH_type_monitor_table);
-
-#if SHADOW_PAGING_LEVELS != 4
-    {
-        mfn_t m3mfn;
-        l4_pgentry_t *l4e = map_domain_page(mmfn);
-        l3_pgentry_t *l3e;
-        int linear_slot = shadow_l4_table_offset(SH_LINEAR_PT_VIRT_START);
-
-        /* Need to destroy the l3 and l2 monitor pages used
-         * for the linear map */
-        ASSERT(l4e_get_flags(l4e[linear_slot]) & _PAGE_PRESENT);
-        m3mfn = l4e_get_mfn(l4e[linear_slot]);
-        l3e = map_domain_page(m3mfn);
-        ASSERT(l3e_get_flags(l3e[0]) & _PAGE_PRESENT);
-        shadow_free(d, l3e_get_mfn(l3e[0]));
-        unmap_domain_page(l3e);
-        shadow_free(d, m3mfn);
-
-        if ( is_pv_32bit_domain(d) )
-        {
-            /* Need to destroy the l3 and l2 monitor pages that map the
-             * Xen VAs at 3GB-4GB */
-            ASSERT(l4e_get_flags(l4e[0]) & _PAGE_PRESENT);
-            m3mfn = l4e_get_mfn(l4e[0]);
-            l3e = map_domain_page(m3mfn);
-            ASSERT(l3e_get_flags(l3e[3]) & _PAGE_PRESENT);
-            shadow_free(d, l3e_get_mfn(l3e[3]));
-            unmap_domain_page(l3e);
-            shadow_free(d, m3mfn);
-        }
-        unmap_domain_page(l4e);
-    }
-#endif
-
-    /* Put the memory back in the pool */
-    shadow_free(d, mmfn);
-}
-#endif
-
 /**************************************************************************/
 /* Functions to destroy non-Xen mappings in a pagetable hierarchy.
  * These are called from common code when we are running out of shadow
@@ -4705,8 +4583,6 @@ const struct paging_mode sh_paging_mode = {
     .shadow.cmpxchg_guest_entry    = sh_cmpxchg_guest_entry,
 #endif
 #ifdef CONFIG_HVM
-    .shadow.make_monitor_table     = sh_make_monitor_table,
-    .shadow.destroy_monitor_table  = sh_destroy_monitor_table,
 #if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC
     .shadow.guess_wrmap            = sh_guess_wrmap,
 #endif
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 5372fdc253..e9b304f755 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -366,9 +366,6 @@ void sh_set_toplevel_shadow(struct vcpu *v,
                                                  mfn_t gmfn,
                                                  uint32_t shadow_type));
 
-/* Install the xen mappings in various flavours of shadow */
-void sh_install_xen_entries_in_l4(struct domain *, mfn_t gl4mfn, mfn_t sl4mfn);
-
 /* Update the shadows in response to a pagetable write from Xen */
 int sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size);
 
@@ -410,6 +407,14 @@ void shadow_update_paging_modes(struct vcpu *v);
  * With user_only == 1, unhooks only the user-mode mappings. */
 void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only);
 
+/*
+ * sh_{make,destroy}_monitor_table() depend only on the number of shadow
+ * levels.
+ */
+mfn_t sh_make_monitor_table(const struct vcpu *v, unsigned int shadow_levels);
+void sh_destroy_monitor_table(const struct vcpu *v, mfn_t mmfn,
+                              unsigned int shadow_levels);
+
 /* VRAM dirty tracking helpers. */
 void shadow_vram_get_mfn(mfn_t mfn, unsigned int l1f,
                          mfn_t sl1mfn, const void *sl1e,
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index d5096748ac..416b284123 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -262,15 +262,6 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define sh_rm_write_access_from_sl1p INTERNAL_NAME(sh_rm_write_access_from_sl1p)
 #endif
 
-/* sh_make_monitor_table depends only on the number of shadow levels */
-#define sh_make_monitor_table \
-        SHADOW_SH_NAME(sh_make_monitor_table, SHADOW_PAGING_LEVELS)
-#define sh_destroy_monitor_table \
-        SHADOW_SH_NAME(sh_destroy_monitor_table, SHADOW_PAGING_LEVELS)
-
-mfn_t sh_make_monitor_table(struct vcpu *v);
-void sh_destroy_monitor_table(struct vcpu *v, mfn_t mmfn);
-
 #if SHADOW_PAGING_LEVELS == 3
 #define MFN_FITS_IN_HVM_CR3(_MFN) !(mfn_x(_MFN) >> 20)
 #endif
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 61534da538..726f48339a 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -107,8 +107,6 @@ struct shadow_paging_mode {
                                             mfn_t gmfn);
 #endif
 #ifdef CONFIG_HVM
-    mfn_t         (*make_monitor_table    )(struct vcpu *v);
-    void          (*destroy_monitor_table )(struct vcpu *v, mfn_t mmfn);
     int           (*guess_wrmap           )(struct vcpu *v, 
                                             unsigned long vaddr, mfn_t gmfn);
     void          (*pagetable_dying       )(paddr_t gpa);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:34:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:34:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17072.41889 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3CL-0002fA-AC; Sun, 01 Nov 2020 02:34:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17072.41889; Sun, 01 Nov 2020 02:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3CL-0002f3-70; Sun, 01 Nov 2020 02:34:25 +0000
Received: by outflank-mailman (input) for mailman id 17072;
 Sun, 01 Nov 2020 02:34:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3CK-0002er-1E
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:24 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3a3d7a65-fdf3-4be7-879d-6f1b592486c5;
 Sun, 01 Nov 2020 02:34:23 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3CJ-0005lP-DK
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3CJ-0002z8-CP
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3CK-0002er-1E
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:24 +0000
X-Inumbo-ID: 3a3d7a65-fdf3-4be7-879d-6f1b592486c5
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 3a3d7a65-fdf3-4be7-879d-6f1b592486c5;
	Sun, 01 Nov 2020 02:34:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LZwLlMHGZpopQSBgLHSvcvjvGs4nzfdvnkO4L4wN7pE=; b=B/KrGAib3P7k0oZ9fC083eM3lw
	HFtp67PCauhXOPn15rXor0qViZrg8v1prhSujvR6YADMINktBAtA6FTlERKIgpqmqJsPwrnlLyOL9
	vNOgrYNMQJWog39sX3HLLSGOOUUQF4fHtoFwkaaCnp+Y6dMeauKSg8K+8Y2zEGCA3Z0g=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3CJ-0005lP-DK
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3CJ-0002z8-CP
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: correct GFN use by sh_unshadow_for_p2m_change()
Message-Id: <E1kZ3CJ-0002z8-CP@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:34:23 +0000

commit 92bc18632011c85a58247ce305ffa4ca583f52cd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Oct 30 14:27:23 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Oct 30 14:27:23 2020 +0100

    x86/shadow: correct GFN use by sh_unshadow_for_p2m_change()
    
    Luckily sh_remove_all_mappings()'s use of the parameter is limited to
    generation of log messages. Nevertheless we'd better pass correct GFNs
    around:
    - the incoming GFN, when replacing a large page, may not be large page
      aligned,
    - incrementing by page-size-scaled values can't be right.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 0d59dea6ad..9c3d9a7cfd 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3121,6 +3121,8 @@ static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
                  && mfn_valid(nmfn) )
                 npte = map_domain_page(nmfn);
 
+            gfn &= ~(L1_PAGETABLE_ENTRIES - 1);
+
             for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
             {
                 if ( !npte
@@ -3129,8 +3131,7 @@ static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
                 {
                     /* This GFN->MFN mapping has gone away */
                     sh_remove_all_shadows_and_parents(d, omfn);
-                    if ( sh_remove_all_mappings(d, omfn,
-                                                _gfn(gfn + (i << PAGE_SHIFT))) )
+                    if ( sh_remove_all_mappings(d, omfn, _gfn(gfn + i)) )
                         cpumask_or(&flushmask, &flushmask, d->dirty_cpumask);
                 }
                 omfn = mfn_add(omfn, 1);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:34:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:34:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17074.41893 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3CV-0002gp-BT; Sun, 01 Nov 2020 02:34:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17074.41893; Sun, 01 Nov 2020 02:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3CV-0002gh-8U; Sun, 01 Nov 2020 02:34:35 +0000
Received: by outflank-mailman (input) for mailman id 17074;
 Sun, 01 Nov 2020 02:34:34 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3CU-0002gU-60
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:34 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b3bef570-41e7-4ef7-8939-18b17de2b4d9;
 Sun, 01 Nov 2020 02:34:33 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3CT-0005lX-Hh
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3CT-000390-Fq
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:33 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3CU-0002gU-60
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:34 +0000
X-Inumbo-ID: b3bef570-41e7-4ef7-8939-18b17de2b4d9
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id b3bef570-41e7-4ef7-8939-18b17de2b4d9;
	Sun, 01 Nov 2020 02:34:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0+uy/uqDTlFG7VAec+BNUI/H1IPMXOj5MPWAHgEqtek=; b=UqREeHtFyw6rvQjNrvQ/rL2Ba7
	TZK3Y1uFw7tR9vmIhAycB0T1xEw/cLIzIH4NS5zzjclDokHufiqae4GSK4xaiaXnHFx4ohmXxlFXd
	RN3NkOYyIKn2lI6FH4K8NrHrsV49PjqYwFrRmYAzi3JyxVtNdKYCkEmlnB/ZIoYgLLko=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3CT-0005lX-Hh
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3CT-000390-Fq
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: process softirq while saving/loading entries
Message-Id: <E1kZ3CT-000390-Fq@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:34:33 +0000

commit e0daa27e9511f7c9ce6e2be7655231e112d69920
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Oct 30 14:28:03 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Oct 30 14:28:03 2020 +0100

    x86/hvm: process softirq while saving/loading entries
    
    On slow systems with sync_console saving or loading the context of big
    guests can cause the watchdog to trigger. Fix this by adding a couple
    of process_pending_softirqs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/save.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c
index a2c56fbc1e..584620985b 100644
--- a/xen/arch/x86/hvm/save.c
+++ b/xen/arch/x86/hvm/save.c
@@ -21,6 +21,7 @@
  */
 
 #include <xen/guest_access.h>
+#include <xen/softirq.h>
 #include <xen/version.h>
 
 #include <asm/hvm/support.h>
@@ -255,6 +256,7 @@ int hvm_save(struct domain *d, hvm_domain_context_t *h)
                            v, i);
                     return -ENODATA;
                 }
+                process_pending_softirqs();
             }
         }
         else
@@ -268,6 +270,7 @@ int hvm_save(struct domain *d, hvm_domain_context_t *h)
                        d->domain_id, i);
                 return -ENODATA;
             }
+            process_pending_softirqs();
         }
     }
 
@@ -341,6 +344,7 @@ int hvm_load(struct domain *d, hvm_domain_context_t *h)
                    d->domain_id, desc->typecode, desc->instance);
             return -1;
         }
+        process_pending_softirqs();
     }
 
     /* Not reached */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:34:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:34:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17075.41898 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Cg-0002iJ-DL; Sun, 01 Nov 2020 02:34:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17075.41898; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Cg-0002iC-A6; Sun, 01 Nov 2020 02:34:46 +0000
Received: by outflank-mailman (input) for mailman id 17075;
 Sun, 01 Nov 2020 02:34:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3Ce-0002hz-BK
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:44 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6e14200a-c24f-42b3-a686-8e9fe527809b;
 Sun, 01 Nov 2020 02:34:43 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Cd-0005le-M7
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Cd-00039a-LJ
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:43 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3Ce-0002hz-BK
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:44 +0000
X-Inumbo-ID: 6e14200a-c24f-42b3-a686-8e9fe527809b
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 6e14200a-c24f-42b3-a686-8e9fe527809b;
	Sun, 01 Nov 2020 02:34:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pxwLHuESzzpqMdTPubSxeRnmEPunAWzR+e+z3d2QUdM=; b=sdCagQbmlXGZRvNDhqiK//gfje
	k9MEYG+KwAnr7iIjafFZyiK32DDEaCv59jiH45jEOYqVraKgW6jjnyGCQEURV/Z/Gv8XFSZOyJYFm
	glw8NVjGaSPFtuO1CNpN0CZUVdC+v1F4TLkKhRLSf4spvmNbEY05ekBoWrLcyyAkDp+4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Cd-0005le-M7
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Cd-00039a-LJ
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: support AVX-VNNI
Message-Id: <E1kZ3Cd-00039a-LJ@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:34:43 +0000

commit a780b17c72ef9f40f024a32fcda19f2544acaf2a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Oct 30 14:29:06 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Oct 30 14:29:06 2020 +0100

    x86emul: support AVX-VNNI
    
    These are VEX-encoded equivalents of the EVEX-encoded AVX512-VNNI ISA
    extension.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_cpuid.c               |  1 +
 tools/misc/xen-cpuid.c                       |  2 +-
 tools/tests/x86_emulator/predicates.c        |  4 ++
 tools/tests/x86_emulator/test_x86_emulator.c | 55 ++++++++++++++++++++++++++++
 tools/tests/x86_emulator/x86-emulate.h       |  1 +
 xen/arch/x86/x86_emulate/x86_emulate.c       |  9 +++++
 xen/include/asm-x86/cpufeature.h             |  1 +
 xen/include/public/arch-x86/cpufeatureset.h  |  1 +
 xen/tools/gen-cpuid.py                       |  2 +-
 9 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 16c077cceb..259612834e 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -226,6 +226,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"core-caps",    0x00000007,  0, CPUID_REG_EDX, 30,  1},
         {"ssbd",         0x00000007,  0, CPUID_REG_EDX, 31,  1},
 
+        {"avx-vnni",     0x00000007,  1, CPUID_REG_EAX,  4,  1},
         {"avx512-bf16",  0x00000007,  1, CPUID_REG_EAX,  5,  1},
 
         {"lahfsahf",     0x80000001, NA, CPUID_REG_ECX,  0,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 2446941a47..c81aa93055 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -175,7 +175,7 @@ static const char *const str_7d0[32] =
 
 static const char *const str_7a1[32] =
 {
-    /* 4 */                 [ 5] = "avx512-bf16",
+    [ 4] = "avx-vnni",      [ 5] = "avx512-bf16",
 };
 
 static const struct {
diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c
index 137681ba78..94b99c94e8 100644
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -1335,6 +1335,10 @@ static const struct vex {
     { { 0x45 }, 2, T, R, pfx_66, Wn, Ln }, /* vpsrlv{d,q} */
     { { 0x46 }, 2, T, R, pfx_66, W0, Ln }, /* vpsravd */
     { { 0x47 }, 2, T, R, pfx_66, Wn, Ln }, /* vpsllv{d,q} */
+    { { 0x50 }, 2, T, R, pfx_66, W0, Ln }, /* vpdpbusd */
+    { { 0x51 }, 2, T, R, pfx_66, W0, Ln }, /* vpdpbusds */
+    { { 0x52 }, 2, T, R, pfx_66, W0, Ln }, /* vpdpwssd */
+    { { 0x53 }, 2, T, R, pfx_66, W0, Ln }, /* vpdpwssds */
     { { 0x58 }, 2, T, R, pfx_66, W0, Ln }, /* vpbroadcastd */
     { { 0x59 }, 2, T, R, pfx_66, W0, Ln }, /* vpbroadcastq */
     { { 0x5a }, 2, F, R, pfx_66, W0, L1 }, /* vbroadcasti128 */
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index b9663214e2..cbb8f34f58 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -5028,6 +5028,61 @@ int main(int argc, char **argv)
         printf("okay\n");
     }
 
+    printf("%-40s", "Testing vpdpwssd (%ecx),%{y,z}mmA,%{y,z}mmB...");
+    if ( stack_exec && cpu_has_avx512_vnni && cpu_has_avx_vnni )
+    {
+        /* Do the same operation two ways and compare the results. */
+        decl_insn(vpdpwssd_vex1);
+        decl_insn(vpdpwssd_vex2);
+        decl_insn(vpdpwssd_evex);
+
+        for ( i = 0; i < 24; ++i )
+            res[i] = i | (~i << 16);
+
+        asm volatile ( "vmovdqu32 32(%0), %%zmm1\n\t"
+                       "vextracti64x4 $1, %%zmm1, %%ymm2\n\t"
+                       "vpxor %%xmm0, %%xmm0, %%xmm3\n\t"
+                       "vpxor %%xmm0, %%xmm0, %%xmm4\n\t"
+                       "vpxor %%xmm0, %%xmm0, %%xmm5\n"
+                       put_insn(vpdpwssd_vex1,
+                                /* %{vex%} vpdpwssd (%1), %%ymm1, %%ymm3" */
+                                ".byte 0xc4, 0xe2, 0x75, 0x52, 0x19") "\n"
+                       put_insn(vpdpwssd_vex2,
+                                /* "%{vex%} vpdpwssd 32(%1), %%ymm2, %%ymm4" */
+                                ".byte 0xc4, 0xe2, 0x6d, 0x52, 0x61, 0x20") "\n"
+                       put_insn(vpdpwssd_evex,
+                                /* "vpdpwssd (%1), %%zmm1, %%zmm5" */
+                                ".byte 0x62, 0xf2, 0x75, 0x48, 0x52, 0x29")
+                       :: "r" (res), "c" (NULL) );
+
+        set_insn(vpdpwssd_vex1);
+        regs.ecx = (unsigned long)res;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( rc != X86EMUL_OKAY || !check_eip(vpdpwssd_vex1) )
+            goto fail;
+
+        set_insn(vpdpwssd_vex2);
+        regs.ecx = (unsigned long)res;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( rc != X86EMUL_OKAY || !check_eip(vpdpwssd_vex2) )
+            goto fail;
+
+        set_insn(vpdpwssd_evex);
+        regs.ecx = (unsigned long)res;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( rc != X86EMUL_OKAY || !check_eip(vpdpwssd_evex) )
+            goto fail;
+
+        asm ( "vinserti64x4 $1, %%ymm4, %%zmm3, %%zmm0\n\t"
+              "vpcmpeqd %%zmm0, %%zmm5, %%k0\n\t"
+              "kmovw %%k0, %0" : "=g" (rc) );
+        if ( rc != 0xffff )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
+
     printf("%-40s", "Testing invpcid 16(%ecx),%%edx...");
     if ( stack_exec )
     {
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index fc52edf8ce..e1a2aaef68 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -170,6 +170,7 @@ static inline bool xcr0_mask(uint64_t mask)
 #define cpu_has_avx512_4fmaps (cp.feat.avx512_4fmaps && xcr0_mask(0xe6))
 #define cpu_has_avx512_vp2intersect (cp.feat.avx512_vp2intersect && xcr0_mask(0xe6))
 #define cpu_has_serialize  cp.feat.serialize
+#define cpu_has_avx_vnni   (cp.feat.avx_vnni && xcr0_mask(6))
 #define cpu_has_avx512_bf16 (cp.feat.avx512_bf16 && xcr0_mask(0xe6))
 
 #define cpu_has_xgetbv1   (cpu_has_xsave && cp.xstate.xgetbv1)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index fd70551bc2..a35b63634b 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2008,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_avx_vnni()    (ctxt->cpuid->feat.avx_vnni)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
 #define vcpu_must_have(feat) \
@@ -9453,6 +9454,14 @@ x86_emulate(
         generate_exception_if(vex.l, EXC_UD);
         goto simd_0f_avx;
 
+    case X86EMUL_OPC_VEX_66(0x0f38, 0x50): /* vpdpbusd [xy]mm/mem,[xy]mm,[xy]mm */
+    case X86EMUL_OPC_VEX_66(0x0f38, 0x51): /* vpdpbusds [xy]mm/mem,[xy]mm,[xy]mm */
+    case X86EMUL_OPC_VEX_66(0x0f38, 0x52): /* vpdpwssd [xy]mm/mem,[xy]mm,[xy]mm */
+    case X86EMUL_OPC_VEX_66(0x0f38, 0x53): /* vpdpwssds [xy]mm/mem,[xy]mm,[xy]mm */
+        host_and_vcpu_must_have(avx_vnni);
+        generate_exception_if(vex.w, EXC_UD);
+        goto simd_0f_avx;
+
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x50): /* vpdpbusd [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x51): /* vpdpbusds [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x52): /* vpdpwssd [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 4de992781e..ad3d84bdde 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -133,6 +133,7 @@
 #define cpu_has_serialize       boot_cpu_has(X86_FEATURE_SERIALIZE)
 
 /* CPUID level 0x00000007:1.eax */
+#define cpu_has_avx_vnni        boot_cpu_has(X86_FEATURE_AVX_VNNI)
 #define cpu_has_avx512_bf16     boot_cpu_has(X86_FEATURE_AVX512_BF16)
 
 /* Synthesized. */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index ef7cca334d..6f7efaad6d 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -273,6 +273,7 @@ XEN_CPUFEATURE(CORE_CAPS,     9*32+30) /*   IA32_CORE_CAPABILITIES MSR */
 XEN_CPUFEATURE(SSBD,          9*32+31) /*A  MSR_SPEC_CTRL.SSBD available */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1.eax, word 10 */
+XEN_CPUFEATURE(AVX_VNNI,     10*32+ 4) /*A  AVX-VNNI Instructions */
 XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
 
 #endif /* XEN_CPUFEATURE */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 143ee7cae1..50412b9a46 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -252,7 +252,7 @@ def crunch_numbers(state):
         # feature flags.  If want to use AVX512, AVX2 must be supported and
         # enabled.  Certain later extensions, acting on 256-bit vectors of
         # integers, better depend on AVX2 than AVX.
-        AVX2: [AVX512F, VAES, VPCLMULQDQ],
+        AVX2: [AVX512F, VAES, VPCLMULQDQ, AVX_VNNI],
 
         # AVX512F is taken to mean hardware support for 512bit registers
         # (which in practice depends on the EVEX prefix to encode) as well
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:34:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:34:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17076.41901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Cq-0002jn-G9; Sun, 01 Nov 2020 02:34:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17076.41901; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Cq-0002jf-DB; Sun, 01 Nov 2020 02:34:56 +0000
Received: by outflank-mailman (input) for mailman id 17076;
 Sun, 01 Nov 2020 02:34:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3Co-0002jT-Cs
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:54 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4b4a2565-eae3-49e5-b29f-16b076a8c5ac;
 Sun, 01 Nov 2020 02:34:53 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Cn-0005lo-PL
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Cn-0003AJ-Od
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:53 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3Co-0002jT-Cs
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:54 +0000
X-Inumbo-ID: 4b4a2565-eae3-49e5-b29f-16b076a8c5ac
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 4b4a2565-eae3-49e5-b29f-16b076a8c5ac;
	Sun, 01 Nov 2020 02:34:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ctDmd6RgS74nI9ud/ZlcFMVkPnhImJPUWCIrgBsQa6A=; b=lTkfrHVjpe0N96hw+nRBn0bNvE
	HRdLXeG65krEhmBLnLs2RqY9ip6od11nTbeyB2l4eUkfcimLj+Pe4Nb4IFbSH+s1L3+uuYUbFdNmq
	zrggZel051Q5uktQL765x7b4fS8GDnFDN85jnLWm8tYL87wWtHqNvB6a5VnxMZPMeu2k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Cn-0005lo-PL
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Cn-0003AJ-Od
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:34:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: send mapcache invalidation request to qemu regardless of preemption
Message-Id: <E1kZ3Cn-0003AJ-Od@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:34:53 +0000

commit 177cf860f0b7dcbb8e0f4b495cad677995444c7a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Oct 30 14:30:00 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Oct 30 14:30:00 2020 +0100

    x86/HVM: send mapcache invalidation request to qemu regardless of preemption
    
    Even if only part of a hypercall completed before getting preempted,
    invalidation ought to occur. Therefore fold the two return statements.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hypercall.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index b6ccaf4457..ac573c8e94 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -326,14 +326,11 @@ int hvm_hypercall(struct cpu_user_regs *regs)
 
     HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%lu -> %lx", eax, regs->rax);
 
-    if ( curr->hcall_preempted )
-        return HVM_HCALL_preempted;
-
     if ( unlikely(currd->arch.hvm.qemu_mapcache_invalidate) &&
          test_and_clear_bool(currd->arch.hvm.qemu_mapcache_invalidate) )
         send_invalidate_req();
 
-    return HVM_HCALL_completed;
+    return curr->hcall_preempted ? HVM_HCALL_preempted : HVM_HCALL_completed;
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:35:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:35:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17077.41906 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3D0-0002lA-Hn; Sun, 01 Nov 2020 02:35:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17077.41906; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3D0-0002l2-Ee; Sun, 01 Nov 2020 02:35:06 +0000
Received: by outflank-mailman (input) for mailman id 17077;
 Sun, 01 Nov 2020 02:35:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3Cy-0002kr-G7
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a447f0c7-cd76-436c-9f93-fd8fb39c7b85;
 Sun, 01 Nov 2020 02:35:04 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Cx-0005mA-Sb
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Cx-0003B4-Rn
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:03 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3Cy-0002kr-G7
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:04 +0000
X-Inumbo-ID: a447f0c7-cd76-436c-9f93-fd8fb39c7b85
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id a447f0c7-cd76-436c-9f93-fd8fb39c7b85;
	Sun, 01 Nov 2020 02:35:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=44ua6zdu0RUlI1CbgncRYSy2DZQSKSpQ3I7TRyt6j8E=; b=JyG6FyooPHFU5O/MbQ2H0NMTZM
	UBnb7pGb3FvPFtE3xJy95jaeGoIn3vasa91eUdJIgmvI0sfKWimKILqVdveJMMC9h0fbBfNtD9/wq
	4Zz5FV4Hr2GZ+O9ErieEwtsqJS0TMF/RcsOg7pi5Yl6UGeYfPgY7tKVNWpHZ9byIiu+w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Cx-0005mA-Sb
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Cx-0003B4-Rn
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: fix build of PV shim when !GRANT_TABLE
Message-Id: <E1kZ3Cx-0003B4-Rn@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:35:03 +0000

commit b1b4f9598b021c7a9dc6b33eb55bc3e5912614f6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Oct 30 14:30:35 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Oct 30 14:30:35 2020 +0100

    x86: fix build of PV shim when !GRANT_TABLE
    
    To do its compat translation, shim code needs to include the compat
    header. For this to work, this header first of all needs to be
    generated.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/include/Makefile b/xen/include/Makefile
index 5c2f57a0f6..75e982a316 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -24,6 +24,7 @@ headers-$(CONFIG_X86)     += compat/arch-x86/xen-$(compat-arch-y).h
 headers-$(CONFIG_ARGO)    += compat/argo.h
 headers-$(CONFIG_PV)      += compat/callback.h
 headers-$(CONFIG_GRANT_TABLE) += compat/grant_table.h
+headers-$(CONFIG_PV_SHIM) += compat/grant_table.h
 headers-$(CONFIG_HVM)     += compat/hvm/dm_op.h
 headers-$(CONFIG_HVM)     += compat/hvm/hvm_op.h
 headers-$(CONFIG_HVM)     += compat/hvm/hvm_vcpu.h
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:35:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:35:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17078.41910 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3DA-0002mX-Jt; Sun, 01 Nov 2020 02:35:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17078.41910; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3DA-0002mM-GB; Sun, 01 Nov 2020 02:35:16 +0000
Received: by outflank-mailman (input) for mailman id 17078;
 Sun, 01 Nov 2020 02:35:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3D8-0002mC-Nx
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:14 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8d2949dc-4ffd-49bb-ad4d-038a37ad22f9;
 Sun, 01 Nov 2020 02:35:14 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3D8-0005mD-02
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3D7-0003Bm-VM
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3D8-0002mC-Nx
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:14 +0000
X-Inumbo-ID: 8d2949dc-4ffd-49bb-ad4d-038a37ad22f9
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 8d2949dc-4ffd-49bb-ad4d-038a37ad22f9;
	Sun, 01 Nov 2020 02:35:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UyvmTRtsvaf2uGu8Jon3jcxgO/Rqj083twZ/v22OAio=; b=idX4600WFWwsSD7Nj9SHslKC1p
	yWqxBYz3hx2QVcK/nEAw4UkSY+B+jx+YyadJy92UYs7mNelT4yYHewzHJsUXsBNmRZ2RHTj69Cy1J
	IHt9y5ARDrpBJX5V204+OFv9AQlKh9rcmUJtq2sDrrz4plc8+ROJiNIIL/skd6+rEE2M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3D8-0005mD-02
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3D7-0003Bm-VM
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: PV shim doesn't need GRANT_TABLE
Message-Id: <E1kZ3D7-0003Bm-VM@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:35:13 +0000

commit ca56b06043bb4241eeb0a41a60daffb1408a08d5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Oct 30 14:31:00 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Oct 30 14:31:00 2020 +0100

    x86: PV shim doesn't need GRANT_TABLE
    
    The only reference into the code controlled by this option is from the
    hypercall table, and that hypercall table entry gets overwritten.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/configs/pvshim_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/configs/pvshim_defconfig b/xen/arch/x86/configs/pvshim_defconfig
index 5478b991ac..cdf5776610 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -9,6 +9,7 @@ CONFIG_EXPERT=y
 CONFIG_SCHED_NULL=y
 # Disable features not used by the PV shim
 # CONFIG_XEN_SHSTK is not set
+# CONFIG_GRANT_TABLE is not set
 # CONFIG_HYPFS is not set
 # CONFIG_BIGMEM is not set
 # CONFIG_KEXEC is not set
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:35:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:35:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17079.41914 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3DK-0002oT-Lq; Sun, 01 Nov 2020 02:35:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17079.41914; Sun, 01 Nov 2020 02: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3DK-0002oL-I9; Sun, 01 Nov 2020 02:35:26 +0000
Received: by outflank-mailman (input) for mailman id 17079;
 Sun, 01 Nov 2020 02:35:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3DI-0002o8-Ny
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:24 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id faba7295-48ea-4d21-959c-b4534e819fed;
 Sun, 01 Nov 2020 02:35:24 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3DI-0005ms-3V
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3DI-0003CG-2d
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3DI-0002o8-Ny
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:24 +0000
X-Inumbo-ID: faba7295-48ea-4d21-959c-b4534e819fed
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id faba7295-48ea-4d21-959c-b4534e819fed;
	Sun, 01 Nov 2020 02:35:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9JmpD49MS3hKBKWczKwi3/NxNBrid1HAPn7BtTsxut0=; b=XAanlgZfk1m/6iwHy6tHhMQ4Hh
	GWOWX7ty8h3+2Zu3s9zT357de/BrlriDWVvlwxn4eo43lfi7NH8VRsNnkY+c9aefyxZE6WGcdcdXT
	8fnxsOp9VsAe4wsYcXC0R/JbH+I3GzGVQU/EuMWcdiOZku1dP4RDKTHU8SQLzN5CkGQg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3DI-0005ms-3V
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3DI-0003CG-2d
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()
Message-Id: <E1kZ3DI-0003CG-2d@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:35:24 +0000

commit 1c4aa69ca1e1fad20b2158051eb152276d1eb973
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Sep 26 17:44:29 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Oct 30 18:17:34 2020 +0000

    xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()
    
    The functions acpi_os_{un,}map_memory() are meant to be arch-agnostic
    while the __acpi_os_{un,}map_memory() are meant to be arch-specific.
    
    Currently, the former are still containing x86 specific code.
    
    To avoid this rather strange split, the generic helpers are reworked so
    they are arch-agnostic. This requires the introduction of a new helper
    __acpi_os_unmap_memory() that will undo any mapping done by
    __acpi_os_map_memory().
    
    Currently, the arch-helper for unmap is basically a no-op so it only
    returns whether the mapping was arch specific. But this will change
    in the future.
    
    Note that the x86 version of acpi_os_map_memory() was already able to
    able the 1MB region. Hence why there is no addition of new code.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Elliott Mitchell <ehem+xen@m5p.com>
---
 xen/arch/arm/acpi/lib.c | 12 ++++++++++++
 xen/arch/x86/acpi/lib.c | 18 ++++++++++++++++++
 xen/drivers/acpi/osl.c  | 34 ++++++++++++++++++----------------
 xen/include/xen/acpi.h  |  1 +
 4 files changed, 49 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
index 4fc6e17322..fcc186b033 100644
--- a/xen/arch/arm/acpi/lib.c
+++ b/xen/arch/arm/acpi/lib.c
@@ -30,6 +30,10 @@ char *__acpi_map_table(paddr_t phys, unsigned long size)
     unsigned long base, offset, mapped_size;
     int idx;
 
+    /* No arch specific implementation after early boot */
+    if ( system_state >= SYS_STATE_boot )
+        return NULL;
+
     offset = phys & (PAGE_SIZE - 1);
     mapped_size = PAGE_SIZE - offset;
     set_fixmap(FIXMAP_ACPI_BEGIN, maddr_to_mfn(phys), PAGE_HYPERVISOR);
@@ -49,6 +53,14 @@ char *__acpi_map_table(paddr_t phys, unsigned long size)
     return ((char *) base + offset);
 }
 
+bool __acpi_unmap_table(const void *ptr, unsigned long size)
+{
+    vaddr_t vaddr = (vaddr_t)ptr;
+
+    return ((vaddr >= FIXMAP_ADDR(FIXMAP_ACPI_BEGIN)) &&
+            (vaddr < (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE)));
+}
+
 /* True to indicate PSCI 0.2+ is implemented */
 bool __init acpi_psci_present(void)
 {
diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c
index 265b9ad819..a22414a05c 100644
--- a/xen/arch/x86/acpi/lib.c
+++ b/xen/arch/x86/acpi/lib.c
@@ -46,6 +46,10 @@ char *__acpi_map_table(paddr_t phys, unsigned long size)
 	if ((phys + size) <= (1 * 1024 * 1024))
 		return __va(phys);
 
+	/* No further arch specific implementation after early boot */
+	if (system_state >= SYS_STATE_boot)
+		return NULL;
+
 	offset = phys & (PAGE_SIZE - 1);
 	mapped_size = PAGE_SIZE - offset;
 	set_fixmap(FIX_ACPI_END, phys);
@@ -66,6 +70,20 @@ char *__acpi_map_table(paddr_t phys, unsigned long size)
 	return ((char *) base + offset);
 }
 
+bool __acpi_unmap_table(const void *ptr, unsigned long size)
+{
+	unsigned long vaddr = (unsigned long)ptr;
+
+	if ((vaddr >= DIRECTMAP_VIRT_START) &&
+	    (vaddr < DIRECTMAP_VIRT_END)) {
+		ASSERT(!((__pa(ptr) + size - 1) >> 20));
+		return true;
+	}
+
+	return ((vaddr >= __fix_to_virt(FIX_ACPI_END)) &&
+		(vaddr < (__fix_to_virt(FIX_ACPI_BEGIN) + PAGE_SIZE)));
+}
+
 unsigned int acpi_get_processor_id(unsigned int cpu)
 {
 	unsigned int acpiid, apicid;
diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c
index 4c8bb7839e..389505f786 100644
--- a/xen/drivers/acpi/osl.c
+++ b/xen/drivers/acpi/osl.c
@@ -92,27 +92,29 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
 void __iomem *
 acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
 {
-	if (system_state >= SYS_STATE_boot) {
-		mfn_t mfn = _mfn(PFN_DOWN(phys));
-		unsigned int offs = phys & (PAGE_SIZE - 1);
-
-		/* The low first Mb is always mapped on x86. */
-		if (IS_ENABLED(CONFIG_X86) && !((phys + size - 1) >> 20))
-			return __va(phys);
-		return __vmap(&mfn, PFN_UP(offs + size), 1, 1,
-			      ACPI_MAP_MEM_ATTR, VMAP_DEFAULT) + offs;
-	}
-	return __acpi_map_table(phys, size);
+	void *ptr;
+	mfn_t mfn = _mfn(PFN_DOWN(phys));
+	unsigned int offs = PAGE_OFFSET(phys);
+
+	/* Try the arch specific implementation first */
+	ptr = __acpi_map_table(phys, size);
+	if (ptr)
+		return ptr;
+
+	/* No common implementation for early boot map */
+	if (unlikely(system_state < SYS_STATE_boot))
+		return NULL;
+
+	ptr = __vmap(&mfn, PFN_UP(offs + size), 1, 1,
+		     ACPI_MAP_MEM_ATTR, VMAP_DEFAULT);
+
+	return !ptr ? NULL : (ptr + offs);
 }
 
 void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
 {
-	if (IS_ENABLED(CONFIG_X86) &&
-	    (unsigned long)virt >= DIRECTMAP_VIRT_START &&
-	    (unsigned long)virt < DIRECTMAP_VIRT_END) {
-		ASSERT(!((__pa(virt) + size - 1) >> 20));
+	if (__acpi_unmap_table(virt, size))
 		return;
-	}
 
 	if (system_state >= SYS_STATE_boot)
 		vunmap((void *)((unsigned long)virt & PAGE_MASK));
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index c945ab05c8..21d5e9feb5 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -68,6 +68,7 @@ typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, co
 
 unsigned int acpi_get_processor_id (unsigned int cpu);
 char * __acpi_map_table (paddr_t phys_addr, unsigned long size);
+bool __acpi_unmap_table(const void *ptr, unsigned long size);
 int acpi_boot_init (void);
 int acpi_boot_table_init (void);
 int acpi_numa_init (void);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:35:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:35:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17080.41917 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3DU-0002pi-Me; Sun, 01 Nov 2020 02:35:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17080.41917; Sun, 01 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3DU-0002pb-Jl; Sun, 01 Nov 2020 02:35:36 +0000
Received: by outflank-mailman (input) for mailman id 17080;
 Sun, 01 Nov 2020 02:35:34 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3DS-0002pQ-Sk
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:34 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 73932ad1-2985-4ecf-be0f-faff68e4b877;
 Sun, 01 Nov 2020 02:35:34 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3DS-0005n7-6g
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3DS-0003Cu-5v
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:34 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3DS-0002pQ-Sk
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:34 +0000
X-Inumbo-ID: 73932ad1-2985-4ecf-be0f-faff68e4b877
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 73932ad1-2985-4ecf-be0f-faff68e4b877;
	Sun, 01 Nov 2020 02:35:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R/hTk54TrFziDwDn7ro3Wn8Z8RvNTkl902q4n6QuAzE=; b=sA8NnMtfrSWmzHS5FI/zIBMgdC
	Audx6dJ2G8BMEhzymzo48U1GC+kiZaV1jBtExi7ip2ezrwB2mt6wnPP2HxKOBkLL+S/rV8/zM6icW
	4Ps08YUMPCyjUdjyZiZDhuUVAsx0pSQYsWrootRZES3wOV6R155N2T6Yk+fl2k3BpgZ0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3DS-0005n7-6g
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3DS-0003Cu-5v
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: acpi: The fixmap area should always be cleared during failure/unmap
Message-Id: <E1kZ3DS-0003Cu-5v@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:35:34 +0000

commit 4d625ff3c3a939dc270b03654337568c30c5ab6e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Sep 26 19:53:27 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Oct 30 18:43:23 2020 +0000

    xen/arm: acpi: The fixmap area should always be cleared during failure/unmap
    
    Commit 022387ee1ad3 "xen/arm: mm: Don't open-code Xen PT update in
    {set, clear}_fixmap()" enforced that each set_fixmap() should be
    paired with a clear_fixmap(). Any failure to follow the model would
    result to a platform crash.
    
    Unfortunately, the use of fixmap in the ACPI code was overlooked as it
    is calling set_fixmap() but not clear_fixmap().
    
    The function __acpi_os_map_table() is reworked so:
        - We know before the mapping whether the fixmap region is big
        enough for the mapping.
        - It will fail if the fixmap is already in use. This is not a
        change of behavior but clarifying the current expectation to avoid
        hitting a BUG().
    
    The function __acpi_os_unmap_table() will now call clear_fixmap().
    
    Reported-by: Wei Xu <xuwei5@hisilicon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/acpi/lib.c | 73 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 56 insertions(+), 17 deletions(-)

diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
index fcc186b033..a59cc4074c 100644
--- a/xen/arch/arm/acpi/lib.c
+++ b/xen/arch/arm/acpi/lib.c
@@ -25,40 +25,79 @@
 #include <xen/init.h>
 #include <xen/mm.h>
 
+static bool fixmap_inuse;
+
 char *__acpi_map_table(paddr_t phys, unsigned long size)
 {
-    unsigned long base, offset, mapped_size;
-    int idx;
+    unsigned long base, offset;
+    mfn_t mfn;
+    unsigned int idx;
 
     /* No arch specific implementation after early boot */
     if ( system_state >= SYS_STATE_boot )
         return NULL;
 
     offset = phys & (PAGE_SIZE - 1);
-    mapped_size = PAGE_SIZE - offset;
-    set_fixmap(FIXMAP_ACPI_BEGIN, maddr_to_mfn(phys), PAGE_HYPERVISOR);
-    base = FIXMAP_ADDR(FIXMAP_ACPI_BEGIN);
+    base = FIXMAP_ADDR(FIXMAP_ACPI_BEGIN) + offset;
+
+    /* Check the fixmap is big enough to map the region */
+    if ( (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE - base) < size )
+        return NULL;
+
+    /* With the fixmap, we can only map one region at the time */
+    if ( fixmap_inuse )
+        return NULL;
 
-    /* Most cases can be covered by the below. */
+    fixmap_inuse = true;
+
+    size += offset;
+    mfn = maddr_to_mfn(phys);
     idx = FIXMAP_ACPI_BEGIN;
-    while ( mapped_size < size )
-    {
-        if ( ++idx > FIXMAP_ACPI_END )
-            return NULL;    /* cannot handle this */
-        phys += PAGE_SIZE;
-        set_fixmap(idx, maddr_to_mfn(phys), PAGE_HYPERVISOR);
-        mapped_size += PAGE_SIZE;
-    }
 
-    return ((char *) base + offset);
+    do {
+        set_fixmap(idx, mfn, PAGE_HYPERVISOR);
+        size -= min(size, (unsigned long)PAGE_SIZE);
+        mfn = mfn_add(mfn, 1);
+        idx++;
+    } while ( size > 0 );
+
+    return (char *)base;
 }
 
 bool __acpi_unmap_table(const void *ptr, unsigned long size)
 {
     vaddr_t vaddr = (vaddr_t)ptr;
+    unsigned int idx;
+
+    /* We are only handling fixmap address in the arch code */
+    if ( (vaddr < FIXMAP_ADDR(FIXMAP_ACPI_BEGIN)) ||
+         (vaddr >= (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE)) )
+        return false;
+
+    /*
+     * __acpi_map_table() will always return a pointer in the first page
+     * for the ACPI fixmap region. The caller is expected to free with
+     * the same address.
+     */
+    ASSERT((vaddr & PAGE_MASK) == FIXMAP_ADDR(FIXMAP_ACPI_BEGIN));
+
+    /* The region allocated fit in the ACPI fixmap region. */
+    ASSERT(size < (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE - vaddr));
+    ASSERT(fixmap_inuse);
+
+    fixmap_inuse = false;
+
+    size += vaddr - FIXMAP_ADDR(FIXMAP_ACPI_BEGIN);
+    idx = FIXMAP_ACPI_BEGIN;
+
+    do
+    {
+        clear_fixmap(idx);
+        size -= min(size, (unsigned long)PAGE_SIZE);
+        idx++;
+    } while ( size > 0 );
 
-    return ((vaddr >= FIXMAP_ADDR(FIXMAP_ACPI_BEGIN)) &&
-            (vaddr < (FIXMAP_ADDR(FIXMAP_ACPI_END) + PAGE_SIZE)));
+    return true;
 }
 
 /* True to indicate PSCI 0.2+ is implemented */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:35:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:35:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17081.41922 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3De-0002r0-PG; Sun, 01 Nov 2020 02:35:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17081.41922; Sun, 01 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3De-0002qt-LN; Sun, 01 Nov 2020 02:35:46 +0000
Received: by outflank-mailman (input) for mailman id 17081;
 Sun, 01 Nov 2020 02:35:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3Dc-0002qk-UP
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:44 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4da7c81e-0ca8-40fe-9f4b-aa77d8ae4694;
 Sun, 01 Nov 2020 02:35:44 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Dc-0005nA-9q
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Dc-0003Di-94
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3Dc-0002qk-UP
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:44 +0000
X-Inumbo-ID: 4da7c81e-0ca8-40fe-9f4b-aa77d8ae4694
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 4da7c81e-0ca8-40fe-9f4b-aa77d8ae4694;
	Sun, 01 Nov 2020 02:35:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1n+LY2Akdm6Om/4S8wonndJgyxRQXsMB1/gjGShGGi0=; b=fgbYumYSZVQpw/oT9POZ5xV7Jx
	FXnnazE4iL45Lmts8TMwIa1DArVvxroQeikrGEfOyNCsEtRyBkTuUd2qNjKpXiEPix4D8uK8bpyXF
	BuOUtMernvdYIqEjWy+3gkQpS1rppHS7O+zu5FGddr8fAGw2GJlJg8HOdFKwBvJH6KU4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Dc-0005nA-9q
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Dc-0003Di-94
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Check if the platform is not using ACPI before initializing Dom0less
Message-Id: <E1kZ3Dc-0003Di-94@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:35:44 +0000

commit dac867bf9adc1562a4cf9db5f89726597af13ef8
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Sep 26 21:16:55 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Oct 30 18:43:42 2020 +0000

    xen/arm: Check if the platform is not using ACPI before initializing Dom0less
    
    Dom0less requires a device-tree. However, since commit 6e3e77120378
    "xen/arm: setup: Relocate the Device-Tree later on in the boot", the
    device-tree will not get unflatten when using ACPI.
    
    This will lead to a crash during boot.
    
    Given the complexity to setup dom0less with ACPI (for instance how to
    assign device?), we should skip any code related to Dom0less when using
    ACPI.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Tested-by: Elliott Mitchell <ehem+xen@m5p.com>
---
 xen/arch/arm/setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index f16b33fa87..35e5bee04e 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -987,7 +987,8 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     system_state = SYS_STATE_active;
 
-    create_domUs();
+    if ( acpi_disabled )
+        create_domUs();
 
     domain_unpause_by_systemcontroller(dom0);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:35:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:35:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17082.41926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Dn-0002sX-Rv; Sun, 01 Nov 2020 02:35:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17082.41926; Sun, 01 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Dn-0002sP-Ow; Sun, 01 Nov 2020 02:35:55 +0000
Received: by outflank-mailman (input) for mailman id 17082;
 Sun, 01 Nov 2020 02:35:55 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3Dn-0002sG-0v
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:55 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9c4e428b-c769-45a2-86bb-8a6d0f5d0de8;
 Sun, 01 Nov 2020 02:35:54 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Dm-0005nL-DE
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Dm-0003Ea-CQ
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3Dn-0002sG-0v
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:55 +0000
X-Inumbo-ID: 9c4e428b-c769-45a2-86bb-8a6d0f5d0de8
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 9c4e428b-c769-45a2-86bb-8a6d0f5d0de8;
	Sun, 01 Nov 2020 02:35:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qKAIQ0E2Iw0422vPJXTEo2veHIPnaiIbNx+pnkbujlc=; b=xbo+EgaHsjiKGZOviJOI7TEzCy
	qffEMq6OTQJSA07m3751XdowAVesJHL6fE55f9DMwjK1cvrYdz2Rs7kxYyWQn3IfzKjptpMDbCkfN
	EzjJ+dXYO+s47ypzVbLVj8SP5tXmIv2VLzw4NgIogaIyx9mftv/Z3SZw2CYaSeOgT7SA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Dm-0005nL-DE
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Dm-0003Ea-CQ
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:35:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Introduce fw_unreserved_regions() and use it
Message-Id: <E1kZ3Dm-0003Ea-CQ@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:35:54 +0000

commit 9c2bc0f24b2ba7082df408b3c33ec9a86bf20cf0
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Sep 26 21:30:14 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Oct 30 18:43:42 2020 +0000

    xen/arm: Introduce fw_unreserved_regions() and use it
    
    Since commit 6e3e77120378 "xen/arm: setup: Relocate the Device-Tree
    later on in the boot", the device-tree will not be kept mapped when
    using ACPI.
    
    However, a few places are calling dt_unreserved_regions() which expects
    a valid DT. This will lead to a crash.
    
    As the DT should not be used for ACPI (other than for detecting the
    modules), a new function fw_unreserved_regions() is introduced.
    
    It will behave the same way on DT system. On ACPI system, it will
    unreserve the whole region.
    
    Take the opportunity to clarify that bootinfo.reserved_mem is only used
    when booting using Device-Tree.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/kernel.c       |  2 +-
 xen/arch/arm/setup.c        | 22 +++++++++++++++++-----
 xen/include/asm-arm/setup.h |  3 ++-
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 032923853f..ab78689ed2 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -307,7 +307,7 @@ static __init int kernel_decompress(struct bootmodule *mod)
      * Free the original kernel, update the pointers to the
      * decompressed kernel
      */
-    dt_unreserved_regions(addr, addr + size, init_domheap_pages, 0);
+    fw_unreserved_regions(addr, addr + size, init_domheap_pages, 0);
 
     return 0;
 }
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 35e5bee04e..7fcff9af2a 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -196,8 +196,9 @@ static void __init processor_id(void)
     processor_setup();
 }
 
-void __init dt_unreserved_regions(paddr_t s, paddr_t e,
-                                  void (*cb)(paddr_t, paddr_t), int first)
+static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
+                                         void (*cb)(paddr_t, paddr_t),
+                                         int first)
 {
     int i, nr = fdt_num_mem_rsv(device_tree_flattened);
 
@@ -244,6 +245,17 @@ void __init dt_unreserved_regions(paddr_t s, paddr_t e,
     cb(s, e);
 }
 
+void __init fw_unreserved_regions(paddr_t s, paddr_t e,
+                                  void (*cb)(paddr_t, paddr_t), int first)
+{
+    if ( acpi_disabled )
+        dt_unreserved_regions(s, e, cb, first);
+    else
+        cb(s, e);
+}
+
+
+
 struct bootmodule __init *add_boot_module(bootmodule_kind kind,
                                           paddr_t start, paddr_t size,
                                           bool domU)
@@ -405,7 +417,7 @@ void __init discard_initial_modules(void)
              !mfn_valid(maddr_to_mfn(e)) )
             continue;
 
-        dt_unreserved_regions(s, e, init_domheap_pages, 0);
+        fw_unreserved_regions(s, e, init_domheap_pages, 0);
     }
 
     mi->nr_mods = 0;
@@ -712,7 +724,7 @@ static void __init setup_mm(void)
                 n = mfn_to_maddr(mfn_add(xenheap_mfn_start, xenheap_pages));
             }
 
-            dt_unreserved_regions(s, e, init_boot_pages, 0);
+            fw_unreserved_regions(s, e, init_boot_pages, 0);
 
             s = n;
         }
@@ -765,7 +777,7 @@ static void __init setup_mm(void)
             if ( e > bank_end )
                 e = bank_end;
 
-            dt_unreserved_regions(s, e, init_boot_pages, 0);
+            fw_unreserved_regions(s, e, init_boot_pages, 0);
             s = n;
         }
     }
diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index 2f8f24e286..28bf622aa1 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -67,6 +67,7 @@ struct bootcmdlines {
 
 struct bootinfo {
     struct meminfo mem;
+    /* The reserved regions are only used when booting using Device-Tree */
     struct meminfo reserved_mem;
     struct bootmodules modules;
     struct bootcmdlines cmdlines;
@@ -96,7 +97,7 @@ int construct_dom0(struct domain *d);
 void create_domUs(void);
 
 void discard_initial_modules(void);
-void dt_unreserved_regions(paddr_t s, paddr_t e,
+void fw_unreserved_regions(paddr_t s, paddr_t e,
                            void (*cb)(paddr_t, paddr_t), int first);
 
 size_t boot_fdt_info(const void *fdt, paddr_t paddr);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 02:36:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 02:36:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17083.41930 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Dx-0002tw-U9; Sun, 01 Nov 2020 02:36:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17083.41930; Sun, 01 Nov 2020 02:36: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZ3Dx-0002tn-QU; Sun, 01 Nov 2020 02:36:05 +0000
Received: by outflank-mailman (input) for mailman id 17083;
 Sun, 01 Nov 2020 02:36:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZ3Dx-0002ti-42
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:36:05 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 48c3f4bc-5f4b-4c99-90aa-3e5021599d3c;
 Sun, 01 Nov 2020 02:36:04 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Dw-0005ni-Gb
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:36:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZ3Dw-0003Fh-Fj
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:36:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZ3Dx-0002ti-42
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:36:05 +0000
X-Inumbo-ID: 48c3f4bc-5f4b-4c99-90aa-3e5021599d3c
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 48c3f4bc-5f4b-4c99-90aa-3e5021599d3c;
	Sun, 01 Nov 2020 02:36:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ud1XzHmhRneJE2g4NIRnzej1lbckPJEZI5D+BUjY/f8=; b=Fwq9UQfjOwNNdL4VMvFb86kVVi
	Wly8EFr76aB6QrEo9m+2Hj5W0JcDSvonNN14QlukR6h2T4guwjDOOxHU+K6/le0fHmHHtCirgJ3OQ
	X3RUYT3oNPOrI3timfuigiYbVdVs7AM2rI8MQEzRYj1foRbvqgYB7Lrd9nWXhkjEJdbY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Dw-0005ni-Gb
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:36:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZ3Dw-0003Fh-Fj
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 02:36:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: acpi: add BAD_MADT_GICC_ENTRY() macro
Message-Id: <E1kZ3Dw-0003Fh-Fj@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 02:36:04 +0000

commit 7056f2f89f03f2f804ac7e776c7b2b000cd716cd
Author:     Julien Grall <julien.grall@arm.com>
AuthorDate: Wed Sep 30 12:25:04 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Oct 30 18:47:14 2020 +0000

    xen/arm: acpi: add BAD_MADT_GICC_ENTRY() macro
    
    Imported from Linux commit b6cfb277378ef831c0fa84bcff5049307294adc6:
    
        The BAD_MADT_ENTRY() macro is designed to work for all of the subtables
        of the MADT.  In the ACPI 5.1 version of the spec, the struct for the
        GICC subtable (struct acpi_madt_generic_interrupt) is 76 bytes long; in
        ACPI 6.0, the struct is 80 bytes long.  But, there is only one definition
        in ACPICA for this struct -- and that is the 6.0 version.  Hence, when
        BAD_MADT_ENTRY() compares the struct size to the length in the GICC
        subtable, it fails if 5.1 structs are in use, and there are systems in
        the wild that have them.
    
        This patch adds the BAD_MADT_GICC_ENTRY() that checks the GICC subtable
        only, accounting for the difference in specification versions that are
        possible.  The BAD_MADT_ENTRY() will continue to work as is for all other
        MADT subtables.
    
        This code is being added to an arm64 header file since that is currently
        the only architecture using the GICC subtable of the MADT.  As a GIC is
        specific to ARM, it is also unlikely the subtable will be used elsewhere.
    
        Fixes: aeb823bbacc2 ("ACPICA: ACPI 6.0: Add changes for FADT table.")
        Signed-off-by: Al Stone <al.stone@linaro.org>
        Acked-by: Will Deacon <will.deacon@arm.com>
        Acked-by: "Rafael J. Wysocki" <rjw@rjwysocki.net>
        [catalin.marinas@arm.com: extra brackets around macro arguments]
        Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    
    Signed-off-by: Julien Grall <julien.grall@arm.com>
    Signed-off-by: Andre Przywara <andre.przywara@arm.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Tested-by: Elliott Mitchell <ehem+xen@m5p.com>
---
 xen/include/asm-arm/acpi.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h
index 50340281a9..b52ae2d6ef 100644
--- a/xen/include/asm-arm/acpi.h
+++ b/xen/include/asm-arm/acpi.h
@@ -54,6 +54,14 @@ void acpi_smp_init_cpus(void);
  */
 paddr_t acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index);
 
+/* Macros for consistency checks of the GICC subtable of MADT */
+#define ACPI_MADT_GICC_LENGTH	\
+    (acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
+
+#define BAD_MADT_GICC_ENTRY(entry, end)						\
+    (!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) ||	\
+     (entry)->header.length != ACPI_MADT_GICC_LENGTH)
+
 #ifdef CONFIG_ACPI
 extern bool acpi_disabled;
 /* Basic configuration for ACPI */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 21:22:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 21:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17324.42110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZKne-0000IR-Or; Sun, 01 Nov 2020 21:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17324.42110; Sun, 01 Nov 2020 21: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZKne-0000IJ-Lv; Sun, 01 Nov 2020 21:22:06 +0000
Received: by outflank-mailman (input) for mailman id 17324;
 Sun, 01 Nov 2020 21:22:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZKnd-0000IE-5w
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:05 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9ae4ef30-3942-4e91-9ed4-21ca3514937c;
 Sun, 01 Nov 2020 21:22:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZKna-0004xu-OV
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZKna-0001ve-MY
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZKnd-0000IE-5w
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:05 +0000
X-Inumbo-ID: 9ae4ef30-3942-4e91-9ed4-21ca3514937c
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 9ae4ef30-3942-4e91-9ed4-21ca3514937c;
	Sun, 01 Nov 2020 21:22:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nnfg01I+4/emzmXwcBPq7Tv0+TPVUuP/fVxkrf7shzM=; b=MuRAjCTf5z1fEKPu4Gsej3z4v/
	idjZ4ZnDuX9Y/FjVxosO3YjfM7wPKIgTfMX691VvVtYLd4yo6wuIqI+t5twYXkmqBSFrLIQwbePDK
	5HCJLb7EkmuGXTz2GPi/9uTwQrCaRlHyPZr3wM0So4l65JQ5uJXzd28r7n3EiQa4KW6I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZKna-0004xu-OV
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZKna-0001ve-MY
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] x86/pv: Drop FLUSH_TLB_GLOBAL in do_mmu_update() for XPTI
Message-Id: <E1kZKna-0001ve-MY@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 21:22:02 +0000

commit b1d6f37aa5aa9f3fc5a269b9dd21b7feb7444be0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 22 11:28:58 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 27 18:03:32 2020 +0000

    x86/pv: Drop FLUSH_TLB_GLOBAL in do_mmu_update() for XPTI
    
    c/s 9d1d31ad9498 "x86: slightly reduce Meltdown band-aid overhead" removed the
    use of Global TLB flushes on the Xen entry path, but added a FLUSH_TLB_GLOBAL
    to the L4 path in do_mmu_update().
    
    However, this was unnecessary.
    
    It is the guests responsibility to perform appropriate TLB flushing if the L4
    modification altered an established mapping in a flush-relevant way.  In this
    case, an MMUEXT_OP hypercall will follow.  The case which Xen needs to cover
    is when new mappings are created, and the resync on the exit-to-guest path
    covers this correctly.
    
    There is a corner case with multiple vCPUs in hypercalls at the same time,
    which 9d1d31ad9498 changed, and this patch changes back to its original XPTI
    behaviour.
    
    Architecturally, established TLB entries can continue to be used until the
    broadcast flush has completed.  Therefore, even with concurrent hypercalls,
    the guest cannot depend on older mappings not being used until an MMUEXT_OP
    hypercall completes.  Xen's implementation of guest-initiated flushes will
    take correct effect on top of an in-progress hypercall, picking up new mapping
    setting before the other vCPU's MMUEXT_OP completes.
    
    Note: The correctness of this change is not impacted by whether XPTI uses
    global mappings or not.  Correctness there depends on the behaviour of Xen on
    the entry/exit paths when switching two/from the XPTI "shadow" pagetables.
    
    This is (not really) XSA-286 (but necessary to simplify the logic).
    
    Fixes: 9d1d31ad9498 ("x86: slightly reduce Meltdown band-aid overhead")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 055e1c3a3d95b1e753148369fbc4ba48782dd602)
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index e7b8f4ee4b..86f31b334f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4301,7 +4301,7 @@ long do_mmu_update(
 
         cpumask_andnot(mask, pt_owner->dirty_cpumask, cpumask_of(cpu));
         if ( !cpumask_empty(mask) )
-            flush_mask(mask, FLUSH_TLB_GLOBAL | FLUSH_ROOT_PGTBL);
+            flush_mask(mask, FLUSH_ROOT_PGTBL);
     }
 
     perfc_add(num_page_updates, i);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sun Nov 01 21:22:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 01 Nov 2020 21:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17325.42114 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZKnn-0000JG-QZ; Sun, 01 Nov 2020 21:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17325.42114; Sun, 01 Nov 2020 21: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZKnn-0000J8-NQ; Sun, 01 Nov 2020 21:22:15 +0000
Received: by outflank-mailman (input) for mailman id 17325;
 Sun, 01 Nov 2020 21:22:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZKnm-0000Iz-D9
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:14 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ef36af47-4e6b-4471-823c-a6402e7634e4;
 Sun, 01 Nov 2020 21:22:13 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZKnk-0004xx-SK
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZKnk-0001wD-RC
 for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:12 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=67BP=EH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZKnm-0000Iz-D9
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:14 +0000
X-Inumbo-ID: ef36af47-4e6b-4471-823c-a6402e7634e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id ef36af47-4e6b-4471-823c-a6402e7634e4;
	Sun, 01 Nov 2020 21:22:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8XAO+BQl8eSdmUQeUt/UDFMdxnW/1lXf06je9Kj4Dfk=; b=QWHhxqgusfOIeRKJEfsTKr/Lre
	0p5oIu8in9CkdQ9znPCKbNuslamv9up+WE7TiF0QCO+dnVKVcfFRPxTtKMJpEz8Q+eNo2CK1AJgnL
	jHwoITpswMuhZI/IplfOHwL45YpYi6KZfxr58cTeIuXgDxjJVAiz3Yi27J1MCMnyyEaI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZKnk-0004xx-SK
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZKnk-0001wD-RC
	for xen-changelog@lists.xenproject.org; Sun, 01 Nov 2020 21:22:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] x86/pv: Flush TLB in response to paging structure changes
Message-Id: <E1kZKnk-0001wD-RC@xenbits.xenproject.org>
Date: Sun, 01 Nov 2020 21:22:12 +0000

commit 4100d463dbdd95d85fabe387dd5676bed75f65f7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 19 15:51:22 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 27 18:04:17 2020 +0000

    x86/pv: Flush TLB in response to paging structure changes
    
    With MMU_UPDATE, a PV guest can make changes to higher level pagetables.  This
    is safe from Xen's point of view (as the update only affects guest mappings),
    and the guest is required to flush (if necessary) after making updates.
    
    However, Xen's use of linear pagetables (UPDATE_VA_MAPPING, GNTTABOP_map,
    writeable pagetables, etc.) is an implementation detail outside of the
    API/ABI.
    
    Changes in the paging structure require invalidations in the linear pagetable
    range for subsequent accesses into the linear pagetables to access non-stale
    mappings.  Xen must provide suitable flushing to prevent intermixed guest
    actions from accidentally accessing/modifying the wrong pagetable.
    
    For all L2 and higher modifications, flush the TLB.  PV guests cannot create
    L2 or higher entries with the Global bit set, so no mappings established in
    the linear range can be global.  (This could in principle be an order 39 flush
    starting at LINEAR_PT_VIRT_START, but no such mechanism exists in practice.)
    
    Express the necessary flushes as a set of booleans which accumulate across the
    operation.  Comment the flushing logic extensively.
    
    This is XSA-286.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 16a20963b3209788f2c0d3a3eebb7d92f03f5883)
---
 xen/arch/x86/mm.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 59 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 86f31b334f..db4cfdf20b 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4005,7 +4005,8 @@ long do_mmu_update(
     struct vcpu *curr = current, *v = curr;
     struct domain *d = v->domain, *pt_owner = d, *pg_owner;
     mfn_t map_mfn = INVALID_MFN;
-    bool sync_guest = false;
+    bool flush_linear_pt = false, flush_root_pt_local = false,
+        flush_root_pt_others = false;
     uint32_t xsm_needed = 0;
     uint32_t xsm_checked = 0;
     int rc = put_old_guest_table(curr);
@@ -4155,6 +4156,8 @@ long do_mmu_update(
                         break;
                     rc = mod_l2_entry(va, l2e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
+                    if ( !rc )
+                        flush_linear_pt = true;
                     break;
 
                 case PGT_l3_page_table:
@@ -4162,6 +4165,8 @@ long do_mmu_update(
                         break;
                     rc = mod_l3_entry(va, l3e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
+                    if ( !rc )
+                        flush_linear_pt = true;
                     break;
 
                 case PGT_l4_page_table:
@@ -4169,6 +4174,8 @@ long do_mmu_update(
                         break;
                     rc = mod_l4_entry(va, l4e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
+                    if ( !rc )
+                        flush_linear_pt = true;
                     if ( !rc && pt_owner->arch.pv.xpti )
                     {
                         bool local_in_use = false;
@@ -4176,7 +4183,7 @@ long do_mmu_update(
                         if ( pagetable_get_pfn(curr->arch.guest_table) == mfn )
                         {
                             local_in_use = true;
-                            get_cpu_info()->root_pgt_changed = true;
+                            flush_root_pt_local = true;
                         }
 
                         /*
@@ -4188,7 +4195,7 @@ long do_mmu_update(
                              (1 + !!(page->u.inuse.type_info & PGT_pinned) +
                               (pagetable_get_pfn(curr->arch.guest_table_user) ==
                                mfn) + local_in_use) )
-                            sync_guest = true;
+                            flush_root_pt_others = true;
                     }
                     break;
 
@@ -4290,19 +4297,61 @@ long do_mmu_update(
     if ( va )
         unmap_domain_page(va);
 
-    if ( sync_guest )
+    /*
+     * Perform required TLB maintenance.
+     *
+     * This logic currently depend on flush_linear_pt being a superset of the
+     * flush_root_pt_* conditions.
+     *
+     * pt_owner may not be current->domain.  This may occur during
+     * construction of 32bit PV guests, or debugging of PV guests.  The
+     * behaviour cannot be correct with domain unpaused.  We therefore expect
+     * pt_owner->dirty_cpumask to be empty, but it is a waste of effort to
+     * explicitly check for, and exclude, this corner case.
+     *
+     * flush_linear_pt requires a FLUSH_TLB to all dirty CPUs.  The flush must
+     * be performed now to maintain correct behaviour across a multicall.
+     * i.e. we cannot relax FLUSH_TLB to FLUSH_ROOT_PGTBL, given that the
+     * former is a side effect of the latter, because the resync (which is in
+     * the return-to-guest path) happens too late.
+     *
+     * flush_root_pt_* requires FLUSH_ROOT_PGTBL on either the local CPU
+     * (implies pt_owner == current->domain and current->processor set in
+     * pt_owner->dirty_cpumask), and/or all *other* dirty CPUs as there are
+     * references we can't account for locally.
+     */
+    if ( flush_linear_pt /* || flush_root_pt_local || flush_root_pt_others */ )
     {
+        unsigned int cpu = smp_processor_id();
+        cpumask_t *mask = pt_owner->dirty_cpumask;
+
         /*
-         * Force other vCPU-s of the affected guest to pick up L4 entry
-         * changes (if any).
+         * Always handle local flushing separately (if applicable), to
+         * separate the flush invocations appropriately for scope of the two
+         * flush_root_pt_* variables.
          */
-        unsigned int cpu = smp_processor_id();
-        cpumask_t *mask = per_cpu(scratch_cpumask, cpu);
+        if ( likely(cpumask_test_cpu(cpu, mask)) )
+        {
+            mask = per_cpu(scratch_cpumask, cpu);
 
-        cpumask_andnot(mask, pt_owner->dirty_cpumask, cpumask_of(cpu));
+            cpumask_copy(mask, pt_owner->dirty_cpumask);
+            __cpumask_clear_cpu(cpu, mask);
+
+            flush_local(FLUSH_TLB |
+                        (flush_root_pt_local ? FLUSH_ROOT_PGTBL : 0));
+        }
+        else
+            /* Sanity check.  flush_root_pt_local implies local cpu is dirty. */
+            ASSERT(!flush_root_pt_local);
+
+        /* Flush the remote dirty CPUs.  Does not include the local CPU. */
         if ( !cpumask_empty(mask) )
-            flush_mask(mask, FLUSH_ROOT_PGTBL);
+            flush_mask(mask, FLUSH_TLB |
+                       (flush_root_pt_others ? FLUSH_ROOT_PGTBL : 0));
     }
+    else
+        /* Sanity check.  flush_root_pt_* implies flush_linear_pt. */
+        ASSERT(!flush_root_pt_local && !flush_root_pt_others);
 
     perfc_add(num_page_updates, i);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 02 08:11:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Nov 2020 08:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17456.42235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZUvm-0006A0-SW; Mon, 02 Nov 2020 08:11:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17456.42235; Mon, 02 Nov 2020 08:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZUvm-00069s-PX; Mon, 02 Nov 2020 08:11:10 +0000
Received: by outflank-mailman (input) for mailman id 17456;
 Mon, 02 Nov 2020 08:11:09 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=f9Q8=EI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZUvl-00069m-E3
 for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 08:11:09 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3e129635-b2e2-4e00-9bac-6eac32520959;
 Mon, 02 Nov 2020 08:11:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZUvh-0001nl-4d
 for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 08:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZUvh-0006gv-20
 for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 08:11:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=f9Q8=EI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZUvl-00069m-E3
	for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 08:11:09 +0000
X-Inumbo-ID: 3e129635-b2e2-4e00-9bac-6eac32520959
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 3e129635-b2e2-4e00-9bac-6eac32520959;
	Mon, 02 Nov 2020 08:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V4U7Yb+GISo43rjOphBxOoiAByOPZLmbbOv2rE/Xytk=; b=0yMdqlfKKLBqJEoUUYdP9dsJKQ
	XimCZGyyZL5nxQJl6V43LAoKcQEyCL4DF/eizzcf+4l8twnaGlVT6KAjJb/63VwAPUJrXY8tVadoT
	63tJNUhwKId/SFvaGqCLWafo06xkluqyTd6R5xIprrrk4NMD4yGgHhuvx6NdOk8pg8HY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZUvh-0001nl-4d
	for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 08:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZUvh-0006gv-20
	for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 08:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] update Xen version to 4.12.4
Message-Id: <E1kZUvh-0006gv-20@xenbits.xenproject.org>
Date: Mon, 02 Nov 2020 08:11:05 +0000

commit 97b7b5567fba6918a656ad349051b5343b5dea2e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 2 09:06:25 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Nov 2 09:06:25 2020 +0100

    update Xen version to 4.12.4
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index be5634f26e..bf6fc83f08 100644
--- a/Config.mk
+++ b/Config.mk
@@ -276,15 +276,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= ef529e6ab7c31290a33045bb1f1837447cc0eb56
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.12.3
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.12.3
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.12.4
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.12.4
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.12.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.12.3
+QEMU_TRADITIONAL_REVISION ?= xen-4.12.4
 # Wed Oct 10 18:52:54 2018 +0000
 # xen/pt: allow QEMU to request MSI unmasking at bind time
 
diff --git a/xen/Makefile b/xen/Makefile
index 25e8014dba..0fdf88b498 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    = 12
-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.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 02 22:00:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Nov 2020 22:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.17946.42690 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZhry-0005FM-G4; Mon, 02 Nov 2020 22:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 17946.42690; Mon, 02 Nov 2020 22: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kZhry-0005FE-D3; Mon, 02 Nov 2020 22:00:06 +0000
Received: by outflank-mailman (input) for mailman id 17946;
 Mon, 02 Nov 2020 22:00:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=f9Q8=EI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kZhrw-0004ys-Gy
 for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 22:00:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b057dd9a-e301-475a-8fe0-ce79e4b77326;
 Mon, 02 Nov 2020 22:00:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZhru-0002gn-HJ
 for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 22:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kZhru-0000fp-Ek
 for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 22:00:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=f9Q8=EI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kZhrw-0004ys-Gy
	for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 22:00:04 +0000
X-Inumbo-ID: b057dd9a-e301-475a-8fe0-ce79e4b77326
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id b057dd9a-e301-475a-8fe0-ce79e4b77326;
	Mon, 02 Nov 2020 22:00:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gLeVsTHo32awlNxMSMgSlWGJiF9+YUN29fpT+tJXY6g=; b=0IZlMu+HiIiESEIUEJYiLcPPct
	1Dt0RK1Wt6E2AVzHtN/UvktNIh+QBF7vK6q3HCop2tB1hZjLihqiT2/zOfRX1UfnbvFOme4nxglg1
	nQ6SMx8P4bs43vgU2BKT+pXwGy80wY/msZHLfSMqyPwk+OvUF0DBAIPosNG0EaH5o9TI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZhru-0002gn-HJ
	for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 22:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kZhru-0000fp-Ek
	for xen-changelog@lists.xenproject.org; Mon, 02 Nov 2020 22:00:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] update Xen version to 4.12.4
Message-Id: <E1kZhru-0000fp-Ek@xenbits.xenproject.org>
Date: Mon, 02 Nov 2020 22:00:02 +0000

commit 97b7b5567fba6918a656ad349051b5343b5dea2e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 2 09:06:25 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Nov 2 09:06:25 2020 +0100

    update Xen version to 4.12.4
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index be5634f26e..bf6fc83f08 100644
--- a/Config.mk
+++ b/Config.mk
@@ -276,15 +276,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= ef529e6ab7c31290a33045bb1f1837447cc0eb56
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.12.3
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.12.3
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.12.4
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.12.4
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.12.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.12.3
+QEMU_TRADITIONAL_REVISION ?= xen-4.12.4
 # Wed Oct 10 18:52:54 2018 +0000
 # xen/pt: allow QEMU to request MSI unmasking at bind time
 
diff --git a/xen/Makefile b/xen/Makefile
index 25e8014dba..0fdf88b498 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    = 12
-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.12


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18880.43937 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEE9-0002xH-6Q; Wed, 04 Nov 2020 08:33:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18880.43937; Wed, 04 Nov 2020 08:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEE9-0002x9-38; Wed, 04 Nov 2020 08:33:09 +0000
Received: by outflank-mailman (input) for mailman id 18880;
 Wed, 04 Nov 2020 08:33:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEE7-0002wy-Dt
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:07 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b37292df-3cf1-40bc-a566-c8e17a974111;
 Wed, 04 Nov 2020 08:33:06 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEE6-00087E-0w
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEE5-0003KF-Vq
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEE7-0002wy-Dt
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:07 +0000
X-Inumbo-ID: b37292df-3cf1-40bc-a566-c8e17a974111
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id b37292df-3cf1-40bc-a566-c8e17a974111;
	Wed, 04 Nov 2020 08:33:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o60ZZmuSxLgYyzJ+X1zvh6hNYYaocPnd/ffmFQd6l0k=; b=5DI8SN6pCq+l5W/YcsGfiqDr7R
	FmLqNisv6Zg5B+iHfbSjVbHteyjelC8u1ageK/t9/xg//PZXW7OzA5Ev5T7GKCQ31E399yIVa4YCA
	OzqM++az2FSdl8sCDjKGyKlvLGzfVGzIE6My4aY+wyvAEM1PkSaXYzEt3N+0XB7AP9ro=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEE6-00087E-0w
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEE5-0003KF-Vq
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaEE5-0003KF-Vq@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:33:05 +0000

commit 8587160b3e2951b722d395a0346bb17c3c22152f
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Aug 19 18:31:45 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:22:37 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 88d4bc7384..ab02aca5f4 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -767,6 +767,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:33:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:33:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18883.43956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEEI-00030V-HV; Wed, 04 Nov 2020 08:33:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18883.43956; Wed, 04 Nov 2020 08:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEEI-00030N-Ec; Wed, 04 Nov 2020 08:33:18 +0000
Received: by outflank-mailman (input) for mailman id 18883;
 Wed, 04 Nov 2020 08:33:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEEH-000301-01
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:17 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f7c97b6b-bed2-48f1-b3ae-73561ad90f3d;
 Wed, 04 Nov 2020 08:33:16 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEEG-00087H-5G
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEEG-0003LI-3P
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEEH-000301-01
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:17 +0000
X-Inumbo-ID: f7c97b6b-bed2-48f1-b3ae-73561ad90f3d
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id f7c97b6b-bed2-48f1-b3ae-73561ad90f3d;
	Wed, 04 Nov 2020 08:33:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YX+ZmGRBwQBITG+QiXVWh0jow3TAh1t7jxAjPgSmevI=; b=0ozCupQcGCZMW9vHMjrXFKFbwC
	usDCxo1OUrtsJR78eQ+d2+ItR6Ax4gMjx5giaG6gQAP0D+wtBI9OZAovZFRMkrJC4PwSCiBElLY4f
	rY9YggD97YRwEf4C/6BPoPc0rqWmkxUv3mHoSVCbvAvVmFZMynyw5qbGfa00czeEe2Eg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEEG-00087H-5G
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEEG-0003LI-3P
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: don't have timestamp inserted in config.gz
Message-Id: <E1kaEEG-0003LI-3P@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:33:16 +0000

commit 5816d327e44ab37ae08730f4c54a80835998f31f
Author:     Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
AuthorDate: Wed Nov 4 09:24:40 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:24:40 2020 +0100

    xen: don't have timestamp inserted in config.gz
    
    This is for improving reproducible builds.
    
    Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/Makefile b/xen/common/Makefile
index 083f62acb6..d109f279a4 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -80,7 +80,7 @@ obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
 
 CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFIG_CONFIG)
 config.gz: $(CONF_FILE)
-	gzip -c $< >$@
+	gzip -n -c $< >$@
 
 config_data.o: config.gz
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:33:29 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:33:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18884.43960 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEET-00034r-J5; Wed, 04 Nov 2020 08:33:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18884.43960; Wed, 04 Nov 2020 08:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEET-00034i-G7; Wed, 04 Nov 2020 08:33:29 +0000
Received: by outflank-mailman (input) for mailman id 18884;
 Wed, 04 Nov 2020 08:33:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEER-00033v-FN
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:27 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0d71619f-dec5-4b8f-a39b-babbd538878e;
 Wed, 04 Nov 2020 08:33:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEEQ-00087U-9T
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEEQ-0003MH-7Z
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEER-00033v-FN
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:27 +0000
X-Inumbo-ID: 0d71619f-dec5-4b8f-a39b-babbd538878e
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 0d71619f-dec5-4b8f-a39b-babbd538878e;
	Wed, 04 Nov 2020 08:33:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rBQegF1Efyz5cRxSWRFQHAiKQxvCHUY3ghPb/XXDAO4=; b=4Y/FWJgSwWsOtqDPcosr8FO3ol
	i3VwGsjeaBdEQeKniDHOJhCcB8s2wJlfQxNPtSoZdG4ksWSv5+/t+rtqfPW1TIVGdMAj7+50pOZau
	f1+ke9hdCQPBnMzr2ci5y9/aLNNZSVZZIH8YybtRNoYwCDQvI9VyVVSpwY9CycMbCbng=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEEQ-00087U-9T
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEEQ-0003MH-7Z
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/spinlocks: spin_trylock with interrupts off is always fine
Message-Id: <E1kaEEQ-0003MH-7Z@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:33:26 +0000

commit c0d3cc9b0f343ef455ce3e2c4c605064a2934865
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 4 09:26:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:26:42 2020 +0100

    xen/spinlocks: spin_trylock with interrupts off is always fine
    
    Even if a spinlock was taken with interrupts on before calling
    spin_trylock() with interrupts off is fine, as it can't block.
    
    Add a bool parameter "try" to check_lock() for handling this case.
    
    Remove the call of check_lock() from _spin_is_locked(), as it really
    serves no purpose and it can even lead to false crashes, e.g. when
    a lock was taken correctly with interrupts enabled and the call of
    _spin_is_locked() happened with interrupts off. In case the lock is
    taken with wrong interrupt flags this will be catched when taking
    the lock.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/spinlock.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index ce3106e2d3..b4aaf6bce6 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -13,7 +13,7 @@
 
 static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0);
 
-static void check_lock(union lock_debug *debug)
+static void check_lock(union lock_debug *debug, bool try)
 {
     bool irq_safe = !local_irq_is_enabled();
 
@@ -42,7 +42,13 @@ static void check_lock(union lock_debug *debug)
      * 
      * To guard against this subtle bug we latch the IRQ safety of every
      * spinlock in the system, on first use.
+     *
+     * A spin_trylock() with interrupts off is always fine, as this can't
+     * block and above deadlock scenario doesn't apply.
      */
+    if ( try && irq_safe )
+        return;
+
     if ( unlikely(debug->irq_safe != irq_safe) )
     {
         union lock_debug seen, new = { 0 };
@@ -102,7 +108,7 @@ void spin_debug_disable(void)
 
 #else /* CONFIG_DEBUG_LOCKS */
 
-#define check_lock(l) ((void)0)
+#define check_lock(l, t) ((void)0)
 #define check_barrier(l) ((void)0)
 #define got_lock(l) ((void)0)
 #define rel_lock(l) ((void)0)
@@ -159,7 +165,7 @@ void inline _spin_lock_cb(spinlock_t *lock, void (*cb)(void *), void *data)
     spinlock_tickets_t tickets = SPINLOCK_TICKET_INC;
     LOCK_PROFILE_VAR;
 
-    check_lock(&lock->debug);
+    check_lock(&lock->debug, false);
     preempt_disable();
     tickets.head_tail = arch_fetch_and_add(&lock->tickets.head_tail,
                                            tickets.head_tail);
@@ -220,8 +226,6 @@ void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
 
 int _spin_is_locked(spinlock_t *lock)
 {
-    check_lock(&lock->debug);
-
     /*
      * Recursive locks may be locked by another CPU, yet we return
      * "false" here, making this function suitable only for use in
@@ -236,7 +240,7 @@ int _spin_trylock(spinlock_t *lock)
 {
     spinlock_tickets_t old, new;
 
-    check_lock(&lock->debug);
+    check_lock(&lock->debug, true);
     old = observe_lock(&lock->tickets);
     if ( old.head != old.tail )
         return 0;
@@ -294,7 +298,7 @@ int _spin_trylock_recursive(spinlock_t *lock)
     BUILD_BUG_ON(NR_CPUS > SPINLOCK_NO_CPU);
     BUILD_BUG_ON(SPINLOCK_RECURSE_BITS < 3);
 
-    check_lock(&lock->debug);
+    check_lock(&lock->debug, true);
 
     if ( likely(lock->recurse_cpu != cpu) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:33:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18886.43964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEEb-00037R-LA; Wed, 04 Nov 2020 08:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18886.43964; Wed, 04 Nov 2020 08:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEEb-00037J-Hw; Wed, 04 Nov 2020 08:33:37 +0000
Received: by outflank-mailman (input) for mailman id 18886;
 Wed, 04 Nov 2020 08:33:37 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEEb-00037D-8t
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:37 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id da1c4a45-1273-4b4f-834f-447c05fe97b0;
 Wed, 04 Nov 2020 08:33:36 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEEa-000883-Cy
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEEa-0003NS-Bu
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEEb-00037D-8t
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:37 +0000
X-Inumbo-ID: da1c4a45-1273-4b4f-834f-447c05fe97b0
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id da1c4a45-1273-4b4f-834f-447c05fe97b0;
	Wed, 04 Nov 2020 08:33:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xz9KxM9/q5UBsLxIfa01GpzS8MypTPoG0NWErpFXA84=; b=k3vQ72u6Qmntz+RfSPJM4XMMA8
	MGSiPY0qb6HFYtlcQvxD4fk4sH1XlS9HHVoq8Hv8WpmNzZYzr6jco7Nx/k+CVqrAznemeEu/PvsjU
	BK31D1B8uKzaLveVZsDxUTN+Z1Z3uTUnNSsMO2JKwcDN0jZylhEO8UiQBXFK9Ioxt/NU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEEa-000883-Cy
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEEa-0003NS-Bu
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:33:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: drop guest_get_eff_l1e()
Message-Id: <E1kaEEa-0003NS-Bu@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:33:36 +0000

commit 9ff9705647646aa937b5f5c1426a64c69a62b3bd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 4 09:27:22 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:27:22 2020 +0100

    x86/mm: drop guest_get_eff_l1e()
    
    There's no actual user of it: pv_ro_page_fault() has a
    guest_kernel_mode() conditional around its only call site.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/mm.c            | 21 ---------------------
 xen/arch/x86/pv/mm.h            |  7 +++++--
 xen/arch/x86/pv/ro-page-fault.c |  2 +-
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index 14cb0f2d4e..5d74d11cba 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -55,27 +55,6 @@ l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn)
     return (l1_pgentry_t *)map_domain_page(*gl1mfn) + l1_table_offset(linear);
 }
 
-/*
- * Read the guest's l1e that maps this address, from the kernel-mode
- * page tables.
- */
-static l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
-{
-    struct vcpu *curr = current;
-    const bool user_mode = !(curr->arch.flags & TF_kernel_mode);
-    l1_pgentry_t l1e;
-
-    if ( user_mode )
-        toggle_guest_pt(curr);
-
-    l1e = guest_get_eff_l1e(linear);
-
-    if ( user_mode )
-        toggle_guest_pt(curr);
-
-    return l1e;
-}
-
 /*
  * Map a guest's LDT page (covering the byte at @offset from start of the LDT)
  * into Xen's virtual range.  Returns true if the mapping changed, false
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
index b1b66e46c8..2a21859dd4 100644
--- a/xen/arch/x86/pv/mm.h
+++ b/xen/arch/x86/pv/mm.h
@@ -5,8 +5,11 @@ l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn);
 
 int new_guest_cr3(mfn_t mfn);
 
-/* Read a PV guest's l1e that maps this linear address. */
-static inline l1_pgentry_t guest_get_eff_l1e(unsigned long linear)
+/*
+ * Read the guest's l1e that maps this address, from the kernel-mode
+ * page tables.
+ */
+static inline l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
 {
     l1_pgentry_t l1e;
 
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index 7f6fbc92fb..8d0007ede5 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -342,7 +342,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
     bool mmio_ro;
 
     /* Attempt to read the PTE that maps the VA being accessed. */
-    pte = guest_get_eff_l1e(addr);
+    pte = guest_get_eff_kern_l1e(addr);
 
     /* We are only looking for read-only mappings */
     if ( ((l1e_get_flags(pte) & (_PAGE_PRESENT | _PAGE_RW)) != _PAGE_PRESENT) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:44:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18892.43981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEOk-00046f-Sb; Wed, 04 Nov 2020 08:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18892.43981; Wed, 04 Nov 2020 08:44:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEOk-00046X-Og; Wed, 04 Nov 2020 08:44:06 +0000
Received: by outflank-mailman (input) for mailman id 18892;
 Wed, 04 Nov 2020 08:44:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEOj-00046D-Fh
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:05 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 25ef7ac2-fbfc-4411-b5dd-6c4806a18c98;
 Wed, 04 Nov 2020 08:44:04 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEOi-0008Kt-KR
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEOi-0004gB-Iz
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEOj-00046D-Fh
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:05 +0000
X-Inumbo-ID: 25ef7ac2-fbfc-4411-b5dd-6c4806a18c98
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 25ef7ac2-fbfc-4411-b5dd-6c4806a18c98;
	Wed, 04 Nov 2020 08:44:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QF2g2SfMUKEvpJxybwowqUPMty85FibtZXOMxKSpjX0=; b=WOMqq01uAjn8P2Yr6J1PWGkqy3
	XlHpIHfZqEt8gXnZRRln0vZSTMVpas9QJ5u3tJ5s719uatHEAmjt86Fn16AINUF60Sr8+HQL6DaUB
	ChgOlGAzekaWtI0YhrD+etZCManxohLaml4xztl8P/V9+Mspcp5R73ovYtBx9otFikZ8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEOi-0008Kt-KR
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEOi-0004gB-Iz
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaEOi-0004gB-Iz@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:44:04 +0000

commit 5784d1e9424151adfdc836535489bd068c6c0700
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:35:16 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:35:16 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 88a182ac31..55a65ae136 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -758,6 +758,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:44:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18895.43983 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEOu-000482-TU; Wed, 04 Nov 2020 08:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18895.43983; Wed, 04 Nov 2020 08:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEOu-00047u-QR; Wed, 04 Nov 2020 08:44:16 +0000
Received: by outflank-mailman (input) for mailman id 18895;
 Wed, 04 Nov 2020 08:44:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEOu-00047o-5Y
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:16 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 828eb916-c357-4fad-835a-6f06f618e0fe;
 Wed, 04 Nov 2020 08:44:15 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEOt-0008L0-97
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEOt-0004hx-6W
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEOu-00047o-5Y
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:16 +0000
X-Inumbo-ID: 828eb916-c357-4fad-835a-6f06f618e0fe
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 828eb916-c357-4fad-835a-6f06f618e0fe;
	Wed, 04 Nov 2020 08:44:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AW04tdznttSdDE4Ajgxz6u9r6a7e4ZAYmVw+p0ydArg=; b=LYdZLEuAm2nP2rgE3s9abi6IEO
	wMT2EdlQKUTiXDBEwZJQgj7BxdLZXrLGXna6LgRNN85Ozj2HwZyuZmTCml0gFZ3rAhw0U7iEl4hfb
	03Hf3G8H2qfSh+6MtvRq0Ob/gkMk9o0xDbki/+CV7nbTwxx54Wv7kXFoUbrZAqOgj23Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEOt-0008L0-97
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEOt-0004hx-6W
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaEOt-0004hx-6W@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:44:15 +0000

commit 83115491d4b3dbcb7c8dbe74ce3e59cdfac69b03
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:35:52 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:35:52 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index b24649ef2d..3e2c8be75e 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -738,6 +738,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:44:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:44:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18896.43988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEP6-0004AM-Uz; Wed, 04 Nov 2020 08:44:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18896.43988; Wed, 04 Nov 2020 08:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEP6-0004AE-S7; Wed, 04 Nov 2020 08:44:28 +0000
Received: by outflank-mailman (input) for mailman id 18896;
 Wed, 04 Nov 2020 08:44:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEP5-0004A3-Dn
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:27 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cbf50a3a-b758-4218-b069-b7683584b581;
 Wed, 04 Nov 2020 08:44:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEP3-0008LD-Uk
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEP3-0004jk-RX
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEP5-0004A3-Dn
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:27 +0000
X-Inumbo-ID: cbf50a3a-b758-4218-b069-b7683584b581
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id cbf50a3a-b758-4218-b069-b7683584b581;
	Wed, 04 Nov 2020 08:44:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/xTg39OhY6xa3OqA+ItmGbu3BBJ1xc5y0BqzjHXowmM=; b=fkEL4bTCdohkqrYpaHbg9ZdjaJ
	OCoUEG71EWqf2OIX+szUQIeq9+a7BwatXkuNRu3S56Nd5ZNkr77kYu4CcbEuH/kRjszHxD9n8vti+
	W/+mgtIpWEiz0GkSqLZauUXpH8DCw8O+mH1RAT77h3QOM5XdOCfVsv+1+Jji4ynW8U6I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEP3-0008LD-Uk
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEP3-0004jk-RX
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaEP3-0004jk-RX@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:44:25 +0000

commit 4f9294d21c47415376215d68a0298e88582b8e7a
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:36:36 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:36:36 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 52f25fa85a..b4038974f9 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -722,6 +722,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:44:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:44:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18898.43992 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEPH-0004CE-1o; Wed, 04 Nov 2020 08:44:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18898.43992; Wed, 04 Nov 2020 08:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEPG-0004C6-V6; Wed, 04 Nov 2020 08:44:38 +0000
Received: by outflank-mailman (input) for mailman id 18898;
 Wed, 04 Nov 2020 08:44:37 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEPF-0004Bs-NW
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:37 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7640b28b-21ff-42d0-95aa-14aadbee76e0;
 Wed, 04 Nov 2020 08:44:36 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEPE-0008Lz-HE
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEPE-0004mO-GG
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEPF-0004Bs-NW
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:37 +0000
X-Inumbo-ID: 7640b28b-21ff-42d0-95aa-14aadbee76e0
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 7640b28b-21ff-42d0-95aa-14aadbee76e0;
	Wed, 04 Nov 2020 08:44:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gnZp69t2FL8Bb3MXJck07fOshIpPhgnMseh75X4EPhw=; b=Cl0af8OWR++hBBnG+/DB1oasAF
	/Y9oWZE47jK4FlHGB/W/8iS43DpKxIq8ZjJPUfDuY9px0gwvEPK9HBUsFFQxr+HOULR/g0SRPuHPV
	DP7fSFRU1OSuv6V9BIyX4cl72+FvX9zUIAfkLx+rPCqU/WZ21F623XEXu3g0byRLyh/g=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEPE-0008Lz-HE
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEPE-0004mO-GG
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.11] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaEPE-0004mO-GG@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:44:36 +0000

commit b5eb4956e1d2d73546f8cfdef635b6819ed7b527
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:37:12 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:37:12 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 2478a53be6..0c5bb6d4bc 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -692,6 +692,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 08:44:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 08:44:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.18899.43995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEPR-0004Db-3E; Wed, 04 Nov 2020 08:44:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 18899.43995; Wed, 04 Nov 2020 08:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaEPR-0004DT-0P; Wed, 04 Nov 2020 08:44:49 +0000
Received: by outflank-mailman (input) for mailman id 18899;
 Wed, 04 Nov 2020 08:44:48 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaEPQ-0004DK-1x
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:48 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9927611c-b6e6-4dc7-9d30-58be28eba9bc;
 Wed, 04 Nov 2020 08:44:47 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEPP-0008MC-4Z
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaEPP-0004oA-3b
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaEPQ-0004DK-1x
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:48 +0000
X-Inumbo-ID: 9927611c-b6e6-4dc7-9d30-58be28eba9bc
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 9927611c-b6e6-4dc7-9d30-58be28eba9bc;
	Wed, 04 Nov 2020 08:44:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BA1KZRShma2/mL0tc9rp567zfcz7s82UQ1MT/5Na+Gs=; b=XzCG7cZxFYuV+ttLiI421J1LuK
	4BgPtyYVUBoxgosWxXyfMpi5xmjDYmPiyd9MfnTAqxbsLdBhVxyBNETxMGV65q0pz/KNQl7E4fil9
	b+7DUxD3dylOEid4P2Y+OnYR8rULPx/HiN1/D4qngBs2dbo2gkgEUiPxta4r35PZSJ0Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEPP-0008MC-4Z
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaEPP-0004oA-3b
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 08:44:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.10] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaEPP-0004oA-3b@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 08:44:47 +0000

commit 7a4ec792d12d58d14e4d0a9cb569be4fd4fe9cf5
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:38:53 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:38:53 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index ae4670c39b..cb618e29ec 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -679,6 +679,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 10:11:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 10:11:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19001.44181 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaFl3-0005P1-Ew; Wed, 04 Nov 2020 10:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19001.44181; Wed, 04 Nov 2020 10:11:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaFl3-0005Ot-Bi; Wed, 04 Nov 2020 10:11:13 +0000
Received: by outflank-mailman (input) for mailman id 19001;
 Wed, 04 Nov 2020 10:11:12 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaFl2-0005Oo-2f
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:12 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f575b75b-cbca-4337-a0ee-bab6f386a5ee;
 Wed, 04 Nov 2020 10:11:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaFkv-0001ot-DN
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaFkv-0004wO-9b
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaFl2-0005Oo-2f
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:12 +0000
X-Inumbo-ID: f575b75b-cbca-4337-a0ee-bab6f386a5ee
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id f575b75b-cbca-4337-a0ee-bab6f386a5ee;
	Wed, 04 Nov 2020 10:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Pkelzkex5gJWUjyoUlY4bJDqrQqdLeIwV2SMJRKGZX8=; b=2duVTz8AVw6B8vDyTBxQgeHQdU
	KSwtDZBp/RrJXnta7FtHEOI8ODzp7s4+hrVC5TM4w+GHIMCLq8tcYPqcoQO382256MQH+92cVkYxC
	KOc5dYxmPV5AXvwUiMFStjXxN1EO5RTYv0xRCKvy/KarIlKtDm3e8HkxJloaJM7vFHWs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaFkv-0001ot-DN
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaFkv-0004wO-9b
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] build: use if_changed more consistently (and correctly) for prelink*.o
Message-Id: <E1kaFkv-0004wO-9b@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 10:11:05 +0000

commit 9f954ae7fb1c7dc3b02e5ccac6978c3a8e86086e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 4 11:01:02 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 11:01:02 2020 +0100

    build: use if_changed more consistently (and correctly) for prelink*.o
    
    Switch to $(call if_changed,ld) where possible; presumably not doing so
    in e321576f4047 ("xen/build: start using if_changed") right away was an
    oversight, as it did for Arm in (just) one case. It failed to add
    prelink.o to $(targets), though, causing - judging from the observed
    behavior on x86 - undue rebuilds of the final binary (because of
    prelink.o getting rebuild for $(cmd_prelink.o) being empty, in turn
    because of .prelink.o.cmd not getting read) during "make install-xen".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    master commit: dd2cfba88c3d0e144ffec07c6b5b86e54a9d98a9
    master date: 2020-09-22 10:19:38 +0200
---
 xen/arch/arm/Makefile |  4 +++-
 xen/arch/x86/Makefile | 18 ++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 7e82b2178c..1ded44d200 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -95,12 +95,14 @@ prelink_lto.o: $(ALL_OBJS)
 
 # Link it with all the binary objects
 prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $^
+	$(call if_changed,ld)
 else
 prelink.o: $(ALL_OBJS) FORCE
 	$(call if_changed,ld)
 endif
 
+targets += prelink.o
+
 $(TARGET)-syms: prelink.o xen.lds
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b388861679..26ff2a9a3e 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -124,19 +124,21 @@ prelink-efi_lto.o: $(ALL_OBJS) efi/runtime.o efi/compat.o
 	$(LD_LTO) -r -o $@ $(filter-out %/efi/built_in.o,$^)
 
 # Link it with all the binary objects
-prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $^
+prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
+	$(call if_changed,ld)
 
-prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink-efi_lto.o efi/boot.init.o
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $^
+prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink-efi_lto.o efi/boot.init.o FORCE
+	$(call if_changed,ld)
 else
-prelink.o: $(ALL_OBJS)
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $^
+prelink.o: $(ALL_OBJS) FORCE
+	$(call if_changed,ld)
 
-prelink-efi.o: $(ALL_OBJS) efi/boot.init.o efi/runtime.o efi/compat.o
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out %/efi/built_in.o,$^)
+prelink-efi.o: $(filter-out %/efi/built_in.o,$(ALL_OBJS)) efi/boot.init.o efi/runtime.o efi/compat.o FORCE
+	$(call if_changed,ld)
 endif
 
+targets += prelink.o prelink-efi.o
+
 $(TARGET)-syms: prelink.o xen.lds
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 10:11:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 10:11:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19002.44183 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaFl8-0005Pd-Fu; Wed, 04 Nov 2020 10:11:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19002.44183; Wed, 04 Nov 2020 10:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaFl8-0005PX-D8; Wed, 04 Nov 2020 10:11:18 +0000
Received: by outflank-mailman (input) for mailman id 19002;
 Wed, 04 Nov 2020 10:11:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaFl7-0005PJ-JV
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:17 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 519c8a35-7841-41c1-990b-0444a2560b21;
 Wed, 04 Nov 2020 10:11:15 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaFl5-0001ow-H8
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaFl5-0004xE-Fm
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaFl7-0005PJ-JV
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:17 +0000
X-Inumbo-ID: 519c8a35-7841-41c1-990b-0444a2560b21
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 519c8a35-7841-41c1-990b-0444a2560b21;
	Wed, 04 Nov 2020 10:11:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SUojRRSXjUIBBqOSZejsCUlj+OUMJepwx+bf2RjqZug=; b=U1zr1sTcBbrHdfZEDI4gtJoMl3
	BwT+IKb+QTjkz2XOPz+tS1t0ncyhW9yGB1B2l3YtdVxFJEKa+hwRNjVzDeSjG9ffHsYTMVlp2lX74
	/qEh9U21L6eCdFRr7PRbPeezFyP/B/ieaXcByhd1eSszRr5u0vTc4AbeMxzCcdrGTm2k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaFl5-0001ow-H8
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaFl5-0004xE-Fm
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] pci: cleanup MSI interrupts before removing device from IOMMU
Message-Id: <E1kaFl5-0004xE-Fm@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 10:11:15 +0000

commit 898864c3736338548bc2f684b7e307326e0dd4a5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 4 11:01:27 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 11:01:27 2020 +0100

    pci: cleanup MSI interrupts before removing device from IOMMU
    
    Doing the MSI cleanup after removing the device from the IOMMU leads
    to the following panic on AMD hardware:
    
    Assertion 'table.ptr && (index < intremap_table_entries(table.ptr, iommu))' failed at iommu_intr.c:172
    ----[ Xen-4.13.1-10.0.3-d  x86_64  debug=y   Not tainted ]----
    CPU:    3
    RIP:    e008:[<ffff82d08026ae3c>] drivers/passthrough/amd/iommu_intr.c#get_intremap_entry+0x52/0x7b
    [...]
    Xen call trace:
       [<ffff82d08026ae3c>] R drivers/passthrough/amd/iommu_intr.c#get_intremap_entry+0x52/0x7b
       [<ffff82d08026af25>] F drivers/passthrough/amd/iommu_intr.c#update_intremap_entry_from_msi_msg+0xc0/0x342
       [<ffff82d08026ba65>] F amd_iommu_msi_msg_update_ire+0x98/0x129
       [<ffff82d08025dd36>] F iommu_update_ire_from_msi+0x1e/0x21
       [<ffff82d080286862>] F msi_free_irq+0x55/0x1a0
       [<ffff82d080286f25>] F pci_cleanup_msi+0x8c/0xb0
       [<ffff82d08025cf52>] F pci_remove_device+0x1af/0x2da
       [<ffff82d0802a42d1>] F do_physdev_op+0xd18/0x1187
       [<ffff82d080383925>] F pv_hypercall+0x1f5/0x567
       [<ffff82d08038a432>] F lstar_enter+0x112/0x120
    
    That's because the call to iommu_remove_device on AMD hardware will
    remove the per-device interrupt remapping table, and hence the call to
    pci_cleanup_msi done afterwards will find a null intremap table and
    crash.
    
    Reorder the calls so that MSI interrupts are torn down before removing
    the device from the IOMMU.
    
    Fixes: d7cfeb7c13ed ("AMD/IOMMU: don't blindly allocate interrupt remapping tables")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 710f62cc826bb8c7ead99f9d6b6b269e39ff3e98
    master date: 2020-10-23 10:13:14 +0200
---
 xen/drivers/passthrough/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 5846978890..2d6238a5bb 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -843,10 +843,10 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
     list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
         if ( pdev->bus == bus && pdev->devfn == devfn )
         {
+            pci_cleanup_msi(pdev);
             ret = iommu_remove_device(pdev);
             if ( pdev->domain )
                 list_del(&pdev->domain_list);
-            pci_cleanup_msi(pdev);
             free_pdev(pseg, pdev);
             printk(XENLOG_DEBUG "PCI remove device %04x:%02x:%02x.%u\n",
                    seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 10:11:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 10:11:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19003.44189 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaFlH-0005Rm-I0; Wed, 04 Nov 2020 10:11:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19003.44189; Wed, 04 Nov 2020 10:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaFlH-0005Re-Ec; Wed, 04 Nov 2020 10:11:27 +0000
Received: by outflank-mailman (input) for mailman id 19003;
 Wed, 04 Nov 2020 10:11:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaFlG-0005Qo-Ln
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:26 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5339c2b3-818b-4659-9d06-c0093134496a;
 Wed, 04 Nov 2020 10:11:25 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaFlF-0001pA-Lx
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaFlF-0004y4-KB
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaFlG-0005Qo-Ln
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:26 +0000
X-Inumbo-ID: 5339c2b3-818b-4659-9d06-c0093134496a
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 5339c2b3-818b-4659-9d06-c0093134496a;
	Wed, 04 Nov 2020 10:11:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6apT/aTDal+czwSKeuh/VG5POBiLggDMRT+BzXGQLNk=; b=aXLMYpbE3z8Q0ocTRqRtU0uDcc
	7CdpVSkyxrHKO5l9qiPYI+g1PhmKx+v9NvwjdP+JCKCuuE2zlxDQXAqiYNKWdfzozS6A1Kz7sI+Vl
	HlMlhMsjg8Rn39ikPho7tjcU0BaadM2pzB3ryeTKY0RXkVIc8pIUD8YPdVIWO54pJUTk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaFlF-0001pA-Lx
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaFlF-0004y4-KB
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 10:11:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86emul: fix PINSRW and adjust other {,V}PINSR*
Message-Id: <E1kaFlF-0004y4-KB@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 10:11:25 +0000

commit fc8fab1bb4d3a16914d8e7f6e288e946e68d5a41
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 4 11:02:30 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 11:02:30 2020 +0100

    x86emul: fix PINSRW and adjust other {,V}PINSR*
    
    The use of simd_packed_int together with no further update to op_bytes
    has lead to wrong signaling of #GP(0) for PINSRW without a 16-byte
    aligned memory operand. Use simd_none instead and override it after
    general decoding with simd_other, like is done for the B/D/Q siblings.
    
    While benign, for consistency also use DstImplicit instead of DstReg
    in x86_decode_twobyte().
    
    PINSR{B,D,Q} also had a stray (redundant) get_fpu() invocation, which
    gets dropped.
    
    For further consistency also
    - use src.bytes instead of op_bytes in relevant memcpy() invocations,
    - avoid the pointless updating of op_bytes (all we care about later is
      that the value be less than 16).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 06f0598b41f23c9e4cf7d8c5a05b282de92f3a35
    master date: 2020-10-23 18:03:18 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index ee6341b1b7..9b29548e2d 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -362,7 +362,7 @@ static const struct twobyte_table {
     [0xc1] = { DstMem|SrcReg|ModRM },
     [0xc2] = { DstImplicit|SrcImmByte|ModRM, simd_any_fp, d8s_vl },
     [0xc3] = { DstMem|SrcReg|ModRM|Mov },
-    [0xc4] = { DstReg|SrcImmByte|ModRM, simd_packed_int, 1 },
+    [0xc4] = { DstImplicit|SrcImmByte|ModRM, simd_none, 1 },
     [0xc5] = { DstReg|SrcImmByte|ModRM|Mov },
     [0xc6] = { DstImplicit|SrcImmByte|ModRM, simd_packed_fp, d8s_vl },
     [0xc7] = { ImplicitOps|ModRM },
@@ -2784,7 +2784,7 @@ x86_decode_twobyte(
         /* fall through */
     case X86EMUL_OPC_VEX_66(0, 0xc4): /* vpinsrw */
     case X86EMUL_OPC_EVEX_66(0, 0xc4): /* vpinsrw */
-        state->desc = DstReg | SrcMem16;
+        state->desc = DstImplicit | SrcMem16;
         break;
 
     case 0xf0:
@@ -8587,6 +8587,7 @@ x86_emulate(
         generate_exception_if(vex.l, EXC_UD);
         memcpy(mmvalp, &src.val, 2);
         ea.type = OP_MEM;
+        state->simd_size = simd_other;
         goto simd_0f_int_imm8;
 
 #ifndef X86EMUL_NO_SIMD
@@ -8601,9 +8602,8 @@ x86_emulate(
             host_and_vcpu_must_have(avx512bw);
         if ( !mode_64bit() )
             evex.w = 0;
-        memcpy(mmvalp, &src.val, op_bytes);
+        memcpy(mmvalp, &src.val, src.bytes);
         ea.type = OP_MEM;
-        op_bytes = src.bytes;
         d = SrcMem16; /* Fake for the common SIMD code below. */
         state->simd_size = simd_other;
         goto avx512f_imm8_no_sae;
@@ -10766,10 +10766,8 @@ x86_emulate(
     case X86EMUL_OPC_66(0x0f3a, 0x20): /* pinsrb $imm8,r32/m8,xmm */
     case X86EMUL_OPC_66(0x0f3a, 0x22): /* pinsr{d,q} $imm8,r/m,xmm */
         host_and_vcpu_must_have(sse4_1);
-        get_fpu(X86EMUL_FPU_xmm);
-        memcpy(mmvalp, &src.val, op_bytes);
+        memcpy(mmvalp, &src.val, src.bytes);
         ea.type = OP_MEM;
-        op_bytes = src.bytes;
         d = SrcMem16; /* Fake for the common SIMD code below. */
         state->simd_size = simd_other;
         goto simd_0f3a_common;
@@ -10779,9 +10777,8 @@ x86_emulate(
         generate_exception_if(vex.l, EXC_UD);
         if ( !mode_64bit() )
             vex.w = 0;
-        memcpy(mmvalp, &src.val, op_bytes);
+        memcpy(mmvalp, &src.val, src.bytes);
         ea.type = OP_MEM;
-        op_bytes = src.bytes;
         d = SrcMem16; /* Fake for the common SIMD code below. */
         state->simd_size = simd_other;
         goto simd_0f_int_imm8;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 22:22:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 22:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19567.44763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaRAM-0006Sw-4u; Wed, 04 Nov 2020 22:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19567.44763; Wed, 04 Nov 2020 22: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaRAM-0006Sn-1a; Wed, 04 Nov 2020 22:22:06 +0000
Received: by outflank-mailman (input) for mailman id 19567;
 Wed, 04 Nov 2020 22:22:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaRAK-0006Si-Fh
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 22:22:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 420a912d-2122-44ff-b5b4-c42dcbdf32eb;
 Wed, 04 Nov 2020 22:22:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaRAI-0000hy-3M
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 22:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaRAI-0003Hv-23
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 22:22:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaRAK-0006Si-Fh
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 22:22:04 +0000
X-Inumbo-ID: 420a912d-2122-44ff-b5b4-c42dcbdf32eb
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 420a912d-2122-44ff-b5b4-c42dcbdf32eb;
	Wed, 04 Nov 2020 22:22:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KKNnD8YAi4d4UYGZyZ/QXP107SaMUzfjxx1Axn2t9DE=; b=edzTl18iiyXq5gaU2CEzOvLiWa
	sGxoHo2lb0fQRQ8TzKQjDV+HL37U8Gxs3V/1nqOX4p01ksA60EN1LY6uAn+prQO/qa/9FZEBiAXgm
	Xs2yQMifwWjv0BbADCjgU6RpecVsTrYxwG+xT53wZCLcSDeVg6aPx1UarTRGNDhNsuUI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaRAI-0000hy-3M
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 22:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaRAI-0003Hv-23
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 22:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaRAI-0003Hv-23@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 22:22:02 +0000

commit 5784d1e9424151adfdc836535489bd068c6c0700
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:35:16 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:35:16 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 88a182ac31..55a65ae136 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -758,6 +758,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Nov 04 23:55:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Nov 2020 23:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19584.44806 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaScL-0005yz-4K; Wed, 04 Nov 2020 23:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19584.44806; Wed, 04 Nov 2020 23: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaScL-0005yq-0Y; Wed, 04 Nov 2020 23:55:05 +0000
Received: by outflank-mailman (input) for mailman id 19584;
 Wed, 04 Nov 2020 23:55:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaScJ-0005yN-Tv
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 23:55:03 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0b1edc92-700c-463f-8f58-e577d23b0b99;
 Wed, 04 Nov 2020 23:55:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaScI-0002a0-LT
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 23:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaScI-0001wb-Js
 for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 23:55:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=wPYk=EK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaScJ-0005yN-Tv
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 23:55:03 +0000
X-Inumbo-ID: 0b1edc92-700c-463f-8f58-e577d23b0b99
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 0b1edc92-700c-463f-8f58-e577d23b0b99;
	Wed, 04 Nov 2020 23:55:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JjDJ+1/yfjCXTyOid4E4XfZ3QXoYQ3THutzhkVI/i6w=; b=rQ+NV/A7OzOtxKl6nsUBfI9no/
	fnHHqvPD+3WjS+VULJh7rCsBpYNj8W8Dz6T3lSDFI1YgfIgfkKnFu3sDMk1q3oqrOXv779cTEkuaW
	Rjvz71dvow6pi8/dcKoAYzFTtV1a49+2n96DmWnYORnTtn02K0zzjzKkKwj3BYaGBwLQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaScI-0002a0-LT
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 23:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaScI-0001wb-Js
	for xen-changelog@lists.xenproject.org; Wed, 04 Nov 2020 23:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.10] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaScI-0001wb-Js@xenbits.xenproject.org>
Date: Wed, 04 Nov 2020 23:55:02 +0000

commit 7a4ec792d12d58d14e4d0a9cb569be4fd4fe9cf5
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:38:53 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:38:53 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index ae4670c39b..cb618e29ec 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -679,6 +679,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Nov 05 03:44:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Nov 2020 03:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19617.44834 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaWBy-00064R-L9; Thu, 05 Nov 2020 03:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19617.44834; Thu, 05 Nov 2020 03:44:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaWBy-00064J-I0; Thu, 05 Nov 2020 03:44:06 +0000
Received: by outflank-mailman (input) for mailman id 19617;
 Thu, 05 Nov 2020 03:44:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaWBx-00064E-96
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 03:44:05 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ef9e86d2-d725-4126-a25a-85e961eefc99;
 Thu, 05 Nov 2020 03:44:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaWBu-00042f-FZ
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 03:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaWBu-00077O-DO
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 03:44:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaWBx-00064E-96
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 03:44:05 +0000
X-Inumbo-ID: ef9e86d2-d725-4126-a25a-85e961eefc99
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id ef9e86d2-d725-4126-a25a-85e961eefc99;
	Thu, 05 Nov 2020 03:44:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oh4Ly8IUj9WLpr9HqmhacC+xnKBj9otCLuT742zev/E=; b=0JU5tj3cjtX8/86xYu+DW7w7gR
	CUhVfz/vt4GUnuoMOKVeAWyOgvyAsOHfM0/Y8jW3OEeG2XNRuEsFi2WYq76ludFgfjyHZJuYWoPj1
	72koNQ/x0gF+F+S0HoWBReBrW69rd97p+VQsmCQJRy8uVwhJDtkEpG35kPuAWvL2hBZU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaWBu-00042f-FZ
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 03:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaWBu-00077O-DO
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 03:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.11] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaWBu-00077O-DO@xenbits.xenproject.org>
Date: Thu, 05 Nov 2020 03:44:02 +0000

commit b5eb4956e1d2d73546f8cfdef635b6819ed7b527
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:37:12 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:37:12 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 2478a53be6..0c5bb6d4bc 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -692,6 +692,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Thu Nov 05 11:00:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Nov 2020 11:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19710.44997 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaczt-0003fA-3j; Thu, 05 Nov 2020 11:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19710.44997; Thu, 05 Nov 2020 11:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaczt-0003em-0K; Thu, 05 Nov 2020 11:00:05 +0000
Received: by outflank-mailman (input) for mailman id 19710;
 Thu, 05 Nov 2020 11:00:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaczs-0003Uw-61
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 11:00:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c7c4d691-40ec-453c-bea0-fc44819f501d;
 Thu, 05 Nov 2020 11:00:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaczq-0005fx-06
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 11:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaczp-0003lM-Ti
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 11:00:01 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaczs-0003Uw-61
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 11:00:04 +0000
X-Inumbo-ID: c7c4d691-40ec-453c-bea0-fc44819f501d
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id c7c4d691-40ec-453c-bea0-fc44819f501d;
	Thu, 05 Nov 2020 11:00:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rwHeD3AlHkZIG1SaRP3lCFgFH8mVegf/+euxYq48EYc=; b=XQAgLn8z1LjLgfBq/EXkAwbR8R
	x/7L4PfuWJFgMKMLDLU1GmqBEb0D6ZG0IUdxoCmvtHe8Jl8F1bJ1uqWptjcLWtu6lD94gPRWQSxK9
	wVVZUFDYztDG3cTn8H+zelVhUk4EJsH2mBnoTPYEubcjm3LrRNbUGNo3fptrTceDrUVE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaczq-0005fx-06
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 11:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaczp-0003lM-Ti
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 11:00:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kaczp-0003lM-Ti@xenbits.xenproject.org>
Date: Thu, 05 Nov 2020 11:00:01 +0000

commit 83115491d4b3dbcb7c8dbe74ce3e59cdfac69b03
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:35:52 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:35:52 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index b24649ef2d..3e2c8be75e 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -738,6 +738,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Nov 05 15:44:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Nov 2020 15:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19866.45306 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahQj-0004LT-C9; Thu, 05 Nov 2020 15:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19866.45306; Thu, 05 Nov 2020 15:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahQj-0004LL-97; Thu, 05 Nov 2020 15:44:05 +0000
Received: by outflank-mailman (input) for mailman id 19866;
 Thu, 05 Nov 2020 15:44:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kahQh-0004LG-Q3
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:03 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c000fa1f-c4d7-4dc7-90b8-96223d9340aa;
 Thu, 05 Nov 2020 15:44:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahQg-000364-AH
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahQg-0007LC-8d
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kahQh-0004LG-Q3
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:03 +0000
X-Inumbo-ID: c000fa1f-c4d7-4dc7-90b8-96223d9340aa
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id c000fa1f-c4d7-4dc7-90b8-96223d9340aa;
	Thu, 05 Nov 2020 15:44:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A90Fxfc8uzW1uQBOQ97gHkLfX1GhLfZg8ChSUi+c4oM=; b=Mzofd38+u7REFXXVfWr0xT6rnU
	6qDfMCrcKovHaQudZLGAPI513tsPVvLa2m0U1Vu/zPghqJX05MgrY+RTT4gGJbblYAfQU7z2hurQq
	2txbK95b72Td/DTn9nj0dTOULiuUQ+Q2uvViUWEHVa/xn/SXewItpVZP4GgNnvU+tdcA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahQg-000364-AH
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahQg-0007LC-8d
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kahQg-0007LC-8d@xenbits.xenproject.org>
Date: Thu, 05 Nov 2020 15:44:02 +0000

commit 8587160b3e2951b722d395a0346bb17c3c22152f
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Aug 19 18:31:45 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:22:37 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 88d4bc7384..ab02aca5f4 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -767,6 +767,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 05 15:44:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Nov 2020 15:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19867.45310 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahQs-0004Mc-Dz; Thu, 05 Nov 2020 15:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19867.45310; Thu, 05 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahQs-0004MU-Ao; Thu, 05 Nov 2020 15:44:14 +0000
Received: by outflank-mailman (input) for mailman id 19867;
 Thu, 05 Nov 2020 15:44:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kahQr-0004MP-8N
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:13 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id faaa7a74-a382-4d4a-b846-6c853d764464;
 Thu, 05 Nov 2020 15:44:12 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahQq-00036A-F7
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahQq-0007Ls-Ct
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:12 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kahQr-0004MP-8N
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:13 +0000
X-Inumbo-ID: faaa7a74-a382-4d4a-b846-6c853d764464
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id faaa7a74-a382-4d4a-b846-6c853d764464;
	Thu, 05 Nov 2020 15:44:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+28zBe72TjvrkIZkQQFhTCl0tE5vB5MiGw3LL88FrXo=; b=0iz5PJrKbnxLV1S9IcwXaV7FC0
	6nJS4FT5mds0/8UzopVSAGsBvjpVfGt7lSqBSwi+kgBBeNUjucA8b/YFcFDpPd7/0OUbzIb1J0P+4
	7Ktw9hOKN8nJFsKx235Mrjog4PMRLmtR2R9Nd0ypeByH00FXUFnyS1J8KQ3ofnFJxXco=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahQq-00036A-F7
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahQq-0007Ls-Ct
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: don't have timestamp inserted in config.gz
Message-Id: <E1kahQq-0007Ls-Ct@xenbits.xenproject.org>
Date: Thu, 05 Nov 2020 15:44:12 +0000

commit 5816d327e44ab37ae08730f4c54a80835998f31f
Author:     Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
AuthorDate: Wed Nov 4 09:24:40 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:24:40 2020 +0100

    xen: don't have timestamp inserted in config.gz
    
    This is for improving reproducible builds.
    
    Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/Makefile b/xen/common/Makefile
index 083f62acb6..d109f279a4 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -80,7 +80,7 @@ obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
 
 CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFIG_CONFIG)
 config.gz: $(CONF_FILE)
-	gzip -c $< >$@
+	gzip -n -c $< >$@
 
 config_data.o: config.gz
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 05 15:44:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Nov 2020 15:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19868.45315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahR3-0004OA-Fo; Thu, 05 Nov 2020 15:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19868.45315; Thu, 05 Nov 2020 15:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahR3-0004O1-CN; Thu, 05 Nov 2020 15:44:25 +0000
Received: by outflank-mailman (input) for mailman id 19868;
 Thu, 05 Nov 2020 15:44:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kahR2-0004Ns-0c
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:24 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 78dbef1e-4b5f-402f-8817-f77f49ef2789;
 Thu, 05 Nov 2020 15:44:22 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahR0-00036h-J6
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahR0-0007Mr-He
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:22 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kahR2-0004Ns-0c
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:24 +0000
X-Inumbo-ID: 78dbef1e-4b5f-402f-8817-f77f49ef2789
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 78dbef1e-4b5f-402f-8817-f77f49ef2789;
	Thu, 05 Nov 2020 15:44:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZmpQfLGO+R0jggmvMeauJbw5+uJiUt43De5+7HYUMbo=; b=Ej4VmgOORhCJgFfkxwn6tcQOG6
	sC9hdc84fXkEpPU9WNUY0iWQByyJlvk/l0MrBkDLr0tHW6KeN8P/aYUeuA1FeMG0KHRDf6HlGMd/L
	rr76NbxhPRjcoTmjBgmCde58alORMR3uArJcwRjasGCrZajB8GFyzHYmvApNQauoK/QQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahR0-00036h-J6
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahR0-0007Mr-He
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/spinlocks: spin_trylock with interrupts off is always fine
Message-Id: <E1kahR0-0007Mr-He@xenbits.xenproject.org>
Date: Thu, 05 Nov 2020 15:44:22 +0000

commit c0d3cc9b0f343ef455ce3e2c4c605064a2934865
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 4 09:26:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:26:42 2020 +0100

    xen/spinlocks: spin_trylock with interrupts off is always fine
    
    Even if a spinlock was taken with interrupts on before calling
    spin_trylock() with interrupts off is fine, as it can't block.
    
    Add a bool parameter "try" to check_lock() for handling this case.
    
    Remove the call of check_lock() from _spin_is_locked(), as it really
    serves no purpose and it can even lead to false crashes, e.g. when
    a lock was taken correctly with interrupts enabled and the call of
    _spin_is_locked() happened with interrupts off. In case the lock is
    taken with wrong interrupt flags this will be catched when taking
    the lock.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/spinlock.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index ce3106e2d3..b4aaf6bce6 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -13,7 +13,7 @@
 
 static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0);
 
-static void check_lock(union lock_debug *debug)
+static void check_lock(union lock_debug *debug, bool try)
 {
     bool irq_safe = !local_irq_is_enabled();
 
@@ -42,7 +42,13 @@ static void check_lock(union lock_debug *debug)
      * 
      * To guard against this subtle bug we latch the IRQ safety of every
      * spinlock in the system, on first use.
+     *
+     * A spin_trylock() with interrupts off is always fine, as this can't
+     * block and above deadlock scenario doesn't apply.
      */
+    if ( try && irq_safe )
+        return;
+
     if ( unlikely(debug->irq_safe != irq_safe) )
     {
         union lock_debug seen, new = { 0 };
@@ -102,7 +108,7 @@ void spin_debug_disable(void)
 
 #else /* CONFIG_DEBUG_LOCKS */
 
-#define check_lock(l) ((void)0)
+#define check_lock(l, t) ((void)0)
 #define check_barrier(l) ((void)0)
 #define got_lock(l) ((void)0)
 #define rel_lock(l) ((void)0)
@@ -159,7 +165,7 @@ void inline _spin_lock_cb(spinlock_t *lock, void (*cb)(void *), void *data)
     spinlock_tickets_t tickets = SPINLOCK_TICKET_INC;
     LOCK_PROFILE_VAR;
 
-    check_lock(&lock->debug);
+    check_lock(&lock->debug, false);
     preempt_disable();
     tickets.head_tail = arch_fetch_and_add(&lock->tickets.head_tail,
                                            tickets.head_tail);
@@ -220,8 +226,6 @@ void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
 
 int _spin_is_locked(spinlock_t *lock)
 {
-    check_lock(&lock->debug);
-
     /*
      * Recursive locks may be locked by another CPU, yet we return
      * "false" here, making this function suitable only for use in
@@ -236,7 +240,7 @@ int _spin_trylock(spinlock_t *lock)
 {
     spinlock_tickets_t old, new;
 
-    check_lock(&lock->debug);
+    check_lock(&lock->debug, true);
     old = observe_lock(&lock->tickets);
     if ( old.head != old.tail )
         return 0;
@@ -294,7 +298,7 @@ int _spin_trylock_recursive(spinlock_t *lock)
     BUILD_BUG_ON(NR_CPUS > SPINLOCK_NO_CPU);
     BUILD_BUG_ON(SPINLOCK_RECURSE_BITS < 3);
 
-    check_lock(&lock->debug);
+    check_lock(&lock->debug, true);
 
     if ( likely(lock->recurse_cpu != cpu) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 05 15:44:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Nov 2020 15:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19870.45320 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahRE-0004Pp-Hk; Thu, 05 Nov 2020 15:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19870.45320; Thu, 05 Nov 2020 15:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahRE-0004Pc-Du; Thu, 05 Nov 2020 15:44:36 +0000
Received: by outflank-mailman (input) for mailman id 19870;
 Thu, 05 Nov 2020 15:44:34 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kahRC-0004PS-Ta
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:34 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5c2a6526-dea6-44fc-8236-31ffd19fdd10;
 Thu, 05 Nov 2020 15:44:32 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahRA-00036u-Mg
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahRA-0007Nx-Ld
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:32 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kahRC-0004PS-Ta
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:34 +0000
X-Inumbo-ID: 5c2a6526-dea6-44fc-8236-31ffd19fdd10
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 5c2a6526-dea6-44fc-8236-31ffd19fdd10;
	Thu, 05 Nov 2020 15:44:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=izIB4Kq9VW1iU5+IRXw0MKoBxMIFYw3lmKQfH6f0FKQ=; b=QLMdDYVDFS6MklxPuF8+cOYQ9T
	aOsVOMkNQeqgAict317JOisaDhQew1ILbe1FupAm4L3GzO47H8mkfJNerOe8cyzrq1kWwpYReNnU7
	Yq8XjPsGSG0+Iq2hGgEC2AiFBci+GMLcjGLysxK7AhEO3YMzvKHwWhUFJ6CSTPDzfArE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahRA-00036u-Mg
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahRA-0007Nx-Ld
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:44:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: drop guest_get_eff_l1e()
Message-Id: <E1kahRA-0007Nx-Ld@xenbits.xenproject.org>
Date: Thu, 05 Nov 2020 15:44:32 +0000

commit 9ff9705647646aa937b5f5c1426a64c69a62b3bd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 4 09:27:22 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:27:22 2020 +0100

    x86/mm: drop guest_get_eff_l1e()
    
    There's no actual user of it: pv_ro_page_fault() has a
    guest_kernel_mode() conditional around its only call site.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/mm.c            | 21 ---------------------
 xen/arch/x86/pv/mm.h            |  7 +++++--
 xen/arch/x86/pv/ro-page-fault.c |  2 +-
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index 14cb0f2d4e..5d74d11cba 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -55,27 +55,6 @@ l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn)
     return (l1_pgentry_t *)map_domain_page(*gl1mfn) + l1_table_offset(linear);
 }
 
-/*
- * Read the guest's l1e that maps this address, from the kernel-mode
- * page tables.
- */
-static l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
-{
-    struct vcpu *curr = current;
-    const bool user_mode = !(curr->arch.flags & TF_kernel_mode);
-    l1_pgentry_t l1e;
-
-    if ( user_mode )
-        toggle_guest_pt(curr);
-
-    l1e = guest_get_eff_l1e(linear);
-
-    if ( user_mode )
-        toggle_guest_pt(curr);
-
-    return l1e;
-}
-
 /*
  * Map a guest's LDT page (covering the byte at @offset from start of the LDT)
  * into Xen's virtual range.  Returns true if the mapping changed, false
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
index b1b66e46c8..2a21859dd4 100644
--- a/xen/arch/x86/pv/mm.h
+++ b/xen/arch/x86/pv/mm.h
@@ -5,8 +5,11 @@ l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn);
 
 int new_guest_cr3(mfn_t mfn);
 
-/* Read a PV guest's l1e that maps this linear address. */
-static inline l1_pgentry_t guest_get_eff_l1e(unsigned long linear)
+/*
+ * Read the guest's l1e that maps this address, from the kernel-mode
+ * page tables.
+ */
+static inline l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
 {
     l1_pgentry_t l1e;
 
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index 7f6fbc92fb..8d0007ede5 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -342,7 +342,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
     bool mmio_ro;
 
     /* Attempt to read the PTE that maps the VA being accessed. */
-    pte = guest_get_eff_l1e(addr);
+    pte = guest_get_eff_kern_l1e(addr);
 
     /* We are only looking for read-only mappings */
     if ( ((l1e_get_flags(pte) & (_PAGE_PRESENT | _PAGE_RW)) != _PAGE_PRESENT) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 05 15:55:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Nov 2020 15:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19889.45361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahbQ-0005es-8V; Thu, 05 Nov 2020 15:55:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19889.45361; Thu, 05 Nov 2020 15:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahbQ-0005ek-5a; Thu, 05 Nov 2020 15:55:08 +0000
Received: by outflank-mailman (input) for mailman id 19889;
 Thu, 05 Nov 2020 15:55:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kahbO-0005ef-FM
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:06 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 986311f9-58e4-4cd7-8dd6-bb4065cd8ede;
 Thu, 05 Nov 2020 15:55:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahbN-0003LM-Ct
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahbN-0008AO-Bl
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kahbO-0005ef-FM
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:06 +0000
X-Inumbo-ID: 986311f9-58e4-4cd7-8dd6-bb4065cd8ede
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 986311f9-58e4-4cd7-8dd6-bb4065cd8ede;
	Thu, 05 Nov 2020 15:55:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m1zwXDhZntxkJpaljBzFqZV4qPivcbnviMD+lxcNrm0=; b=vA6CupCmjcJR85fa73jhSS9Edw
	ZwJA2/EJGAcwoBO3sVuqC0gC3j/NSjcFEu3W3AQLvseaXPAZDWZrmyajHp+1HNmiCNkffvo4Ba3yq
	UXsPP0UH1qm/PG6z/Xsar25A5bpgyIuKi7yMJYq1cs4VsHLl14a5uY6xrv8jn1ASLaJ0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahbN-0003LM-Ct
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahbN-0008AO-Bl
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/python: pass more -rpath-link options to ld
Message-Id: <E1kahbN-0008AO-Bl@xenbits.xenproject.org>
Date: Thu, 05 Nov 2020 15:55:05 +0000

commit 2b8314a3c354d04545700c80ff5a5f86799b79c7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 5 16:48:37 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 5 16:48:37 2020 +0100

    tools/python: pass more -rpath-link options to ld
    
    With the split of libraries, I've observed a number of warnings from
    (old?) ld.
    
    Instead of duplicating the additions in two places, introduce a setup.py
    make variable holding all the common parts of the invocations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/python/Makefile | 14 ++++++++------
 tools/python/setup.py |  7 ++++++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/tools/python/Makefile b/tools/python/Makefile
index 5e555acf1c..cc76423647 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -8,19 +8,21 @@ PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
 PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS)
 INSTALL_LOG = build/installed_files.txt
 
+setup.py = CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" \
+           SHLIB_libxenctrl="$(SHLIB_libxenctrl)" \
+           SHLIB_libxenguest="$(SHLIB_libxenguest)" \
+           SHLIB_libxenstore="$(SHLIB_libxenstore)" \
+           $(PYTHON) setup.py
+
 .PHONY: build
 build:
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
+	$(setup.py) build
 
 .PHONY: install
 install:
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \
-		LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \
-		--record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
+	$(setup.py) install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
 		--root="$(DESTDIR)" --force
-
 	$(INSTALL_PYTHON_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PYTHON_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
 
diff --git a/tools/python/setup.py b/tools/python/setup.py
index 1afe800479..8c95db7769 100644
--- a/tools/python/setup.py
+++ b/tools/python/setup.py
@@ -4,6 +4,10 @@ import os, sys
 
 XEN_ROOT = "../.."
 
+SHLIB_libxenctrl = os.environ['SHLIB_libxenctrl'].split()
+SHLIB_libxenguest = os.environ['SHLIB_libxenguest'].split()
+SHLIB_libxenstore = os.environ['SHLIB_libxenstore'].split()
+
 extra_compile_args  = [ "-fno-strict-aliasing", "-Werror" ]
 
 PATH_XEN      = XEN_ROOT + "/tools/include"
@@ -24,7 +28,7 @@ xc = Extension("xc",
                library_dirs       = [ PATH_LIBXENCTRL, PATH_LIBXENGUEST ],
                libraries          = [ "xenctrl", "xenguest" ],
                depends            = [ PATH_LIBXENCTRL + "/libxenctrl.so", PATH_LIBXENGUEST + "/libxenguest.so" ],
-               extra_link_args    = [ "-Wl,-rpath-link="+PATH_LIBXENTOOLLOG ],
+               extra_link_args    = SHLIB_libxenctrl + SHLIB_libxenguest,
                sources            = [ "xen/lowlevel/xc/xc.c" ])
 
 xs = Extension("xs",
@@ -33,6 +37,7 @@ xs = Extension("xs",
                library_dirs       = [ PATH_XENSTORE ],
                libraries          = [ "xenstore" ],
                depends            = [ PATH_XENSTORE + "/libxenstore.so" ],
+               extra_link_args    = SHLIB_libxenstore,
                sources            = [ "xen/lowlevel/xs/xs.c" ])
 
 plat = os.uname()[0]
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 05 15:55:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Nov 2020 15:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.19890.45365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahbZ-0005gH-Ai; Thu, 05 Nov 2020 15:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 19890.45365; Thu, 05 Nov 2020 15:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kahbZ-0005g9-79; Thu, 05 Nov 2020 15:55:17 +0000
Received: by outflank-mailman (input) for mailman id 19890;
 Thu, 05 Nov 2020 15:55:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kahbY-0005g3-EC
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:16 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id da7b8859-887d-40f9-af86-c9dc1edfd8aa;
 Thu, 05 Nov 2020 15:55:15 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahbX-0003LS-Hx
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kahbX-0008BF-FR
 for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=8CHh=EL=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kahbY-0005g3-EC
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:16 +0000
X-Inumbo-ID: da7b8859-887d-40f9-af86-c9dc1edfd8aa
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id da7b8859-887d-40f9-af86-c9dc1edfd8aa;
	Thu, 05 Nov 2020 15:55:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4X/ujEa4ZZK5GpiOFDg50YbDauswC55Gxtx0QRhM1gQ=; b=OWhUQbuq8oLEfaaImvwo82aMN6
	qhYb79TcG6HYlOnz0QUA1ZTK+W9C8wQLsh8iN64P2EqBkG3SdVZKZq5PldalLwf76DyWib/efRpCI
	dgfnFcdTmxfkEZuEZkLKrD7R848dZcKP45SLucwsZzAIcgE3NFG00AfC93NLuZ2RaoGw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahbX-0003LS-Hx
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kahbX-0008BF-FR
	for xen-changelog@lists.xenproject.org; Thu, 05 Nov 2020 15:55:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: fix libacpi dependency
Message-Id: <E1kahbX-0008BF-FR@xenbits.xenproject.org>
Date: Thu, 05 Nov 2020 15:55:15 +0000

commit e006b2e3be72e502b86bd9e1405417abd87bdfed
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 5 16:48:55 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 5 16:48:55 2020 +0100

    libxl: fix libacpi dependency
    
    $(DSDT_FILES-y) depends on the recursive make to have run in libacpi/
    such that the file(s) itself/themselves were generated before
    compilation gets attempted. The same, however, is also necessary for
    generated headers, before source files including them would get
    attempted to be compiled.
    
    The dependency specified in libacpi's Makefile, otoh, is entirely
    pointless nowadays - no compilation happens there anymore (except for
    tools involved in building the generated files). Together with it, the
    rule generating acpi.a also can go away.
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Fixes: 14c0d328da2b ("libxl/acpi: Build ACPI tables for HVMlite guests")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libacpi/Makefile    | 5 -----
 tools/libs/light/Makefile | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index c17f3924cc..2448687dbb 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -89,11 +89,6 @@ iasl:
 	@echo 
 	@exit 1
 
-build.o: ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h ssdt_laptop_slate.h
-
-acpi.a: $(OBJS)
-	$(AR) rc $@ $(OBJS)
-
 clean:
 	rm -f $(C_SRC) $(H_SRC) $(MK_DSDT) $(C_SRC:=.$(TMP_SUFFIX))
 	rm -f $(patsubst %.c,%.hex,$(C_SRC)) $(patsubst %.c,%.aml,$(C_SRC)) $(patsubst %.c,%.asl,$(C_SRC))
diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 3424fdb61b..68f6fa315f 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -32,7 +32,7 @@ ACPI_PATH  = $(XEN_ROOT)/tools/libacpi
 DSDT_FILES-$(CONFIG_X86) = dsdt_pvh.c
 ACPI_OBJS  = $(patsubst %.c,%.o,$(DSDT_FILES-y)) build.o static_tables.o
 ACPI_PIC_OBJS = $(patsubst %.o,%.opic,$(ACPI_OBJS))
-$(DSDT_FILES-y): acpi
+$(DSDT_FILES-y) build.o: acpi
 vpath build.c $(ACPI_PATH)/
 vpath static_tables.c $(ACPI_PATH)/
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 02:00:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 02:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20324.46124 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kar2u-00012o-BT; Fri, 06 Nov 2020 02:00:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20324.46124; Fri, 06 Nov 2020 02:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kar2u-00012e-7n; Fri, 06 Nov 2020 02:00:08 +0000
Received: by outflank-mailman (input) for mailman id 20324;
 Fri, 06 Nov 2020 02:00:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kar2t-0000zS-M2
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:07 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 463962e9-cb45-4485-b381-ca667f90d171;
 Fri, 06 Nov 2020 02:00:06 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kar2s-0004vy-Kw
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kar2s-0008IQ-JN
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kar2t-0000zS-M2
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:07 +0000
X-Inumbo-ID: 463962e9-cb45-4485-b381-ca667f90d171
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 463962e9-cb45-4485-b381-ca667f90d171;
	Fri, 06 Nov 2020 02:00:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gHUd9L8m++WDJa/PX10XbuhSGdt2b3o3eNcWtHL43bw=; b=TmISX/oX870ST70yQlhAg7cEP6
	NDChdkXbbUP8Lc0NetYdWI6mWxtINYK1wwDuyVxr+mpbTo9p4F9so0hJuNNCgaBUpdl6TWpDDBcVk
	FBI1yvQatjyLwC4qd74cs6wlKxvD/9YzonWPiso6gX2Bhf4ey8e4wdK5tZN6kffCXxzs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kar2s-0004vy-Kw
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kar2s-0008IQ-JN
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] xen/arm64: force gcc 10+ to always inline generic atomics helpers
Message-Id: <E1kar2s-0008IQ-JN@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 02:00:06 +0000

commit f61c5d0ca729eda5e936b8aa2b45c4192e2f2b64
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 11 12:45:33 2020 +0200
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 17:48:15 2020 -0800

    xen/arm64: force gcc 10+ to always inline generic atomics helpers
    
    Recent versions of gcc (at least 10.x) will not inline generic atomics
    helpers by default. Instead they will expect the software to either link
    with libatomic.so or implement the helpers, which would result in
    
    undefined reference to `__aarch64_ldadd4_acq_rel'
    
    for us (not having any local implementation).
    
    To keep the previous behavior, force gcc to always inline the generic
    atomics helpers.
    
    Long term we probably want to avoid relying on gcc atomics helpers as
    this doesn't allow us to switch between LSE and LL/SC atomics.
    
    Suggested-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 5d45ecabe3c0b2097df623ab7b471f8915cfdde6)
---
 xen/arch/arm/arch.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index c8186f5828..11caec86ba 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -12,6 +12,7 @@ CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-a15
 
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
+$(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
 
 ifneq ($(filter command line environment,$(origin CONFIG_EARLY_PRINTK)),)
     $(error You must use 'make menuconfig' to enable/disable early printk now)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 02:00:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 02:00:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20326.46128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kar35-00014Q-EM; Fri, 06 Nov 2020 02:00:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20326.46128; Fri, 06 Nov 2020 02:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kar35-00014I-B0; Fri, 06 Nov 2020 02:00:19 +0000
Received: by outflank-mailman (input) for mailman id 20326;
 Fri, 06 Nov 2020 02:00:18 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kar34-000149-8G
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:18 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1a2f4049-336d-4113-9dbc-a086a1bd7c72;
 Fri, 06 Nov 2020 02:00:16 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kar32-0004w4-PY
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kar32-0008Jt-Nb
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kar34-000149-8G
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:18 +0000
X-Inumbo-ID: 1a2f4049-336d-4113-9dbc-a086a1bd7c72
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 1a2f4049-336d-4113-9dbc-a086a1bd7c72;
	Fri, 06 Nov 2020 02:00:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qFtHxau4jy3ys/S770gNSEoKUxZVGpZuGGuLH0W2CyE=; b=kmWuy1eJiTmSK1ryXDb9+2K7ya
	mdfFMHN+kXLotSmOhdWBQMC4Q3+ya5QCRt5Oz81bqiBlVwjOSrxyYolOiW07R0fpV0owngYKhJQdP
	5Tp5b9X1FSAG2uKbiLPkI+Eu6yDA038d371B2KjHMmChQ1ttNTEfzjyDyIwCSPXqtaSk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kar32-0004w4-PY
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kar32-0008Jt-Nb
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] xen/arm: bootfdt: Ignore empty memory bank
Message-Id: <E1kar32-0008Jt-Nb@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 02:00:16 +0000

commit 7d2b21fd36c2a47799eed71c67bae7faa1ec4272
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Sep 18 18:11:16 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 17:49:04 2020 -0800

    xen/arm: bootfdt: Ignore empty memory bank
    
    At the moment, Xen will stop processing the Device Tree if a memory
    bank is empty (size == 0).
    
    Unfortunately, some of the Device Tree (such as on Colibri imx8qxp)
    may contain such a bank. This means Xen will not be able to boot
    properly.
    
    Relax the check to just ignore the banks. FWIW this also seems to be the
    behavior adopted by Linux.
    
    Reported-by: Daniel Wagner <Daniel.Wagner2@itk-engineering.de>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 5a37207df52066efefe419c677b089a654d37afc)
---
 xen/arch/arm/bootfdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 08fb59f4e7..dcff512648 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -163,8 +163,9 @@ static int __init process_memory_node(const void *fdt, int node,
     for ( i = 0; i < banks && mem->nr_banks < NR_MEM_BANKS; i++ )
     {
         device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+        /* Some DT may describe empty bank, ignore them */
         if ( !size )
-            return -EINVAL;
+            continue;
         mem->bank[mem->nr_banks].start = start;
         mem->bank[mem->nr_banks].size = size;
         mem->nr_banks++;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 02:00:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 02:00:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20327.46131 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kar3E-000160-FU; Fri, 06 Nov 2020 02:00:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20327.46131; Fri, 06 Nov 2020 02:00:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kar3E-00015s-CX; Fri, 06 Nov 2020 02:00:28 +0000
Received: by outflank-mailman (input) for mailman id 20327;
 Fri, 06 Nov 2020 02:00:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kar3D-00015g-Nj
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:27 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b5beaf65-60c7-4fa9-9f8b-4a96d8b75d55;
 Fri, 06 Nov 2020 02:00:27 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kar3C-0004wK-TR
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kar3C-0008Kk-S1
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kar3D-00015g-Nj
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:27 +0000
X-Inumbo-ID: b5beaf65-60c7-4fa9-9f8b-4a96d8b75d55
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id b5beaf65-60c7-4fa9-9f8b-4a96d8b75d55;
	Fri, 06 Nov 2020 02:00:27 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+isRwjVmmOyXc1Rh4UqL5J529O1kwWoOdWumMyeYEUU=; b=GA6b9jNCmRS2f90Z3EJMSoj0bp
	U772eTHdPtYsLTr1m2L/tU4PXM3y0XopiTFxXuS+ogli+qziQQHbrJyjXCcuOuMihYnmq/8dwGBuG
	RROr8F9ZgRHj/2fGqPzLXxdegDM92a9zX2tAdh2zBH1amhzOe03KdfphCMI/TxrvINYc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kar3C-0004wK-TR
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kar3C-0008Kk-S1
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] xen/arm: sched: Ensure the vCPU context is seen before vcpu_pause() returns
Message-Id: <E1kar3C-0008Kk-S1@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 02:00:26 +0000

commit d131310e60828a15f1354f0d73a89f42b64fe810
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Sep 22 20:31:04 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 17:49:26 2020 -0800

    xen/arm: sched: Ensure the vCPU context is seen before vcpu_pause() returns
    
    Some callers of vcpu_pause() will expect to access the latest vcpu
    context when the function returns (see XENDOMCTL_{set,get}vcpucontext}.
    
    However, the latest vCPU context can only be observed after
    v->is_running has been observed to be false.
    
    As there is no memory barrier instruction generated, a processor could
    try to speculatively access the vCPU context before it was observed.
    
    To prevent the corruption of the vCPU context, we need to insert a
    memory barrier instruction after v->is_running is observed and before
    the context is accessed. This barrier is added in sync_vcpu_execstate()
    as it seems to be the place where we expect the synchronization to
    happen.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit f6790389613cd54775ece6575013a679572b46b3)
---
 xen/arch/arm/domain.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 31169326b2..ac6a419f55 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -371,7 +371,20 @@ void sync_local_execstate(void)
 
 void sync_vcpu_execstate(struct vcpu *v)
 {
-    /* Nothing to do -- no lazy switching */
+    /*
+     * We don't support lazy switching.
+     *
+     * However the context may have been saved from a remote pCPU so we
+     * need a barrier to ensure it is observed before continuing.
+     *
+     * Per vcpu_context_saved(), the context can be observed when
+     * v->is_running is false (the caller should check it before calling
+     * this function).
+     *
+     * Note this is a full barrier to also prevent update of the context
+     * to happen before it was observed.
+     */
+    smp_mb();
 }
 
 #define NEXT_ARG(fmt, args)                                                 \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 02:00:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 02:00:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20328.46136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kar3P-00018b-HU; Fri, 06 Nov 2020 02:00:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20328.46136; Fri, 06 Nov 2020 02:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kar3P-00018S-EM; Fri, 06 Nov 2020 02:00:39 +0000
Received: by outflank-mailman (input) for mailman id 20328;
 Fri, 06 Nov 2020 02:00:39 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kar3O-00018M-VI
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:38 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5cd99518-f202-4850-bb0d-f304777a339e;
 Fri, 06 Nov 2020 02:00:37 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kar3N-0004ws-23
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kar3M-0008LU-W4
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kar3O-00018M-VI
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:38 +0000
X-Inumbo-ID: 5cd99518-f202-4850-bb0d-f304777a339e
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 5cd99518-f202-4850-bb0d-f304777a339e;
	Fri, 06 Nov 2020 02:00:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4v0B+hmGMCiG1zOcYni+dfHxu92ld+PVhdn9aOmvuD8=; b=LiYBv+zkkF0mNNFpF60tApyHKL
	XfArmxKRG1sWthFG5I9hOTugiBsXZ4Z5/jBMOW5AADKka/76okmadUi814DF7Tj+y7gKHonO3hwkD
	uLJJQJhu0aFZqpJscAvicWMFDpsMSNh3ivKcTMoSjeoddLFLL6bL6KYofoSoCDKw2uYI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kar3N-0004ws-23
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kar3M-0008LU-W4
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:00:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] arm,smmu: match start level of page table walk with P2M
Message-Id: <E1kar3M-0008LU-W4@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 02:00:36 +0000

commit 29b48aa27de1a40be45cb5ccd6e427ad63992ff3
Author:     Laurentiu Tudor <laurentiu.tudor@nxp.com>
AuthorDate: Fri Oct 2 13:33:44 2020 +0300
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 17:49:54 2020 -0800

    arm,smmu: match start level of page table walk with P2M
    
    Don't hardcode the lookup start level of the page table walk to 1
    and instead match the one used in P2M. This should fix scenarios
    involving SMMU where the start level is different than 1.
    In order for the SMMU driver to also compile on arm32 move the
    P2M_ROOT_LEVEL in the p2m header file (while at it, for
    consistency also P2M_ROOT_ORDER) and use the macro in the smmu
    driver.
    
    Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 9ae1197582798b394d696cff94c4d742319bdbbf)
---
 xen/arch/arm/p2m.c                 |  9 ++-------
 xen/drivers/passthrough/arm/smmu.c |  2 +-
 xen/include/asm-arm/p2m.h          | 11 +++++++++++
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ce59f2b503..4eeb867ca1 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -17,17 +17,12 @@
 #define INVALID_VMID 0 /* VMID 0 is reserved */
 
 #ifdef CONFIG_ARM_64
-static unsigned int __read_mostly p2m_root_order;
-static unsigned int __read_mostly p2m_root_level;
-#define P2M_ROOT_ORDER    p2m_root_order
-#define P2M_ROOT_LEVEL p2m_root_level
+unsigned int __read_mostly p2m_root_order;
+unsigned int __read_mostly p2m_root_level;
 static unsigned int __read_mostly max_vmid = MAX_VMID_8_BIT;
 /* VMID is by default 8 bit width on AArch64 */
 #define MAX_VMID       max_vmid
 #else
-/* First level P2M is always 2 consecutive pages */
-#define P2M_ROOT_LEVEL 1
-#define P2M_ROOT_ORDER    1
 /* VMID is always 8 bit width on AArch32 */
 #define MAX_VMID        MAX_VMID_8_BIT
 #endif
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 94662a8501..4ba6d3ab94 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -1152,7 +1152,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain)
 	      (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT);
 
 	if (!stage1)
-		reg |= (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT);
+		reg |= (2 - P2M_ROOT_LEVEL) << TTBCR_SL0_SHIFT;
 
 	writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR);
 
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index 5fdb6e8183..28ca9a838e 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -13,6 +13,17 @@
 /* Holds the bit size of IPAs in p2m tables.  */
 extern unsigned int p2m_ipa_bits;
 
+#ifdef CONFIG_ARM_64
+extern unsigned int p2m_root_order;
+extern unsigned int p2m_root_level;
+#define P2M_ROOT_ORDER    p2m_root_order
+#define P2M_ROOT_LEVEL p2m_root_level
+#else
+/* First level P2M is always 2 consecutive pages */
+#define P2M_ROOT_ORDER    1
+#define P2M_ROOT_LEVEL 1
+#endif
+
 struct domain;
 
 extern void memory_type_changed(struct domain *);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 02:11:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 02:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20333.46142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1karDa-00022f-Bo; Fri, 06 Nov 2020 02:11:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20333.46142; Fri, 06 Nov 2020 02:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1karDa-00022X-94; Fri, 06 Nov 2020 02:11:10 +0000
Received: by outflank-mailman (input) for mailman id 20333;
 Fri, 06 Nov 2020 02:11:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1karDZ-00022S-4t
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:11:09 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4be2d18d-b28a-4767-b2bc-6c6cdac09629;
 Fri, 06 Nov 2020 02:11:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1karDV-00059G-NM
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1karDV-0000uv-KH
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:11:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1karDZ-00022S-4t
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:11:09 +0000
X-Inumbo-ID: 4be2d18d-b28a-4767-b2bc-6c6cdac09629
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 4be2d18d-b28a-4767-b2bc-6c6cdac09629;
	Fri, 06 Nov 2020 02:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eVpthmoalEBPOlMX25ow2amv146mh79OgNaLMwx9tWs=; b=kQx3nZsCEtTwBLHIDPyRbhPubv
	DQBbQW+x2FF3J3imHlVTYF8U2MNKR2Lkl9VnfmykllQj8bwUhog3LYIArKDhYQWyFs+6sRR2oWtgM
	sq9vD9rPdFiPMyY8155VpmuhvTPweSIDfew50ah4dxuU6wSf/Bt+esjSGChXY+yz/kS8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1karDV-00059G-NM
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1karDV-0000uv-KH
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 02:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: traps: Don't panic when receiving an unknown debug trap
Message-Id: <E1karDV-0000uv-KH@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 02:11:05 +0000

commit 957708c2d1ae25d7375abd5e5e70c3043d64f1f1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Nov 5 22:31:06 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 18:00:10 2020 -0800

    xen/arm: traps: Don't panic when receiving an unknown debug trap
    
    Even if debug trap are only meant for debugging purpose, it is quite
    harsh to crash Xen if one of the trap sent by the guest is not handled.
    
    So switch from a panic() to a printk().
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 8f40d0e0b6..a36f145e67 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1410,7 +1410,7 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
         show_execution_state(regs);
         break;
     default:
-        panic("DOM%d: Unhandled debug trap %#x\n", domid, code);
+        printk("DOM%d: Unhandled debug trap %#x\n", domid, code);
         break;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 09:00:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 09:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20507.46432 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaxbN-00067L-5X; Fri, 06 Nov 2020 09:00:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20507.46432; Fri, 06 Nov 2020 09:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaxbN-00067B-2L; Fri, 06 Nov 2020 09:00:09 +0000
Received: by outflank-mailman (input) for mailman id 20507;
 Fri, 06 Nov 2020 09:00:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaxbL-000676-Pf
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:00:07 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ae61468f-90ad-4a19-b217-adffcbf785a4;
 Fri, 06 Nov 2020 09:00:06 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaxbK-0006Cl-Ei
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:00:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaxbK-00072o-DH
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:00:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaxbL-000676-Pf
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:00:07 +0000
X-Inumbo-ID: ae61468f-90ad-4a19-b217-adffcbf785a4
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id ae61468f-90ad-4a19-b217-adffcbf785a4;
	Fri, 06 Nov 2020 09:00:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gc6yDMJf/Nqa8WXFLUYml/cKtaqQRqmKmj/UbwlUqhY=; b=ueqFWem4QZb07pRY7EAM5y95hY
	AbtY6XdnhqCLChaKH30XqN/QSP3Ax4AFVOI8zPZzJ3HiOgNInnwM8E+UO7onuLkJGXEAggu3fC2NP
	Y6M70Z20MApqTjoxL2Sr7DBu9PmOh2IcSecIMXP4NbLbjq1HxFEvGBsgDJBQJGkZzX/A=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaxbK-0006Cl-Ei
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:00:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaxbK-00072o-DH
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:00:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] SUPPORT: Add linux device model stubdom to Toolstack
Message-Id: <E1kaxbK-00072o-DH@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 09:00:06 +0000

commit 0c96e4297da07944525729ddbe438b0131ab5b7e
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Fri Nov 6 09:57:11 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 6 09:57:11 2020 +0100

    SUPPORT: Add linux device model stubdom to Toolstack
    
    Add qemu-xen linux device model stubdomain to the Toolstack section as a
    Tech Preview.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 4ddd6499d999a7d08cabfda5b0262e473dd5beed
    master date: 2020-10-23 17:14:08 +0100
---
 SUPPORT.md | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 55a65ae136..8070b2df99 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -167,6 +167,12 @@ Go (golang) bindings for libxl
 
     Status: Experimental
 
+### Linux device model stubdomains
+
+Support for running qemu-xen device model in a linux stubdomain.
+
+    Status: Tech Preview
+
 ## Toolstack/3rd party
 
 ### libvirt driver for xl
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 09:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 09:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20588.46595 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaySc-0003au-Ue; Fri, 06 Nov 2020 09:55:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20588.46595; Fri, 06 Nov 2020 09:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaySc-0003am-Ri; Fri, 06 Nov 2020 09:55:10 +0000
Received: by outflank-mailman (input) for mailman id 20588;
 Fri, 06 Nov 2020 09:55:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaySb-0003ah-5P
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:09 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 77a170ec-d529-4be7-aff1-2e860a8c0d84;
 Fri, 06 Nov 2020 09:55:06 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaySX-0007Lz-Ut
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaySX-00038I-So
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaySb-0003ah-5P
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:09 +0000
X-Inumbo-ID: 77a170ec-d529-4be7-aff1-2e860a8c0d84
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 77a170ec-d529-4be7-aff1-2e860a8c0d84;
	Fri, 06 Nov 2020 09:55:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W1V4L37zIpS2Iz4pSUEJKCQ2SzGctaQMQgIf+TeKhCM=; b=oCtwDg5o+AjrWMhP2QpXktNGUc
	bA4n2Hj+aqs8xaq0TwYZ80plwGjTLnKGC2QjFHdGYY2ASJM3t7b+9NRdyzDueznOj4NP+9Jv4CP2L
	I1w6JxO4Fg630K8eippoO5FUAYtXFikjkB8DOKkULdHM5OzibsFA7Ww5OkLv1WQqtckE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaySX-0007Lz-Ut
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaySX-00038I-So
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/locking: harmonize spinlocks and rwlocks regarding preemption
Message-Id: <E1kaySX-00038I-So@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 09:55:05 +0000

commit c3453a23f7905d24f2404787543e26ec7d02301c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Nov 6 10:47:09 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 6 10:47:09 2020 +0100

    xen/locking: harmonize spinlocks and rwlocks regarding preemption
    
    Spinlocks and rwlocks behave differently in the try variants regarding
    preemption: rwlocks are switching preemption off before testing the
    lock, while spinlocks do so only after the first check.
    
    Modify _spin_trylock() to disable preemption before testing the lock
    to be held in order to be preemption-ready.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/spinlock.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index b4aaf6bce6..f4eb50f030 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -240,13 +240,16 @@ int _spin_trylock(spinlock_t *lock)
 {
     spinlock_tickets_t old, new;
 
+    preempt_disable();
     check_lock(&lock->debug, true);
     old = observe_lock(&lock->tickets);
     if ( old.head != old.tail )
+    {
+        preempt_enable();
         return 0;
+    }
     new = old;
     new.tail++;
-    preempt_disable();
     if ( cmpxchg(&lock->tickets.head_tail,
                  old.head_tail, new.head_tail) != old.head_tail )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 09:55:21 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 09:55:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20590.46602 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaySn-0003cN-1s; Fri, 06 Nov 2020 09:55:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20590.46602; Fri, 06 Nov 2020 09: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaySm-0003cE-Uo; Fri, 06 Nov 2020 09:55:20 +0000
Received: by outflank-mailman (input) for mailman id 20590;
 Fri, 06 Nov 2020 09:55:19 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaySl-0003ah-2m
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:19 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 79270155-d0a3-458b-8a75-de01d1de316e;
 Fri, 06 Nov 2020 09:55:16 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaySi-0007M6-31
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaySi-000396-1J
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaySl-0003ah-2m
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:19 +0000
X-Inumbo-ID: 79270155-d0a3-458b-8a75-de01d1de316e
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 79270155-d0a3-458b-8a75-de01d1de316e;
	Fri, 06 Nov 2020 09:55:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xf2KuROQwMXi0o0bQZGXLufM1evCfPI6UQUW+dG876A=; b=aWdTBJ83u8h2SGNKlezz7G5Oiw
	/pLYS8LYqmlra+YgRCBhUi3kI59w88eFGi45TnPsQAddr4fzZM3+VnskoBjuFN9gjQXkp+7i/5EPW
	F4xAsnUbQsaxDr7R9iwzumxYEDHMreIKxSm+1sTBHrD5CkPhlJ7Uo+PMQ5mzH/IN7iSI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaySi-0007M6-31
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaySi-000396-1J
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/rwlock: add check_lock() handling to rwlocks
Message-Id: <E1kaySi-000396-1J@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 09:55:16 +0000

commit e19bcb626f50a652fb1854a8b2f2c9c371687a11
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Nov 6 10:48:07 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 6 10:48:07 2020 +0100

    xen/rwlock: add check_lock() handling to rwlocks
    
    Checking whether a lock is consistently used regarding interrupts on
    or off is beneficial for rwlocks, too.
    
    So add check_lock() calls to rwlock functions. For this purpose make
    check_lock() globally accessible.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/spinlock.c      |  3 +--
 xen/include/xen/rwlock.h   | 15 +++++++++++++++
 xen/include/xen/spinlock.h |  2 ++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index f4eb50f030..b90981bb27 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -13,7 +13,7 @@
 
 static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0);
 
-static void check_lock(union lock_debug *debug, bool try)
+void check_lock(union lock_debug *debug, bool try)
 {
     bool irq_safe = !local_irq_is_enabled();
 
@@ -108,7 +108,6 @@ void spin_debug_disable(void)
 
 #else /* CONFIG_DEBUG_LOCKS */
 
-#define check_lock(l, t) ((void)0)
 #define check_barrier(l) ((void)0)
 #define got_lock(l) ((void)0)
 #define rel_lock(l) ((void)0)
diff --git a/xen/include/xen/rwlock.h b/xen/include/xen/rwlock.h
index 427664037a..0cc9167715 100644
--- a/xen/include/xen/rwlock.h
+++ b/xen/include/xen/rwlock.h
@@ -56,6 +56,7 @@ static inline int _read_trylock(rwlock_t *lock)
     u32 cnts;
 
     preempt_disable();
+    check_lock(&lock->lock.debug, true);
     cnts = atomic_read(&lock->cnts);
     if ( likely(_can_read_lock(cnts)) )
     {
@@ -87,7 +88,11 @@ static inline void _read_lock(rwlock_t *lock)
      * arch_lock_acquire_barrier().
      */
     if ( likely(_can_read_lock(cnts)) )
+    {
+        /* The slow path calls check_lock() via spin_lock(). */
+        check_lock(&lock->lock.debug, false);
         return;
+    }
 
     /* The slowpath will decrement the reader count, if necessary. */
     queue_read_lock_slowpath(lock);
@@ -162,7 +167,11 @@ static inline void _write_lock(rwlock_t *lock)
      * arch_lock_acquire_barrier().
      */
     if ( atomic_cmpxchg(&lock->cnts, 0, _write_lock_val()) == 0 )
+    {
+        /* The slow path calls check_lock() via spin_lock(). */
+        check_lock(&lock->lock.debug, false);
         return;
+    }
 
     queue_write_lock_slowpath(lock);
     /*
@@ -197,6 +206,7 @@ static inline int _write_trylock(rwlock_t *lock)
     u32 cnts;
 
     preempt_disable();
+    check_lock(&lock->lock.debug, true);
     cnts = atomic_read(&lock->cnts);
     if ( unlikely(cnts) ||
          unlikely(atomic_cmpxchg(&lock->cnts, 0, _write_lock_val()) != 0) )
@@ -328,6 +338,11 @@ static inline void _percpu_read_lock(percpu_rwlock_t **per_cpudata,
         /* Drop the read lock because we don't need it anymore. */
         read_unlock(&percpu_rwlock->rwlock);
     }
+    else
+    {
+        /* All other paths have implicit check_lock() calls via read_lock(). */
+        check_lock(&percpu_rwlock->rwlock.lock.debug, false);
+    }
 }
 
 static inline void _percpu_read_unlock(percpu_rwlock_t **per_cpudata,
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index ca13b600a0..9fa4e600c1 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -21,11 +21,13 @@ union lock_debug {
     };
 };
 #define _LOCK_DEBUG { LOCK_DEBUG_INITVAL }
+void check_lock(union lock_debug *debug, bool try);
 void spin_debug_enable(void);
 void spin_debug_disable(void);
 #else
 union lock_debug { };
 #define _LOCK_DEBUG { }
+#define check_lock(l, t) ((void)0)
 #define spin_debug_enable() ((void)0)
 #define spin_debug_disable() ((void)0)
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 09:55:32 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 09:55:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20592.46606 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaySy-0003dy-4P; Fri, 06 Nov 2020 09:55:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20592.46606; Fri, 06 Nov 2020 09:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kaySy-0003dq-1T; Fri, 06 Nov 2020 09:55:32 +0000
Received: by outflank-mailman (input) for mailman id 20592;
 Fri, 06 Nov 2020 09:55:30 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kaySw-0003dK-GH
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:30 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fd2b0f05-1630-4c77-aee9-627686427f7e;
 Fri, 06 Nov 2020 09:55:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaySs-0007ML-6X
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kaySs-00039o-5T
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kaySw-0003dK-GH
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:30 +0000
X-Inumbo-ID: fd2b0f05-1630-4c77-aee9-627686427f7e
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id fd2b0f05-1630-4c77-aee9-627686427f7e;
	Fri, 06 Nov 2020 09:55:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5LbJ0/JZeIBXRvhAvmJP3huQVillc1MOoFWLYMijwJ4=; b=IGeii7x4IMtp2JgCfaaN6/g3SI
	zQVsrwFdM9SRbWWUhtfUNL8ffD0mXXRxesLPDc6NWs9v1tmNMAFYwpBQHLfVmr+10YAqGAPnshGx6
	lVa8NAtiHwg8koUBt3aeu5FB709eruYGY192HgamAIBCxuMjfv0sICHfoNv5OnUukP0g=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaySs-0007ML-6X
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kaySs-00039o-5T
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 09:55:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] PCI: remove unused pcidevs_trylock()
Message-Id: <E1kaySs-00039o-5T@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 09:55:26 +0000

commit 2a5f9f6a6932214fda76b9b3c03e024772882d34
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Nov 6 10:48:44 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 6 10:48:44 2020 +0100

    PCI: remove unused pcidevs_trylock()
    
    pcidevs_trylock() is used nowhere, so remove it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/drivers/passthrough/pci.c | 5 -----
 xen/include/xen/pci.h         | 1 -
 2 files changed, 6 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 2a3bce1462..51e584127e 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -69,11 +69,6 @@ bool_t pcidevs_locked(void)
     return !!spin_is_locked(&_pcidevs_lock);
 }
 
-bool_t pcidevs_trylock(void)
-{
-    return !!spin_trylock_recursive(&_pcidevs_lock);
-}
-
 static struct radix_tree_root pci_segments;
 
 static inline struct pci_seg *get_pseg(u16 seg)
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index c4d3879761..20a54a5bb4 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -148,7 +148,6 @@ struct pci_dev {
 void pcidevs_lock(void);
 void pcidevs_unlock(void);
 bool_t __must_check pcidevs_locked(void);
-bool_t __must_check pcidevs_trylock(void);
 
 bool_t pci_known_segment(u16 seg);
 bool_t pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 15:44:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 15:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20906.46935 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3uJ-0002lF-MA; Fri, 06 Nov 2020 15:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20906.46935; Fri, 06 Nov 2020 15:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3uJ-0002l7-JH; Fri, 06 Nov 2020 15:44:07 +0000
Received: by outflank-mailman (input) for mailman id 20906;
 Fri, 06 Nov 2020 15:44:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb3uI-0002l2-Nm
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:06 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9efaf54c-c869-4455-94e3-5d62dc5d99f4;
 Fri, 06 Nov 2020 15:44:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3uH-0006GD-E7
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3uH-0001Z6-CR
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb3uI-0002l2-Nm
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:06 +0000
X-Inumbo-ID: 9efaf54c-c869-4455-94e3-5d62dc5d99f4
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 9efaf54c-c869-4455-94e3-5d62dc5d99f4;
	Fri, 06 Nov 2020 15:44:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n8AJ+ac0WcSGUfJj1OaQ6uk+ZHfgxLWYZ8db6pDTnR0=; b=EnypTTg5TxbW5iKwTYU6uJfn4j
	zlV+XihDuWZvpaF+9S8imRQWcUhis8PJYqyvQI18EInZv33iHfsaSO/fbF1uKSCw4XimrjYaEX+1F
	3tRjyjdv2e9JPNbF+neB1KWJELIxFPjFWCvU6/1qmX3kDspO6aoMTW63pYNNdEES72p4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3uH-0006GD-E7
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3uH-0001Z6-CR
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kb3uH-0001Z6-CR@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 15:44:05 +0000

commit 7ea428895af2840d85c524f0bd11a38aac308308
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:30:18 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 5abd128b6b..5234dcc73f 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -129,6 +129,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -138,14 +139,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -259,26 +261,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 15:44:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 15:44:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20907.46940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3uU-0002lu-Nu; Fri, 06 Nov 2020 15:44:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20907.46940; Fri, 06 Nov 2020 15:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3uU-0002lm-Kw; Fri, 06 Nov 2020 15:44:18 +0000
Received: by outflank-mailman (input) for mailman id 20907;
 Fri, 06 Nov 2020 15:44:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb3uT-0002lh-Q1
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:17 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d12014ad-95cd-42e5-a6d1-207317bfaacd;
 Fri, 06 Nov 2020 15:44:16 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3uS-0006GJ-1w
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3uS-0001aL-14
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb3uT-0002lh-Q1
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:17 +0000
X-Inumbo-ID: d12014ad-95cd-42e5-a6d1-207317bfaacd
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id d12014ad-95cd-42e5-a6d1-207317bfaacd;
	Fri, 06 Nov 2020 15:44:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l3AAV5mFsNPp3KK2YrBsGxy1U4c/D6oDRXRJn/LymkE=; b=Spo9FHf9zvcl4cLZLwcO1h587T
	U8fHB2FonO3sXSWHse3ZoCrrz8aIJ2LlRjEMClKz6klrCb7htlWizKm3m59HVKGua7ye0gE6g5QjT
	lgoaRBgn8YRgsaSS0b5gQslDnq4cXYpZDyQdTlumARoFDjl5307WDVkYUU22JsapUPU8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3uS-0006GJ-1w
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3uS-0001aL-14
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.13] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kb3uS-0001aL-14@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 15:44:16 +0000

commit 7269466a5b0c0e89b36dc9a7db0554ae404aa230
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:32:03 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 5abd128b6b..5234dcc73f 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -129,6 +129,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -138,14 +139,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -259,26 +261,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 15:44:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 15:44:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20908.46946 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3ue-0002nJ-QF; Fri, 06 Nov 2020 15:44:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20908.46946; Fri, 06 Nov 2020 15:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3ue-0002n9-MT; Fri, 06 Nov 2020 15:44:28 +0000
Received: by outflank-mailman (input) for mailman id 20908;
 Fri, 06 Nov 2020 15:44:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb3ud-0002n1-Lr
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:27 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b2e4cc8c-fc70-4fbb-8363-895e2e54636d;
 Fri, 06 Nov 2020 15:44:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3uc-0006GT-NY
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3uc-0001by-KU
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb3ud-0002n1-Lr
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:27 +0000
X-Inumbo-ID: b2e4cc8c-fc70-4fbb-8363-895e2e54636d
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id b2e4cc8c-fc70-4fbb-8363-895e2e54636d;
	Fri, 06 Nov 2020 15:44:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f46Sy7SkIGrPu+kGGiyk1e0u2NWEGhk+LvDDO05aClQ=; b=IkCSL8NVCIprkA1DiVnKYJUtMb
	gCkS541vjDy8x+7NKpxC0KgcPNuxCpQT58jpkXodtniQZeh6DoZECxsSDJIJ0ETEJeZQ/GpL4mEaZ
	thdiWUuO+yKA5/b+oqyuHvh7PpWfaG0Ao4r2TYEADgTt2x6+0nh/ZlCKQkEw72hDZ2JU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3uc-0006GT-NY
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3uc-0001by-KU
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.12] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kb3uc-0001by-KU@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 15:44:26 +0000

commit 92a78636a51611475f711637c44cafbda3ef9859
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:37:12 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 241ae66b15..c060a83656 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -130,6 +130,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -139,14 +140,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -260,26 +262,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 15:44:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 15:44:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20909.46948 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3up-0002ob-RR; Fri, 06 Nov 2020 15:44:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20909.46948; Fri, 06 Nov 2020 15:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3up-0002oT-OF; Fri, 06 Nov 2020 15:44:39 +0000
Received: by outflank-mailman (input) for mailman id 20909;
 Fri, 06 Nov 2020 15:44:38 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb3uo-0002oN-Pa
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:38 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a5df7b07-cff7-4bde-8dbd-d17fd864342c;
 Fri, 06 Nov 2020 15:44:37 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3un-0006Gd-Bq
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3un-0001dS-Ao
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:37 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb3uo-0002oN-Pa
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:38 +0000
X-Inumbo-ID: a5df7b07-cff7-4bde-8dbd-d17fd864342c
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id a5df7b07-cff7-4bde-8dbd-d17fd864342c;
	Fri, 06 Nov 2020 15:44:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A672tXW7h+lCu412C4IGBkD3cdWyAlEONXUWWptqwRU=; b=GwlnI6UzXcJa2L/1IWaRa/jMbU
	XCfim5AEUbzfgCxX7QLoM74mAqSH5KCwvdMaZYPgj2DZYtU/wCLTvlk8VGFKeXPfeQLgbqy5v+jC4
	+yW8Nzi2Wu5mLGU/z+ZlOQnx9SOJOVy+IG9I1diMojQbUW0sUDzc7MJcwOL4SkFWwlys=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3un-0006Gd-Bq
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3un-0001dS-Ao
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.11] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kb3un-0001dS-Ao@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 15:44:37 +0000

commit cf8d15e2819784ed2360b7b557f72db8f8db5ff6
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:38:39 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 241ae66b15..c060a83656 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -130,6 +130,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -139,14 +140,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -260,26 +262,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 15:44:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 15:44:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20910.46953 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3uz-0002pz-Tb; Fri, 06 Nov 2020 15:44:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20910.46953; Fri, 06 Nov 2020 15:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb3uz-0002pr-Q0; Fri, 06 Nov 2020 15:44:49 +0000
Received: by outflank-mailman (input) for mailman id 20910;
 Fri, 06 Nov 2020 15:44:49 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb3uz-0002pi-4a
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:49 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id de252f2b-6718-4fba-ba70-8c96077518ad;
 Fri, 06 Nov 2020 15:44:48 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3uy-0006Gk-0j
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb3ux-0001f9-VZ
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb3uz-0002pi-4a
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:49 +0000
X-Inumbo-ID: de252f2b-6718-4fba-ba70-8c96077518ad
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id de252f2b-6718-4fba-ba70-8c96077518ad;
	Fri, 06 Nov 2020 15:44:48 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T09BnNdS41Oi7KFeKwg/BfNGfeI5kcCz7rbB9jpEUws=; b=y4X0XEJp+mcH3bxuuiAv8q/UyW
	niFxBlLXt5tvhaat9syR6GNQGXNAnsqRDhIKA7vA8lU90WZ7eKNMUnIWm3+gOF0DyVAjQS6Yaz1p9
	W7OseLxmkK5ftZofDj8OxyLj7prPFDyyuuA1Kn4g0lAzcn7wkhDQsURMGaMZBt2h3xGQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3uy-0006Gk-0j
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb3ux-0001f9-VZ
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 15:44:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.10] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kb3ux-0001f9-VZ@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 15:44:47 +0000

commit e6ade47b1e1c4b9f2e49384c68c4edff783433af
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:39:20 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 241ae66b15..c060a83656 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -130,6 +130,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -139,14 +140,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -260,26 +262,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 16:22:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 16:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20963.47070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb4V8-0007lg-7J; Fri, 06 Nov 2020 16:22:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20963.47070; Fri, 06 Nov 2020 16:22: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb4V8-0007lY-40; Fri, 06 Nov 2020 16:22:10 +0000
Received: by outflank-mailman (input) for mailman id 20963;
 Fri, 06 Nov 2020 16:22:08 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb4V6-0007lT-Ro
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:08 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f2fcce13-065b-403c-a614-114fc0704066;
 Fri, 06 Nov 2020 16:22:06 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb4V3-0007bA-UA
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb4V3-0004Qh-SI
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb4V6-0007lT-Ro
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:08 +0000
X-Inumbo-ID: f2fcce13-065b-403c-a614-114fc0704066
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id f2fcce13-065b-403c-a614-114fc0704066;
	Fri, 06 Nov 2020 16:22:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kfgloG46YXv0xs0/kZEwoQWJ85dPfaOnlTkoLQyDxWg=; b=HGItX64HgTxLpv5QYs+zX2HeKr
	KMMvtfME/El1TGScvsZcTLy3V7UoDUkC/wUPtuLK1s2I6Cj9CCS89XU7cLz4Askq2MUDSx1NRnKrn
	xddHtXpCrWcgTlGqdoaNX3NhHOQ9ISt84ecUXyb+x00vh0pDo+8ATvqJcIdJIEbIRtDI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb4V3-0007bA-UA
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb4V3-0004Qh-SI
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/xl: fix cpupool-cpu-remove
Message-Id: <E1kb4V3-0004Qh-SI@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 16:22:05 +0000

commit 8aac8e0ef43a452d0b565d63e4943c275badba3f
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Fri Nov 6 14:05:17 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Nov 6 16:03:18 2020 +0000

    docs/xl: fix cpupool-cpu-remove
    
    The cpu-pool must be specified.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Wei Liu <wl@xen.org>
---
 docs/man/xl.1.pod.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 5f7d3a7134..f92bacfa72 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1351,7 +1351,7 @@ All the specified CPUs that can be added to the cpupool will be added
 to it. If some CPU can't (e.g., because they're already part of another
 cpupool), an error is reported about each one of them.
 
-=item B<cpupool-cpu-remove> I<cpus|node:nodes>
+=item B<cpupool-cpu-remove> I<cpu-pool> I<cpus|node:nodes>
 
 Removes one or more CPUs or NUMA nodes from I<cpu-pool>. CPUs and NUMA
 nodes can be specified as single CPU/node IDs or as ranges, using the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 16:22:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 16:22:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20964.47074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb4VG-0007mn-9d; Fri, 06 Nov 2020 16:22:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20964.47074; Fri, 06 Nov 2020 16:22:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb4VG-0007mf-6h; Fri, 06 Nov 2020 16:22:18 +0000
Received: by outflank-mailman (input) for mailman id 20964;
 Fri, 06 Nov 2020 16:22:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb4VF-0007mU-1W
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:17 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c768cae0-90bb-40b6-9c48-f516d3f3384e;
 Fri, 06 Nov 2020 16:22:16 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb4VE-0007bF-1x
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb4VE-0004RW-0V
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb4VF-0007mU-1W
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:17 +0000
X-Inumbo-ID: c768cae0-90bb-40b6-9c48-f516d3f3384e
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id c768cae0-90bb-40b6-9c48-f516d3f3384e;
	Fri, 06 Nov 2020 16:22:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TR0kP1Yk9pRKiRxTHUqa1wfD3ylGA1VivKqfmUtliC4=; b=JLpMe/HGBS7nAcFAEYzXPBS4xi
	k5erAzRLyP1CD9brY9TFlm/aLPseuNZd6+bcMN8YXmowb+jlLdjjlq27bLrnc8TvtHfd4CvZKYm4n
	pqzUsljz/XHzEbZizreNGh0ujnUdBCOc09hBxDhF9SR1r+1Kr2P5Pc8Kf3dU3nWM83eo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb4VE-0007bF-1x
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb4VE-0004RW-0V
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/light: correct bitmap operations
Message-Id: <E1kb4VE-0004RW-0V@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 16:22:16 +0000

commit 4196b1523aebe0ed929accba318d5e833d7ff6b3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Nov 6 15:05:04 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Nov 6 16:03:33 2020 +0000

    tools/libs/light: correct bitmap operations
    
    Libxl bitmap operations for single bits (test, set, reset) take the bit
    number as a signed integer without testing the value to be larger than
    0.
    
    Correct that by adding the appropriate tests.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index b039143b8a..4699c4a0a3 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -688,21 +688,21 @@ int libxl_bitmap_is_empty(const libxl_bitmap *bitmap)
 
 int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit)
 {
-    if (bit >= bitmap->size * 8)
+    if (bit >= bitmap->size * 8 || bit < 0)
         return 0;
     return (bitmap->map[bit / 8] & (1 << (bit & 7))) ? 1 : 0;
 }
 
 void libxl_bitmap_set(libxl_bitmap *bitmap, int bit)
 {
-    if (bit >= bitmap->size * 8)
+    if (bit >= bitmap->size * 8 || bit < 0)
         return;
     bitmap->map[bit / 8] |= 1 << (bit & 7);
 }
 
 void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit)
 {
-    if (bit >= bitmap->size * 8)
+    if (bit >= bitmap->size * 8 || bit < 0)
         return;
     bitmap->map[bit / 8] &= ~(1 << (bit & 7));
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 16:22:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 16:22:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20965.47078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb4VQ-0007oC-BP; Fri, 06 Nov 2020 16:22:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20965.47078; Fri, 06 Nov 2020 16:22: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb4VQ-0007o4-8C; Fri, 06 Nov 2020 16:22:28 +0000
Received: by outflank-mailman (input) for mailman id 20965;
 Fri, 06 Nov 2020 16:22:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb4VO-0007nu-Ux
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:26 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 060e500b-6134-480b-be44-69c383f1ca5b;
 Fri, 06 Nov 2020 16:22:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb4VO-0007bU-6G
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb4VO-0004SG-4V
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb4VO-0007nu-Ux
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:26 +0000
X-Inumbo-ID: 060e500b-6134-480b-be44-69c383f1ca5b
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 060e500b-6134-480b-be44-69c383f1ca5b;
	Fri, 06 Nov 2020 16:22:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hEGvia/aDlME5dqBUD+WjrhQ6j3a1OlbqFzLeiPR7nc=; b=6N8bEe9kF3g6tCfvX5TPp/V6w2
	GpplKePLv9kZHaYmCTw1Hh4rbs3/WuKhhWMTLBsr8C3NxGs4eULo0Ve7moV5rflTmbXXzxLFrWihU
	IGGSr41J8JSWhBXrL88qLU/O9TfKY1fajrqAhPCSQQln+v7xnOlfkZf291j0kQVmFpt0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb4VO-0007bU-6G
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb4VO-0004SG-4V
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:22:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: set vuart_gfn in libxl__build_hvm
Message-Id: <E1kb4VO-0004SG-4V@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 16:22:26 +0000

commit cd800ce442eeba5bc0857ade70a075367c01c350
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Nov 6 16:12:56 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Nov 6 16:12:56 2020 +0000

    libxl: set vuart_gfn in libxl__build_hvm
    
    Setting vuart_gfn was missed when switching ARM guests to the PVH build.
    Like libxl__build_pv, libxl__build_hvm should set state->vuart_gfn to
    dom->vuart_gfn.
    
    Without this change, xl console cannot connect to the vuart console (-t
    vuart), see https://marc.info/?l=xen-devel&m=160402342101366.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_dom.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 01d989a976..19168572fd 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -1177,6 +1177,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
         LOG(ERROR, "hvm build set params failed");
         goto out;
     }
+    state->vuart_gfn = dom->vuart_gfn;
 
     rc = hvm_build_set_xs_values(gc, domid, dom, info);
     if (rc != 0) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 06 16:33:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Nov 2020 16:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.20973.47094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb4fk-0000OY-AX; Fri, 06 Nov 2020 16:33:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 20973.47094; Fri, 06 Nov 2020 16:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kb4fk-0000OQ-7V; Fri, 06 Nov 2020 16:33:08 +0000
Received: by outflank-mailman (input) for mailman id 20973;
 Fri, 06 Nov 2020 16:33:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kb4fi-0000OL-2Q
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:33:06 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f4780680-724e-42ee-868c-0052aea06500;
 Fri, 06 Nov 2020 16:33:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb4fh-0007qZ-4u
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kb4fh-0005EH-2y
 for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:33:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=IjMJ=EM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kb4fi-0000OL-2Q
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:33:06 +0000
X-Inumbo-ID: f4780680-724e-42ee-868c-0052aea06500
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id f4780680-724e-42ee-868c-0052aea06500;
	Fri, 06 Nov 2020 16:33:05 +0000 (UTC)
DKIM-Signature: v=1; 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/+vggUt9FAXLJo1vRK845Bq69pJYRgCQn3SxHn4aIk=; b=uIvc3RYo+NpqNcHh3mKK+PgF6f
	uA/x2EfNsx2O9V+u0RTylwP3jJm9c5KPRW/wJkgzUAMCz+mD1dJ0lv2cB5sXgtY6EYyljeFKV7I6E
	ExKfPChL/4Jr0Zsl4FzXxliEoXxKShW4U4M6t4bCL7iNs4kkMeVqwJzCso5sQiZIs2zI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb4fh-0007qZ-4u
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kb4fh-0005EH-2y
	for xen-changelog@lists.xenproject.org; Fri, 06 Nov 2020 16:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: Add suppress-vmdesc to QEMU machine
Message-Id: <E1kb4fh-0005EH-2y@xenbits.xenproject.org>
Date: Fri, 06 Nov 2020 16:33:05 +0000

commit 0a5e0ce0fb7e5a3b5dfdc936058d2c0e04e5e258
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu Oct 29 15:03:32 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Nov 6 16:20:36 2020 +0000

    libxl: Add suppress-vmdesc to QEMU machine
    
    The device model state saved by QMP xen-save-devices-state doesn't
    include the vmdesc json.  When restoring an HVM, xen-load-devices-state
    always triggers "Expected vmdescription section, but got 0".  This is
    not a problem when restore comes from a file.  However, when QEMU runs
    in a linux stubdom and comes over a console, EOF is not received.  This
    causes a delay restoring - though it does restore.
    
    Setting suppress-vmdesc skips looking for the vmdesc during restore and
    avoids the wait.
    
    QEMU 5.2 enables suppress-vmdesc by default for xenfv, but this change
    sets it manually for xenfv and xen_platform_pci=0 when -machine pc is
    use.
    
    QEMU commit 9850c6047b8b "migration: Allow to suppress vmdesc
    submission" added suppress-vmdesc in QEMU 2.3.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index d1ff35dda3..3da83259c0 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1778,9 +1778,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
             /* Switching here to the machine "pc" which does not add
              * the xen-platform device instead of the default "xenfv" machine.
              */
-            machinearg = libxl__strdup(gc, "pc,accel=xen");
+            machinearg = libxl__strdup(gc, "pc,accel=xen,suppress-vmdesc=on");
         } else {
-            machinearg = libxl__strdup(gc, "xenfv");
+            machinearg = libxl__strdup(gc, "xenfv,suppress-vmdesc=on");
         }
         if (b_info->u.hvm.mmio_hole_memkb) {
             uint64_t max_ram_below_4g = (1ULL << 32) -
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 00:33:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 00:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21200.47485 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbCAD-0003Hd-PQ; Sat, 07 Nov 2020 00:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21200.47485; Sat, 07 Nov 2020 00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbCAD-0003HV-MF; Sat, 07 Nov 2020 00:33:05 +0000
Received: by outflank-mailman (input) for mailman id 21200;
 Sat, 07 Nov 2020 00:33:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbCAC-0003HQ-QT
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 00:33:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 97641c34-21a2-4b08-a0ad-68916c9d9228;
 Sat, 07 Nov 2020 00:33:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbCAA-0001cU-GD
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 00:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbCAA-0002cM-Do
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 00:33:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbCAC-0003HQ-QT
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 00:33:04 +0000
X-Inumbo-ID: 97641c34-21a2-4b08-a0ad-68916c9d9228
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 97641c34-21a2-4b08-a0ad-68916c9d9228;
	Sat, 07 Nov 2020 00:33:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/kVbEO0gzThQQwAXZp5yio9vt3kY23rvDcUd5+2LlxE=; b=d+HjGeZJrqBVMecvYkv/pTpXtu
	xnRdJUW5eiOKkxEdLnx3G2NPvcKBw4bE5OyA9bvXGdVw0hgONOgJ1ENbMqBLTo0oPiOBLmarFUKNK
	qVAwdSLZ8HI6dM4ogEBXVSMnKCGOz1Hu+WYmb9Fr/BQmfWpINXD2guGsjV5vS2j1crJQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbCAA-0001cU-GD
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 00:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbCAA-0002cM-Do
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 00:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] SUPPORT.md: Desupport qemu trad except stub dm
Message-Id: <E1kbCAA-0002cM-Do@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 00:33:02 +0000

commit 4f9294d21c47415376215d68a0298e88582b8e7a
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Wed Nov 4 09:36:36 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 09:36:36 2020 +0100

    SUPPORT.md: Desupport qemu trad except stub dm
    
    While investigating XSA-335 we discovered that many upstream security
    fixes were missing.  It is not practical to backport them.  There is
    no good reason to be running this very ancient version of qemu, except
    that it is the only way to run a stub dm which is currently supported
    by upstream.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 8587160b3e2951b722d395a0346bb17c3c22152f
    master date: 2020-11-04 09:22:37 +0100
---
 SUPPORT.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 52f25fa85a..b4038974f9 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -722,6 +722,21 @@ See the section **Blkback** for image formats supported by QEMU.
 
     Status: Supported, not security supported
 
+### qemu-xen-traditional ###
+
+The Xen Project provides an old version of qemu with modifications
+which enable use as a device model stub domain.  The old version is
+normally selected by default only in a stub dm configuration, but it
+can be requested explicitly in other configurations, for example in
+`xl` with `device_model_version="QEMU_XEN_TRADITIONAL"`.
+
+    Status, Device Model Stub Domains: Supported, with caveats
+    Status, as host process device model: No security support, not recommended
+
+qemu-xen-traditional is security supported only for those available
+devices which are supported for mainstream QEMU (see above), with
+trusted driver domains (see Device Model Stub Domains).
+
 ## Virtual Firmware
 
 ### x86/HVM iPXE
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 09:22:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 09:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21326.47648 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQA-000536-5g; Sat, 07 Nov 2020 09:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21326.47648; Sat, 07 Nov 2020 09: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQA-00052y-2Q; Sat, 07 Nov 2020 09:22:06 +0000
Received: by outflank-mailman (input) for mailman id 21326;
 Sat, 07 Nov 2020 09:22:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbKQ8-00052q-Ns
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3acb520c-292f-41e8-8321-e01679bdc501;
 Sat, 07 Nov 2020 09:22:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQ6-00019D-L3
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQ6-0006oN-IN
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbKQ8-00052q-Ns
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:04 +0000
X-Inumbo-ID: 3acb520c-292f-41e8-8321-e01679bdc501
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 3acb520c-292f-41e8-8321-e01679bdc501;
	Sat, 07 Nov 2020 09:22:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PowkM8BXPHE3Vl6HammNLz6eVdGb4U+aR0n57kyBm5E=; b=AoLkFc5KRi7WEQ+PnBx56kdqse
	VMUThqqRMUHCuYjpaHK8GX4vWOY4AEO6t3UZjphBTbCz3fUrjSzMZbsmQlxo+uqKjjn4FerMBVdGH
	zRC/O+5by/W1viRUA/o5uWxymLeAF+3Xd+jMmGKhYkaGAQZZEmr8xxImkLLu5B0O3Jx4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQ6-00019D-L3
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQ6-0006oN-IN
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] build: use if_changed more consistently (and correctly) for prelink*.o
Message-Id: <E1kbKQ6-0006oN-IN@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 09:22:02 +0000

commit 9f954ae7fb1c7dc3b02e5ccac6978c3a8e86086e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 4 11:01:02 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 11:01:02 2020 +0100

    build: use if_changed more consistently (and correctly) for prelink*.o
    
    Switch to $(call if_changed,ld) where possible; presumably not doing so
    in e321576f4047 ("xen/build: start using if_changed") right away was an
    oversight, as it did for Arm in (just) one case. It failed to add
    prelink.o to $(targets), though, causing - judging from the observed
    behavior on x86 - undue rebuilds of the final binary (because of
    prelink.o getting rebuild for $(cmd_prelink.o) being empty, in turn
    because of .prelink.o.cmd not getting read) during "make install-xen".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    master commit: dd2cfba88c3d0e144ffec07c6b5b86e54a9d98a9
    master date: 2020-09-22 10:19:38 +0200
---
 xen/arch/arm/Makefile |  4 +++-
 xen/arch/x86/Makefile | 18 ++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 7e82b2178c..1ded44d200 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -95,12 +95,14 @@ prelink_lto.o: $(ALL_OBJS)
 
 # Link it with all the binary objects
 prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $^
+	$(call if_changed,ld)
 else
 prelink.o: $(ALL_OBJS) FORCE
 	$(call if_changed,ld)
 endif
 
+targets += prelink.o
+
 $(TARGET)-syms: prelink.o xen.lds
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b388861679..26ff2a9a3e 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -124,19 +124,21 @@ prelink-efi_lto.o: $(ALL_OBJS) efi/runtime.o efi/compat.o
 	$(LD_LTO) -r -o $@ $(filter-out %/efi/built_in.o,$^)
 
 # Link it with all the binary objects
-prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $^
+prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
+	$(call if_changed,ld)
 
-prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink-efi_lto.o efi/boot.init.o
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $^
+prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink-efi_lto.o efi/boot.init.o FORCE
+	$(call if_changed,ld)
 else
-prelink.o: $(ALL_OBJS)
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $^
+prelink.o: $(ALL_OBJS) FORCE
+	$(call if_changed,ld)
 
-prelink-efi.o: $(ALL_OBJS) efi/boot.init.o efi/runtime.o efi/compat.o
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out %/efi/built_in.o,$^)
+prelink-efi.o: $(filter-out %/efi/built_in.o,$(ALL_OBJS)) efi/boot.init.o efi/runtime.o efi/compat.o FORCE
+	$(call if_changed,ld)
 endif
 
+targets += prelink.o prelink-efi.o
+
 $(TARGET)-syms: prelink.o xen.lds
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 09:22:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 09:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21327.47651 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQJ-00054E-6s; Sat, 07 Nov 2020 09:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21327.47651; Sat, 07 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQJ-000547-42; Sat, 07 Nov 2020 09:22:15 +0000
Received: by outflank-mailman (input) for mailman id 21327;
 Sat, 07 Nov 2020 09:22:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbKQH-00053u-Uq
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:13 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e2681a9e-7b58-4ee5-8f0d-4fc4a14c3864;
 Sat, 07 Nov 2020 09:22:12 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQG-00019G-Of
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQG-0006p4-Nl
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:12 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbKQH-00053u-Uq
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:13 +0000
X-Inumbo-ID: e2681a9e-7b58-4ee5-8f0d-4fc4a14c3864
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id e2681a9e-7b58-4ee5-8f0d-4fc4a14c3864;
	Sat, 07 Nov 2020 09:22:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Kkk0Mefe8hj7YcvLQ0MwREtXHd2HKqRaPzuWF4TW938=; b=Hpk7qXJ+txlOGQS6/pPC9TQLc+
	ds/LHV5Mgk+HFoKGmbBNd09dw1NzULjZX4c94F6gF3ddiseKEfjZNabPfpaglLeai6iJ0k+DWo8Jv
	PstYHN86s9ioHpXTHiq7LdvAXY/hGif5lGjpDBP2lc2XpZ8EnnsT7UG/YR9fAOmXA/AU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQG-00019G-Of
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQG-0006p4-Nl
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] pci: cleanup MSI interrupts before removing device from IOMMU
Message-Id: <E1kbKQG-0006p4-Nl@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 09:22:12 +0000

commit 898864c3736338548bc2f684b7e307326e0dd4a5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 4 11:01:27 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 11:01:27 2020 +0100

    pci: cleanup MSI interrupts before removing device from IOMMU
    
    Doing the MSI cleanup after removing the device from the IOMMU leads
    to the following panic on AMD hardware:
    
    Assertion 'table.ptr && (index < intremap_table_entries(table.ptr, iommu))' failed at iommu_intr.c:172
    ----[ Xen-4.13.1-10.0.3-d  x86_64  debug=y   Not tainted ]----
    CPU:    3
    RIP:    e008:[<ffff82d08026ae3c>] drivers/passthrough/amd/iommu_intr.c#get_intremap_entry+0x52/0x7b
    [...]
    Xen call trace:
       [<ffff82d08026ae3c>] R drivers/passthrough/amd/iommu_intr.c#get_intremap_entry+0x52/0x7b
       [<ffff82d08026af25>] F drivers/passthrough/amd/iommu_intr.c#update_intremap_entry_from_msi_msg+0xc0/0x342
       [<ffff82d08026ba65>] F amd_iommu_msi_msg_update_ire+0x98/0x129
       [<ffff82d08025dd36>] F iommu_update_ire_from_msi+0x1e/0x21
       [<ffff82d080286862>] F msi_free_irq+0x55/0x1a0
       [<ffff82d080286f25>] F pci_cleanup_msi+0x8c/0xb0
       [<ffff82d08025cf52>] F pci_remove_device+0x1af/0x2da
       [<ffff82d0802a42d1>] F do_physdev_op+0xd18/0x1187
       [<ffff82d080383925>] F pv_hypercall+0x1f5/0x567
       [<ffff82d08038a432>] F lstar_enter+0x112/0x120
    
    That's because the call to iommu_remove_device on AMD hardware will
    remove the per-device interrupt remapping table, and hence the call to
    pci_cleanup_msi done afterwards will find a null intremap table and
    crash.
    
    Reorder the calls so that MSI interrupts are torn down before removing
    the device from the IOMMU.
    
    Fixes: d7cfeb7c13ed ("AMD/IOMMU: don't blindly allocate interrupt remapping tables")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 710f62cc826bb8c7ead99f9d6b6b269e39ff3e98
    master date: 2020-10-23 10:13:14 +0200
---
 xen/drivers/passthrough/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 5846978890..2d6238a5bb 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -843,10 +843,10 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
     list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
         if ( pdev->bus == bus && pdev->devfn == devfn )
         {
+            pci_cleanup_msi(pdev);
             ret = iommu_remove_device(pdev);
             if ( pdev->domain )
                 list_del(&pdev->domain_list);
-            pci_cleanup_msi(pdev);
             free_pdev(pseg, pdev);
             printk(XENLOG_DEBUG "PCI remove device %04x:%02x:%02x.%u\n",
                    seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 09:22:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 09:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21328.47656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQT-000563-96; Sat, 07 Nov 2020 09:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21328.47656; Sat, 07 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQT-00055v-5g; Sat, 07 Nov 2020 09:22:25 +0000
Received: by outflank-mailman (input) for mailman id 21328;
 Sat, 07 Nov 2020 09:22:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbKQR-00055j-Sh
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:23 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 42a6cd34-3a2b-4108-989f-539b7689d969;
 Sat, 07 Nov 2020 09:22:23 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQQ-0001A6-T6
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQQ-0006pj-Rg
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:22 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbKQR-00055j-Sh
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:23 +0000
X-Inumbo-ID: 42a6cd34-3a2b-4108-989f-539b7689d969
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 42a6cd34-3a2b-4108-989f-539b7689d969;
	Sat, 07 Nov 2020 09:22:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jS1P/JZu6hqRiGgF4kJPv9rr5z68yiUi5+N92VMm1YE=; b=YkW4vpNFS2GY5eBe1kK8ASeunq
	7qeVwGl+Z2W1dhwKcp7PLlmckTbx+wHZbJi3/HqCzsREl+GaDddM/SWHH+if5+U0mw6noTgZ6xkDt
	CsT3BohnM1TSBokzkcswZnrjQFCDrQBkAuHCyY259qFzojLPiXLW/IckMWNpAYxz1yP8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQQ-0001A6-T6
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQQ-0006pj-Rg
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86emul: fix PINSRW and adjust other {,V}PINSR*
Message-Id: <E1kbKQQ-0006pj-Rg@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 09:22:22 +0000

commit fc8fab1bb4d3a16914d8e7f6e288e946e68d5a41
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 4 11:02:30 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 4 11:02:30 2020 +0100

    x86emul: fix PINSRW and adjust other {,V}PINSR*
    
    The use of simd_packed_int together with no further update to op_bytes
    has lead to wrong signaling of #GP(0) for PINSRW without a 16-byte
    aligned memory operand. Use simd_none instead and override it after
    general decoding with simd_other, like is done for the B/D/Q siblings.
    
    While benign, for consistency also use DstImplicit instead of DstReg
    in x86_decode_twobyte().
    
    PINSR{B,D,Q} also had a stray (redundant) get_fpu() invocation, which
    gets dropped.
    
    For further consistency also
    - use src.bytes instead of op_bytes in relevant memcpy() invocations,
    - avoid the pointless updating of op_bytes (all we care about later is
      that the value be less than 16).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 06f0598b41f23c9e4cf7d8c5a05b282de92f3a35
    master date: 2020-10-23 18:03:18 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index ee6341b1b7..9b29548e2d 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -362,7 +362,7 @@ static const struct twobyte_table {
     [0xc1] = { DstMem|SrcReg|ModRM },
     [0xc2] = { DstImplicit|SrcImmByte|ModRM, simd_any_fp, d8s_vl },
     [0xc3] = { DstMem|SrcReg|ModRM|Mov },
-    [0xc4] = { DstReg|SrcImmByte|ModRM, simd_packed_int, 1 },
+    [0xc4] = { DstImplicit|SrcImmByte|ModRM, simd_none, 1 },
     [0xc5] = { DstReg|SrcImmByte|ModRM|Mov },
     [0xc6] = { DstImplicit|SrcImmByte|ModRM, simd_packed_fp, d8s_vl },
     [0xc7] = { ImplicitOps|ModRM },
@@ -2784,7 +2784,7 @@ x86_decode_twobyte(
         /* fall through */
     case X86EMUL_OPC_VEX_66(0, 0xc4): /* vpinsrw */
     case X86EMUL_OPC_EVEX_66(0, 0xc4): /* vpinsrw */
-        state->desc = DstReg | SrcMem16;
+        state->desc = DstImplicit | SrcMem16;
         break;
 
     case 0xf0:
@@ -8587,6 +8587,7 @@ x86_emulate(
         generate_exception_if(vex.l, EXC_UD);
         memcpy(mmvalp, &src.val, 2);
         ea.type = OP_MEM;
+        state->simd_size = simd_other;
         goto simd_0f_int_imm8;
 
 #ifndef X86EMUL_NO_SIMD
@@ -8601,9 +8602,8 @@ x86_emulate(
             host_and_vcpu_must_have(avx512bw);
         if ( !mode_64bit() )
             evex.w = 0;
-        memcpy(mmvalp, &src.val, op_bytes);
+        memcpy(mmvalp, &src.val, src.bytes);
         ea.type = OP_MEM;
-        op_bytes = src.bytes;
         d = SrcMem16; /* Fake for the common SIMD code below. */
         state->simd_size = simd_other;
         goto avx512f_imm8_no_sae;
@@ -10766,10 +10766,8 @@ x86_emulate(
     case X86EMUL_OPC_66(0x0f3a, 0x20): /* pinsrb $imm8,r32/m8,xmm */
     case X86EMUL_OPC_66(0x0f3a, 0x22): /* pinsr{d,q} $imm8,r/m,xmm */
         host_and_vcpu_must_have(sse4_1);
-        get_fpu(X86EMUL_FPU_xmm);
-        memcpy(mmvalp, &src.val, op_bytes);
+        memcpy(mmvalp, &src.val, src.bytes);
         ea.type = OP_MEM;
-        op_bytes = src.bytes;
         d = SrcMem16; /* Fake for the common SIMD code below. */
         state->simd_size = simd_other;
         goto simd_0f3a_common;
@@ -10779,9 +10777,8 @@ x86_emulate(
         generate_exception_if(vex.l, EXC_UD);
         if ( !mode_64bit() )
             vex.w = 0;
-        memcpy(mmvalp, &src.val, op_bytes);
+        memcpy(mmvalp, &src.val, src.bytes);
         ea.type = OP_MEM;
-        op_bytes = src.bytes;
         d = SrcMem16; /* Fake for the common SIMD code below. */
         state->simd_size = simd_other;
         goto simd_0f_int_imm8;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 09:22:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 09:22:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21329.47660 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQd-00057a-Bk; Sat, 07 Nov 2020 09:22:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21329.47660; Sat, 07 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQd-00057S-8o; Sat, 07 Nov 2020 09:22:35 +0000
Received: by outflank-mailman (input) for mailman id 21329;
 Sat, 07 Nov 2020 09:22:34 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbKQc-00057J-35
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:34 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b07835d9-b0cd-444f-aed5-c8cce4713d48;
 Sat, 07 Nov 2020 09:22:33 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQb-0001AG-07
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQa-0006qY-VS
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:32 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbKQc-00057J-35
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:34 +0000
X-Inumbo-ID: b07835d9-b0cd-444f-aed5-c8cce4713d48
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id b07835d9-b0cd-444f-aed5-c8cce4713d48;
	Sat, 07 Nov 2020 09:22:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tz+TKdnQkGvyPTLeW7T09ZCT8f1fs7TM6+41g9tj5qI=; b=WhtMR/8KtWsyB5wrQ04gKM4FYg
	uZL3cj+9AawkFldxpQVPg9Qy3L7z/AFlfUNfdtV3cFyY/ybbAN3br46MpP/jVS6rm3Q1wS/iymxNZ
	qn+7UqbZ+coGMwOkg36HuPS3v72KwkECOCb/4D7cjPfmbuaiFVZULEVedAVSBT5/8Cyo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQb-0001AG-07
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQa-0006qY-VS
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] xen/arm64: force gcc 10+ to always inline generic atomics helpers
Message-Id: <E1kbKQa-0006qY-VS@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 09:22:32 +0000

commit f61c5d0ca729eda5e936b8aa2b45c4192e2f2b64
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 11 12:45:33 2020 +0200
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 17:48:15 2020 -0800

    xen/arm64: force gcc 10+ to always inline generic atomics helpers
    
    Recent versions of gcc (at least 10.x) will not inline generic atomics
    helpers by default. Instead they will expect the software to either link
    with libatomic.so or implement the helpers, which would result in
    
    undefined reference to `__aarch64_ldadd4_acq_rel'
    
    for us (not having any local implementation).
    
    To keep the previous behavior, force gcc to always inline the generic
    atomics helpers.
    
    Long term we probably want to avoid relying on gcc atomics helpers as
    this doesn't allow us to switch between LSE and LL/SC atomics.
    
    Suggested-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 5d45ecabe3c0b2097df623ab7b471f8915cfdde6)
---
 xen/arch/arm/arch.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index c8186f5828..11caec86ba 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -12,6 +12,7 @@ CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-a15
 
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
+$(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
 
 ifneq ($(filter command line environment,$(origin CONFIG_EARLY_PRINTK)),)
     $(error You must use 'make menuconfig' to enable/disable early printk now)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 09:22:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 09:22:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21330.47664 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQn-00059B-DG; Sat, 07 Nov 2020 09:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21330.47664; Sat, 07 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQn-000593-AI; Sat, 07 Nov 2020 09:22:45 +0000
Received: by outflank-mailman (input) for mailman id 21330;
 Sat, 07 Nov 2020 09:22:44 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbKQl-00058p-UR
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:43 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e2b6b0eb-3d91-4822-adf8-3e7ffb826a36;
 Sat, 07 Nov 2020 09:22:43 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQl-0001Bs-4Z
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQl-0006sr-2Z
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:43 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbKQl-00058p-UR
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:43 +0000
X-Inumbo-ID: e2b6b0eb-3d91-4822-adf8-3e7ffb826a36
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id e2b6b0eb-3d91-4822-adf8-3e7ffb826a36;
	Sat, 07 Nov 2020 09:22:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YP5cpZ9wBun3d9GF1RodRqFMKWKsSpLGl+TJNgfGrS0=; b=Xi+yBcNLQnIz7zujIikUhm+Fdm
	xt+qNXhxS6R8Dztt3oF3sVisqT3N6TQ1gPtF0y559o46imDtdJInCZzRxEQhr2klfzbaFD4NWrh1M
	aMfYbXV1O+H6qeJ50BA2PEzRPe/Mc/tY2CTEqEw+HIOQWoqDh7abzR1Qdk4XuKXrhEoc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQl-0001Bs-4Z
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQl-0006sr-2Z
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] xen/arm: bootfdt: Ignore empty memory bank
Message-Id: <E1kbKQl-0006sr-2Z@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 09:22:43 +0000

commit 7d2b21fd36c2a47799eed71c67bae7faa1ec4272
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Sep 18 18:11:16 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 17:49:04 2020 -0800

    xen/arm: bootfdt: Ignore empty memory bank
    
    At the moment, Xen will stop processing the Device Tree if a memory
    bank is empty (size == 0).
    
    Unfortunately, some of the Device Tree (such as on Colibri imx8qxp)
    may contain such a bank. This means Xen will not be able to boot
    properly.
    
    Relax the check to just ignore the banks. FWIW this also seems to be the
    behavior adopted by Linux.
    
    Reported-by: Daniel Wagner <Daniel.Wagner2@itk-engineering.de>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 5a37207df52066efefe419c677b089a654d37afc)
---
 xen/arch/arm/bootfdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 08fb59f4e7..dcff512648 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -163,8 +163,9 @@ static int __init process_memory_node(const void *fdt, int node,
     for ( i = 0; i < banks && mem->nr_banks < NR_MEM_BANKS; i++ )
     {
         device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+        /* Some DT may describe empty bank, ignore them */
         if ( !size )
-            return -EINVAL;
+            continue;
         mem->bank[mem->nr_banks].start = start;
         mem->bank[mem->nr_banks].size = size;
         mem->nr_banks++;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 09:22:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 09:22:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21331.47668 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQx-0005Ax-F2; Sat, 07 Nov 2020 09:22:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21331.47668; Sat, 07 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKQx-0005Ap-Bu; Sat, 07 Nov 2020 09:22:55 +0000
Received: by outflank-mailman (input) for mailman id 21331;
 Sat, 07 Nov 2020 09:22:54 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbKQw-0005Ah-5w
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:54 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 51fe02a2-7952-4802-9f3a-c0689a9834ea;
 Sat, 07 Nov 2020 09:22:53 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQv-0001Bz-7s
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKQv-0006to-6y
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:53 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbKQw-0005Ah-5w
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:54 +0000
X-Inumbo-ID: 51fe02a2-7952-4802-9f3a-c0689a9834ea
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 51fe02a2-7952-4802-9f3a-c0689a9834ea;
	Sat, 07 Nov 2020 09:22:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xBru36TLVzXyoiArYTXmFKOfZSFOp3bnq2rTR9rQr+A=; b=NucwCE7xTIaSq01FDMp2P5+Dye
	OQwUwwoVOcKuSk6V15yNf7zzALovJCkk6bIMyuahcGKooU3U1GXw9YJj4FPu5IDW7j3pY5shIO0Lu
	cQFViHxv+5duGYgkCnIeF5oCdVfX/GsOUarBTbvtrB/mHr/5XIAtmxESq09uDc8QuYtQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQv-0001Bz-7s
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKQv-0006to-6y
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:22:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] xen/arm: sched: Ensure the vCPU context is seen before vcpu_pause() returns
Message-Id: <E1kbKQv-0006to-6y@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 09:22:53 +0000

commit d131310e60828a15f1354f0d73a89f42b64fe810
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Sep 22 20:31:04 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 17:49:26 2020 -0800

    xen/arm: sched: Ensure the vCPU context is seen before vcpu_pause() returns
    
    Some callers of vcpu_pause() will expect to access the latest vcpu
    context when the function returns (see XENDOMCTL_{set,get}vcpucontext}.
    
    However, the latest vCPU context can only be observed after
    v->is_running has been observed to be false.
    
    As there is no memory barrier instruction generated, a processor could
    try to speculatively access the vCPU context before it was observed.
    
    To prevent the corruption of the vCPU context, we need to insert a
    memory barrier instruction after v->is_running is observed and before
    the context is accessed. This barrier is added in sync_vcpu_execstate()
    as it seems to be the place where we expect the synchronization to
    happen.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit f6790389613cd54775ece6575013a679572b46b3)
---
 xen/arch/arm/domain.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 31169326b2..ac6a419f55 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -371,7 +371,20 @@ void sync_local_execstate(void)
 
 void sync_vcpu_execstate(struct vcpu *v)
 {
-    /* Nothing to do -- no lazy switching */
+    /*
+     * We don't support lazy switching.
+     *
+     * However the context may have been saved from a remote pCPU so we
+     * need a barrier to ensure it is observed before continuing.
+     *
+     * Per vcpu_context_saved(), the context can be observed when
+     * v->is_running is false (the caller should check it before calling
+     * this function).
+     *
+     * Note this is a full barrier to also prevent update of the context
+     * to happen before it was observed.
+     */
+    smp_mb();
 }
 
 #define NEXT_ARG(fmt, args)                                                 \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 09:23:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 09:23:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21332.47672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKR7-0005E2-Gb; Sat, 07 Nov 2020 09:23:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21332.47672; Sat, 07 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKR7-0005Du-DT; Sat, 07 Nov 2020 09:23:05 +0000
Received: by outflank-mailman (input) for mailman id 21332;
 Sat, 07 Nov 2020 09:23:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbKR6-0005Dk-8p
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ecc9c757-2365-4f30-927d-228c8926f6fa;
 Sat, 07 Nov 2020 09:23:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKR5-0001CP-CA
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKR5-0006uk-AR
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbKR6-0005Dk-8p
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:04 +0000
X-Inumbo-ID: ecc9c757-2365-4f30-927d-228c8926f6fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id ecc9c757-2365-4f30-927d-228c8926f6fa;
	Sat, 07 Nov 2020 09:23:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vQz4OOmbawRX+V7KBkmpzOh5ccDWbNOD9eqMsLia5Do=; b=3bDxeP66nfpZXYHzGWaodxFmuU
	pPPYWhshgkXoN0IYyiB8DdYOBP/3VnpCtu4FMA5Stk1Qo2LUR2b8dVJdSY+mQjjevTW5i1N+/Xvhx
	l80DirR8xdqsiuQfDKE0VqrfiPezUTslSop54vDWkkx4slZ0wVyB0qpzMMPWUX8w36zg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKR5-0001CP-CA
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKR5-0006uk-AR
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] arm,smmu: match start level of page table walk with P2M
Message-Id: <E1kbKR5-0006uk-AR@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 09:23:03 +0000

commit 29b48aa27de1a40be45cb5ccd6e427ad63992ff3
Author:     Laurentiu Tudor <laurentiu.tudor@nxp.com>
AuthorDate: Fri Oct 2 13:33:44 2020 +0300
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 17:49:54 2020 -0800

    arm,smmu: match start level of page table walk with P2M
    
    Don't hardcode the lookup start level of the page table walk to 1
    and instead match the one used in P2M. This should fix scenarios
    involving SMMU where the start level is different than 1.
    In order for the SMMU driver to also compile on arm32 move the
    P2M_ROOT_LEVEL in the p2m header file (while at it, for
    consistency also P2M_ROOT_ORDER) and use the macro in the smmu
    driver.
    
    Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 9ae1197582798b394d696cff94c4d742319bdbbf)
---
 xen/arch/arm/p2m.c                 |  9 ++-------
 xen/drivers/passthrough/arm/smmu.c |  2 +-
 xen/include/asm-arm/p2m.h          | 11 +++++++++++
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ce59f2b503..4eeb867ca1 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -17,17 +17,12 @@
 #define INVALID_VMID 0 /* VMID 0 is reserved */
 
 #ifdef CONFIG_ARM_64
-static unsigned int __read_mostly p2m_root_order;
-static unsigned int __read_mostly p2m_root_level;
-#define P2M_ROOT_ORDER    p2m_root_order
-#define P2M_ROOT_LEVEL p2m_root_level
+unsigned int __read_mostly p2m_root_order;
+unsigned int __read_mostly p2m_root_level;
 static unsigned int __read_mostly max_vmid = MAX_VMID_8_BIT;
 /* VMID is by default 8 bit width on AArch64 */
 #define MAX_VMID       max_vmid
 #else
-/* First level P2M is always 2 consecutive pages */
-#define P2M_ROOT_LEVEL 1
-#define P2M_ROOT_ORDER    1
 /* VMID is always 8 bit width on AArch32 */
 #define MAX_VMID        MAX_VMID_8_BIT
 #endif
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 94662a8501..4ba6d3ab94 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -1152,7 +1152,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain)
 	      (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT);
 
 	if (!stage1)
-		reg |= (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT);
+		reg |= (2 - P2M_ROOT_LEVEL) << TTBCR_SL0_SHIFT;
 
 	writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR);
 
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index 5fdb6e8183..28ca9a838e 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -13,6 +13,17 @@
 /* Holds the bit size of IPAs in p2m tables.  */
 extern unsigned int p2m_ipa_bits;
 
+#ifdef CONFIG_ARM_64
+extern unsigned int p2m_root_order;
+extern unsigned int p2m_root_level;
+#define P2M_ROOT_ORDER    p2m_root_order
+#define P2M_ROOT_LEVEL p2m_root_level
+#else
+/* First level P2M is always 2 consecutive pages */
+#define P2M_ROOT_ORDER    1
+#define P2M_ROOT_LEVEL 1
+#endif
+
 struct domain;
 
 extern void memory_type_changed(struct domain *);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 09:23:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 09:23:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21333.47676 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKRH-0005FX-IB; Sat, 07 Nov 2020 09:23:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21333.47676; Sat, 07 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbKRH-0005FP-FC; Sat, 07 Nov 2020 09:23:15 +0000
Received: by outflank-mailman (input) for mailman id 21333;
 Sat, 07 Nov 2020 09:23:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbKRG-0005FD-7q
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:14 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2181aee1-a5dd-4176-a086-2a314931696c;
 Sat, 07 Nov 2020 09:23:13 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKRF-0001CV-FX
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbKRF-0006vS-Ej
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbKRG-0005FD-7q
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:14 +0000
X-Inumbo-ID: 2181aee1-a5dd-4176-a086-2a314931696c
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 2181aee1-a5dd-4176-a086-2a314931696c;
	Sat, 07 Nov 2020 09:23:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hWfPAanpQWzkUaZhQleW31Qn6fpMdOCWNEVA/deAukw=; b=a5AWcf+JcpJKjmn2/wXue8CNhE
	FrQ6Cnrq4So+fJsI3Z1ounPZXiUvb3HCFYvJ2t8o24rpguYpe6DU0+9/JeIvSaxMz4eZY+nJyztg1
	TbzGz5cWFQTazIC+afKE2iYJCnQYbAjrj8Dg5DTkcDMMyzbqQMFMjCkQGKyXg9x9ZD1I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKRF-0001CV-FX
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbKRF-0006vS-Ej
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 09:23:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] SUPPORT: Add linux device model stubdom to Toolstack
Message-Id: <E1kbKRF-0006vS-Ej@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 09:23:13 +0000

commit 0c96e4297da07944525729ddbe438b0131ab5b7e
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Fri Nov 6 09:57:11 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 6 09:57:11 2020 +0100

    SUPPORT: Add linux device model stubdom to Toolstack
    
    Add qemu-xen linux device model stubdomain to the Toolstack section as a
    Tech Preview.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    master commit: 4ddd6499d999a7d08cabfda5b0262e473dd5beed
    master date: 2020-10-23 17:14:08 +0100
---
 SUPPORT.md | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 55a65ae136..8070b2df99 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -167,6 +167,12 @@ Go (golang) bindings for libxl
 
     Status: Experimental
 
+### Linux device model stubdomains
+
+Support for running qemu-xen device model in a linux stubdomain.
+
+    Status: Tech Preview
+
 ## Toolstack/3rd party
 
 ### libvirt driver for xl
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 15:33:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 15:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21397.47715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbQDA-0003DV-Rl; Sat, 07 Nov 2020 15:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21397.47715; Sat, 07 Nov 2020 15:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbQDA-0003DN-Oj; Sat, 07 Nov 2020 15:33:04 +0000
Received: by outflank-mailman (input) for mailman id 21397;
 Sat, 07 Nov 2020 15:33:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbQD9-0003DH-8D
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 15:33:03 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cde2e54a-24ab-4590-82f2-5c4071bfa2b5;
 Sat, 07 Nov 2020 15:33:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbQD8-0000IN-2l
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 15:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbQD8-0007lo-0a
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 15:33:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbQD9-0003DH-8D
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 15:33:03 +0000
X-Inumbo-ID: cde2e54a-24ab-4590-82f2-5c4071bfa2b5
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id cde2e54a-24ab-4590-82f2-5c4071bfa2b5;
	Sat, 07 Nov 2020 15:33:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HdZfV76CLgHjlue4QYbaMaRnU4XrgUkc/53StHMB0VI=; b=uvATAu93X8mu5W8vj4uWt9yTOm
	T/O+8u8hVFLgwP9Bmxl7bM/FseEkspFLWFIJeutGBND11UQgvaFTshq0DFL5uBBRrO8XXcP69JVRA
	wnQZPuz0RE2zlZo2dK78VlOoagB2GcKyOnouPsZcuT7DT8f6w8uXEEJjg8ngNKOG4fHU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbQD8-0000IN-2l
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 15:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbQD8-0007lo-0a
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 15:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.13] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kbQD8-0007lo-0a@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 15:33:02 +0000

commit 7269466a5b0c0e89b36dc9a7db0554ae404aa230
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:32:03 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 5abd128b6b..5234dcc73f 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -129,6 +129,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -138,14 +139,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -259,26 +261,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 18:11:20 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 18:11:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21440.47750 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbSgE-0000bG-ME; Sat, 07 Nov 2020 18:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21440.47750; Sat, 07 Nov 2020 18:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbSgE-0000b6-Ig; Sat, 07 Nov 2020 18:11:14 +0000
Received: by outflank-mailman (input) for mailman id 21440;
 Sat, 07 Nov 2020 18:11:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbSgD-0000Y7-Dr
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 18:11:13 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d3b81958-ed9b-4dbb-ba18-531fc9ae6127;
 Sat, 07 Nov 2020 18:11:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbSg2-00042H-Qr
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 18:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbSg2-0007Bg-Pt
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 18:11:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbSgD-0000Y7-Dr
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 18:11:13 +0000
X-Inumbo-ID: d3b81958-ed9b-4dbb-ba18-531fc9ae6127
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id d3b81958-ed9b-4dbb-ba18-531fc9ae6127;
	Sat, 07 Nov 2020 18:11:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oWOyGERu8+wTh0KbQGA6puVIOzaBgejNs+SZOZ6aNZE=; b=ehSxTH/UwIRg52uSH2UFXfhhUC
	YnFGUivumQbDB3p7sb4JjTLGxWFLz3IgNST1djxGbS1Vc84TtT7wHTKO7N1nM9ni/2OKVXh4VWs8y
	gvFQebpIostZMkCVx5cwrIN+As0/LfVfEJDyJ9oV0W+w3/1WkNnyJm69vmYwD0+azY0w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbSg2-00042H-Qr
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 18:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbSg2-0007Bg-Pt
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 18:11:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.11] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kbSg2-0007Bg-Pt@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 18:11:02 +0000

commit cf8d15e2819784ed2360b7b557f72db8f8db5ff6
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:38:39 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 241ae66b15..c060a83656 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -130,6 +130,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -139,14 +140,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -260,26 +262,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Sat Nov 07 22:33:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 07 Nov 2020 22:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21493.47801 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbWld-00065M-7P; Sat, 07 Nov 2020 22:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21493.47801; Sat, 07 Nov 2020 22: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbWld-00065E-4Q; Sat, 07 Nov 2020 22:33:05 +0000
Received: by outflank-mailman (input) for mailman id 21493;
 Sat, 07 Nov 2020 22:33:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbWlc-000659-2x
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 22:33:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id aef7607a-fb4b-44fc-ad2f-c6260026fb13;
 Sat, 07 Nov 2020 22:33:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbWla-00010m-QB
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 22:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbWla-0001GB-M3
 for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 22:33:02 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=0u63=EN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbWlc-000659-2x
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 22:33:04 +0000
X-Inumbo-ID: aef7607a-fb4b-44fc-ad2f-c6260026fb13
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id aef7607a-fb4b-44fc-ad2f-c6260026fb13;
	Sat, 07 Nov 2020 22:33:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OGYmNOU0klsodAtJSf85mksbNlO08EoSZ7I8ywTVl7Y=; b=EboUCy+ZZHAK1dMXzzF+j/iZ80
	2LdrR4mcn6nwdu0LPaH8Vr5iAKYNQVu0zyXJ1NoVpmfRGFYx3s4MADr+7bazdxiX8IXrmTpJaB7qF
	xx+2dJnEkOpy9T299BZRQpNUiryzcC2L328eELutS54AHw4tlecskR6XGlmfW+w9a5r8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbWla-00010m-QB
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 22:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbWla-0001GB-M3
	for xen-changelog@lists.xenproject.org; Sat, 07 Nov 2020 22:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.10] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kbWla-0001GB-M3@xenbits.xenproject.org>
Date: Sat, 07 Nov 2020 22:33:02 +0000

commit e6ade47b1e1c4b9f2e49384c68c4edff783433af
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:39:20 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 241ae66b15..c060a83656 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -130,6 +130,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -139,14 +140,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -260,26 +262,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Sun Nov 08 14:22:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Nov 2020 14:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21682.48009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbla0-00029H-17; Sun, 08 Nov 2020 14:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21682.48009; Sun, 08 Nov 2020 14: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kblZz-000298-UI; Sun, 08 Nov 2020 14:22:03 +0000
Received: by outflank-mailman (input) for mailman id 21682;
 Sun, 08 Nov 2020 14:22:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UtP1=EO=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kblZz-000293-AU
 for xen-changelog@lists.xenproject.org; Sun, 08 Nov 2020 14:22:03 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9a5160fb-c097-4975-8109-6d77db1933ed;
 Sun, 08 Nov 2020 14:22:02 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kblZy-0001G3-5D
 for xen-changelog@lists.xenproject.org; Sun, 08 Nov 2020 14:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kblZy-0000sH-3C
 for xen-changelog@lists.xenproject.org; Sun, 08 Nov 2020 14:22:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=UtP1=EO=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kblZz-000293-AU
	for xen-changelog@lists.xenproject.org; Sun, 08 Nov 2020 14:22:03 +0000
X-Inumbo-ID: 9a5160fb-c097-4975-8109-6d77db1933ed
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 9a5160fb-c097-4975-8109-6d77db1933ed;
	Sun, 08 Nov 2020 14:22:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SqNwG+LNfKIK1EgMzP1TSPMMGraDQ+RVZHSN5FseqbU=; b=JodnV7useh24uP3Od+A300tXJx
	bSydhhcL6hXypH2bpao6ArhIuLfeYmeetigrhVLy3T3BhGz5K1AcVyBu8xpxQex7X24su/whrW4kH
	tIlkcClRtprCvW4c++hm+myJKQXEyryxmQ8nOiO2svizU0w5+LM43b0M3olMSZB0oWm0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kblZy-0001G3-5D
	for xen-changelog@lists.xenproject.org; Sun, 08 Nov 2020 14:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kblZy-0000sH-3C
	for xen-changelog@lists.xenproject.org; Sun, 08 Nov 2020 14:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.12] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kblZy-0000sH-3C@xenbits.xenproject.org>
Date: Sun, 08 Nov 2020 14:22:02 +0000

commit 92a78636a51611475f711637c44cafbda3ef9859
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:37:12 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 241ae66b15..c060a83656 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -130,6 +130,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -139,14 +140,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -260,26 +262,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 05:00:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 05:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.21945.48275 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbzHg-0000VU-TD; Mon, 09 Nov 2020 05:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 21945.48275; Mon, 09 Nov 2020 05: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kbzHg-0000V0-PM; Mon, 09 Nov 2020 05:00:04 +0000
Received: by outflank-mailman (input) for mailman id 21945;
 Mon, 09 Nov 2020 05:00:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kbzHg-0000PD-84
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 05:00:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 66a3b5f6-f3bb-4f7d-9e9c-682b7621d189;
 Mon, 09 Nov 2020 05:00:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbzHe-0000XA-Sx
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 05:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kbzHe-0003bh-Qe
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 05:00:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kbzHg-0000PD-84
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 05:00:04 +0000
X-Inumbo-ID: 66a3b5f6-f3bb-4f7d-9e9c-682b7621d189
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 66a3b5f6-f3bb-4f7d-9e9c-682b7621d189;
	Mon, 09 Nov 2020 05:00:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IKg3tpNMUeARII6t00ywn8w4V9koOzdLzCO1JsrBggQ=; b=A7YodduHfEQcdSVz6K1Jz5RRTh
	wZoZd1w03Zrd1+4jqcJxupTAQfLy7fzQjkJ4zu7QgzdXQJlrswxZiabJ6sLd8dCoskjO7vfO451Ir
	TTcwfvK8VFSyXLW1XXZzJ4pyswpXDMQ4QkkPfFQ4X8gToem1Y/61sq/VMMASzgJES5cs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbzHe-0000XA-Sx
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 05:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kbzHe-0003bh-Qe
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 05:00:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] usb: fix setup_len init (CVE-2020-14364)
Message-Id: <E1kbzHe-0003bh-Qe@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 05:00:02 +0000

commit 7ea428895af2840d85c524f0bd11a38aac308308
Author:     Gerd Hoffmann <kraxel@redhat.com>
AuthorDate: Tue Aug 25 07:36:36 2020 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Fri Nov 6 15:30:18 2020 +0000

    usb: fix setup_len init (CVE-2020-14364)
    
    Store calculated setup_len in a local variable, verify it, and only
    write it to the struct (USBDevice->setup_len) in case it passed the
    sanity checks.
    
    This prevents other code (do_token_{in,out} functions specifically)
    from working with invalid USBDevice->setup_len values and overrunning
    the USBDevice->setup_buf[] buffer.
    
    Fixes: CVE-2020-14364
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Tested-by: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: Li Qiang <liq3ea@gmail.com>
    Message-id: 20200825053636.29648-1-kraxel@redhat.com
    (cherry picked from commit b946434f2659a182afc17e155be6791ebfb302eb)
---
 hw/usb/core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 5abd128b6b..5234dcc73f 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -129,6 +129,7 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
 static void do_token_setup(USBDevice *s, USBPacket *p)
 {
     int request, value, index;
+    unsigned int setup_len;
 
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
@@ -138,14 +139,15 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
     usb_packet_copy(p, s->setup_buf, p->iov.size);
     s->setup_index = 0;
     p->actual_length = 0;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -259,26 +261,28 @@ static void do_token_out(USBDevice *s, USBPacket *p)
 static void do_parameter(USBDevice *s, USBPacket *p)
 {
     int i, request, value, index;
+    unsigned int setup_len;
 
     for (i = 0; i < 8; i++) {
         s->setup_buf[i] = p->parameter >> (i*8);
     }
 
     s->setup_state = SETUP_STATE_PARAM;
-    s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
 
     request = (s->setup_buf[0] << 8) | s->setup_buf[1];
     value   = (s->setup_buf[3] << 8) | s->setup_buf[2];
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
-    if (s->setup_len > sizeof(s->data_buf)) {
+    setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
+    if (setup_len > sizeof(s->data_buf)) {
         fprintf(stderr,
                 "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
-                s->setup_len, sizeof(s->data_buf));
+                setup_len, sizeof(s->data_buf));
         p->status = USB_RET_STALL;
         return;
     }
+    s->setup_len = setup_len;
 
     if (p->pid == USB_TOKEN_OUT) {
         usb_packet_copy(p, s->data_buf, s->setup_len);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 17:55:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 17:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22806.49239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBNk-0000SK-82; Mon, 09 Nov 2020 17:55:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22806.49239; Mon, 09 Nov 2020 17:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBNk-0000SC-5C; Mon, 09 Nov 2020 17:55:08 +0000
Received: by outflank-mailman (input) for mailman id 22806;
 Mon, 09 Nov 2020 17:55:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBNj-0000S7-38
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:07 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fd7e15fb-679d-466a-9f9b-66b8062be87f;
 Mon, 09 Nov 2020 17:55:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBNg-0003Kq-U2
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBNg-0007bn-RI
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBNj-0000S7-38
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:07 +0000
X-Inumbo-ID: fd7e15fb-679d-466a-9f9b-66b8062be87f
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id fd7e15fb-679d-466a-9f9b-66b8062be87f;
	Mon, 09 Nov 2020 17:55:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jCN/41JZUA0jmG4K3ZGheSNBiAP7ssVE/K5u9X+ijuc=; b=pnPRR9xKZ8L8lpR9XULSKYUqk2
	fVTsWQbqLeXF19KZjdYyRQBsMIxQxt4mQOS3mt6N+8FafeGWpi491ce+jtp8/y2+ZSi8y7YbzLWg/
	VTDTiaoNYVSR5EqmhvwWI2NGopI4CS8tozsxv0pwBDkfAEhT74zIa4CZavuCNiQSt7xE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBNg-0003Kq-U2
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBNg-0007bn-RI
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] libxl: workaround gcc 10.2 maybe-uninitialized warning
Message-Id: <E1kcBNg-0007bn-RI@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 17:55:04 +0000

commit 71a12a97988c516a17aba40bb5df9274133e9e92
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:35 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:13:34 2020 +0000

    libxl: workaround gcc 10.2 maybe-uninitialized warning
    
    It seems xlu_pci_parse_bdf has a state machine that is too complex for
    gcc to understand. The build fails with:
    
        libxlu_pci.c: In function 'xlu_pci_parse_bdf':
        libxlu_pci.c:32:18: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           32 |     pcidev->func = func;
              |     ~~~~~~~~~~~~~^~~~~~
        libxlu_pci.c:51:29: note: 'func' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                             ^~~~
        libxlu_pci.c:31:17: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           31 |     pcidev->dev = dev;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:24: note: 'dev' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                        ^~~
        libxlu_pci.c:30:17: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           30 |     pcidev->bus = bus;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:19: note: 'bus' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                   ^~~
        libxlu_pci.c:29:20: error: 'dom' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           29 |     pcidev->domain = domain;
              |     ~~~~~~~~~~~~~~~^~~~~~~~
        libxlu_pci.c:51:14: note: 'dom' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |              ^~~
        cc1: all warnings being treated as errors
    
    Workaround it by setting the initial value to invalid value (0xffffffff)
    and then assert on each value being set. This way we mute the gcc
    warning, while still detecting bugs in the parse code.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit d25cc3ec93ebda030349045d2c7fa14ffde07ed7)
---
 tools/libxl/libxlu_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
index 7947687661..e2709c5f89 100644
--- a/tools/libxl/libxlu_pci.c
+++ b/tools/libxl/libxlu_pci.c
@@ -45,10 +45,11 @@ static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
 #define STATE_TYPE      9
 #define STATE_RDM_STRATEGY      10
 #define STATE_RESERVE_POLICY    11
+#define INVALID         0xffffffff
 int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
 {
     unsigned state = STATE_DOMAIN;
-    unsigned dom, bus, dev, func, vslot = 0;
+    unsigned dom = INVALID, bus = INVALID, dev = INVALID, func = INVALID, vslot = 0;
     char *buf2, *tok, *ptr, *end, *optkey = NULL;
 
     if ( NULL == (buf2 = ptr = strdup(str)) )
@@ -170,6 +171,8 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str
     if ( tok != ptr || state != STATE_TERMINAL )
         goto parse_error;
 
+    assert(dom != INVALID && bus != INVALID && dev != INVALID && func != INVALID);
+
     /* Just a pretty way to fill in the values */
     pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 17:55:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 17:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22807.49244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBNt-0000TA-9l; Mon, 09 Nov 2020 17:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22807.49244; Mon, 09 Nov 2020 17:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBNt-0000T1-6e; Mon, 09 Nov 2020 17:55:17 +0000
Received: by outflank-mailman (input) for mailman id 22807;
 Mon, 09 Nov 2020 17:55:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBNs-0000Su-6X
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:16 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e178adf3-76cf-41dd-8ca3-83ce85ff5205;
 Mon, 09 Nov 2020 17:55:15 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBNr-0003Kt-1q
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBNq-0007cp-WD
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBNs-0000Su-6X
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:16 +0000
X-Inumbo-ID: e178adf3-76cf-41dd-8ca3-83ce85ff5205
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id e178adf3-76cf-41dd-8ca3-83ce85ff5205;
	Mon, 09 Nov 2020 17:55:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T5JVR9qT9+MZyHMpw9CUTn7YVnuSggeYDzZB151cvzc=; b=WsVKj7sZhY5WLaABS6vCFxnAUe
	OLdTYjeCci/XKJ4JAGWK7WmTqdt9U2j1HLvsEKFs1O2RXT2sGRkycl9Rz9MSVEtWVfTouq7U6ePPN
	6NVGMx8ZUuU4BIDSzFFK18yLvz/OausJiJxm0XUWtpMtORbS+/dTOiCt3lmhduyLHUQg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBNr-0003Kt-1q
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBNq-0007cp-WD
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
Message-Id: <E1kcBNq-0007cp-WD@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 17:55:14 +0000

commit f728b2d69f426258f37709de9efac5245a597d0d
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:13:39 2020 +0000

    libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
    
    In file included from /usr/include/string.h:495,
                     from libxl_internal.h:38,
                     from libxl_utils.c:20:
    In function 'strncpy',
        inlined from 'libxl__prepare_sockaddr_un' at libxl_utils.c:1262:5:
    /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit fff1b7f50e75ad9535c86f3fcf425b4945c50a1c)
---
 tools/libxl/libxl_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index f360f5e228..b039143b8a 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -1252,14 +1252,14 @@ int libxl__prepare_sockaddr_un(libxl__gc *gc,
                                struct sockaddr_un *un, const char *path,
                                const char *what)
 {
-    if (sizeof(un->sun_path) <= strlen(path)) {
+    if (sizeof(un->sun_path) - 1 <= strlen(path)) {
         LOG(ERROR, "UNIX socket path '%s' is too long for %s", path, what);
-        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path));
+        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path) - 1);
         return ERROR_INVAL;
     }
     memset(un, 0, sizeof(struct sockaddr_un));
     un->sun_family = AF_UNIX;
-    strncpy(un->sun_path, path, sizeof(un->sun_path));
+    strncpy(un->sun_path, path, sizeof(un->sun_path) - 1);
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 17:55:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 17:55:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22808.49247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBO3-0000Ul-B9; Mon, 09 Nov 2020 17:55:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22808.49247; Mon, 09 Nov 2020 17:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBO3-0000Ud-8F; Mon, 09 Nov 2020 17:55:27 +0000
Received: by outflank-mailman (input) for mailman id 22808;
 Mon, 09 Nov 2020 17:55:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBO2-0000UU-BP
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:26 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d8a1b49c-75b3-4f41-acf0-31a7ce183069;
 Mon, 09 Nov 2020 17:55:25 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBO1-0003L1-4s
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBO1-0007dt-3v
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBO2-0000UU-BP
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:26 +0000
X-Inumbo-ID: d8a1b49c-75b3-4f41-acf0-31a7ce183069
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id d8a1b49c-75b3-4f41-acf0-31a7ce183069;
	Mon, 09 Nov 2020 17:55:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b6r6w+llOWCbBtrH52aJ5DgyUy9s2XQ3dzoShVDodb0=; b=Q7bG7Ord7YOdxrkOAOBm913VFt
	NQE3FgY3Dtirf+EORxfRg1aBTDkvffavkg/3IPBK0vamJo9LvK2xAKBtN9bPUGIAmlTEBO1j6kzs4
	hy1nMOjlESjMIG2u3oRoABJynLNp9QT+eC8qg9ZtcLpXkVjPAFENQqlzlrNhBMvdveQo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBO1-0003L1-4s
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBO1-0007dt-3v
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] tools/xenpmd: Fix gcc10 snprintf warning
Message-Id: <E1kcBO1-0007dt-3v@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 17:55:25 +0000

commit 1f9f1cb3a0216a7d41ded3090b4bb2735cc8a8e6
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Oct 15 10:16:09 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:14:23 2020 +0000

    tools/xenpmd: Fix gcc10 snprintf warning
    
    Add a check for snprintf return code and ignore the entry if we get an
    error. This should in fact never happen and is more a trick to make gcc
    happy and prevent compilation errors.
    
    This is solving the following gcc warning when compiling for arm32 host
    platforms with optimization activated:
    xenpmd.c:92:37: error: '%s' directive output may be truncated writing
    between 4 and 2147483645 bytes into a region of size 271
    [-Werror=format-truncation=]
    
    This is also solving the following Debian bug:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0dfddb2116e3757f77a691a3fe335173088d69dc)
---
 tools/xenpmd/xenpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 1c801caa71..50679efa3f 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
     FILE *file = 0;
     struct dirent *dir_entries;
     char file_name[284];
+    int ret;
     
     do 
     {
@@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
                      dir_entries->d_name);
+        /* This should not happen but is needed to pass gcc checks */
+        if (ret < 0)
+            continue;
+        file_name[sizeof(file_name) - 1] = '\0';
         file = fopen(file_name, "r");
     } while ( !file );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 17:55:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 17:55:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22809.49253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBOE-0000WD-DA; Mon, 09 Nov 2020 17:55:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22809.49253; Mon, 09 Nov 2020 17:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBOE-0000W3-9u; Mon, 09 Nov 2020 17:55:38 +0000
Received: by outflank-mailman (input) for mailman id 22809;
 Mon, 09 Nov 2020 17:55:36 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBOC-0000Vv-KV
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:36 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7c48d77d-7fbb-4012-aeae-18d952e38ce1;
 Mon, 09 Nov 2020 17:55:35 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOB-0003LD-7w
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOB-0007ev-6y
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:35 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBOC-0000Vv-KV
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:36 +0000
X-Inumbo-ID: 7c48d77d-7fbb-4012-aeae-18d952e38ce1
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 7c48d77d-7fbb-4012-aeae-18d952e38ce1;
	Mon, 09 Nov 2020 17:55:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4ppNRyDU1J34+6Rpta1yT1V76xU287xVN01kR920cms=; b=oHHrN4IibPqCAdmBORAJMc0QOP
	BIDJ7wXRw3eXRNGJH9nXy2HoJopQdn5lZ/HUtXX7YgHNpsdS1+V6prylPMr1n7nkJ0HE6OSlWAWvx
	zm7Nm1meHb/ICPjVhru7aIh0JIN3tUvK8P2V7P2tiectC2pC3xel9DgL/3QiapzMXL3M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOB-0003LD-7w
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOB-0007ev-6y
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
Message-Id: <E1kcBOB-0007ev-6y@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 17:55:35 +0000

commit 59b83663f925092f60f699147390c6cb77b55e43
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Thu Mar 19 20:40:24 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:16:20 2020 +0000

    tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
    
    The do_ls() function has somewhat inconsistent handling of errors.
    
    If reading the node's contents with xs_read() fails, then do_ls() will
    just quietly not display the contents.
    
    If reading the node's permissions with xs_get_permissions() fails, then
    do_ls() will print a warning, continue, and ultimately won't exit with
    an error code (unless another error happens).
    
    If recursing into the node with xs_directory() fails, then do_ls() will
    abort immediately, not printing any further nodes.
    
    For persistent failure modes — such as ENOENT because a node has been
    removed, or EACCES because it has had its permisions changed since the
    xs_directory() on the parent directory returned its name — it's
    obviously quite likely that if either of the first two errors occur for
    a given node, then so will the third and thus xenstore-ls will abort.
    
    The ENOENT one is actually a fairly common case, and has caused tools to
    fail to clean up a network device because it *apparently* already
    doesn't exist in xenstore.
    
    There is a school of thought that says, "Well, xenstore-ls returned an
    error. So the tools should not trust its output."
    
    The natural corollary of this would surely be that the tools must re-run
    xenstore-ls as many times as is necessary until its manages to exit
    without hitting the race condition. I am not keen on that conclusion.
    
    For the specific case of ENOENT it seems reasonable to declare that,
    but for the timing, we might as well just not have seen that node at
    all when calling xs_directory() for the parent. By ignoring the error,
    we give acceptable output.
    
    The issue can be reproduced as follows:
    
    (dom0) # for a in `seq 1 1000` ; do
                  xenstore-write /local/domain/2/foo/$a $a ;
             done
    
    Now simultaneously:
    
    (dom0) # for a in `seq 1 999` ; do
                  xenstore-rm /local/domain/2/foo/$a ;
             done
    (dom2) # while true ; do
                  ./xenstore-ls -p /local/domain/2/foo | grep -c 1000 ;
             done
    
    We should expect to see node 1000 in the output, every time.
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit beb105af19cc3e58e2ed49224cfe190a736e5fa0)
---
 tools/xenstore/xenstore_client.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 3afc630ab8..ae7ed3eb9e 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -148,14 +148,20 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms
     int i;
     unsigned int num, len;
 
+    e = xs_directory(h, XBT_NULL, path, &num);
+    if (e == NULL) {
+        if (cur_depth && errno == ENOENT) {
+            /* If a node disappears while recursing, silently move on. */
+            return;
+        }
+
+        err(1, "xs_directory (%s)", path);
+    }
+
     newpath = malloc(STRING_MAX);
     if (!newpath)
       err(1, "malloc in do_ls");
 
-    e = xs_directory(h, XBT_NULL, path, &num);
-    if (e == NULL)
-        err(1, "xs_directory (%s)", path);
-
     for (i = 0; i<num; i++) {
         char buf[MAX_STRLEN(unsigned int)+1];
         struct xs_permissions *perms;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 17:55:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 17:55:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22810.49256 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBON-0000XL-EU; Mon, 09 Nov 2020 17:55:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22810.49256; Mon, 09 Nov 2020 17:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBON-0000XD-BM; Mon, 09 Nov 2020 17:55:47 +0000
Received: by outflank-mailman (input) for mailman id 22810;
 Mon, 09 Nov 2020 17:55:46 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBOM-0000X3-4M
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:46 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c70030b2-bf02-45f0-b5e8-e127fd542924;
 Mon, 09 Nov 2020 17:55:45 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOL-0003LP-Av
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOL-0007g7-A4
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:45 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBOM-0000X3-4M
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:46 +0000
X-Inumbo-ID: c70030b2-bf02-45f0-b5e8-e127fd542924
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id c70030b2-bf02-45f0-b5e8-e127fd542924;
	Mon, 09 Nov 2020 17:55:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RJBPc2O7BMg7sPmr2mvcFBUwPuaye9SOSnn5U5avG0c=; b=miwk8i3w64ujpgMQguYLg+TNTT
	su3OfSG28B4Yg4ltlmIzMKJjR+N1rqmnmAkOrdnjNZTge4XzhVFYdnjSf8ekRptsJ3thiVTMi2H7F
	COWBljrHOV7JM9u++8AtCtDtEVR7hU5ikni40ZJNQf/gbq5sckE3buCjlgq57RrysR8w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOL-0003LP-Av
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOL-0007g7-A4
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] tools/libs/stat: fix broken build
Message-Id: <E1kcBOL-0007g7-A4@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 17:55:45 +0000

commit 7398a44e8636c99f6b06fb16d05a64ee06980d10
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Sep 12 15:08:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:45:32 2020 +0000

    tools/libs/stat: fix broken build
    
    Making getBridge() static triggered a build error with some gcc versions:
    
    error: 'strncpy' output may be truncated copying 15 bytes from a string of
    length 255 [-Werror=stringop-truncation]
    
    Fix that by using a buffer with 256 bytes instead.
    
    Fixes: 6d0ec053907794 ("tools: split libxenstat into new tools/libs/stat directory")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit c8099e48c3dbb8c7399551a265756ecf354eece2)
---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 7530349eee..0274dc4d07 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -78,7 +78,7 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 				sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
 
 				if (access(tmp, F_OK) == 0) {
-					strncpy(result, de->d_name, resultLen - 1);
+					strncpy(result, de->d_name, resultLen);
 					result[resultLen - 1] = 0;
 				}
 		}
@@ -264,7 +264,7 @@ int xenstat_collect_networks(xenstat_node * node)
 {
 	/* Helper variables for parseNetDevLine() function defined above */
 	int i;
-	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[16] = { 0 }, devNoBridge[17] = { 0 };
+	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[256] = { 0 }, devNoBridge[257] = { 0 };
 	unsigned long long rxBytes, rxPackets, rxErrs, rxDrops, txBytes, txPackets, txErrs, txDrops;
 
 	struct priv_data *priv = get_priv_data(node->handle);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 17:55:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 17:55:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22811.49260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBOX-0000ZK-GG; Mon, 09 Nov 2020 17:55:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22811.49260; Mon, 09 Nov 2020 17:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBOX-0000ZB-Cx; Mon, 09 Nov 2020 17:55:57 +0000
Received: by outflank-mailman (input) for mailman id 22811;
 Mon, 09 Nov 2020 17:55:56 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBOW-0000Z1-6Q
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:56 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6a202fc8-5c4b-4701-8981-f9f7837f3f23;
 Mon, 09 Nov 2020 17:55:55 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOV-0003La-El
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOV-0007hB-Cw
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBOW-0000Z1-6Q
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:56 +0000
X-Inumbo-ID: 6a202fc8-5c4b-4701-8981-f9f7837f3f23
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 6a202fc8-5c4b-4701-8981-f9f7837f3f23;
	Mon, 09 Nov 2020 17:55:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y6RND8SwfrBTiVCndGiZeMVPYOQS6iyd5CRvH95ZYI8=; b=mIo4TqGzM7jrX4m1EU8qtHiANI
	lZ7ojb9FfmQ5EZUJ3YUngx36KyEHftKEDSCMp5ngArYMiyS1QRxSfm0YNk8c9Ghu4K88hsuq/+ZRG
	3YASLcuCd5AyyGWbQAkTmGcntBdMPfcQijMPAtaLy2gkmZxf56Uq3Eod7dDuyO2KoGCg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOV-0003La-El
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOV-0007hB-Cw
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:55:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] tools/libxc: report malloc errors in writev_exact
Message-Id: <E1kcBOV-0007hB-Cw@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 17:55:55 +0000

commit 89ae1b185a193fea8e86840c48a2711f04042415
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Wed Sep 23 08:48:40 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:45:32 2020 +0000

    tools/libxc: report malloc errors in writev_exact
    
    The caller of writev_exact should be notified about malloc errors
    when dealing with partial writes.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0d8d289af7a679c028462c4ed5d98586f9ef9648)
---
 tools/libxc/xc_private.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 90974d572e..13a2c723c1 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -722,6 +722,7 @@ int writev_exact(int fd, const struct iovec *iov, int iovcnt)
                     if ( !local_iov )
                     {
                         saved_errno = ENOMEM;
+                        rc = -1;
                         goto out;
                     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 17:56:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 17:56:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22812.49263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBOh-0000ac-Hu; Mon, 09 Nov 2020 17:56:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22812.49263; Mon, 09 Nov 2020 17:56: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBOh-0000aU-Eh; Mon, 09 Nov 2020 17:56:07 +0000
Received: by outflank-mailman (input) for mailman id 22812;
 Mon, 09 Nov 2020 17:56:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBOg-0000aJ-8L
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:06 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6c962493-a485-4dbf-a1c3-0d88a1bb63c2;
 Mon, 09 Nov 2020 17:56:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOf-0003Mb-Hc
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOf-0007iN-Gw
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBOg-0000aJ-8L
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:06 +0000
X-Inumbo-ID: 6c962493-a485-4dbf-a1c3-0d88a1bb63c2
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 6c962493-a485-4dbf-a1c3-0d88a1bb63c2;
	Mon, 09 Nov 2020 17:56:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Grak2POLss29SZXCn9k1Y/AWRmXusCIaT25Ch6ty7UI=; b=YgoJuBkxn1p6gGWk5T/ACVG0rZ
	TBBmBMU+fMKss2jjGpjiTzmM7z/PDpE0dNxwNR4zQcydLJj//hNzCDXF5gr1dPmKVc9UUFHeezf/N
	NHEkV5wI6/qQ9IqW8bPaceJaRDa2EQ05JarlAcoCiXLR4zQ5FJJzDV3zTM34ETy512AI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOf-0003Mb-Hc
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOf-0007iN-Gw
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] tool/libs/light: Fix libxenlight gcc warning
Message-Id: <E1kcBOf-0007iN-Gw@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 17:56:05 +0000

commit 78a53f0ee04bfd14dc21dabd3a0d79343c3b642f
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:02 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:45:32 2020 +0000

    tool/libs/light: Fix libxenlight gcc warning
    
    Fix gcc10 compilation warning about uninitialized variable by setting
    it to 0.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0241809bf838875615797f52af34222e5ab8e98f)
---
 tools/libxl/libxl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c
index e52a9624ea..c739d00f39 100644
--- a/tools/libxl/libxl_mem.c
+++ b/tools/libxl/libxl_mem.c
@@ -562,7 +562,7 @@ out:
 
 int libxl_get_free_memory_0x040700(libxl_ctx *ctx, uint32_t *memkb)
 {
-    uint64_t my_memkb;
+    uint64_t my_memkb = 0;
     int rc;
 
     rc = libxl_get_free_memory(ctx, &my_memkb);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 17:56:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 17:56:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22813.49269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBOr-0000cA-Le; Mon, 09 Nov 2020 17:56:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22813.49269; Mon, 09 Nov 2020 17:56: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBOr-0000by-IG; Mon, 09 Nov 2020 17:56:17 +0000
Received: by outflank-mailman (input) for mailman id 22813;
 Mon, 09 Nov 2020 17:56:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBOq-0000bp-E3
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:16 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fb7056ca-4648-48ad-bfd0-89c002c46418;
 Mon, 09 Nov 2020 17:56:15 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOp-0003Ml-KK
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBOp-0007jE-Jf
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBOq-0000bp-E3
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:16 +0000
X-Inumbo-ID: fb7056ca-4648-48ad-bfd0-89c002c46418
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id fb7056ca-4648-48ad-bfd0-89c002c46418;
	Mon, 09 Nov 2020 17:56:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JXGqcw9nS5nHjrxpMudiw8Bdu1OEiubdEoS2qgJmSdU=; b=O1JzgZevSslnGRalYSEa+x1/Qn
	RFlmmbDRf/1db+QWhkT8tVdGr8lvf0w25m54I+QPGdCWCqT0+0b1WFr7PuucyrX7VstpQoFQrxucg
	a7tVzLsenMEx6Lr9ULp8l7Y6RIlyoJvwc/rIewMugKZu9q0YdCDXrUOX1vJ/EfwxdNQU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOp-0003Ml-KK
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBOp-0007jE-Jf
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 17:56:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] tools/libs/stat: use memcpy instead of strncpy in getBridge
Message-Id: <E1kcBOp-0007jE-Jf@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 17:56:15 +0000

commit a38060ece699f22cd317219bec53c0d27279155b
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:01 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:45:32 2020 +0000

    tools/libs/stat: use memcpy instead of strncpy in getBridge
    
    Use memcpy in getBridge to prevent gcc warnings about truncated
    strings. We know that we might truncate it, so the gcc warning
    here is wrong.
    Revert previous change changing buffer sizes as bigger buffers
    are not needed.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 40fe714ca4245a9716264fcb3ee8df42c3650cf6)
---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 0274dc4d07..9c0cb277c5 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <regex.h>
+#include <xen-tools/libs.h>
 
 #include "xenstat_priv.h"
 
@@ -78,8 +79,14 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 				sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
 
 				if (access(tmp, F_OK) == 0) {
-					strncpy(result, de->d_name, resultLen);
-					result[resultLen - 1] = 0;
+					/*
+					 * Do not use strncpy to prevent compiler warning with
+					 * gcc >= 10.0
+					 * If de->d_name is longer then resultLen we truncate it
+					 */
+					memset(result, 0, resultLen);
+					memcpy(result, de->d_name, MIN(strnlen(de->d_name,
+									NAME_MAX),resultLen - 1));
 				}
 		}
 	}
@@ -264,7 +271,7 @@ int xenstat_collect_networks(xenstat_node * node)
 {
 	/* Helper variables for parseNetDevLine() function defined above */
 	int i;
-	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[256] = { 0 }, devNoBridge[257] = { 0 };
+	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[16] = { 0 }, devNoBridge[17] = { 0 };
 	unsigned long long rxBytes, rxPackets, rxErrs, rxDrops, txBytes, txPackets, txErrs, txDrops;
 
 	struct priv_data *priv = get_priv_data(node->handle);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:00:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22814.49272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBSa-0001S5-Vq; Mon, 09 Nov 2020 18:00:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22814.49272; Mon, 09 Nov 2020 18:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBSa-0001Ry-Sj; Mon, 09 Nov 2020 18:00:08 +0000
Received: by outflank-mailman (input) for mailman id 22814;
 Mon, 09 Nov 2020 18:00:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBSZ-0001Rt-Gr
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:07 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 86151305-a507-4aac-bcba-2cf9f991d0d4;
 Mon, 09 Nov 2020 18:00:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBSX-0003YC-MK
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBSX-0008FG-LW
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBSZ-0001Rt-Gr
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:07 +0000
X-Inumbo-ID: 86151305-a507-4aac-bcba-2cf9f991d0d4
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 86151305-a507-4aac-bcba-2cf9f991d0d4;
	Mon, 09 Nov 2020 18:00:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kL2KDVQc7UPxnI3/bmnJ7ZgcYmzaanyYbWkuxeT+tJ4=; b=2AR4lex3Gx4lQZwqIp8bc2PBAx
	MmmjA9VhNa+RQhb1ALeo0geMsf4R8ByI/MwJTIKXVeCyo+fH44MXof1WRvzmJZmHfd2ziim3jkYy6
	j/l8KzK3Bz+BPetDLrZVg+omu9qOTcsiOEUibgqARSeykju2+USqo6GiEDEZNYtGd188=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBSX-0003YC-MK
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBSX-0008FG-LW
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] libxl: workaround gcc 10.2 maybe-uninitialized warning
Message-Id: <E1kcBSX-0008FG-LW@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:00:05 +0000

commit c0dc42ac0708998424441798eae98907e78e8c57
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:35 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    libxl: workaround gcc 10.2 maybe-uninitialized warning
    
    It seems xlu_pci_parse_bdf has a state machine that is too complex for
    gcc to understand. The build fails with:
    
        libxlu_pci.c: In function 'xlu_pci_parse_bdf':
        libxlu_pci.c:32:18: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           32 |     pcidev->func = func;
              |     ~~~~~~~~~~~~~^~~~~~
        libxlu_pci.c:51:29: note: 'func' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                             ^~~~
        libxlu_pci.c:31:17: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           31 |     pcidev->dev = dev;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:24: note: 'dev' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                        ^~~
        libxlu_pci.c:30:17: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           30 |     pcidev->bus = bus;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:19: note: 'bus' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                   ^~~
        libxlu_pci.c:29:20: error: 'dom' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           29 |     pcidev->domain = domain;
              |     ~~~~~~~~~~~~~~~^~~~~~~~
        libxlu_pci.c:51:14: note: 'dom' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |              ^~~
        cc1: all warnings being treated as errors
    
    Workaround it by setting the initial value to invalid value (0xffffffff)
    and then assert on each value being set. This way we mute the gcc
    warning, while still detecting bugs in the parse code.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit d25cc3ec93ebda030349045d2c7fa14ffde07ed7)
---
 tools/libxl/libxlu_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
index 2cd793d223..e39c2c7250 100644
--- a/tools/libxl/libxlu_pci.c
+++ b/tools/libxl/libxlu_pci.c
@@ -45,10 +45,11 @@ static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
 #define STATE_TYPE      9
 #define STATE_RDM_STRATEGY      10
 #define STATE_RESERVE_POLICY    11
+#define INVALID         0xffffffff
 int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
 {
     unsigned state = STATE_DOMAIN;
-    unsigned dom, bus, dev, func, vslot = 0;
+    unsigned dom = INVALID, bus = INVALID, dev = INVALID, func = INVALID, vslot = 0;
     char *buf2, *tok, *ptr, *end, *optkey = NULL;
 
     if ( NULL == (buf2 = ptr = strdup(str)) )
@@ -170,6 +171,8 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str
     if ( tok != ptr || state != STATE_TERMINAL )
         goto parse_error;
 
+    assert(dom != INVALID && bus != INVALID && dev != INVALID && func != INVALID);
+
     /* Just a pretty way to fill in the values */
     pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:00:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:00:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22815.49276 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBSk-0001Sy-1b; Mon, 09 Nov 2020 18:00:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22815.49276; Mon, 09 Nov 2020 18:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBSj-0001Sq-Uf; Mon, 09 Nov 2020 18:00:17 +0000
Received: by outflank-mailman (input) for mailman id 22815;
 Mon, 09 Nov 2020 18:00:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBSi-0001Sh-OH
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:16 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e1beea20-bf1a-404b-b7c6-12f97135b1ea;
 Mon, 09 Nov 2020 18:00:16 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBSh-0003YI-QA
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBSh-0008HG-OR
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBSi-0001Sh-OH
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:16 +0000
X-Inumbo-ID: e1beea20-bf1a-404b-b7c6-12f97135b1ea
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id e1beea20-bf1a-404b-b7c6-12f97135b1ea;
	Mon, 09 Nov 2020 18:00:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w+6w+ChBwYMvXMow+1jt2F5pF23bwNbbYqo4gGk5HQw=; b=nvu2p8/3U15YLXFUrGynHOn35+
	QKB54lkC8tShgxOcJxyJiiRcu4o1KbNHiyq0GFBIxDAWMl+bMHulj0xhmbGrOdr30Z5l0LdI/ufKw
	AV1riL79WgLs6+ECBKird/80cRom9x+YWTzqljKAeixBJ3LhJBm6G3BjpAEPR514c/Ww=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBSh-0003YI-QA
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBSh-0008HG-OR
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
Message-Id: <E1kcBSh-0008HG-OR@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:00:15 +0000

commit b3b43ac44c57892b829ee3c109cdb829c0440825
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
    
    In file included from /usr/include/string.h:495,
                     from libxl_internal.h:38,
                     from libxl_utils.c:20:
    In function 'strncpy',
        inlined from 'libxl__prepare_sockaddr_un' at libxl_utils.c:1262:5:
    /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit fff1b7f50e75ad9535c86f3fcf425b4945c50a1c)
---
 tools/libxl/libxl_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index f360f5e228..b039143b8a 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -1252,14 +1252,14 @@ int libxl__prepare_sockaddr_un(libxl__gc *gc,
                                struct sockaddr_un *un, const char *path,
                                const char *what)
 {
-    if (sizeof(un->sun_path) <= strlen(path)) {
+    if (sizeof(un->sun_path) - 1 <= strlen(path)) {
         LOG(ERROR, "UNIX socket path '%s' is too long for %s", path, what);
-        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path));
+        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path) - 1);
         return ERROR_INVAL;
     }
     memset(un, 0, sizeof(struct sockaddr_un));
     un->sun_family = AF_UNIX;
-    strncpy(un->sun_path, path, sizeof(un->sun_path));
+    strncpy(un->sun_path, path, sizeof(un->sun_path) - 1);
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:00:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:00:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22816.49279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBSu-0001UY-2u; Mon, 09 Nov 2020 18:00:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22816.49279; Mon, 09 Nov 2020 18:00:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBSt-0001UQ-WF; Mon, 09 Nov 2020 18:00:28 +0000
Received: by outflank-mailman (input) for mailman id 22816;
 Mon, 09 Nov 2020 18:00:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBSs-0001UH-O4
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:26 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1600550e-0f44-4ddf-af1f-2b366584d0b8;
 Mon, 09 Nov 2020 18:00:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBSr-0003YR-T2
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBSr-0008I6-SG
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBSs-0001UH-O4
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:26 +0000
X-Inumbo-ID: 1600550e-0f44-4ddf-af1f-2b366584d0b8
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 1600550e-0f44-4ddf-af1f-2b366584d0b8;
	Mon, 09 Nov 2020 18:00:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r8muluNCUewmoHdLIb6Vd7F+5clskQ26IdSYvVAkDnc=; b=FNjQwySeEY8/Klqqm7c4YmwWkx
	/cIa3uNr1AXeM2JsbGbDtjU1YN0J5Kztsll2kORoItay8F9jAYmQRkevf4GYvTaIH68ENW0nskeyJ
	QojR6PlZRCBcBa9vH57lQmSuEZXa7zz6HX9YjeF0jer4MLwbEFSt8CK1KTepaZj5eD08=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBSr-0003YR-T2
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBSr-0008I6-SG
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] tools/xenpmd: Fix gcc10 snprintf warning
Message-Id: <E1kcBSr-0008I6-SG@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:00:25 +0000

commit 75c57992911d7b4b3828369f7e45ff67e60ff1ea
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Oct 15 10:16:09 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/xenpmd: Fix gcc10 snprintf warning
    
    Add a check for snprintf return code and ignore the entry if we get an
    error. This should in fact never happen and is more a trick to make gcc
    happy and prevent compilation errors.
    
    This is solving the following gcc warning when compiling for arm32 host
    platforms with optimization activated:
    xenpmd.c:92:37: error: '%s' directive output may be truncated writing
    between 4 and 2147483645 bytes into a region of size 271
    [-Werror=format-truncation=]
    
    This is also solving the following Debian bug:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0dfddb2116e3757f77a691a3fe335173088d69dc)
---
 tools/xenpmd/xenpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 1c801caa71..50679efa3f 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
     FILE *file = 0;
     struct dirent *dir_entries;
     char file_name[284];
+    int ret;
     
     do 
     {
@@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
                      dir_entries->d_name);
+        /* This should not happen but is needed to pass gcc checks */
+        if (ret < 0)
+            continue;
+        file_name[sizeof(file_name) - 1] = '\0';
         file = fopen(file_name, "r");
     } while ( !file );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:00:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:00:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22817.49284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBT5-0001Vy-4P; Mon, 09 Nov 2020 18:00:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22817.49284; Mon, 09 Nov 2020 18:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBT5-0001Vq-1a; Mon, 09 Nov 2020 18:00:39 +0000
Received: by outflank-mailman (input) for mailman id 22817;
 Mon, 09 Nov 2020 18:00:37 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBT3-0001Vd-0t
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:37 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b6a92bf7-94e1-4090-a0d7-1ec32f8f3384;
 Mon, 09 Nov 2020 18:00:36 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBT2-0003Yj-0y
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBT1-0008J4-VB
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:35 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBT3-0001Vd-0t
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:37 +0000
X-Inumbo-ID: b6a92bf7-94e1-4090-a0d7-1ec32f8f3384
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id b6a92bf7-94e1-4090-a0d7-1ec32f8f3384;
	Mon, 09 Nov 2020 18:00:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qaGaWn8OyiQgWc6oTprcZ0DIL4iKX7jjMhQdv+Jd9/k=; b=LTaaiWM0WYy2BUgy8NHBh4h8CV
	ZMwjIgvwBR5QEe19gzDfNNVfYs5GHkH3GVv6REmChMqbcWauwCIYO1PpPdbmcWxj4r92pXQNgSe13
	25b9q/jbZLXRW1HM+bbhCJLQqmPv3kcwXmAeRreHui627uRMX3VOw3f8SAx1W0uUQEws=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBT2-0003Yj-0y
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBT1-0008J4-VB
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
Message-Id: <E1kcBT1-0008J4-VB@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:00:35 +0000

commit 1892cb922430fcce58161e0f00d64d7cb142eed4
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Thu Mar 19 20:40:24 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
    
    The do_ls() function has somewhat inconsistent handling of errors.
    
    If reading the node's contents with xs_read() fails, then do_ls() will
    just quietly not display the contents.
    
    If reading the node's permissions with xs_get_permissions() fails, then
    do_ls() will print a warning, continue, and ultimately won't exit with
    an error code (unless another error happens).
    
    If recursing into the node with xs_directory() fails, then do_ls() will
    abort immediately, not printing any further nodes.
    
    For persistent failure modes — such as ENOENT because a node has been
    removed, or EACCES because it has had its permisions changed since the
    xs_directory() on the parent directory returned its name — it's
    obviously quite likely that if either of the first two errors occur for
    a given node, then so will the third and thus xenstore-ls will abort.
    
    The ENOENT one is actually a fairly common case, and has caused tools to
    fail to clean up a network device because it *apparently* already
    doesn't exist in xenstore.
    
    There is a school of thought that says, "Well, xenstore-ls returned an
    error. So the tools should not trust its output."
    
    The natural corollary of this would surely be that the tools must re-run
    xenstore-ls as many times as is necessary until its manages to exit
    without hitting the race condition. I am not keen on that conclusion.
    
    For the specific case of ENOENT it seems reasonable to declare that,
    but for the timing, we might as well just not have seen that node at
    all when calling xs_directory() for the parent. By ignoring the error,
    we give acceptable output.
    
    The issue can be reproduced as follows:
    
    (dom0) # for a in `seq 1 1000` ; do
                  xenstore-write /local/domain/2/foo/$a $a ;
             done
    
    Now simultaneously:
    
    (dom0) # for a in `seq 1 999` ; do
                  xenstore-rm /local/domain/2/foo/$a ;
             done
    (dom2) # while true ; do
                  ./xenstore-ls -p /local/domain/2/foo | grep -c 1000 ;
             done
    
    We should expect to see node 1000 in the output, every time.
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit beb105af19cc3e58e2ed49224cfe190a736e5fa0)
---
 tools/xenstore/xenstore_client.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 3afc630ab8..ae7ed3eb9e 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -148,14 +148,20 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms
     int i;
     unsigned int num, len;
 
+    e = xs_directory(h, XBT_NULL, path, &num);
+    if (e == NULL) {
+        if (cur_depth && errno == ENOENT) {
+            /* If a node disappears while recursing, silently move on. */
+            return;
+        }
+
+        err(1, "xs_directory (%s)", path);
+    }
+
     newpath = malloc(STRING_MAX);
     if (!newpath)
       err(1, "malloc in do_ls");
 
-    e = xs_directory(h, XBT_NULL, path, &num);
-    if (e == NULL)
-        err(1, "xs_directory (%s)", path);
-
     for (i = 0; i<num; i++) {
         char buf[MAX_STRLEN(unsigned int)+1];
         struct xs_permissions *perms;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:00:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:00:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22818.49287 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTF-0001XC-6D; Mon, 09 Nov 2020 18:00:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22818.49287; Mon, 09 Nov 2020 18:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTF-0001X5-39; Mon, 09 Nov 2020 18:00:49 +0000
Received: by outflank-mailman (input) for mailman id 22818;
 Mon, 09 Nov 2020 18:00:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBTD-0001Ww-Mz
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:47 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6ed06712-8932-4546-ab4c-5ef89ab26ec6;
 Mon, 09 Nov 2020 18:00:46 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTC-0003Yq-5p
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTC-0008KA-39
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:46 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBTD-0001Ww-Mz
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:47 +0000
X-Inumbo-ID: 6ed06712-8932-4546-ab4c-5ef89ab26ec6
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 6ed06712-8932-4546-ab4c-5ef89ab26ec6;
	Mon, 09 Nov 2020 18:00:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AoufP43ABYKSOlb0QcEtVYa+wc7CYyoOqop/iFt2Smw=; b=UK2RxX0QoHgub1w/TnD6i/kllM
	iZqXEraaK7gTiUmEZImAKBwyu/tgbngT7qhqEBkErKdBhsHHnj61Ug3d+iDmH+Pe9tloJU0SJEvny
	TQcwDdmj3feRyCiiwfVchDEpl++6Gn26X7WmV02HWmLUvugRyVt91tp+Eg8bsVIifg/M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTC-0003Yq-5p
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTC-0008KA-39
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] tools/libs/stat: fix broken build
Message-Id: <E1kcBTC-0008KA-39@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:00:46 +0000

commit c64c15f8d44f889770bc8c1204fd57f7bd598c3c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Sep 12 15:08:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/libs/stat: fix broken build
    
    Making getBridge() static triggered a build error with some gcc versions:
    
    error: 'strncpy' output may be truncated copying 15 bytes from a string of
    length 255 [-Werror=stringop-truncation]
    
    Fix that by using a buffer with 256 bytes instead.
    
    Fixes: 6d0ec053907794 ("tools: split libxenstat into new tools/libs/stat directory")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit c8099e48c3dbb8c7399551a265756ecf354eece2)
---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 7530349eee..0274dc4d07 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -78,7 +78,7 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 				sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
 
 				if (access(tmp, F_OK) == 0) {
-					strncpy(result, de->d_name, resultLen - 1);
+					strncpy(result, de->d_name, resultLen);
 					result[resultLen - 1] = 0;
 				}
 		}
@@ -264,7 +264,7 @@ int xenstat_collect_networks(xenstat_node * node)
 {
 	/* Helper variables for parseNetDevLine() function defined above */
 	int i;
-	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[16] = { 0 }, devNoBridge[17] = { 0 };
+	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[256] = { 0 }, devNoBridge[257] = { 0 };
 	unsigned long long rxBytes, rxPackets, rxErrs, rxDrops, txBytes, txPackets, txErrs, txDrops;
 
 	struct priv_data *priv = get_priv_data(node->handle);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:00:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:00:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22819.49292 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTP-0001Z4-9a; Mon, 09 Nov 2020 18:00:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22819.49292; Mon, 09 Nov 2020 18:00: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTP-0001Yw-6U; Mon, 09 Nov 2020 18:00:59 +0000
Received: by outflank-mailman (input) for mailman id 22819;
 Mon, 09 Nov 2020 18:00:57 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBTN-0001Ym-7A
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:57 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 845c0b22-d34e-4a89-a117-6a63db6582fe;
 Mon, 09 Nov 2020 18:00:56 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTM-0003Z2-9n
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTM-0008Lr-7v
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:56 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBTN-0001Ym-7A
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:57 +0000
X-Inumbo-ID: 845c0b22-d34e-4a89-a117-6a63db6582fe
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 845c0b22-d34e-4a89-a117-6a63db6582fe;
	Mon, 09 Nov 2020 18:00:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iQJK/sRFAJXTVkdpsFj9GzKB3M3Y6XcACVHrKn3jeso=; b=ZRiXqwyxlYy4k9aJzgepkDiKoW
	PuwHbBudOkNE4FGa/DX1qzW6hKSz2CgOagy1kMrbyb4b4uhJ5XQ3TESXmuUwLQJRulJ97SCnGx3CR
	HZEgAq4nLc53ImSYcq2b0HyjGNX8ThF/61RT0+byr+Elkr1X2Zz8uxWsH0VZ2fTdJsSA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTM-0003Z2-9n
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTM-0008Lr-7v
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:00:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] tools/libxc: report malloc errors in writev_exact
Message-Id: <E1kcBTM-0008Lr-7v@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:00:56 +0000

commit e596bf77d8d3c13d5c0db20d97aa1e1846add8a7
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Wed Sep 23 08:48:40 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/libxc: report malloc errors in writev_exact
    
    The caller of writev_exact should be notified about malloc errors
    when dealing with partial writes.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0d8d289af7a679c028462c4ed5d98586f9ef9648)
---
 tools/libxc/xc_private.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 90974d572e..13a2c723c1 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -722,6 +722,7 @@ int writev_exact(int fd, const struct iovec *iov, int iovcnt)
                     if ( !local_iov )
                     {
                         saved_errno = ENOMEM;
+                        rc = -1;
                         goto out;
                     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:01:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:01:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22820.49296 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTZ-0001aF-B7; Mon, 09 Nov 2020 18:01:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22820.49296; Mon, 09 Nov 2020 18:01: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTZ-0001a7-8B; Mon, 09 Nov 2020 18:01:09 +0000
Received: by outflank-mailman (input) for mailman id 22820;
 Mon, 09 Nov 2020 18:01:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBTX-0001Zw-7H
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:07 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 09d0daa6-41c5-4e73-bce8-c077026fe414;
 Mon, 09 Nov 2020 18:01:06 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTW-0003Zm-Cl
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTW-0008NL-Bv
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBTX-0001Zw-7H
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:07 +0000
X-Inumbo-ID: 09d0daa6-41c5-4e73-bce8-c077026fe414
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 09d0daa6-41c5-4e73-bce8-c077026fe414;
	Mon, 09 Nov 2020 18:01:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LzwvaXbMlUUjzb+RlCgE4c/Trwhj/R60+cNRKw6Tye0=; b=C8F57JzQmb6Z0qiOJfXud8Qh7B
	jJPc1tI5TQjV/dVrfK3Hp9w7VdDx7maLdgD/g966D/glV1QU8EKh10iRAs14oZw9HiHMHzMmpvwE2
	5je9N/Je3+Sq6iUUyTziDwKrSRNkciCs+poQWA32RgGDAx4wBx63lEUC1OtOzUD74W5I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTW-0003Zm-Cl
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTW-0008NL-Bv
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] tool/libs/light: Fix libxenlight gcc warning
Message-Id: <E1kcBTW-0008NL-Bv@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:01:06 +0000

commit d204083a01ccf13df9f6e03e423476b9d8a85c85
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:02 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tool/libs/light: Fix libxenlight gcc warning
    
    Fix gcc10 compilation warning about uninitialized variable by setting
    it to 0.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0241809bf838875615797f52af34222e5ab8e98f)
---
 tools/libxl/libxl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c
index 7c01fac7e5..f5ba1e2234 100644
--- a/tools/libxl/libxl_mem.c
+++ b/tools/libxl/libxl_mem.c
@@ -560,7 +560,7 @@ out:
 
 int libxl_get_free_memory_0x040700(libxl_ctx *ctx, uint32_t *memkb)
 {
-    uint64_t my_memkb;
+    uint64_t my_memkb = 0;
     int rc;
 
     rc = libxl_get_free_memory(ctx, &my_memkb);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:01:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:01:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22821.49301 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTi-0001bg-D3; Mon, 09 Nov 2020 18:01:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22821.49301; Mon, 09 Nov 2020 18:01:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTi-0001bT-9e; Mon, 09 Nov 2020 18:01:18 +0000
Received: by outflank-mailman (input) for mailman id 22821;
 Mon, 09 Nov 2020 18:01:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBTh-0001bN-SJ
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:17 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 425826b7-2389-4d39-b50d-a6ecd6d03048;
 Mon, 09 Nov 2020 18:01:16 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTg-0003Zz-GX
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTg-0008O5-Ep
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBTh-0001bN-SJ
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:17 +0000
X-Inumbo-ID: 425826b7-2389-4d39-b50d-a6ecd6d03048
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 425826b7-2389-4d39-b50d-a6ecd6d03048;
	Mon, 09 Nov 2020 18:01:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p22uQOyejiQilK+sO2GyGvrjfQLeAzhJfN1oxePrtJY=; b=Yshd9H0VVDSnik8ayJaF50jH2A
	7dau6jCAXNX9RWQVwcJTi11Lt8yOJt9QAZDddK/7Tvo4cXbjzznMni/LPcEDbjLpb92t+wIiBeHEl
	XD0oAqC0ugrbLaFqH4wtE0KJuJg5pGk/CuhCkKbo77e94viGwqOqoqKZKkZEBDMEZLtI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTg-0003Zz-GX
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTg-0008O5-Ep
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] tools/libs/stat: use memcpy instead of strncpy in getBridge
Message-Id: <E1kcBTg-0008O5-Ep@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:01:16 +0000

commit 43edb26167d0312eed7291d40261acd3e9e7f794
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:01 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/libs/stat: use memcpy instead of strncpy in getBridge
    
    Use memcpy in getBridge to prevent gcc warnings about truncated
    strings. We know that we might truncate it, so the gcc warning
    here is wrong.
    Revert previous change changing buffer sizes as bigger buffers
    are not needed.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 40fe714ca4245a9716264fcb3ee8df42c3650cf6)
---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 0274dc4d07..9c0cb277c5 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <regex.h>
+#include <xen-tools/libs.h>
 
 #include "xenstat_priv.h"
 
@@ -78,8 +79,14 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 				sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
 
 				if (access(tmp, F_OK) == 0) {
-					strncpy(result, de->d_name, resultLen);
-					result[resultLen - 1] = 0;
+					/*
+					 * Do not use strncpy to prevent compiler warning with
+					 * gcc >= 10.0
+					 * If de->d_name is longer then resultLen we truncate it
+					 */
+					memset(result, 0, resultLen);
+					memcpy(result, de->d_name, MIN(strnlen(de->d_name,
+									NAME_MAX),resultLen - 1));
 				}
 		}
 	}
@@ -264,7 +271,7 @@ int xenstat_collect_networks(xenstat_node * node)
 {
 	/* Helper variables for parseNetDevLine() function defined above */
 	int i;
-	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[256] = { 0 }, devNoBridge[257] = { 0 };
+	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[16] = { 0 }, devNoBridge[17] = { 0 };
 	unsigned long long rxBytes, rxPackets, rxErrs, rxDrops, txBytes, txPackets, txErrs, txDrops;
 
 	struct priv_data *priv = get_priv_data(node->handle);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:01:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:01:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22822.49305 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTs-0001cy-EY; Mon, 09 Nov 2020 18:01:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22822.49305; Mon, 09 Nov 2020 18:01:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBTs-0001co-BA; Mon, 09 Nov 2020 18:01:28 +0000
Received: by outflank-mailman (input) for mailman id 22822;
 Mon, 09 Nov 2020 18:01:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBTr-0001ce-Jz
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:27 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1ca03c4c-d940-4493-bedd-ad9ca797667c;
 Mon, 09 Nov 2020 18:01:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTq-0003a9-Ja
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBTq-0008PD-Ic
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBTr-0001ce-Jz
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:27 +0000
X-Inumbo-ID: 1ca03c4c-d940-4493-bedd-ad9ca797667c
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 1ca03c4c-d940-4493-bedd-ad9ca797667c;
	Mon, 09 Nov 2020 18:01:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cL85otdwisaFDXht5yg5B0J8cyMsqGpGJJC0D2c5L10=; b=KSWjr45XKlOX60viOGmSxiKKJr
	QIufzj+fLWp9Nthe9IkaZOdfwAC8+V/08VHs+B2I1IH6Bfdl9y9NqYFjAsNdsGwn68Ks+xSkuXtXk
	ecJ3n+tc1f5GbuNUYuzaw1tjRdlvIHq9ljGhtGYBqCSHs0Evx8pefr1I4qjGsNSRv1hw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTq-0003a9-Ja
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBTq-0008PD-Ic
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] tools/xenstore: mark variable in header as extern
Message-Id: <E1kcBTq-0008PD-Ic@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:01:26 +0000

commit a5756aa6398b5e333ca15583dfd7fdaa21c0f116
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed May 20 17:39:42 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:54:01 2020 +0000

    tools/xenstore: mark variable in header as extern
    
    This patch fix "multiple definition of `xprintf'" (or xgt_handle)
    build error with GCC 10.1.0.
    
    These are the error reported:
        gcc xs_tdb_dump.o utils.o tdb.o talloc.o      -o xs_tdb_dump
        /usr/bin/ld: utils.o:./utils.h:27: multiple definition of `xprintf'; xs_tdb_dump.o:./utils.h:27: first defined here
        [...]
        gcc xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xenstored_control.o xs_lib.o talloc.o utils.o tdb.o hashtable.o xenstored_posix.o      -lsystemd   -Wl,-rpath-link=... ../libxc/libxenctrl.so -lrt  -o xenstored
        /usr/bin/ld: xenstored_watch.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_domain.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_transaction.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_control.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_posix.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
    
    A difference that I noticed with earlier version of the build chain is
    that before, I had:
        $ nm xs_tdb_dump.o | grep xprintf
        0000000000000008 C xprintf
    And now, it's:
        0000000000000000 B xprintf
    With the patch apply, the symbol isn't in xs_tdb_dump.o anymore.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit dacdbf7088d6a3705a9831e73991c2b14c519a65)
---
 tools/xenstore/utils.h          | 2 +-
 tools/xenstore/xenstored_core.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstore/utils.h b/tools/xenstore/utils.h
index 522c3594a2..6a1b5de9bd 100644
--- a/tools/xenstore/utils.h
+++ b/tools/xenstore/utils.h
@@ -24,7 +24,7 @@ static inline bool strends(const char *a, const char *b)
 void barf(const char *fmt, ...) __attribute__((noreturn));
 void barf_perror(const char *fmt, ...) __attribute__((noreturn));
 
-void (*xprintf)(const char *fmt, ...);
+extern void (*xprintf)(const char *fmt, ...);
 
 #define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
 
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 56a279cfbb..c4c32bc88f 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -204,7 +204,7 @@ void finish_daemonize(void);
 /* Open a pipe for signal handling */
 void init_pipe(int reopen_log_pipe[2]);
 
-xengnttab_handle **xgt_handle;
+extern xengnttab_handle **xgt_handle;
 
 int remember_string(struct hashtable *hash, const char *str);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:01:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:01:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22823.49308 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBU2-0001eF-Fr; Mon, 09 Nov 2020 18:01:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22823.49308; Mon, 09 Nov 2020 18:01:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBU2-0001e7-Cj; Mon, 09 Nov 2020 18:01:38 +0000
Received: by outflank-mailman (input) for mailman id 22823;
 Mon, 09 Nov 2020 18:01:37 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBU1-0001dx-Lt
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:37 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 24d31065-3d02-40e7-9bea-1fa007f424fa;
 Mon, 09 Nov 2020 18:01:36 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBU0-0003bn-MR
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBU0-0008QE-Lb
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBU1-0001dx-Lt
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:37 +0000
X-Inumbo-ID: 24d31065-3d02-40e7-9bea-1fa007f424fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 24d31065-3d02-40e7-9bea-1fa007f424fa;
	Mon, 09 Nov 2020 18:01:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JUChJCAG5N8PK1+4LSzg905/fKFQDnoGbiiop/a7Nyg=; b=MAwSrdv057QRJQCKMSZ/0+ev5I
	UrW7KsOZYcxnuAa0/j6sutYE44vsspbztexmcwFftd3ECBaG9U8OUVEynIwTnVjupi1HwnENW5Yvo
	C3lDinwh3cplACCIad7pSayjZpfF3Sx3OphnWWjAGJbrUw5IeJa0m7CJQUEik+p6AC2k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBU0-0003bn-MR
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBU0-0008QE-Lb
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] kdd: stop using [0] arrays to access packet contents
Message-Id: <E1kcBU0-0008QE-Lb@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:01:36 +0000

commit a92f93500e662fac540ce75f72d43856213eb01d
Author:     Tim Deegan <tim@xen.org>
AuthorDate: Fri Jun 26 10:40:44 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:57:07 2020 +0000

    kdd: stop using [0] arrays to access packet contents
    
    GCC 10 is unhappy about this, and we already use 64k buffers
    in the only places where packets are allocated, so move the
    64k size into the packet definition.
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Signed-off-by: Tim Deegan <tim@xen.org>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit 3471cafbdda35eacf04670881dd2aee2558b4f08)
---
 tools/debugger/kdd/kdd.c | 4 ++--
 tools/debugger/kdd/kdd.h | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index fb8c645355..87f18559bf 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,11 +67,11 @@ typedef struct {
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_hdr)];           /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_hdr)];           /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */
diff --git a/tools/debugger/kdd/kdd.h b/tools/debugger/kdd/kdd.h
index bfb00ba5c5..b9a17440df 100644
--- a/tools/debugger/kdd/kdd.h
+++ b/tools/debugger/kdd/kdd.h
@@ -68,7 +68,6 @@ typedef struct {
     uint16_t len;     /* Payload length, excl. header and trailing byte */
     uint32_t id;      /* Echoed in responses */
     uint32_t sum;     /* Unsigned sum of all payload bytes */
-    uint8_t payload[0];
 } PACKED kdd_hdr;
 
 #define KDD_PKT_CMD 0x0002      /* Debugger commands (and replies to them) */
@@ -323,7 +322,7 @@ typedef struct {
         kdd_msg msg;
         kdd_reg reg;
         kdd_stc stc;
-        uint8_t payload[0];
+        uint8_t payload[65536];
     };
 } PACKED kdd_pkt;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:01:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:01:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22824.49312 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBUC-0001fZ-HG; Mon, 09 Nov 2020 18:01:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22824.49312; Mon, 09 Nov 2020 18:01:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBUC-0001fR-EK; Mon, 09 Nov 2020 18:01:48 +0000
Received: by outflank-mailman (input) for mailman id 22824;
 Mon, 09 Nov 2020 18:01:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBUB-0001fM-SH
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:47 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d4660019-5927-454d-b2c6-f8eb1756fd62;
 Mon, 09 Nov 2020 18:01:47 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBUA-0003bx-QS
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBUA-0008RJ-OX
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:46 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBUB-0001fM-SH
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:47 +0000
X-Inumbo-ID: d4660019-5927-454d-b2c6-f8eb1756fd62
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id d4660019-5927-454d-b2c6-f8eb1756fd62;
	Mon, 09 Nov 2020 18:01:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Y675O7t9UTmiJDGum5unaKQXM5/fSvrICSneBrQov0=; b=DmK2XylzdPDNAqEqxGfU4mzPbv
	JWkipIHXnyjL1dP2dq6KUgi37HnYBn0+YbOqSeNvnXpUAVLnpuQ/Bg3gEuMAVjm9e3gAKg+XvsvpZ
	dElLft19pzWmG6aSGIOf2Lc6eFijkZ/XXmZTB3EDLMOLM+Fj5p3nN79P4w45rwNNoGSU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBUA-0003bx-QS
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBUA-0008RJ-OX
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:01:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] kdd: fix build again
Message-Id: <E1kcBUA-0008RJ-OX@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:01:46 +0000

commit 971a9d14667448427ddea1cf15fd7fd409205c58
Author:     Wei Liu <wl@xen.org>
AuthorDate: Fri Jul 3 20:10:01 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:57:10 2020 +0000

    kdd: fix build again
    
    Restore Tim's patch. The one that was committed was recreated by me
    because git didn't accept my saved copy. I made some mistakes while
    recreating that patch and here we are.
    
    Fixes: 3471cafbdda3 ("kdd: stop using [0] arrays to access packet contents")
    Reported-by: Michael Young <m.a.young@durham.ac.uk>
    Signed-off-by: Wei Liu <wl@xen.org>
    Reviewed-by: Tim Deegan <tim@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit d44cbbe0f3243afcc56e47dcfa97bbfe23e46fbb)
---
 tools/debugger/kdd/kdd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index 87f18559bf..30eb4408a7 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,11 +67,11 @@ typedef struct {
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr)];           /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_pkt)];           /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr)];           /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_pkt)];           /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:11:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22835.49329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdD-0002e5-J2; Mon, 09 Nov 2020 18:11:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22835.49329; Mon, 09 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdD-0002dx-FP; Mon, 09 Nov 2020 18:11:07 +0000
Received: by outflank-mailman (input) for mailman id 22835;
 Mon, 09 Nov 2020 18:11:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBdC-0002ds-KY
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:06 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 958d2d3a-a4ee-429a-add8-4e1b26c5353f;
 Mon, 09 Nov 2020 18:11:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdB-0003n7-0W
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdA-00016P-T9
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBdC-0002ds-KY
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:06 +0000
X-Inumbo-ID: 958d2d3a-a4ee-429a-add8-4e1b26c5353f
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 958d2d3a-a4ee-429a-add8-4e1b26c5353f;
	Mon, 09 Nov 2020 18:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7s6fD5Eq7RD/zHUjfzpCiN30ZL0b72A96N1o9GB37Ew=; b=kNQJ3kD0fwjLmY5qa0GaQj4QC+
	F1A9cNb4fa/hMVi/17funp/ZzQrdURWgRw/zZH3qdmSw/EBkxiP5v9OoqDfT5S4Y70XIqzB4iE/xv
	y7i3fJXqOeSEOqKePRWCbjBNF92uQSx/brloBrB6RqLnSnEH/Sq6DXJLgBV6aLKcmDUo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdB-0003n7-0W
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdA-00016P-T9
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] libxl: workaround gcc 10.2 maybe-uninitialized warning
Message-Id: <E1kcBdA-00016P-T9@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:11:04 +0000

commit fd4cc0bc9b362e11c28f8025b94fc548c5ffe2fe
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:35 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:13 2020 +0000

    libxl: workaround gcc 10.2 maybe-uninitialized warning
    
    It seems xlu_pci_parse_bdf has a state machine that is too complex for
    gcc to understand. The build fails with:
    
        libxlu_pci.c: In function 'xlu_pci_parse_bdf':
        libxlu_pci.c:32:18: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           32 |     pcidev->func = func;
              |     ~~~~~~~~~~~~~^~~~~~
        libxlu_pci.c:51:29: note: 'func' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                             ^~~~
        libxlu_pci.c:31:17: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           31 |     pcidev->dev = dev;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:24: note: 'dev' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                        ^~~
        libxlu_pci.c:30:17: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           30 |     pcidev->bus = bus;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:19: note: 'bus' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                   ^~~
        libxlu_pci.c:29:20: error: 'dom' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           29 |     pcidev->domain = domain;
              |     ~~~~~~~~~~~~~~~^~~~~~~~
        libxlu_pci.c:51:14: note: 'dom' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |              ^~~
        cc1: all warnings being treated as errors
    
    Workaround it by setting the initial value to invalid value (0xffffffff)
    and then assert on each value being set. This way we mute the gcc
    warning, while still detecting bugs in the parse code.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit d25cc3ec93ebda030349045d2c7fa14ffde07ed7)
---
 tools/libxl/libxlu_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
index 2cd793d223..e39c2c7250 100644
--- a/tools/libxl/libxlu_pci.c
+++ b/tools/libxl/libxlu_pci.c
@@ -45,10 +45,11 @@ static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
 #define STATE_TYPE      9
 #define STATE_RDM_STRATEGY      10
 #define STATE_RESERVE_POLICY    11
+#define INVALID         0xffffffff
 int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
 {
     unsigned state = STATE_DOMAIN;
-    unsigned dom, bus, dev, func, vslot = 0;
+    unsigned dom = INVALID, bus = INVALID, dev = INVALID, func = INVALID, vslot = 0;
     char *buf2, *tok, *ptr, *end, *optkey = NULL;
 
     if ( NULL == (buf2 = ptr = strdup(str)) )
@@ -170,6 +171,8 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str
     if ( tok != ptr || state != STATE_TERMINAL )
         goto parse_error;
 
+    assert(dom != INVALID && bus != INVALID && dev != INVALID && func != INVALID);
+
     /* Just a pretty way to fill in the values */
     pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:11:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:11:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22836.49331 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdN-0002f9-LR; Mon, 09 Nov 2020 18:11:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22836.49331; Mon, 09 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdN-0002f2-Ih; Mon, 09 Nov 2020 18:11:17 +0000
Received: by outflank-mailman (input) for mailman id 22836;
 Mon, 09 Nov 2020 18:11:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBdM-0002er-6m
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:16 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 427d99e6-e38f-4b54-8ee1-45ba908249d6;
 Mon, 09 Nov 2020 18:11:15 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdL-0003nC-5E
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdL-00017c-2k
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBdM-0002er-6m
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:16 +0000
X-Inumbo-ID: 427d99e6-e38f-4b54-8ee1-45ba908249d6
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 427d99e6-e38f-4b54-8ee1-45ba908249d6;
	Mon, 09 Nov 2020 18:11:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HITkYG3aBOVBo5361D3CcP9HP4z2uB0pFl4mo39+uns=; b=2jvu0s2x6yZA5PGLTwhz0+HUaL
	opKXzUw0TQyR8SWZ0hDbkeWqM92Zp9YK2Hm8VBJ5vXHyKrKK/zyjXyGorGu8GnRUp8fTvMPk/bK0J
	86xPqR8POZW9KqiNtLLDeCLXXXcjtBcC3LA+sYNTeGiD4Da7qah4zhKKS15uQmBsIp5M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdL-0003nC-5E
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdL-00017c-2k
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
Message-Id: <E1kcBdL-00017c-2k@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:11:15 +0000

commit 34056b2b09f6f0b69b13e5d6af355999640ae399
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:13 2020 +0000

    libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
    
    In file included from /usr/include/string.h:495,
                     from libxl_internal.h:38,
                     from libxl_utils.c:20:
    In function 'strncpy',
        inlined from 'libxl__prepare_sockaddr_un' at libxl_utils.c:1262:5:
    /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit fff1b7f50e75ad9535c86f3fcf425b4945c50a1c)
---
 tools/libxl/libxl_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index f360f5e228..b039143b8a 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -1252,14 +1252,14 @@ int libxl__prepare_sockaddr_un(libxl__gc *gc,
                                struct sockaddr_un *un, const char *path,
                                const char *what)
 {
-    if (sizeof(un->sun_path) <= strlen(path)) {
+    if (sizeof(un->sun_path) - 1 <= strlen(path)) {
         LOG(ERROR, "UNIX socket path '%s' is too long for %s", path, what);
-        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path));
+        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path) - 1);
         return ERROR_INVAL;
     }
     memset(un, 0, sizeof(struct sockaddr_un));
     un->sun_family = AF_UNIX;
-    strncpy(un->sun_path, path, sizeof(un->sun_path));
+    strncpy(un->sun_path, path, sizeof(un->sun_path) - 1);
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:11:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:11:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22837.49338 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdX-0002gx-Ob; Mon, 09 Nov 2020 18:11:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22837.49338; Mon, 09 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdX-0002gk-KE; Mon, 09 Nov 2020 18:11:27 +0000
Received: by outflank-mailman (input) for mailman id 22837;
 Mon, 09 Nov 2020 18:11:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBdW-0002gR-39
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:26 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 369f941e-0489-468f-b7c2-3fd962728b9c;
 Mon, 09 Nov 2020 18:11:25 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdV-0003nN-8x
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdV-00018W-7I
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBdW-0002gR-39
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:26 +0000
X-Inumbo-ID: 369f941e-0489-468f-b7c2-3fd962728b9c
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 369f941e-0489-468f-b7c2-3fd962728b9c;
	Mon, 09 Nov 2020 18:11:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V2K4y6zDPd8jk3r/98O+ONCRkhs2gvlBpxMJed25074=; b=p3APWHwSk8PKOWwkeCBL/MrTcS
	Ep5lx6BjpXm4tIH0TMShUzuZeLJKBWC47TkDELxJuhgo84A+EF6svfe1rSwMDQrPVhi4kTeovvGxM
	TVd/+VnX1z1zdeymlq998u67FqhxgYl9jIjOPiYGNUxMvbjgeHen/92TCC199s3xzrOU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdV-0003nN-8x
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdV-00018W-7I
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] tools/xenpmd: Fix gcc10 snprintf warning
Message-Id: <E1kcBdV-00018W-7I@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:11:25 +0000

commit 5e11fd54587133da204efa24e94789f34b3b7bf5
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Oct 15 10:16:09 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:13 2020 +0000

    tools/xenpmd: Fix gcc10 snprintf warning
    
    Add a check for snprintf return code and ignore the entry if we get an
    error. This should in fact never happen and is more a trick to make gcc
    happy and prevent compilation errors.
    
    This is solving the following gcc warning when compiling for arm32 host
    platforms with optimization activated:
    xenpmd.c:92:37: error: '%s' directive output may be truncated writing
    between 4 and 2147483645 bytes into a region of size 271
    [-Werror=format-truncation=]
    
    This is also solving the following Debian bug:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0dfddb2116e3757f77a691a3fe335173088d69dc)
---
 tools/xenpmd/xenpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 1c801caa71..50679efa3f 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
     FILE *file = 0;
     struct dirent *dir_entries;
     char file_name[284];
+    int ret;
     
     do 
     {
@@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
                      dir_entries->d_name);
+        /* This should not happen but is needed to pass gcc checks */
+        if (ret < 0)
+            continue;
+        file_name[sizeof(file_name) - 1] = '\0';
         file = fopen(file_name, "r");
     } while ( !file );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:11:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:11:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22838.49340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdh-0002i7-Ok; Mon, 09 Nov 2020 18:11:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22838.49340; Mon, 09 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdh-0002hz-Lh; Mon, 09 Nov 2020 18:11:37 +0000
Received: by outflank-mailman (input) for mailman id 22838;
 Mon, 09 Nov 2020 18:11:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBdg-0002hq-Bt
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:36 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3e74bab8-ab0f-4338-b320-0dc7db942db1;
 Mon, 09 Nov 2020 18:11:35 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdf-0003oF-Ch
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdf-00019v-B2
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:35 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBdg-0002hq-Bt
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:36 +0000
X-Inumbo-ID: 3e74bab8-ab0f-4338-b320-0dc7db942db1
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 3e74bab8-ab0f-4338-b320-0dc7db942db1;
	Mon, 09 Nov 2020 18:11:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/FgYid2TSpyZD/eseC6vOkAbhuisjGjf3LNQn/3xfI4=; b=PbyOblL0eN3NL7sgNnDe/InuiI
	WFoZgQ+QayAWcjyYHfEUkBiQH4Tmcoi/A6kUBR8sl0lErsJdBYnGZsMlGku12CGm0HZpcJ53o0MKi
	XjIQ/U9vAZG0oTDnogXYCi8hNIGeaTOVTfnjfIYaiNF3wwEqpKHnt5DM/SxoIGNoxZSo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdf-0003oF-Ch
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdf-00019v-B2
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
Message-Id: <E1kcBdf-00019v-B2@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:11:35 +0000

commit 7ae2afbd93ae5f341aac663288b4ed82d1ad8060
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Thu Mar 19 20:40:24 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:13 2020 +0000

    tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
    
    The do_ls() function has somewhat inconsistent handling of errors.
    
    If reading the node's contents with xs_read() fails, then do_ls() will
    just quietly not display the contents.
    
    If reading the node's permissions with xs_get_permissions() fails, then
    do_ls() will print a warning, continue, and ultimately won't exit with
    an error code (unless another error happens).
    
    If recursing into the node with xs_directory() fails, then do_ls() will
    abort immediately, not printing any further nodes.
    
    For persistent failure modes — such as ENOENT because a node has been
    removed, or EACCES because it has had its permisions changed since the
    xs_directory() on the parent directory returned its name — it's
    obviously quite likely that if either of the first two errors occur for
    a given node, then so will the third and thus xenstore-ls will abort.
    
    The ENOENT one is actually a fairly common case, and has caused tools to
    fail to clean up a network device because it *apparently* already
    doesn't exist in xenstore.
    
    There is a school of thought that says, "Well, xenstore-ls returned an
    error. So the tools should not trust its output."
    
    The natural corollary of this would surely be that the tools must re-run
    xenstore-ls as many times as is necessary until its manages to exit
    without hitting the race condition. I am not keen on that conclusion.
    
    For the specific case of ENOENT it seems reasonable to declare that,
    but for the timing, we might as well just not have seen that node at
    all when calling xs_directory() for the parent. By ignoring the error,
    we give acceptable output.
    
    The issue can be reproduced as follows:
    
    (dom0) # for a in `seq 1 1000` ; do
                  xenstore-write /local/domain/2/foo/$a $a ;
             done
    
    Now simultaneously:
    
    (dom0) # for a in `seq 1 999` ; do
                  xenstore-rm /local/domain/2/foo/$a ;
             done
    (dom2) # while true ; do
                  ./xenstore-ls -p /local/domain/2/foo | grep -c 1000 ;
             done
    
    We should expect to see node 1000 in the output, every time.
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit beb105af19cc3e58e2ed49224cfe190a736e5fa0)
---
 tools/xenstore/xenstore_client.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 3afc630ab8..ae7ed3eb9e 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -148,14 +148,20 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms
     int i;
     unsigned int num, len;
 
+    e = xs_directory(h, XBT_NULL, path, &num);
+    if (e == NULL) {
+        if (cur_depth && errno == ENOENT) {
+            /* If a node disappears while recursing, silently move on. */
+            return;
+        }
+
+        err(1, "xs_directory (%s)", path);
+    }
+
     newpath = malloc(STRING_MAX);
     if (!newpath)
       err(1, "malloc in do_ls");
 
-    e = xs_directory(h, XBT_NULL, path, &num);
-    if (e == NULL)
-        err(1, "xs_directory (%s)", path);
-
     for (i = 0; i<num; i++) {
         char buf[MAX_STRLEN(unsigned int)+1];
         struct xs_permissions *perms;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:11:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:11:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22839.49344 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdr-0002jR-QM; Mon, 09 Nov 2020 18:11:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22839.49344; Mon, 09 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBdr-0002jJ-NO; Mon, 09 Nov 2020 18:11:47 +0000
Received: by outflank-mailman (input) for mailman id 22839;
 Mon, 09 Nov 2020 18:11:46 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBdq-0002jB-F5
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:46 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4aaf6dd5-5680-4fa1-8d67-7c0886405be9;
 Mon, 09 Nov 2020 18:11:45 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdp-0003pB-Fz
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdp-0001BJ-En
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBdq-0002jB-F5
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:46 +0000
X-Inumbo-ID: 4aaf6dd5-5680-4fa1-8d67-7c0886405be9
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 4aaf6dd5-5680-4fa1-8d67-7c0886405be9;
	Mon, 09 Nov 2020 18:11:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kAP7WCCeirm8Ot7rRQorGYQPERs6nlp9S/pjWzdNO/Y=; b=qjLmWPfTPsG7lvwqGOTMvLyGYs
	c+k/zoqJvvTKPm/kv8RwaTLmwVa2uxyJxb3L98Do0tV4SZJea441T7VwHFEmAwKOeW8z5HRBOglf3
	MOvNZdvfy5JXLrzWVHdzZ02bZYxZ01ll6KViJbBfT+8V3ND7jaBiSXpLy9ZRQ1znP+rA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdp-0003pB-Fz
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdp-0001BJ-En
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] tools/libxc: report malloc errors in writev_exact
Message-Id: <E1kcBdp-0001BJ-En@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:11:45 +0000

commit 51eca3933aab0655097948e570479b0696be8e1b
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Wed Sep 23 08:48:40 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:18 2020 +0000

    tools/libxc: report malloc errors in writev_exact
    
    The caller of writev_exact should be notified about malloc errors
    when dealing with partial writes.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0d8d289af7a679c028462c4ed5d98586f9ef9648)
---
 tools/libxc/xc_private.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 90974d572e..13a2c723c1 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -722,6 +722,7 @@ int writev_exact(int fd, const struct iovec *iov, int iovcnt)
                     if ( !local_iov )
                     {
                         saved_errno = ENOMEM;
+                        rc = -1;
                         goto out;
                     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:11:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:11:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22840.49348 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBe1-0002lM-Rd; Mon, 09 Nov 2020 18:11:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22840.49348; Mon, 09 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBe1-0002lE-Oq; Mon, 09 Nov 2020 18:11:57 +0000
Received: by outflank-mailman (input) for mailman id 22840;
 Mon, 09 Nov 2020 18:11:56 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBe0-0002l3-9Z
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:56 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ac547f4b-74ce-49a6-8ba2-d3044ac4b269;
 Mon, 09 Nov 2020 18:11:55 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdz-0003pL-Ih
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBdz-0001CR-I2
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBe0-0002l3-9Z
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:56 +0000
X-Inumbo-ID: ac547f4b-74ce-49a6-8ba2-d3044ac4b269
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id ac547f4b-74ce-49a6-8ba2-d3044ac4b269;
	Mon, 09 Nov 2020 18:11:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PZlD/W8TjxHWcXxnh43LVQhr9h+wfi/Isc76Op+OrbQ=; b=Ufk9nXESNALl4b/A57jL/CQc1D
	FvjctGGX70CzOndbo1TYkLwOQJBnJ7t4gbWeqYwivjcoO9r/YJgsT4Y0QvJ3IFZmWsQ8rhgeiE6bz
	KGjZbP1IjVg/1N+t6oXbS60Yomsg6ld2e+z8mLQBd6k8tOXXXpCD1tMN5NVrrUFsbQ0U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdz-0003pL-Ih
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBdz-0001CR-I2
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:11:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] tool/libs/light: Fix libxenlight gcc warning
Message-Id: <E1kcBdz-0001CR-I2@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:11:55 +0000

commit 8e0c2a20633f2e7ffb6026e3f78536df50f884eb
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:02 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:18 2020 +0000

    tool/libs/light: Fix libxenlight gcc warning
    
    Fix gcc10 compilation warning about uninitialized variable by setting
    it to 0.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0241809bf838875615797f52af34222e5ab8e98f)
---
 tools/libxl/libxl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c
index 448a2af8fd..f354e43162 100644
--- a/tools/libxl/libxl_mem.c
+++ b/tools/libxl/libxl_mem.c
@@ -515,7 +515,7 @@ out:
 
 int libxl_get_free_memory_0x040700(libxl_ctx *ctx, uint32_t *memkb)
 {
-    uint64_t my_memkb;
+    uint64_t my_memkb = 0;
     int rc;
 
     rc = libxl_get_free_memory(ctx, &my_memkb);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:12:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:12:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22841.49351 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBeB-0002mb-TV; Mon, 09 Nov 2020 18:12:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22841.49351; Mon, 09 Nov 2020 18:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBeB-0002mT-QN; Mon, 09 Nov 2020 18:12:07 +0000
Received: by outflank-mailman (input) for mailman id 22841;
 Mon, 09 Nov 2020 18:12:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBeA-0002mK-UM
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:06 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 57a95603-f436-40ce-aed1-f4909395fc68;
 Mon, 09 Nov 2020 18:12:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBe9-0003qI-MC
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBe9-0001Dk-Kg
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBeA-0002mK-UM
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:06 +0000
X-Inumbo-ID: 57a95603-f436-40ce-aed1-f4909395fc68
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 57a95603-f436-40ce-aed1-f4909395fc68;
	Mon, 09 Nov 2020 18:12:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FAiVXLk50tmVX9PfZgA5Ve70klV5C2F1+/zDT1xXAfo=; b=fq3Gpd4UYkqLlUFZGrSxVMS7Mf
	oJ3Oo3sXPbN7Q5mtpRW28y8uc56/jm7o/jf5yGAoohUflbI80t9Aw5QcHr5L3XUtRy7SVPGo7kDjE
	tYOGqJjeEfQWckhiA+ko9ZX5Wf6/rJVD+KP1UZQKXMIb61wzsWEI/bMoTM4pMxKjmJz4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBe9-0003qI-MC
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBe9-0001Dk-Kg
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] tools/xenstore: mark variable in header as extern
Message-Id: <E1kcBe9-0001Dk-Kg@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:12:05 +0000

commit 0e6975b980624bfb363c1a687a79997778940510
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed May 20 17:39:42 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:19 2020 +0000

    tools/xenstore: mark variable in header as extern
    
    This patch fix "multiple definition of `xprintf'" (or xgt_handle)
    build error with GCC 10.1.0.
    
    These are the error reported:
        gcc xs_tdb_dump.o utils.o tdb.o talloc.o      -o xs_tdb_dump
        /usr/bin/ld: utils.o:./utils.h:27: multiple definition of `xprintf'; xs_tdb_dump.o:./utils.h:27: first defined here
        [...]
        gcc xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xenstored_control.o xs_lib.o talloc.o utils.o tdb.o hashtable.o xenstored_posix.o      -lsystemd   -Wl,-rpath-link=... ../libxc/libxenctrl.so -lrt  -o xenstored
        /usr/bin/ld: xenstored_watch.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_domain.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_transaction.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_control.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_posix.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
    
    A difference that I noticed with earlier version of the build chain is
    that before, I had:
        $ nm xs_tdb_dump.o | grep xprintf
        0000000000000008 C xprintf
    And now, it's:
        0000000000000000 B xprintf
    With the patch apply, the symbol isn't in xs_tdb_dump.o anymore.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit dacdbf7088d6a3705a9831e73991c2b14c519a65)
---
 tools/xenstore/utils.h          | 2 +-
 tools/xenstore/xenstored_core.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstore/utils.h b/tools/xenstore/utils.h
index dc3a0a0f8b..ca9941706a 100644
--- a/tools/xenstore/utils.h
+++ b/tools/xenstore/utils.h
@@ -24,7 +24,7 @@ static inline bool strends(const char *a, const char *b)
 void barf(const char *fmt, ...) __attribute__((noreturn));
 void barf_perror(const char *fmt, ...) __attribute__((noreturn));
 
-void (*xprintf)(const char *fmt, ...);
+extern void (*xprintf)(const char *fmt, ...);
 
 #define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
 
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 3d27feb91a..2146f35a6f 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -204,7 +204,7 @@ void finish_daemonize(void);
 /* Open a pipe for signal handling */
 void init_pipe(int reopen_log_pipe[2]);
 
-xengnttab_handle **xgt_handle;
+extern xengnttab_handle **xgt_handle;
 
 int remember_string(struct hashtable *hash, const char *str);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:12:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:12:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22842.49355 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBeL-0002ns-V9; Mon, 09 Nov 2020 18:12:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22842.49355; Mon, 09 Nov 2020 18:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBeL-0002nj-Rv; Mon, 09 Nov 2020 18:12:17 +0000
Received: by outflank-mailman (input) for mailman id 22842;
 Mon, 09 Nov 2020 18:12:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBeK-0002na-Qc
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:16 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d4016b1e-dc27-48fc-a3ff-3c0e93695ec8;
 Mon, 09 Nov 2020 18:12:15 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBeJ-0003qQ-P6
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBeJ-0001F8-OM
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBeK-0002na-Qc
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:16 +0000
X-Inumbo-ID: d4016b1e-dc27-48fc-a3ff-3c0e93695ec8
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id d4016b1e-dc27-48fc-a3ff-3c0e93695ec8;
	Mon, 09 Nov 2020 18:12:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+M4d5EdXT4GLIWwX/UyHpyzvprS1QBH+MX//nxzQdjc=; b=L9p33dPfnV+w0iikxWWfjc3Z4L
	ZOPatH67/Zq83vsaaVDQQqBCTaqkXW4Gyk9Fuapf+ho5F/GfrB2ukIoaog0Bj6EhyOYstWaqlF70t
	/Q1T+palZQwyfubw6IFgiwZw6EmTqWBRz3/NVOmpZezAfalugUf2QacQJeaVleJTJg1c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBeJ-0003qQ-P6
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBeJ-0001F8-OM
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] kdd: stop using [0] arrays to access packet contents
Message-Id: <E1kcBeJ-0001F8-OM@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:12:15 +0000

commit eaafa72cf35c0e4e32a48c2bc57a098a8e166aed
Author:     Tim Deegan <tim@xen.org>
AuthorDate: Fri Jun 26 10:40:44 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:19 2020 +0000

    kdd: stop using [0] arrays to access packet contents
    
    GCC 10 is unhappy about this, and we already use 64k buffers
    in the only places where packets are allocated, so move the
    64k size into the packet definition.
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Signed-off-by: Tim Deegan <tim@xen.org>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit 3471cafbdda35eacf04670881dd2aee2558b4f08)
---
 tools/debugger/kdd/kdd.c | 4 ++--
 tools/debugger/kdd/kdd.h | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index fb8c645355..87f18559bf 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,11 +67,11 @@ typedef struct {
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_hdr)];           /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_hdr)];           /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */
diff --git a/tools/debugger/kdd/kdd.h b/tools/debugger/kdd/kdd.h
index bfb00ba5c5..b9a17440df 100644
--- a/tools/debugger/kdd/kdd.h
+++ b/tools/debugger/kdd/kdd.h
@@ -68,7 +68,6 @@ typedef struct {
     uint16_t len;     /* Payload length, excl. header and trailing byte */
     uint32_t id;      /* Echoed in responses */
     uint32_t sum;     /* Unsigned sum of all payload bytes */
-    uint8_t payload[0];
 } PACKED kdd_hdr;
 
 #define KDD_PKT_CMD 0x0002      /* Debugger commands (and replies to them) */
@@ -323,7 +322,7 @@ typedef struct {
         kdd_msg msg;
         kdd_reg reg;
         kdd_stc stc;
-        uint8_t payload[0];
+        uint8_t payload[65536];
     };
 } PACKED kdd_pkt;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Mon Nov 09 18:12:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Nov 2020 18:12:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.22843.49360 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBeW-0002pO-2K; Mon, 09 Nov 2020 18:12:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 22843.49360; Mon, 09 Nov 2020 18:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcBeV-0002pG-VZ; Mon, 09 Nov 2020 18:12:27 +0000
Received: by outflank-mailman (input) for mailman id 22843;
 Mon, 09 Nov 2020 18:12:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcBeU-0002p5-MR
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:26 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 578f55ed-3b99-466a-ab93-ab9122b16196;
 Mon, 09 Nov 2020 18:12:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBeT-0003qZ-S2
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcBeT-0001GS-RD
 for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=Dh2c=EP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcBeU-0002p5-MR
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:26 +0000
X-Inumbo-ID: 578f55ed-3b99-466a-ab93-ab9122b16196
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 578f55ed-3b99-466a-ab93-ab9122b16196;
	Mon, 09 Nov 2020 18:12:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1wERXXkW2EN2cG6lKvpBFeJ0mFTWkfbCxtqhwTPtM6I=; b=snDfi/OTuctOlr1NkZNdWyd+Sv
	/ZoZJkc1S+QshMOSJ7TtYl4DC606Owb/pP6uvFRCBGoDQ3NqPBZRKmVL/qzzMYR3j6xQjwBYTmQQ9
	oHHoWd3/FnYqNXujL3+Uv7+BJBlO//6kCWUOwANbtAlhXFcpBvcfTp+htEUYeFjBP8NY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBeT-0003qZ-S2
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcBeT-0001GS-RD
	for xen-changelog@lists.xenproject.org; Mon, 09 Nov 2020 18:12:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] kdd: fix build again
Message-Id: <E1kcBeT-0001GS-RD@xenbits.xenproject.org>
Date: Mon, 09 Nov 2020 18:12:25 +0000

commit 46ad8841ac4da8fc2a128e49b8406966bf5d3601
Author:     Wei Liu <wl@xen.org>
AuthorDate: Fri Jul 3 20:10:01 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:19 2020 +0000

    kdd: fix build again
    
    Restore Tim's patch. The one that was committed was recreated by me
    because git didn't accept my saved copy. I made some mistakes while
    recreating that patch and here we are.
    
    Fixes: 3471cafbdda3 ("kdd: stop using [0] arrays to access packet contents")
    Reported-by: Michael Young <m.a.young@durham.ac.uk>
    Signed-off-by: Wei Liu <wl@xen.org>
    Reviewed-by: Tim Deegan <tim@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit d44cbbe0f3243afcc56e47dcfa97bbfe23e46fbb)
---
 tools/debugger/kdd/kdd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index 87f18559bf..30eb4408a7 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,11 +67,11 @@ typedef struct {
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr)];           /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_pkt)];           /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr)];           /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_pkt)];           /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:11:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23185.49784 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQcG-0000w1-Jl; Tue, 10 Nov 2020 10:11:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23185.49784; Tue, 10 Nov 2020 10:11:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQcG-0000vr-GT; Tue, 10 Nov 2020 10:11:08 +0000
Received: by outflank-mailman (input) for mailman id 23185;
 Tue, 10 Nov 2020 10:11:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQcF-0000vX-Qp
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:07 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cee57df4-02fd-409a-a1d2-830fe975e36a;
 Tue, 10 Nov 2020 10:11:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcA-0004nR-Tj
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcA-0000qw-RN
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQcF-0000vX-Qp
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:07 +0000
X-Inumbo-ID: cee57df4-02fd-409a-a1d2-830fe975e36a
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id cee57df4-02fd-409a-a1d2-830fe975e36a;
	Tue, 10 Nov 2020 10:11:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ccb1lUA3RynoyV9ukm/tarKjX9flxy4tjgxoHT/lYgY=; b=pKYBA95tO1GuDeXSYS8dNxcmoq
	oZXFaPC62hbhabn5MFykZwyl9Xew7vl40IvvVMMQEHDHyTXFkHgJUpamNPfKrIvglIbW/5lilPgFA
	QiGOygO0e7Bzz/e0n3FjNyGctMi40ws6V15iXquQx0WnqKwXhcrA1CP0rOBpGOPpPdAg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcA-0004nR-Tj
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcA-0000qw-RN
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] libxl: workaround gcc 10.2 maybe-uninitialized warning
Message-Id: <E1kcQcA-0000qw-RN@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:11:02 +0000

commit c0dc42ac0708998424441798eae98907e78e8c57
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:35 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    libxl: workaround gcc 10.2 maybe-uninitialized warning
    
    It seems xlu_pci_parse_bdf has a state machine that is too complex for
    gcc to understand. The build fails with:
    
        libxlu_pci.c: In function 'xlu_pci_parse_bdf':
        libxlu_pci.c:32:18: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           32 |     pcidev->func = func;
              |     ~~~~~~~~~~~~~^~~~~~
        libxlu_pci.c:51:29: note: 'func' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                             ^~~~
        libxlu_pci.c:31:17: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           31 |     pcidev->dev = dev;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:24: note: 'dev' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                        ^~~
        libxlu_pci.c:30:17: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           30 |     pcidev->bus = bus;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:19: note: 'bus' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                   ^~~
        libxlu_pci.c:29:20: error: 'dom' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           29 |     pcidev->domain = domain;
              |     ~~~~~~~~~~~~~~~^~~~~~~~
        libxlu_pci.c:51:14: note: 'dom' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |              ^~~
        cc1: all warnings being treated as errors
    
    Workaround it by setting the initial value to invalid value (0xffffffff)
    and then assert on each value being set. This way we mute the gcc
    warning, while still detecting bugs in the parse code.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit d25cc3ec93ebda030349045d2c7fa14ffde07ed7)
---
 tools/libxl/libxlu_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
index 2cd793d223..e39c2c7250 100644
--- a/tools/libxl/libxlu_pci.c
+++ b/tools/libxl/libxlu_pci.c
@@ -45,10 +45,11 @@ static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
 #define STATE_TYPE      9
 #define STATE_RDM_STRATEGY      10
 #define STATE_RESERVE_POLICY    11
+#define INVALID         0xffffffff
 int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
 {
     unsigned state = STATE_DOMAIN;
-    unsigned dom, bus, dev, func, vslot = 0;
+    unsigned dom = INVALID, bus = INVALID, dev = INVALID, func = INVALID, vslot = 0;
     char *buf2, *tok, *ptr, *end, *optkey = NULL;
 
     if ( NULL == (buf2 = ptr = strdup(str)) )
@@ -170,6 +171,8 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str
     if ( tok != ptr || state != STATE_TERMINAL )
         goto parse_error;
 
+    assert(dom != INVALID && bus != INVALID && dev != INVALID && func != INVALID);
+
     /* Just a pretty way to fill in the values */
     pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:11:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23187.49790 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQcM-0000yf-MV; Tue, 10 Nov 2020 10:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23187.49790; Tue, 10 Nov 2020 10:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQcM-0000yV-Ht; Tue, 10 Nov 2020 10:11:14 +0000
Received: by outflank-mailman (input) for mailman id 23187;
 Tue, 10 Nov 2020 10:11:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQcL-0000xZ-RM
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:13 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bf1cacd4-503b-47b3-8875-afe2bd103732;
 Tue, 10 Nov 2020 10:11:13 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcL-0004nk-1P
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcK-0000rt-Vu
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:12 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQcL-0000xZ-RM
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:13 +0000
X-Inumbo-ID: bf1cacd4-503b-47b3-8875-afe2bd103732
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id bf1cacd4-503b-47b3-8875-afe2bd103732;
	Tue, 10 Nov 2020 10:11:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cCbcy72Bz8TVStslSxdVeAWTeGncnQONGrYAs+7Y9J0=; b=bsspwolV1v5511qOutkMjwSYFj
	hVeNy4dYkpzycJdLqQ2rG2+TM/WzSfJEOTRx0HpkNmXUC+JpH51ElW5NTUU/w7QyaFbS6uKtuUPm8
	QlKpUT7wnZxLyIi+mLjRgbH/bFH0fnKZpkHzDOXKDHoOwDJONI/mshVjGgkn2FC/ZPqs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcL-0004nk-1P
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcK-0000rt-Vu
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
Message-Id: <E1kcQcK-0000rt-Vu@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:11:12 +0000

commit b3b43ac44c57892b829ee3c109cdb829c0440825
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
    
    In file included from /usr/include/string.h:495,
                     from libxl_internal.h:38,
                     from libxl_utils.c:20:
    In function 'strncpy',
        inlined from 'libxl__prepare_sockaddr_un' at libxl_utils.c:1262:5:
    /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit fff1b7f50e75ad9535c86f3fcf425b4945c50a1c)
---
 tools/libxl/libxl_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index f360f5e228..b039143b8a 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -1252,14 +1252,14 @@ int libxl__prepare_sockaddr_un(libxl__gc *gc,
                                struct sockaddr_un *un, const char *path,
                                const char *what)
 {
-    if (sizeof(un->sun_path) <= strlen(path)) {
+    if (sizeof(un->sun_path) - 1 <= strlen(path)) {
         LOG(ERROR, "UNIX socket path '%s' is too long for %s", path, what);
-        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path));
+        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path) - 1);
         return ERROR_INVAL;
     }
     memset(un, 0, sizeof(struct sockaddr_un));
     un->sun_family = AF_UNIX;
-    strncpy(un->sun_path, path, sizeof(un->sun_path));
+    strncpy(un->sun_path, path, sizeof(un->sun_path) - 1);
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:11:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:11:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23191.49793 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQca-00012W-N0; Tue, 10 Nov 2020 10:11:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23191.49793; Tue, 10 Nov 2020 10:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQca-00012M-Jm; Tue, 10 Nov 2020 10:11:28 +0000
Received: by outflank-mailman (input) for mailman id 23191;
 Tue, 10 Nov 2020 10:11:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQcZ-000127-Cf
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:27 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 576078fd-f672-4f29-918f-1ad753d4c0c5;
 Tue, 10 Nov 2020 10:11:23 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcV-0004nr-5G
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcV-0000sy-3U
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQcZ-000127-Cf
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:27 +0000
X-Inumbo-ID: 576078fd-f672-4f29-918f-1ad753d4c0c5
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 576078fd-f672-4f29-918f-1ad753d4c0c5;
	Tue, 10 Nov 2020 10:11:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ir2yEBwglFumYu+xpIzs8pu79Ok+HhcxGPUrO1X7wvI=; b=3VOoqi19ClVvd5IwrIBsT6p8Oa
	++tfoVysRt1+1+6XpP10sNc5HtGp9HMVRkOdyIwbfltC7x/x6FmqSXLSHZ4CxjZeJpqf+OGxbpnmB
	h+RF+YijHxZij0l4gftOUaGTH+T3WpxAjOxyHnoG5FglDja86kwUzCxTGZNl7OSGqAkw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcV-0004nr-5G
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcV-0000sy-3U
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] tools/xenpmd: Fix gcc10 snprintf warning
Message-Id: <E1kcQcV-0000sy-3U@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:11:23 +0000

commit 75c57992911d7b4b3828369f7e45ff67e60ff1ea
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Oct 15 10:16:09 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/xenpmd: Fix gcc10 snprintf warning
    
    Add a check for snprintf return code and ignore the entry if we get an
    error. This should in fact never happen and is more a trick to make gcc
    happy and prevent compilation errors.
    
    This is solving the following gcc warning when compiling for arm32 host
    platforms with optimization activated:
    xenpmd.c:92:37: error: '%s' directive output may be truncated writing
    between 4 and 2147483645 bytes into a region of size 271
    [-Werror=format-truncation=]
    
    This is also solving the following Debian bug:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0dfddb2116e3757f77a691a3fe335173088d69dc)
---
 tools/xenpmd/xenpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 1c801caa71..50679efa3f 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
     FILE *file = 0;
     struct dirent *dir_entries;
     char file_name[284];
+    int ret;
     
     do 
     {
@@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
                      dir_entries->d_name);
+        /* This should not happen but is needed to pass gcc checks */
+        if (ret < 0)
+            continue;
+        file_name[sizeof(file_name) - 1] = '\0';
         file = fopen(file_name, "r");
     } while ( !file );
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:11:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:11:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23193.49796 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQch-00013u-O6; Tue, 10 Nov 2020 10:11:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23193.49796; Tue, 10 Nov 2020 10:11:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQch-00013n-LI; Tue, 10 Nov 2020 10:11:35 +0000
Received: by outflank-mailman (input) for mailman id 23193;
 Tue, 10 Nov 2020 10:11:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQcg-00013Z-5S
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:34 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5a6f61b4-f016-4564-af83-29c1e45b4f03;
 Tue, 10 Nov 2020 10:11:33 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcf-0004oP-8D
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcf-0000tq-7S
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:33 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQcg-00013Z-5S
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:34 +0000
X-Inumbo-ID: 5a6f61b4-f016-4564-af83-29c1e45b4f03
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 5a6f61b4-f016-4564-af83-29c1e45b4f03;
	Tue, 10 Nov 2020 10:11:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MsZq7l6udqlmJxqFhti8G33xr9xJ2R2JGyFYp3CG06M=; b=0s2+0b9UI5BsIrK2WIVwljB7OZ
	LAqSdYjoC4vBPEqeCi33mFVMbeXaFc3bn+sDBqTy+llvUA+JSG/Ua5IYLD/9JJ/gWWqKtpJKQ+4+x
	ZCN0D0aLN1wd/MjYl8DvIwznS+XoxMhkDi/Xs4JPCnM0X9vWTVmUN4liwkQNnpoXtv/U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcf-0004oP-8D
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcf-0000tq-7S
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
Message-Id: <E1kcQcf-0000tq-7S@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:11:33 +0000

commit 1892cb922430fcce58161e0f00d64d7cb142eed4
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Thu Mar 19 20:40:24 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
    
    The do_ls() function has somewhat inconsistent handling of errors.
    
    If reading the node's contents with xs_read() fails, then do_ls() will
    just quietly not display the contents.
    
    If reading the node's permissions with xs_get_permissions() fails, then
    do_ls() will print a warning, continue, and ultimately won't exit with
    an error code (unless another error happens).
    
    If recursing into the node with xs_directory() fails, then do_ls() will
    abort immediately, not printing any further nodes.
    
    For persistent failure modes — such as ENOENT because a node has been
    removed, or EACCES because it has had its permisions changed since the
    xs_directory() on the parent directory returned its name — it's
    obviously quite likely that if either of the first two errors occur for
    a given node, then so will the third and thus xenstore-ls will abort.
    
    The ENOENT one is actually a fairly common case, and has caused tools to
    fail to clean up a network device because it *apparently* already
    doesn't exist in xenstore.
    
    There is a school of thought that says, "Well, xenstore-ls returned an
    error. So the tools should not trust its output."
    
    The natural corollary of this would surely be that the tools must re-run
    xenstore-ls as many times as is necessary until its manages to exit
    without hitting the race condition. I am not keen on that conclusion.
    
    For the specific case of ENOENT it seems reasonable to declare that,
    but for the timing, we might as well just not have seen that node at
    all when calling xs_directory() for the parent. By ignoring the error,
    we give acceptable output.
    
    The issue can be reproduced as follows:
    
    (dom0) # for a in `seq 1 1000` ; do
                  xenstore-write /local/domain/2/foo/$a $a ;
             done
    
    Now simultaneously:
    
    (dom0) # for a in `seq 1 999` ; do
                  xenstore-rm /local/domain/2/foo/$a ;
             done
    (dom2) # while true ; do
                  ./xenstore-ls -p /local/domain/2/foo | grep -c 1000 ;
             done
    
    We should expect to see node 1000 in the output, every time.
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit beb105af19cc3e58e2ed49224cfe190a736e5fa0)
---
 tools/xenstore/xenstore_client.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 3afc630ab8..ae7ed3eb9e 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -148,14 +148,20 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms
     int i;
     unsigned int num, len;
 
+    e = xs_directory(h, XBT_NULL, path, &num);
+    if (e == NULL) {
+        if (cur_depth && errno == ENOENT) {
+            /* If a node disappears while recursing, silently move on. */
+            return;
+        }
+
+        err(1, "xs_directory (%s)", path);
+    }
+
     newpath = malloc(STRING_MAX);
     if (!newpath)
       err(1, "malloc in do_ls");
 
-    e = xs_directory(h, XBT_NULL, path, &num);
-    if (e == NULL)
-        err(1, "xs_directory (%s)", path);
-
     for (i = 0; i<num; i++) {
         char buf[MAX_STRLEN(unsigned int)+1];
         struct xs_permissions *perms;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:11:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:11:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23194.49800 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQcr-00015Y-QB; Tue, 10 Nov 2020 10:11:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23194.49800; Tue, 10 Nov 2020 10:11:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQcr-00015S-N2; Tue, 10 Nov 2020 10:11:45 +0000
Received: by outflank-mailman (input) for mailman id 23194;
 Tue, 10 Nov 2020 10:11:44 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQcq-00015H-3O
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:44 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5e5d8537-179e-4728-8450-79368bd26f5c;
 Tue, 10 Nov 2020 10:11:43 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcp-0004q2-B6
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcp-0000uo-AK
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:43 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQcq-00015H-3O
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:44 +0000
X-Inumbo-ID: 5e5d8537-179e-4728-8450-79368bd26f5c
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 5e5d8537-179e-4728-8450-79368bd26f5c;
	Tue, 10 Nov 2020 10:11:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yj/e6EKRqxhqY+5vd1tPWlkNX08n5UMo8Fb3drPPW84=; b=MyD5AoyuaHsDOMbhx/yIC/MvyE
	s3VPyAF+GhspRXnolS7xRiE4J4kVuyYqx6B3tg5bUBXxOT9/M6K6DNZqt8qjIPh+dvtYH6aGv2+us
	IfjEtxRCfSUVTAMYU+vKrpRsIKFWIJ5HWujLeBkL9siHb0opdO0yAH1ZYm0C2C6XQWPc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcp-0004q2-B6
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcp-0000uo-AK
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] tools/libs/stat: fix broken build
Message-Id: <E1kcQcp-0000uo-AK@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:11:43 +0000

commit c64c15f8d44f889770bc8c1204fd57f7bd598c3c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Sep 12 15:08:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/libs/stat: fix broken build
    
    Making getBridge() static triggered a build error with some gcc versions:
    
    error: 'strncpy' output may be truncated copying 15 bytes from a string of
    length 255 [-Werror=stringop-truncation]
    
    Fix that by using a buffer with 256 bytes instead.
    
    Fixes: 6d0ec053907794 ("tools: split libxenstat into new tools/libs/stat directory")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit c8099e48c3dbb8c7399551a265756ecf354eece2)
---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 7530349eee..0274dc4d07 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -78,7 +78,7 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 				sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
 
 				if (access(tmp, F_OK) == 0) {
-					strncpy(result, de->d_name, resultLen - 1);
+					strncpy(result, de->d_name, resultLen);
 					result[resultLen - 1] = 0;
 				}
 		}
@@ -264,7 +264,7 @@ int xenstat_collect_networks(xenstat_node * node)
 {
 	/* Helper variables for parseNetDevLine() function defined above */
 	int i;
-	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[16] = { 0 }, devNoBridge[17] = { 0 };
+	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[256] = { 0 }, devNoBridge[257] = { 0 };
 	unsigned long long rxBytes, rxPackets, rxErrs, rxDrops, txBytes, txPackets, txErrs, txDrops;
 
 	struct priv_data *priv = get_priv_data(node->handle);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:11:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:11:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23195.49805 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQd1-00017E-Tc; Tue, 10 Nov 2020 10:11:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23195.49805; Tue, 10 Nov 2020 10:11:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQd1-000176-Qd; Tue, 10 Nov 2020 10:11:55 +0000
Received: by outflank-mailman (input) for mailman id 23195;
 Tue, 10 Nov 2020 10:11:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQd0-00016x-Kg
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:54 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9c7806a5-b7da-4673-925e-b9d7b0a8cfdd;
 Tue, 10 Nov 2020 10:11:53 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcz-0004q7-E6
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQcz-0000vV-DM
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:53 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQd0-00016x-Kg
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:54 +0000
X-Inumbo-ID: 9c7806a5-b7da-4673-925e-b9d7b0a8cfdd
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 9c7806a5-b7da-4673-925e-b9d7b0a8cfdd;
	Tue, 10 Nov 2020 10:11:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HUq81MYO9aKbWzpROqNt+gUHzApOqGPSafrh7Xp0+mk=; b=BQNV1z1fUaAWex9QP32wQDDmb3
	ukoybuZCvpNYcmMbjdDPs4PpDeddjnd4zCBKMGxyDzpwlD9GSoZ5v7iASGDG8OsCI4uhtaEvZdksp
	g1O4RkmugTYH/bqV2bSM5ody8hkJvC7Xd4entyVtg32hTcfJ2taqoUYTrjmmofNsrOto=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcz-0004q7-E6
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQcz-0000vV-DM
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:11:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] tools/libxc: report malloc errors in writev_exact
Message-Id: <E1kcQcz-0000vV-DM@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:11:53 +0000

commit e596bf77d8d3c13d5c0db20d97aa1e1846add8a7
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Wed Sep 23 08:48:40 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/libxc: report malloc errors in writev_exact
    
    The caller of writev_exact should be notified about malloc errors
    when dealing with partial writes.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0d8d289af7a679c028462c4ed5d98586f9ef9648)
---
 tools/libxc/xc_private.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 90974d572e..13a2c723c1 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -722,6 +722,7 @@ int writev_exact(int fd, const struct iovec *iov, int iovcnt)
                     if ( !local_iov )
                     {
                         saved_errno = ENOMEM;
+                        rc = -1;
                         goto out;
                     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:12:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:12:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23196.49809 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdB-00018m-VJ; Tue, 10 Nov 2020 10:12:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23196.49809; Tue, 10 Nov 2020 10:12:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdB-00018e-S9; Tue, 10 Nov 2020 10:12:05 +0000
Received: by outflank-mailman (input) for mailman id 23196;
 Tue, 10 Nov 2020 10:12:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQdA-00018O-AH
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 60e53d43-4c58-403d-8879-4e2c8bdcb654;
 Tue, 10 Nov 2020 10:12:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQd9-0004qU-Gz
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQd9-0000wa-GI
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQdA-00018O-AH
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:04 +0000
X-Inumbo-ID: 60e53d43-4c58-403d-8879-4e2c8bdcb654
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 60e53d43-4c58-403d-8879-4e2c8bdcb654;
	Tue, 10 Nov 2020 10:12:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZfThPyZR8uOl081Ix7f2+Sx+qSFo6rBseBlhoky6SoI=; b=sM4wx7KVk27WvmXrGH+iOe1Vpe
	Jvh1aFA70de4l/1YHmnmAyc5EVl/MJ3EjlTyoY7/ATsiK8CQcQ//CklG4ZIkxfDesuEc3WRzA49NY
	zldgVUy7I475K8pEu2j14dCiLker9yWmgSluk4fqtj32GcVS68RrrIadSthyhCyYlbno=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQd9-0004qU-Gz
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQd9-0000wa-GI
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] tool/libs/light: Fix libxenlight gcc warning
Message-Id: <E1kcQd9-0000wa-GI@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:12:03 +0000

commit d204083a01ccf13df9f6e03e423476b9d8a85c85
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:02 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tool/libs/light: Fix libxenlight gcc warning
    
    Fix gcc10 compilation warning about uninitialized variable by setting
    it to 0.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0241809bf838875615797f52af34222e5ab8e98f)
---
 tools/libxl/libxl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c
index 7c01fac7e5..f5ba1e2234 100644
--- a/tools/libxl/libxl_mem.c
+++ b/tools/libxl/libxl_mem.c
@@ -560,7 +560,7 @@ out:
 
 int libxl_get_free_memory_0x040700(libxl_ctx *ctx, uint32_t *memkb)
 {
-    uint64_t my_memkb;
+    uint64_t my_memkb = 0;
     int rc;
 
     rc = libxl_get_free_memory(ctx, &my_memkb);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:12:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:12:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23197.49813 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdM-0001At-0g; Tue, 10 Nov 2020 10:12:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23197.49813; Tue, 10 Nov 2020 10:12:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdL-0001Al-Ti; Tue, 10 Nov 2020 10:12:15 +0000
Received: by outflank-mailman (input) for mailman id 23197;
 Tue, 10 Nov 2020 10:12:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQdK-0001AX-EG
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:14 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2b23eab6-a6ee-46c5-b2d8-d2c5ae8af2e4;
 Tue, 10 Nov 2020 10:12:13 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQdJ-0004qa-Jv
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQdJ-0000xX-J2
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQdK-0001AX-EG
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:14 +0000
X-Inumbo-ID: 2b23eab6-a6ee-46c5-b2d8-d2c5ae8af2e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 2b23eab6-a6ee-46c5-b2d8-d2c5ae8af2e4;
	Tue, 10 Nov 2020 10:12:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ek57yJR/GwQ6v1k+g65tgjy6WuVS2jA2aARd0Z9f0s8=; b=qEZqGmc7jdqIBDPYTQrRc8ueqS
	CfcL83rup6DnqudUBpeht9pI7IsXuj6O+dlqklm7+nFQ79BnAxI/tjjE+ypo3TbvqJPYu58C6rdBK
	HKTB2fTZvjA5IkpbtBZ4J1vxNogSjj2MxvHYznN87ZkN3+6DZuZlSvhrWn/yfKJ1qR5U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQdJ-0004qa-Jv
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQdJ-0000xX-J2
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] tools/libs/stat: use memcpy instead of strncpy in getBridge
Message-Id: <E1kcQdJ-0000xX-J2@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:12:13 +0000

commit 43edb26167d0312eed7291d40261acd3e9e7f794
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:01 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:48:16 2020 +0000

    tools/libs/stat: use memcpy instead of strncpy in getBridge
    
    Use memcpy in getBridge to prevent gcc warnings about truncated
    strings. We know that we might truncate it, so the gcc warning
    here is wrong.
    Revert previous change changing buffer sizes as bigger buffers
    are not needed.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 40fe714ca4245a9716264fcb3ee8df42c3650cf6)
---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 0274dc4d07..9c0cb277c5 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <regex.h>
+#include <xen-tools/libs.h>
 
 #include "xenstat_priv.h"
 
@@ -78,8 +79,14 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 				sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
 
 				if (access(tmp, F_OK) == 0) {
-					strncpy(result, de->d_name, resultLen);
-					result[resultLen - 1] = 0;
+					/*
+					 * Do not use strncpy to prevent compiler warning with
+					 * gcc >= 10.0
+					 * If de->d_name is longer then resultLen we truncate it
+					 */
+					memset(result, 0, resultLen);
+					memcpy(result, de->d_name, MIN(strnlen(de->d_name,
+									NAME_MAX),resultLen - 1));
 				}
 		}
 	}
@@ -264,7 +271,7 @@ int xenstat_collect_networks(xenstat_node * node)
 {
 	/* Helper variables for parseNetDevLine() function defined above */
 	int i;
-	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[256] = { 0 }, devNoBridge[257] = { 0 };
+	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[16] = { 0 }, devNoBridge[17] = { 0 };
 	unsigned long long rxBytes, rxPackets, rxErrs, rxDrops, txBytes, txPackets, txErrs, txDrops;
 
 	struct priv_data *priv = get_priv_data(node->handle);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:12:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:12:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23199.49817 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdW-0001CO-2P; Tue, 10 Nov 2020 10:12:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23199.49817; Tue, 10 Nov 2020 10:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdV-0001CG-Vj; Tue, 10 Nov 2020 10:12:25 +0000
Received: by outflank-mailman (input) for mailman id 23199;
 Tue, 10 Nov 2020 10:12:24 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQdU-0001C4-K6
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:24 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3654971c-86f2-4c6b-9479-f7d5a60d9598;
 Tue, 10 Nov 2020 10:12:23 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQdT-0004qi-Mn
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQdT-0000ya-Lx
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:23 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQdU-0001C4-K6
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:24 +0000
X-Inumbo-ID: 3654971c-86f2-4c6b-9479-f7d5a60d9598
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 3654971c-86f2-4c6b-9479-f7d5a60d9598;
	Tue, 10 Nov 2020 10:12:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8M0VQs0TjCG3jd99ajcd334AV3Q8DDnR+7A2nwIaTI0=; b=K84WHRVJ5QPy/T84Rua0YcVE5j
	V+fd2CjdKVGJ0fsKOw76xMwAxw0IvL6XsbEEfZgJuAY7D3uETJ0YLf1ED9U2vTHOgkfKQ3Pxz4odB
	qQOLWFUVJ9bUrZQuWMiRia/KQhe9T5gvXBcLjx3ek44WoiMxS4UfOF9AOrLGTv4o9nh0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQdT-0004qi-Mn
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQdT-0000ya-Lx
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] tools/xenstore: mark variable in header as extern
Message-Id: <E1kcQdT-0000ya-Lx@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:12:23 +0000

commit a5756aa6398b5e333ca15583dfd7fdaa21c0f116
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed May 20 17:39:42 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:54:01 2020 +0000

    tools/xenstore: mark variable in header as extern
    
    This patch fix "multiple definition of `xprintf'" (or xgt_handle)
    build error with GCC 10.1.0.
    
    These are the error reported:
        gcc xs_tdb_dump.o utils.o tdb.o talloc.o      -o xs_tdb_dump
        /usr/bin/ld: utils.o:./utils.h:27: multiple definition of `xprintf'; xs_tdb_dump.o:./utils.h:27: first defined here
        [...]
        gcc xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xenstored_control.o xs_lib.o talloc.o utils.o tdb.o hashtable.o xenstored_posix.o      -lsystemd   -Wl,-rpath-link=... ../libxc/libxenctrl.so -lrt  -o xenstored
        /usr/bin/ld: xenstored_watch.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_domain.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_transaction.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_control.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_posix.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
    
    A difference that I noticed with earlier version of the build chain is
    that before, I had:
        $ nm xs_tdb_dump.o | grep xprintf
        0000000000000008 C xprintf
    And now, it's:
        0000000000000000 B xprintf
    With the patch apply, the symbol isn't in xs_tdb_dump.o anymore.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit dacdbf7088d6a3705a9831e73991c2b14c519a65)
---
 tools/xenstore/utils.h          | 2 +-
 tools/xenstore/xenstored_core.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstore/utils.h b/tools/xenstore/utils.h
index 522c3594a2..6a1b5de9bd 100644
--- a/tools/xenstore/utils.h
+++ b/tools/xenstore/utils.h
@@ -24,7 +24,7 @@ static inline bool strends(const char *a, const char *b)
 void barf(const char *fmt, ...) __attribute__((noreturn));
 void barf_perror(const char *fmt, ...) __attribute__((noreturn));
 
-void (*xprintf)(const char *fmt, ...);
+extern void (*xprintf)(const char *fmt, ...);
 
 #define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
 
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 56a279cfbb..c4c32bc88f 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -204,7 +204,7 @@ void finish_daemonize(void);
 /* Open a pipe for signal handling */
 void init_pipe(int reopen_log_pipe[2]);
 
-xengnttab_handle **xgt_handle;
+extern xengnttab_handle **xgt_handle;
 
 int remember_string(struct hashtable *hash, const char *str);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:12:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:12:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23200.49822 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdh-0001EB-4T; Tue, 10 Nov 2020 10:12:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23200.49822; Tue, 10 Nov 2020 10:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdh-0001E2-11; Tue, 10 Nov 2020 10:12:37 +0000
Received: by outflank-mailman (input) for mailman id 23200;
 Tue, 10 Nov 2020 10:12:35 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQdf-0001Dl-MB
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:35 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 40b8188a-5304-40df-897a-53743a9325f8;
 Tue, 10 Nov 2020 10:12:34 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQdd-0004rY-QD
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQdd-0000zY-Ox
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:33 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQdf-0001Dl-MB
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:35 +0000
X-Inumbo-ID: 40b8188a-5304-40df-897a-53743a9325f8
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 40b8188a-5304-40df-897a-53743a9325f8;
	Tue, 10 Nov 2020 10:12:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7gdlOZeqS6NbuKxqeMSnPIsR1S0FRfN9TQGhGD6NBu4=; b=Ryvr5Xhb6gzQgAl3SPHxlyIGaz
	4ha24JYlfGjgxm4R8O8ROcsQ98vvFFrm8tFqOiv/thrYcvsYB+EZ2toeHiuasWlOPZDIIpNZHehvx
	rtroeWb2fTJO8wsR29ZCgXWgPnc5N9ZJxCNQkYzfZ4t3jQsXDOc9c+tIPErVjVhg6aKY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQdd-0004rY-QD
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQdd-0000zY-Ox
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] kdd: stop using [0] arrays to access packet contents
Message-Id: <E1kcQdd-0000zY-Ox@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:12:33 +0000

commit a92f93500e662fac540ce75f72d43856213eb01d
Author:     Tim Deegan <tim@xen.org>
AuthorDate: Fri Jun 26 10:40:44 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:57:07 2020 +0000

    kdd: stop using [0] arrays to access packet contents
    
    GCC 10 is unhappy about this, and we already use 64k buffers
    in the only places where packets are allocated, so move the
    64k size into the packet definition.
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Signed-off-by: Tim Deegan <tim@xen.org>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit 3471cafbdda35eacf04670881dd2aee2558b4f08)
---
 tools/debugger/kdd/kdd.c | 4 ++--
 tools/debugger/kdd/kdd.h | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index fb8c645355..87f18559bf 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,11 +67,11 @@ typedef struct {
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_hdr)];           /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_hdr)];           /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */
diff --git a/tools/debugger/kdd/kdd.h b/tools/debugger/kdd/kdd.h
index bfb00ba5c5..b9a17440df 100644
--- a/tools/debugger/kdd/kdd.h
+++ b/tools/debugger/kdd/kdd.h
@@ -68,7 +68,6 @@ typedef struct {
     uint16_t len;     /* Payload length, excl. header and trailing byte */
     uint32_t id;      /* Echoed in responses */
     uint32_t sum;     /* Unsigned sum of all payload bytes */
-    uint8_t payload[0];
 } PACKED kdd_hdr;
 
 #define KDD_PKT_CMD 0x0002      /* Debugger commands (and replies to them) */
@@ -323,7 +322,7 @@ typedef struct {
         kdd_msg msg;
         kdd_reg reg;
         kdd_stc stc;
-        uint8_t payload[0];
+        uint8_t payload[65536];
     };
 } PACKED kdd_pkt;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 10:12:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 10:12:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23202.49824 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdq-0001FS-5O; Tue, 10 Nov 2020 10:12:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23202.49824; Tue, 10 Nov 2020 10:12:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcQdq-0001FK-2T; Tue, 10 Nov 2020 10:12:46 +0000
Received: by outflank-mailman (input) for mailman id 23202;
 Tue, 10 Nov 2020 10:12:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcQdo-0001FA-VC
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:44 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b4b4b35d-e73e-4540-8370-2098e4366110;
 Tue, 10 Nov 2020 10:12:44 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQdn-0004ri-Sx
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcQdn-00010S-SI
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:43 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcQdo-0001FA-VC
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:44 +0000
X-Inumbo-ID: b4b4b35d-e73e-4540-8370-2098e4366110
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id b4b4b35d-e73e-4540-8370-2098e4366110;
	Tue, 10 Nov 2020 10:12:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BfroIWabc595Xc6xr9GOCTuiykRZB4HCd+tx7Pl2osA=; b=ZZOpg+gta8xf+Jebk7up/bk8Cs
	MxtbKJnSyqiCzxY6b4r3rR3HORwA/Hm7eY70rHcfVXyVJ9/FtosN/7QY2a/8PjqXkPL83ww53ZFai
	+5aRP3kxCZHaUNBGhbUI7QbyiH/L+FvN+hK3++JWAgOl//DS8kTsmI7eHQ9cTd0lIt+8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQdn-0004ri-Sx
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcQdn-00010S-SI
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 10:12:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] kdd: fix build again
Message-Id: <E1kcQdn-00010S-SI@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 10:12:43 +0000

commit 971a9d14667448427ddea1cf15fd7fd409205c58
Author:     Wei Liu <wl@xen.org>
AuthorDate: Fri Jul 3 20:10:01 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:57:10 2020 +0000

    kdd: fix build again
    
    Restore Tim's patch. The one that was committed was recreated by me
    because git didn't accept my saved copy. I made some mistakes while
    recreating that patch and here we are.
    
    Fixes: 3471cafbdda3 ("kdd: stop using [0] arrays to access packet contents")
    Reported-by: Michael Young <m.a.young@durham.ac.uk>
    Signed-off-by: Wei Liu <wl@xen.org>
    Reviewed-by: Tim Deegan <tim@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit d44cbbe0f3243afcc56e47dcfa97bbfe23e46fbb)
---
 tools/debugger/kdd/kdd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index 87f18559bf..30eb4408a7 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,11 +67,11 @@ typedef struct {
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr)];           /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_pkt)];           /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr)];           /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_pkt)];           /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 12:11:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 12:11:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23314.49979 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcSUQ-0004FC-0a; Tue, 10 Nov 2020 12:11:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23314.49979; Tue, 10 Nov 2020 12:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcSUP-0004F5-Td; Tue, 10 Nov 2020 12:11:09 +0000
Received: by outflank-mailman (input) for mailman id 23314;
 Tue, 10 Nov 2020 12:11:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcSUP-0004Ez-3V
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 12:11:09 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 903d7763-4f4c-41cf-9d1a-bf837efcb884;
 Tue, 10 Nov 2020 12:11:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcSUL-0007Ji-6Q
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 12:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcSUL-0005Ew-2z
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 12:11:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcSUP-0004Ez-3V
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 12:11:09 +0000
X-Inumbo-ID: 903d7763-4f4c-41cf-9d1a-bf837efcb884
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 903d7763-4f4c-41cf-9d1a-bf837efcb884;
	Tue, 10 Nov 2020 12:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+WiZ61YBWmFQha06O+9mbXnN75YY+ZlFRlUzYl2ah44=; b=wt4oitBnh+tRrmYjr34qoIR9mK
	oF3Xd+5N9Gst9qFJ38YnNIWduK0S8aU437h36WHFMYs4I6JDPsj2DYoIC1Qb3TsMW891jXc1+ADEF
	r/D5Y4lrDTYVr6bF1WEwzvMFuPUeuA83/XJK05aaEzUUAgv5vF88Apyp76wtINN5LQL8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcSUL-0007Ji-6Q
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 12:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcSUL-0005Ew-2z
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 12:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kcSUL-0005Ew-2z@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 12:11:05 +0000

commit 3059178798a23ba870ff86ff54d442a07e6651fc
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 11:20:14 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c             | 34 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 50 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 9c69ef8792..be8e363862 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -242,6 +242,25 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
             goto gp_fault;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_IA32_THERM_STATUS:
         if ( cp->x86_vendor != X86_VENDOR_INTEL )
             goto gp_fault;
@@ -448,6 +467,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             goto gp_fault;
         break;
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 7cc16d6eda..dbceed8a05 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -849,12 +849,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static uint64_t guest_efer(const struct domain *d)
 {
     uint64_t val;
@@ -1121,14 +1115,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index d8ed83f869..ff8d0772b3 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1069,6 +1069,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 int cpupool_move_domain(struct domain *d, struct cpupool *c);
 int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op);
 int cpupool_get_id(const struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:44:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23406.50123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwL-0004fo-PF; Tue, 10 Nov 2020 13:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23406.50123; Tue, 10 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwL-0004ff-Lk; Tue, 10 Nov 2020 13:44:05 +0000
Received: by outflank-mailman (input) for mailman id 23406;
 Tue, 10 Nov 2020 13:44:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTwK-0004fY-HS
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6830b8d4-844c-4660-b855-7a3421b26869;
 Tue, 10 Nov 2020 13:44:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwI-0000oh-Rd
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwI-0000WH-O1
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:02 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTwK-0004fY-HS
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:04 +0000
X-Inumbo-ID: 6830b8d4-844c-4660-b855-7a3421b26869
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 6830b8d4-844c-4660-b855-7a3421b26869;
	Tue, 10 Nov 2020 13:44:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=39KLzml9NMA2EFob7EuCVOSBzHCIJm1YTHsYnWTtdSc=; b=Z6ZbUSBpbkjsfojp2+aozm7/Sf
	0XyciU2wUdcUnQrxbLwj6NMOvf8nVSK0cgJVMRpIzIXvpcTE3HYt3DJZwS28SRShhSDQtW4kStlxZ
	wfSddGFRE7mo6fN/MhGXzsJ4vGmyC+fkMW6nfQgqMrnGnYtMbfMYdZ/2Wv0elGAONNt8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwI-0000oh-Rd
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwI-0000WH-O1
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] libxl: workaround gcc 10.2 maybe-uninitialized warning
Message-Id: <E1kcTwI-0000WH-O1@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:44:02 +0000

commit fd4cc0bc9b362e11c28f8025b94fc548c5ffe2fe
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:35 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:13 2020 +0000

    libxl: workaround gcc 10.2 maybe-uninitialized warning
    
    It seems xlu_pci_parse_bdf has a state machine that is too complex for
    gcc to understand. The build fails with:
    
        libxlu_pci.c: In function 'xlu_pci_parse_bdf':
        libxlu_pci.c:32:18: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           32 |     pcidev->func = func;
              |     ~~~~~~~~~~~~~^~~~~~
        libxlu_pci.c:51:29: note: 'func' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                             ^~~~
        libxlu_pci.c:31:17: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           31 |     pcidev->dev = dev;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:24: note: 'dev' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                        ^~~
        libxlu_pci.c:30:17: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           30 |     pcidev->bus = bus;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:19: note: 'bus' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                   ^~~
        libxlu_pci.c:29:20: error: 'dom' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           29 |     pcidev->domain = domain;
              |     ~~~~~~~~~~~~~~~^~~~~~~~
        libxlu_pci.c:51:14: note: 'dom' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |              ^~~
        cc1: all warnings being treated as errors
    
    Workaround it by setting the initial value to invalid value (0xffffffff)
    and then assert on each value being set. This way we mute the gcc
    warning, while still detecting bugs in the parse code.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit d25cc3ec93ebda030349045d2c7fa14ffde07ed7)
---
 tools/libxl/libxlu_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
index 2cd793d223..e39c2c7250 100644
--- a/tools/libxl/libxlu_pci.c
+++ b/tools/libxl/libxlu_pci.c
@@ -45,10 +45,11 @@ static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
 #define STATE_TYPE      9
 #define STATE_RDM_STRATEGY      10
 #define STATE_RESERVE_POLICY    11
+#define INVALID         0xffffffff
 int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
 {
     unsigned state = STATE_DOMAIN;
-    unsigned dom, bus, dev, func, vslot = 0;
+    unsigned dom = INVALID, bus = INVALID, dev = INVALID, func = INVALID, vslot = 0;
     char *buf2, *tok, *ptr, *end, *optkey = NULL;
 
     if ( NULL == (buf2 = ptr = strdup(str)) )
@@ -170,6 +171,8 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str
     if ( tok != ptr || state != STATE_TERMINAL )
         goto parse_error;
 
+    assert(dom != INVALID && bus != INVALID && dev != INVALID && func != INVALID);
+
     /* Just a pretty way to fill in the values */
     pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:44:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23407.50127 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwV-0004gs-QS; Tue, 10 Nov 2020 13:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23407.50127; Tue, 10 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwV-0004gj-NG; Tue, 10 Nov 2020 13:44:15 +0000
Received: by outflank-mailman (input) for mailman id 23407;
 Tue, 10 Nov 2020 13:44:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTwT-0004gY-Tj
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:13 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e204e9bf-af02-499a-87af-6ba5184ee723;
 Tue, 10 Nov 2020 13:44:13 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwT-0000ok-0b
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwS-0000ZT-Tv
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:12 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTwT-0004gY-Tj
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:13 +0000
X-Inumbo-ID: e204e9bf-af02-499a-87af-6ba5184ee723
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id e204e9bf-af02-499a-87af-6ba5184ee723;
	Tue, 10 Nov 2020 13:44:13 +0000 (UTC)
DKIM-Signature: v=1; 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/eKlUrKrEec3gW6O8tPbIyZ6d2rpPur7I0KeBmnXck=; b=zkVchZxnJh96MBVJ/HrP8CaFiM
	8J5XvwmKb2IDOkem+N1/W2rvOgdZLdaqF59aJXbEzhVg+ec0FUkW1ZCwiYaKG31oYwRX2TEWI8c6L
	FwKSNIakF7s8UFJlc/XbpAUsVQkvsZO8hEtEz4uD8qEnZz1ry+ovGA8kT8VMQgC/SQKI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwT-0000ok-0b
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwS-0000ZT-Tv
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
Message-Id: <E1kcTwS-0000ZT-Tv@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:44:12 +0000

commit 34056b2b09f6f0b69b13e5d6af355999640ae399
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:13 2020 +0000

    libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
    
    In file included from /usr/include/string.h:495,
                     from libxl_internal.h:38,
                     from libxl_utils.c:20:
    In function 'strncpy',
        inlined from 'libxl__prepare_sockaddr_un' at libxl_utils.c:1262:5:
    /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit fff1b7f50e75ad9535c86f3fcf425b4945c50a1c)
---
 tools/libxl/libxl_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index f360f5e228..b039143b8a 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -1252,14 +1252,14 @@ int libxl__prepare_sockaddr_un(libxl__gc *gc,
                                struct sockaddr_un *un, const char *path,
                                const char *what)
 {
-    if (sizeof(un->sun_path) <= strlen(path)) {
+    if (sizeof(un->sun_path) - 1 <= strlen(path)) {
         LOG(ERROR, "UNIX socket path '%s' is too long for %s", path, what);
-        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path));
+        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path) - 1);
         return ERROR_INVAL;
     }
     memset(un, 0, sizeof(struct sockaddr_un));
     un->sun_family = AF_UNIX;
-    strncpy(un->sun_path, path, sizeof(un->sun_path));
+    strncpy(un->sun_path, path, sizeof(un->sun_path) - 1);
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:44:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23408.50129 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwf-0004j2-Rf; Tue, 10 Nov 2020 13:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23408.50129; Tue, 10 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwf-0004iu-Om; Tue, 10 Nov 2020 13:44:25 +0000
Received: by outflank-mailman (input) for mailman id 23408;
 Tue, 10 Nov 2020 13:44:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTwd-0004ia-Ty
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:23 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bd474766-ea98-498e-b0fa-9580493b4729;
 Tue, 10 Nov 2020 13:44:23 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwd-0000ov-3e
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwd-0000b3-2k
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTwd-0004ia-Ty
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:23 +0000
X-Inumbo-ID: bd474766-ea98-498e-b0fa-9580493b4729
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id bd474766-ea98-498e-b0fa-9580493b4729;
	Tue, 10 Nov 2020 13:44:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MxLFJOH8Gg7wSKYKtGMg08E1kwLLK4+qoHb7nEkARWw=; b=yvMUJWDDO/8fpcrdDtevAzJHYs
	pcIC0xVDGlbE+FbJXbNXXU9A+vlQPyH25jCyNDLOLk2hep0tfXFdkuNkwdQxJJJxptW8ZXUt8JywX
	ravnOiDoRXdWXNmMktuo0sGGKReGeGIMqK+t5GHKFyItYLVaGJgBG6wpNq0NH2FthDmQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwd-0000ov-3e
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwd-0000b3-2k
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/xenpmd: Fix gcc10 snprintf warning
Message-Id: <E1kcTwd-0000b3-2k@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:44:23 +0000

commit 5e11fd54587133da204efa24e94789f34b3b7bf5
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Oct 15 10:16:09 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:13 2020 +0000

    tools/xenpmd: Fix gcc10 snprintf warning
    
    Add a check for snprintf return code and ignore the entry if we get an
    error. This should in fact never happen and is more a trick to make gcc
    happy and prevent compilation errors.
    
    This is solving the following gcc warning when compiling for arm32 host
    platforms with optimization activated:
    xenpmd.c:92:37: error: '%s' directive output may be truncated writing
    between 4 and 2147483645 bytes into a region of size 271
    [-Werror=format-truncation=]
    
    This is also solving the following Debian bug:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0dfddb2116e3757f77a691a3fe335173088d69dc)
---
 tools/xenpmd/xenpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 1c801caa71..50679efa3f 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
     FILE *file = 0;
     struct dirent *dir_entries;
     char file_name[284];
+    int ret;
     
     do 
     {
@@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
                      dir_entries->d_name);
+        /* This should not happen but is needed to pass gcc checks */
+        if (ret < 0)
+            continue;
+        file_name[sizeof(file_name) - 1] = '\0';
         file = fopen(file_name, "r");
     } while ( !file );
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:44:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:44:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23409.50135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwp-0004kI-Ul; Tue, 10 Nov 2020 13:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23409.50135; Tue, 10 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwp-0004kA-QO; Tue, 10 Nov 2020 13:44:35 +0000
Received: by outflank-mailman (input) for mailman id 23409;
 Tue, 10 Nov 2020 13:44:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTwo-0004jx-6j
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:34 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f1b93431-24a6-41f0-affb-8ac867277483;
 Tue, 10 Nov 2020 13:44:33 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwn-0000p3-8N
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwn-0000cn-5o
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:33 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTwo-0004jx-6j
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:34 +0000
X-Inumbo-ID: f1b93431-24a6-41f0-affb-8ac867277483
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id f1b93431-24a6-41f0-affb-8ac867277483;
	Tue, 10 Nov 2020 13:44:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NcsEWwIIjn5VWX8SpviZDcxN5PaRl7r/g4SVSMqTF+A=; b=29YmteqJST3uS6hMhQgMGe9DzI
	k/FQD380A9WumH8kkHt8t3NIAbto54JF0weptr9iptbck1mFcoDL/6Pks7aNyZ5gEoQC9wKPWRJB+
	VMms1FrMlmhD6dPSw9/XUylTIEepNA3ybiMmT9uPvIYRmjPr/9nWvOGXbwVWgZNdqeFg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwn-0000p3-8N
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwn-0000cn-5o
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
Message-Id: <E1kcTwn-0000cn-5o@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:44:33 +0000

commit 7ae2afbd93ae5f341aac663288b4ed82d1ad8060
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Thu Mar 19 20:40:24 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:13 2020 +0000

    tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
    
    The do_ls() function has somewhat inconsistent handling of errors.
    
    If reading the node's contents with xs_read() fails, then do_ls() will
    just quietly not display the contents.
    
    If reading the node's permissions with xs_get_permissions() fails, then
    do_ls() will print a warning, continue, and ultimately won't exit with
    an error code (unless another error happens).
    
    If recursing into the node with xs_directory() fails, then do_ls() will
    abort immediately, not printing any further nodes.
    
    For persistent failure modes — such as ENOENT because a node has been
    removed, or EACCES because it has had its permisions changed since the
    xs_directory() on the parent directory returned its name — it's
    obviously quite likely that if either of the first two errors occur for
    a given node, then so will the third and thus xenstore-ls will abort.
    
    The ENOENT one is actually a fairly common case, and has caused tools to
    fail to clean up a network device because it *apparently* already
    doesn't exist in xenstore.
    
    There is a school of thought that says, "Well, xenstore-ls returned an
    error. So the tools should not trust its output."
    
    The natural corollary of this would surely be that the tools must re-run
    xenstore-ls as many times as is necessary until its manages to exit
    without hitting the race condition. I am not keen on that conclusion.
    
    For the specific case of ENOENT it seems reasonable to declare that,
    but for the timing, we might as well just not have seen that node at
    all when calling xs_directory() for the parent. By ignoring the error,
    we give acceptable output.
    
    The issue can be reproduced as follows:
    
    (dom0) # for a in `seq 1 1000` ; do
                  xenstore-write /local/domain/2/foo/$a $a ;
             done
    
    Now simultaneously:
    
    (dom0) # for a in `seq 1 999` ; do
                  xenstore-rm /local/domain/2/foo/$a ;
             done
    (dom2) # while true ; do
                  ./xenstore-ls -p /local/domain/2/foo | grep -c 1000 ;
             done
    
    We should expect to see node 1000 in the output, every time.
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit beb105af19cc3e58e2ed49224cfe190a736e5fa0)
---
 tools/xenstore/xenstore_client.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 3afc630ab8..ae7ed3eb9e 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -148,14 +148,20 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms
     int i;
     unsigned int num, len;
 
+    e = xs_directory(h, XBT_NULL, path, &num);
+    if (e == NULL) {
+        if (cur_depth && errno == ENOENT) {
+            /* If a node disappears while recursing, silently move on. */
+            return;
+        }
+
+        err(1, "xs_directory (%s)", path);
+    }
+
     newpath = malloc(STRING_MAX);
     if (!newpath)
       err(1, "malloc in do_ls");
 
-    e = xs_directory(h, XBT_NULL, path, &num);
-    if (e == NULL)
-        err(1, "xs_directory (%s)", path);
-
     for (i = 0; i<num; i++) {
         char buf[MAX_STRLEN(unsigned int)+1];
         struct xs_permissions *perms;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:44:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23410.50138 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTx0-0004lr-0d; Tue, 10 Nov 2020 13:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23410.50138; Tue, 10 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTwz-0004lg-Tq; Tue, 10 Nov 2020 13:44:45 +0000
Received: by outflank-mailman (input) for mailman id 23410;
 Tue, 10 Nov 2020 13:44:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTwy-0004lT-4X
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:44 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 206acd82-6d70-4b57-bab9-9f08b0583661;
 Tue, 10 Nov 2020 13:44:43 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwx-0000po-BH
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTwx-0000eP-AV
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:43 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTwy-0004lT-4X
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:44 +0000
X-Inumbo-ID: 206acd82-6d70-4b57-bab9-9f08b0583661
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 206acd82-6d70-4b57-bab9-9f08b0583661;
	Tue, 10 Nov 2020 13:44:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SCOACxchWJVqid1UWVaXMf3r1UJULo7dkEiRNDtMYLk=; b=E/iaqWuu1l9QnpbTjtvYZmXx4t
	tN4EpZZ2SjMbcKrPtRUkEjSLL/FTZvlKulE/eMfpIboarmadEEeP1uw1hEnW30278BnWmtpMgJMOi
	Eu9VYkszCK/Sowrj8OGZmPMeOdROFqqm4YigYuaFTFfRIKaVIF3iKBZw2dEh8foLn6zs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwx-0000po-BH
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTwx-0000eP-AV
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/libxc: report malloc errors in writev_exact
Message-Id: <E1kcTwx-0000eP-AV@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:44:43 +0000

commit 51eca3933aab0655097948e570479b0696be8e1b
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Wed Sep 23 08:48:40 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:18 2020 +0000

    tools/libxc: report malloc errors in writev_exact
    
    The caller of writev_exact should be notified about malloc errors
    when dealing with partial writes.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0d8d289af7a679c028462c4ed5d98586f9ef9648)
---
 tools/libxc/xc_private.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 90974d572e..13a2c723c1 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -722,6 +722,7 @@ int writev_exact(int fd, const struct iovec *iov, int iovcnt)
                     if ( !local_iov )
                     {
                         saved_errno = ENOMEM;
+                        rc = -1;
                         goto out;
                     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:44:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:44:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23412.50142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTx9-0004n4-2b; Tue, 10 Nov 2020 13:44:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23412.50142; Tue, 10 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTx8-0004mw-VI; Tue, 10 Nov 2020 13:44:54 +0000
Received: by outflank-mailman (input) for mailman id 23412;
 Tue, 10 Nov 2020 13:44:54 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTx8-0004mm-6s
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:54 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id be85b2c9-593f-44e3-8778-73ef50a0071f;
 Tue, 10 Nov 2020 13:44:53 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTx7-0000px-EK
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTx7-0000gL-DQ
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:53 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTx8-0004mm-6s
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:54 +0000
X-Inumbo-ID: be85b2c9-593f-44e3-8778-73ef50a0071f
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id be85b2c9-593f-44e3-8778-73ef50a0071f;
	Tue, 10 Nov 2020 13:44:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ISC/n9sYu3ySs8P7dby3okakd22i5Nv3Mdd92gzvt5o=; b=YwuFtb62AzdPV/mzOs+E8xLuOS
	AtVnM+dO3FOL9fma1UpjySXy1iLsoP3/EP6bzJbIlrmjH0GJ25WewKNzOE50B8FL+D2hSxtVJRCSc
	4F1Bbw2+pSvYUCqpPVjsY1RRHlmXKiD0B91DC4z20bCrP2Xvmu4FQWgjtWXNqg2oUOfQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTx7-0000px-EK
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTx7-0000gL-DQ
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:44:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tool/libs/light: Fix libxenlight gcc warning
Message-Id: <E1kcTx7-0000gL-DQ@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:44:53 +0000

commit 8e0c2a20633f2e7ffb6026e3f78536df50f884eb
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:02 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:18 2020 +0000

    tool/libs/light: Fix libxenlight gcc warning
    
    Fix gcc10 compilation warning about uninitialized variable by setting
    it to 0.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0241809bf838875615797f52af34222e5ab8e98f)
---
 tools/libxl/libxl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c
index 448a2af8fd..f354e43162 100644
--- a/tools/libxl/libxl_mem.c
+++ b/tools/libxl/libxl_mem.c
@@ -515,7 +515,7 @@ out:
 
 int libxl_get_free_memory_0x040700(libxl_ctx *ctx, uint32_t *memkb)
 {
-    uint64_t my_memkb;
+    uint64_t my_memkb = 0;
     int rc;
 
     rc = libxl_get_free_memory(ctx, &my_memkb);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:45:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:45:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23414.50146 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTxJ-0004o9-3a; Tue, 10 Nov 2020 13:45:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23414.50146; Tue, 10 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTxJ-0004o1-0f; Tue, 10 Nov 2020 13:45:05 +0000
Received: by outflank-mailman (input) for mailman id 23414;
 Tue, 10 Nov 2020 13:45:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTxI-0004nw-GV
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:04 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 38502ab7-8c5b-4a79-a40c-92ab2116b49d;
 Tue, 10 Nov 2020 13:45:03 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxH-0000qf-H5
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxH-0000iG-GP
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTxI-0004nw-GV
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:04 +0000
X-Inumbo-ID: 38502ab7-8c5b-4a79-a40c-92ab2116b49d
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 38502ab7-8c5b-4a79-a40c-92ab2116b49d;
	Tue, 10 Nov 2020 13:45:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6xYCMu2gkjtcddVqLiZx5zZ//ckq9xSJL/AKAclBKnY=; b=GuGhScKpWbFtUqR1yrB4h7NMjZ
	0ZwFec2/pYn8XKjGFUluckeJQ7BNl65M4y5pxq3goNXNShT4bk8bRElxq1dSY57U+0hBG6VE7Ztt6
	nyAGYbj15fecTGDTwP12BNgKobnJ1BfA6EgpB+SF4ruXAoHZG8M8GkinhSJBWAdK91Ls=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxH-0000qf-H5
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxH-0000iG-GP
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] tools/xenstore: mark variable in header as extern
Message-Id: <E1kcTxH-0000iG-GP@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:45:03 +0000

commit 0e6975b980624bfb363c1a687a79997778940510
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed May 20 17:39:42 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:19 2020 +0000

    tools/xenstore: mark variable in header as extern
    
    This patch fix "multiple definition of `xprintf'" (or xgt_handle)
    build error with GCC 10.1.0.
    
    These are the error reported:
        gcc xs_tdb_dump.o utils.o tdb.o talloc.o      -o xs_tdb_dump
        /usr/bin/ld: utils.o:./utils.h:27: multiple definition of `xprintf'; xs_tdb_dump.o:./utils.h:27: first defined here
        [...]
        gcc xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xenstored_control.o xs_lib.o talloc.o utils.o tdb.o hashtable.o xenstored_posix.o      -lsystemd   -Wl,-rpath-link=... ../libxc/libxenctrl.so -lrt  -o xenstored
        /usr/bin/ld: xenstored_watch.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_domain.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_transaction.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_control.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
        /usr/bin/ld: xenstored_posix.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
    
    A difference that I noticed with earlier version of the build chain is
    that before, I had:
        $ nm xs_tdb_dump.o | grep xprintf
        0000000000000008 C xprintf
    And now, it's:
        0000000000000000 B xprintf
    With the patch apply, the symbol isn't in xs_tdb_dump.o anymore.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit dacdbf7088d6a3705a9831e73991c2b14c519a65)
---
 tools/xenstore/utils.h          | 2 +-
 tools/xenstore/xenstored_core.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstore/utils.h b/tools/xenstore/utils.h
index dc3a0a0f8b..ca9941706a 100644
--- a/tools/xenstore/utils.h
+++ b/tools/xenstore/utils.h
@@ -24,7 +24,7 @@ static inline bool strends(const char *a, const char *b)
 void barf(const char *fmt, ...) __attribute__((noreturn));
 void barf_perror(const char *fmt, ...) __attribute__((noreturn));
 
-void (*xprintf)(const char *fmt, ...);
+extern void (*xprintf)(const char *fmt, ...);
 
 #define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
 
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 3d27feb91a..2146f35a6f 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -204,7 +204,7 @@ void finish_daemonize(void);
 /* Open a pipe for signal handling */
 void init_pipe(int reopen_log_pipe[2]);
 
-xengnttab_handle **xgt_handle;
+extern xengnttab_handle **xgt_handle;
 
 int remember_string(struct hashtable *hash, const char *str);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:45:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:45:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23415.50150 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTxT-0004pH-5o; Tue, 10 Nov 2020 13:45:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23415.50150; Tue, 10 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTxT-0004p9-2T; Tue, 10 Nov 2020 13:45:15 +0000
Received: by outflank-mailman (input) for mailman id 23415;
 Tue, 10 Nov 2020 13:45:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTxS-0004p2-8F
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:14 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 03496512-1204-4c00-818f-4fd1eb97e542;
 Tue, 10 Nov 2020 13:45:13 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxR-0000qk-KC
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxR-0000ju-JJ
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:13 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTxS-0004p2-8F
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:14 +0000
X-Inumbo-ID: 03496512-1204-4c00-818f-4fd1eb97e542
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 03496512-1204-4c00-818f-4fd1eb97e542;
	Tue, 10 Nov 2020 13:45:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LEK0oDxelCL4LNH3Kq4Qw0lYjrq/Smz/6ar+7AXzimI=; b=eDaAGnH8g0mccyVDslowCapdw5
	9lPPFAz2nTQKbZxplKzENyS1gf8XiKTdyBeMPnBNHWFxQfZFlLKdDVM5JdZ6K4tAbSFbCZxme6TJO
	B3Fttnie33Uyd1s2rYarLrdJpi1UdRyWXhvxx5ER9UKXaIF02YyG+O41ChpjUNIZn18w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxR-0000qk-KC
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxR-0000ju-JJ
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] kdd: stop using [0] arrays to access packet contents
Message-Id: <E1kcTxR-0000ju-JJ@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:45:13 +0000

commit eaafa72cf35c0e4e32a48c2bc57a098a8e166aed
Author:     Tim Deegan <tim@xen.org>
AuthorDate: Fri Jun 26 10:40:44 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:19 2020 +0000

    kdd: stop using [0] arrays to access packet contents
    
    GCC 10 is unhappy about this, and we already use 64k buffers
    in the only places where packets are allocated, so move the
    64k size into the packet definition.
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Signed-off-by: Tim Deegan <tim@xen.org>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit 3471cafbdda35eacf04670881dd2aee2558b4f08)
---
 tools/debugger/kdd/kdd.c | 4 ++--
 tools/debugger/kdd/kdd.h | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index fb8c645355..87f18559bf 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,11 +67,11 @@ typedef struct {
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_hdr)];           /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_hdr)];           /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */
diff --git a/tools/debugger/kdd/kdd.h b/tools/debugger/kdd/kdd.h
index bfb00ba5c5..b9a17440df 100644
--- a/tools/debugger/kdd/kdd.h
+++ b/tools/debugger/kdd/kdd.h
@@ -68,7 +68,6 @@ typedef struct {
     uint16_t len;     /* Payload length, excl. header and trailing byte */
     uint32_t id;      /* Echoed in responses */
     uint32_t sum;     /* Unsigned sum of all payload bytes */
-    uint8_t payload[0];
 } PACKED kdd_hdr;
 
 #define KDD_PKT_CMD 0x0002      /* Debugger commands (and replies to them) */
@@ -323,7 +322,7 @@ typedef struct {
         kdd_msg msg;
         kdd_reg reg;
         kdd_stc stc;
-        uint8_t payload[0];
+        uint8_t payload[65536];
     };
 } PACKED kdd_pkt;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:45:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:45:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23416.50155 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTxd-0004qo-7Y; Tue, 10 Nov 2020 13:45:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23416.50155; Tue, 10 Nov 2020 13:45: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTxd-0004qg-4E; Tue, 10 Nov 2020 13:45:25 +0000
Received: by outflank-mailman (input) for mailman id 23416;
 Tue, 10 Nov 2020 13:45:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTxc-0004qb-Bt
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:24 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 111c8ddf-b74a-4ce6-9486-d1f5cb6dc081;
 Tue, 10 Nov 2020 13:45:23 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxb-0000qs-N4
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxb-0000m2-MK
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTxc-0004qb-Bt
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:24 +0000
X-Inumbo-ID: 111c8ddf-b74a-4ce6-9486-d1f5cb6dc081
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 111c8ddf-b74a-4ce6-9486-d1f5cb6dc081;
	Tue, 10 Nov 2020 13:45:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7TusegZ6wrZVpFiaJpE24qbHZxaHQwxY8mFGqe8HwFg=; b=MWRVYr8FXryrXFb5MphHcSlPYl
	GogkW0V47Th+JvgF9zz2FC3Phe+L+A2JoWYpGdIAPaQXU2zXeukQQO15ndAmNVOiamMxVhoYlNe13
	dLBJthKEzpW4tJ9aaNt7Ny/OrRAxeuDS+91BQXjXOcroczCkk7gF9sSiOfuacdF1grZA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxb-0000qs-N4
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxb-0000m2-MK
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] kdd: fix build again
Message-Id: <E1kcTxb-0000m2-MK@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:45:23 +0000

commit 46ad8841ac4da8fc2a128e49b8406966bf5d3601
Author:     Wei Liu <wl@xen.org>
AuthorDate: Fri Jul 3 20:10:01 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:58:19 2020 +0000

    kdd: fix build again
    
    Restore Tim's patch. The one that was committed was recreated by me
    because git didn't accept my saved copy. I made some mistakes while
    recreating that patch and here we are.
    
    Fixes: 3471cafbdda3 ("kdd: stop using [0] arrays to access packet contents")
    Reported-by: Michael Young <m.a.young@durham.ac.uk>
    Signed-off-by: Wei Liu <wl@xen.org>
    Reviewed-by: Tim Deegan <tim@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit d44cbbe0f3243afcc56e47dcfa97bbfe23e46fbb)
---
 tools/debugger/kdd/kdd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index 87f18559bf..30eb4408a7 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,11 +67,11 @@ typedef struct {
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr)];           /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_pkt)];           /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr)];           /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_pkt)];           /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:45:40 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:45:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23417.50160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTxs-0004sF-AN; Tue, 10 Nov 2020 13:45:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23417.50160; Tue, 10 Nov 2020 13:45: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTxs-0004s5-61; Tue, 10 Nov 2020 13:45:40 +0000
Received: by outflank-mailman (input) for mailman id 23417;
 Tue, 10 Nov 2020 13:45:39 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTxq-0004rz-UA
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:38 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d31e470d-dc1d-4cc6-9a31-7c9766d33dec;
 Tue, 10 Nov 2020 13:45:37 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxp-0000rQ-7A
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxp-0000wW-6P
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:37 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTxq-0004rz-UA
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:38 +0000
X-Inumbo-ID: d31e470d-dc1d-4cc6-9a31-7c9766d33dec
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id d31e470d-dc1d-4cc6-9a31-7c9766d33dec;
	Tue, 10 Nov 2020 13:45:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N4Lu6ncqOeB0QwCYSY8adwuW59GlBQe5l5Q7E6VNtRQ=; b=4PrSOYAge40Cd4Va7uRd3AdjNE
	HxpHfyv5fpcMLxlfO9YsUGTrIMTVssTvIpvnsEhYRL/ybpf9QApz22f1rfFPuuKPega9EshN1RIPK
	d/smiZjjR0Ep/323qOfZcIdQHXOKdGrY4+6W5ki15JNccoxiPz6/3Ymg68W/3c/KDRoQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxp-0000rQ-7A
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxp-0000wW-6P
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/evtchn: rework per event channel lock
Message-Id: <E1kcTxp-0000wW-6P@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:45:37 +0000

commit 5f2df45ead7c1195142f68b7923047a1e9479d54
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Nov 10 14:36:15 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:36:15 2020 +0100

    xen/evtchn: rework per event channel lock
    
    Currently the lock for a single event channel needs to be taken with
    interrupts off, which causes deadlocks in some cases.
    
    Rework the per event channel lock to be non-blocking for the case of
    sending an event and removing the need for disabling interrupts for
    taking the lock.
    
    The lock is needed for avoiding races between event channel state
    changes (creation, closing, binding) against normal operations (set
    pending, [un]masking, priority changes).
    
    Use a rwlock, but with some restrictions:
    
    - Changing the state of an event channel (creation, closing, binding)
      needs to use write_lock(), with ASSERT()ing that the lock is taken as
      writer only when the state of the event channel is either before or
      after the locked region appropriate (either free or unbound).
    
    - Sending an event needs to use read_trylock() mostly, in case of not
      obtaining the lock the operation is omitted. This is needed as
      sending an event can happen with interrupts off (at least in some
      cases).
    
    - Dumping the event channel state for debug purposes is using
      read_trylock(), too, in order to avoid blocking in case the lock is
      taken as writer for a long time.
    
    - All other cases can use read_lock().
    
    Fixes: e045199c7c9c54 ("evtchn: address races with evtchn_reset()")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/x86/irq.c         |   6 +-
 xen/arch/x86/pv/shim.c     |   9 +--
 xen/common/event_channel.c | 138 +++++++++++++++++++++++++--------------------
 xen/include/xen/event.h    |  29 ++++++++--
 xen/include/xen/sched.h    |   5 +-
 5 files changed, 112 insertions(+), 75 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 93c4fb9a79..8d1f9a9fc6 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2495,14 +2495,12 @@ static void dump_irqs(unsigned char key)
                 pirq = domain_irq_to_pirq(d, irq);
                 info = pirq_info(d, pirq);
                 evtchn = evtchn_from_port(d, info->evtchn);
-                local_irq_disable();
-                if ( spin_trylock(&evtchn->lock) )
+                if ( evtchn_read_trylock(evtchn) )
                 {
                     pending = evtchn_is_pending(d, evtchn);
                     masked = evtchn_is_masked(d, evtchn);
-                    spin_unlock(&evtchn->lock);
+                    evtchn_read_unlock(evtchn);
                 }
-                local_irq_enable();
                 printk("d%d:%3d(%c%c%c)%c",
                        d->domain_id, pirq, "-P?"[pending],
                        "-M?"[masked], info->masked ? 'M' : '-',
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 9aef7a860a..b4e83e0778 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -660,11 +660,12 @@ void pv_shim_inject_evtchn(unsigned int port)
     if ( port_is_valid(guest, port) )
     {
         struct evtchn *chn = evtchn_from_port(guest, port);
-        unsigned long flags;
 
-        spin_lock_irqsave(&chn->lock, flags);
-        evtchn_port_set_pending(guest, chn->notify_vcpu_id, chn);
-        spin_unlock_irqrestore(&chn->lock, flags);
+        if ( evtchn_read_trylock(chn) )
+        {
+            evtchn_port_set_pending(guest, chn->notify_vcpu_id, chn);
+            evtchn_read_unlock(chn);
+        }
     }
 }
 
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index cd4a2c0501..43e3520df6 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -50,6 +50,29 @@
 
 #define consumer_is_xen(e) (!!(e)->xen_consumer)
 
+/*
+ * Lock an event channel exclusively. This is allowed only when the channel is
+ * free or unbound either when taking or when releasing the lock, as any
+ * concurrent operation on the event channel using evtchn_read_trylock() will
+ * just assume the event channel is free or unbound at the moment when the
+ * evtchn_read_trylock() returns false.
+ */
+static inline void evtchn_write_lock(struct evtchn *evtchn)
+{
+    write_lock(&evtchn->lock);
+
+    evtchn->old_state = evtchn->state;
+}
+
+static inline void evtchn_write_unlock(struct evtchn *evtchn)
+{
+    /* Enforce lock discipline. */
+    ASSERT(evtchn->old_state == ECS_FREE || evtchn->old_state == ECS_UNBOUND ||
+           evtchn->state == ECS_FREE || evtchn->state == ECS_UNBOUND);
+
+    write_unlock(&evtchn->lock);
+}
+
 /*
  * The function alloc_unbound_xen_event_channel() allows an arbitrary
  * notifier function to be specified. However, very few unique functions
@@ -133,7 +156,7 @@ static struct evtchn *alloc_evtchn_bucket(struct domain *d, unsigned int port)
             return NULL;
         }
         chn[i].port = port + i;
-        spin_lock_init(&chn[i].lock);
+        rwlock_init(&chn[i].lock);
     }
     return chn;
 }
@@ -255,7 +278,6 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
     int            port;
     domid_t        dom = alloc->dom;
     long           rc;
-    unsigned long  flags;
 
     d = rcu_lock_domain_by_any_id(dom);
     if ( d == NULL )
@@ -271,14 +293,14 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
     if ( rc )
         goto out;
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state = ECS_UNBOUND;
     if ( (chn->u.unbound.remote_domid = alloc->remote_dom) == DOMID_SELF )
         chn->u.unbound.remote_domid = current->domain->domain_id;
     evtchn_port_init(d, chn);
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     alloc->port = port;
 
@@ -291,32 +313,26 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
 }
 
 
-static unsigned long double_evtchn_lock(struct evtchn *lchn,
-                                        struct evtchn *rchn)
+static void double_evtchn_lock(struct evtchn *lchn, struct evtchn *rchn)
 {
-    unsigned long flags;
-
     if ( lchn <= rchn )
     {
-        spin_lock_irqsave(&lchn->lock, flags);
+        evtchn_write_lock(lchn);
         if ( lchn != rchn )
-            spin_lock(&rchn->lock);
+            evtchn_write_lock(rchn);
     }
     else
     {
-        spin_lock_irqsave(&rchn->lock, flags);
-        spin_lock(&lchn->lock);
+        evtchn_write_lock(rchn);
+        evtchn_write_lock(lchn);
     }
-
-    return flags;
 }
 
-static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn,
-                                 unsigned long flags)
+static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn)
 {
     if ( lchn != rchn )
-        spin_unlock(&lchn->lock);
-    spin_unlock_irqrestore(&rchn->lock, flags);
+        evtchn_write_unlock(lchn);
+    evtchn_write_unlock(rchn);
 }
 
 static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
@@ -326,7 +342,6 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
     int            lport, rport = bind->remote_port;
     domid_t        rdom = bind->remote_dom;
     long           rc;
-    unsigned long  flags;
 
     if ( rdom == DOMID_SELF )
         rdom = current->domain->domain_id;
@@ -362,7 +377,7 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
     if ( rc )
         goto out;
 
-    flags = double_evtchn_lock(lchn, rchn);
+    double_evtchn_lock(lchn, rchn);
 
     lchn->u.interdomain.remote_dom  = rd;
     lchn->u.interdomain.remote_port = rport;
@@ -379,7 +394,7 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
      */
     evtchn_port_set_pending(ld, lchn->notify_vcpu_id, lchn);
 
-    double_evtchn_unlock(lchn, rchn, flags);
+    double_evtchn_unlock(lchn, rchn);
 
     bind->local_port = lport;
 
@@ -402,7 +417,6 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     struct domain *d = current->domain;
     int            virq = bind->virq, vcpu = bind->vcpu;
     int            rc = 0;
-    unsigned long  flags;
 
     if ( (virq < 0) || (virq >= ARRAY_SIZE(v->virq_to_evtchn)) )
         return -EINVAL;
@@ -440,14 +454,14 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
 
     chn = evtchn_from_port(d, port);
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state          = ECS_VIRQ;
     chn->notify_vcpu_id = vcpu;
     chn->u.virq         = virq;
     evtchn_port_init(d, chn);
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     v->virq_to_evtchn[virq] = bind->port = port;
 
@@ -464,7 +478,6 @@ static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
     struct domain *d = current->domain;
     int            port, vcpu = bind->vcpu;
     long           rc = 0;
-    unsigned long  flags;
 
     if ( domain_vcpu(d, vcpu) == NULL )
         return -ENOENT;
@@ -476,13 +489,13 @@ static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
 
     chn = evtchn_from_port(d, port);
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state          = ECS_IPI;
     chn->notify_vcpu_id = vcpu;
     evtchn_port_init(d, chn);
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     bind->port = port;
 
@@ -526,7 +539,6 @@ static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
     struct pirq   *info;
     int            port = 0, pirq = bind->pirq;
     long           rc;
-    unsigned long  flags;
 
     if ( (pirq < 0) || (pirq >= d->nr_pirqs) )
         return -EINVAL;
@@ -559,14 +571,14 @@ static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
         goto out;
     }
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state  = ECS_PIRQ;
     chn->u.pirq.irq = pirq;
     link_pirq_port(port, chn, v);
     evtchn_port_init(d, chn);
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     bind->port = port;
 
@@ -587,7 +599,6 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
     struct evtchn *chn1, *chn2;
     int            port2;
     long           rc = 0;
-    unsigned long  flags;
 
  again:
     spin_lock(&d1->event_lock);
@@ -688,14 +699,14 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         BUG_ON(chn2->state != ECS_INTERDOMAIN);
         BUG_ON(chn2->u.interdomain.remote_dom != d1);
 
-        flags = double_evtchn_lock(chn1, chn2);
+        double_evtchn_lock(chn1, chn2);
 
         evtchn_free(d1, chn1);
 
         chn2->state = ECS_UNBOUND;
         chn2->u.unbound.remote_domid = d1->domain_id;
 
-        double_evtchn_unlock(chn1, chn2, flags);
+        double_evtchn_unlock(chn1, chn2);
 
         goto out;
 
@@ -703,9 +714,9 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         BUG();
     }
 
-    spin_lock_irqsave(&chn1->lock, flags);
+    evtchn_write_lock(chn1);
     evtchn_free(d1, chn1);
-    spin_unlock_irqrestore(&chn1->lock, flags);
+    evtchn_write_unlock(chn1);
 
  out:
     if ( d2 != NULL )
@@ -725,7 +736,6 @@ int evtchn_send(struct domain *ld, unsigned int lport)
     struct evtchn *lchn, *rchn;
     struct domain *rd;
     int            rport, ret = 0;
-    unsigned long  flags;
 
     if ( !port_is_valid(ld, lport) )
         return -EINVAL;
@@ -738,7 +748,7 @@ int evtchn_send(struct domain *ld, unsigned int lport)
 
     lchn = evtchn_from_port(ld, lport);
 
-    spin_lock_irqsave(&lchn->lock, flags);
+    evtchn_read_lock(lchn);
 
     /* Guest cannot send via a Xen-attached event channel. */
     if ( unlikely(consumer_is_xen(lchn)) )
@@ -773,7 +783,7 @@ int evtchn_send(struct domain *ld, unsigned int lport)
     }
 
 out:
-    spin_unlock_irqrestore(&lchn->lock, flags);
+    evtchn_read_unlock(lchn);
 
     return ret;
 }
@@ -806,9 +816,11 @@ void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
 
     d = v->domain;
     chn = evtchn_from_port(d, port);
-    spin_lock(&chn->lock);
-    evtchn_port_set_pending(d, v->vcpu_id, chn);
-    spin_unlock(&chn->lock);
+    if ( evtchn_read_trylock(chn) )
+    {
+        evtchn_port_set_pending(d, v->vcpu_id, chn);
+        evtchn_read_unlock(chn);
+    }
 
  out:
     spin_unlock_irqrestore(&v->virq_lock, flags);
@@ -837,9 +849,11 @@ void send_guest_global_virq(struct domain *d, uint32_t virq)
         goto out;
 
     chn = evtchn_from_port(d, port);
-    spin_lock(&chn->lock);
-    evtchn_port_set_pending(d, chn->notify_vcpu_id, chn);
-    spin_unlock(&chn->lock);
+    if ( evtchn_read_trylock(chn) )
+    {
+        evtchn_port_set_pending(d, chn->notify_vcpu_id, chn);
+        evtchn_read_unlock(chn);
+    }
 
  out:
     spin_unlock_irqrestore(&v->virq_lock, flags);
@@ -849,7 +863,6 @@ void send_guest_pirq(struct domain *d, const struct pirq *pirq)
 {
     int port;
     struct evtchn *chn;
-    unsigned long flags;
 
     /*
      * PV guests: It should not be possible to race with __evtchn_close(). The
@@ -864,9 +877,11 @@ void send_guest_pirq(struct domain *d, const struct pirq *pirq)
     }
 
     chn = evtchn_from_port(d, port);
-    spin_lock_irqsave(&chn->lock, flags);
-    evtchn_port_set_pending(d, chn->notify_vcpu_id, chn);
-    spin_unlock_irqrestore(&chn->lock, flags);
+    if ( evtchn_read_trylock(chn) )
+    {
+        evtchn_port_set_pending(d, chn->notify_vcpu_id, chn);
+        evtchn_read_unlock(chn);
+    }
 }
 
 static struct domain *global_virq_handlers[NR_VIRQS] __read_mostly;
@@ -1068,15 +1083,17 @@ int evtchn_unmask(unsigned int port)
 {
     struct domain *d = current->domain;
     struct evtchn *evtchn;
-    unsigned long flags;
 
     if ( unlikely(!port_is_valid(d, port)) )
         return -EINVAL;
 
     evtchn = evtchn_from_port(d, port);
-    spin_lock_irqsave(&evtchn->lock, flags);
+
+    evtchn_read_lock(evtchn);
+
     evtchn_port_unmask(d, evtchn);
-    spin_unlock_irqrestore(&evtchn->lock, flags);
+
+    evtchn_read_unlock(evtchn);
 
     return 0;
 }
@@ -1156,15 +1173,17 @@ static long evtchn_set_priority(const struct evtchn_set_priority *set_priority)
     unsigned int port = set_priority->port;
     struct evtchn *chn;
     long ret;
-    unsigned long flags;
 
     if ( !port_is_valid(d, port) )
         return -EINVAL;
 
     chn = evtchn_from_port(d, port);
-    spin_lock_irqsave(&chn->lock, flags);
+
+    evtchn_read_lock(chn);
+
     ret = evtchn_port_set_priority(d, chn, set_priority->priority);
-    spin_unlock_irqrestore(&chn->lock, flags);
+
+    evtchn_read_unlock(chn);
 
     return ret;
 }
@@ -1332,7 +1351,6 @@ int alloc_unbound_xen_event_channel(
 {
     struct evtchn *chn;
     int            port, rc;
-    unsigned long  flags;
 
     spin_lock(&ld->event_lock);
 
@@ -1345,14 +1363,14 @@ int alloc_unbound_xen_event_channel(
     if ( rc )
         goto out;
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state = ECS_UNBOUND;
     chn->xen_consumer = get_xen_consumer(notification_fn);
     chn->notify_vcpu_id = lvcpu;
     chn->u.unbound.remote_domid = remote_domid;
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     /*
      * Increment ->xen_evtchns /after/ ->active_evtchns. No explicit
@@ -1388,7 +1406,6 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)
 {
     struct evtchn *lchn, *rchn;
     struct domain *rd;
-    unsigned long flags;
 
     if ( !port_is_valid(ld, lport) )
     {
@@ -1403,7 +1420,8 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)
 
     lchn = evtchn_from_port(ld, lport);
 
-    spin_lock_irqsave(&lchn->lock, flags);
+    if ( !evtchn_read_trylock(lchn) )
+        return;
 
     if ( likely(lchn->state == ECS_INTERDOMAIN) )
     {
@@ -1413,7 +1431,7 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)
         evtchn_port_set_pending(rd, rchn->notify_vcpu_id, rchn);
     }
 
-    spin_unlock_irqrestore(&lchn->lock, flags);
+    evtchn_read_unlock(lchn);
 }
 
 void evtchn_check_pollers(struct domain *d, unsigned int port)
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 2ed4be78f6..a0a85cdda8 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -105,6 +105,21 @@ void notify_via_xen_event_channel(struct domain *ld, int lport);
 #define bucket_from_port(d, p) \
     ((group_from_port(d, p))[((p) % EVTCHNS_PER_GROUP) / EVTCHNS_PER_BUCKET])
 
+static inline void evtchn_read_lock(struct evtchn *evtchn)
+{
+    read_lock(&evtchn->lock);
+}
+
+static inline bool evtchn_read_trylock(struct evtchn *evtchn)
+{
+    return read_trylock(&evtchn->lock);
+}
+
+static inline void evtchn_read_unlock(struct evtchn *evtchn)
+{
+    read_unlock(&evtchn->lock);
+}
+
 static inline bool_t port_is_valid(struct domain *d, unsigned int p)
 {
     if ( p >= read_atomic(&d->valid_evtchns) )
@@ -235,11 +250,12 @@ static inline bool evtchn_port_is_masked(struct domain *d, evtchn_port_t port)
 {
     struct evtchn *evtchn = evtchn_from_port(d, port);
     bool rc;
-    unsigned long flags;
 
-    spin_lock_irqsave(&evtchn->lock, flags);
+    evtchn_read_lock(evtchn);
+
     rc = evtchn_is_masked(d, evtchn);
-    spin_unlock_irqrestore(&evtchn->lock, flags);
+
+    evtchn_read_unlock(evtchn);
 
     return rc;
 }
@@ -252,12 +268,13 @@ static inline int evtchn_port_poll(struct domain *d, evtchn_port_t port)
     if ( port_is_valid(d, port) )
     {
         struct evtchn *evtchn = evtchn_from_port(d, port);
-        unsigned long flags;
 
-        spin_lock_irqsave(&evtchn->lock, flags);
+        evtchn_read_lock(evtchn);
+
         if ( evtchn_usable(evtchn) )
             rc = evtchn_is_pending(d, evtchn);
-        spin_unlock_irqrestore(&evtchn->lock, flags);
+
+        evtchn_read_unlock(evtchn);
     }
 
     return rc;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index ff8d0772b3..7251b3ae3e 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -85,7 +85,7 @@ extern domid_t hardware_domid;
 
 struct evtchn
 {
-    spinlock_t lock;
+    rwlock_t lock;
 #define ECS_FREE         0 /* Channel is available for use.                  */
 #define ECS_RESERVED     1 /* Channel is reserved.                           */
 #define ECS_UNBOUND      2 /* Channel is waiting to bind to a remote domain. */
@@ -114,6 +114,9 @@ struct evtchn
         u16 virq;      /* state == ECS_VIRQ */
     } u;
     u8 priority;
+#ifndef NDEBUG
+    u8 old_state;      /* State when taking lock in write mode. */
+#endif
     u8 last_priority;
     u16 last_vcpu_id;
 #ifdef CONFIG_XSM
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:45:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:45:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23418.50161 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTy1-0004tT-By; Tue, 10 Nov 2020 13:45:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23418.50161; Tue, 10 Nov 2020 13:45: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTy1-0004tM-99; Tue, 10 Nov 2020 13:45:49 +0000
Received: by outflank-mailman (input) for mailman id 23418;
 Tue, 10 Nov 2020 13:45:48 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTy0-0004tD-2y
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:48 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ec9709bf-4576-4ce7-aed2-045b6bf832df;
 Tue, 10 Nov 2020 13:45:47 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxz-0000rT-Ae
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTxz-0000yH-9q
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTy0-0004tD-2y
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:48 +0000
X-Inumbo-ID: ec9709bf-4576-4ce7-aed2-045b6bf832df
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id ec9709bf-4576-4ce7-aed2-045b6bf832df;
	Tue, 10 Nov 2020 13:45:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IHKMtQArkNDjuOejxyIFJ1movctG9ygOOzT0sqOduMA=; b=NVN3S3H2JynMjZEolgS2gfSwT+
	jretcNod/6Z4pSSnxEr57kBSMAO2YFmDYzYQ1Y6qlihn4a4h++rPkKpjF5JRG1qYrOTr+joBN63Vb
	PeQY9jAfoifLM5ee/A1mZTgaT3msbnJSvbSDIf4wJ3g1NMDwAyBvw4hQ35G2Le3qNIE0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxz-0000rT-Ae
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTxz-0000yH-9q
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/evtchn: revert 52e1fc47abc3a0123
Message-Id: <E1kcTxz-0000yH-9q@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:45:47 +0000

commit b5ad37f8e9284cc147218f7a5193d739ae7b956f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Nov 10 14:37:15 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:37:15 2020 +0100

    xen/evtchn: revert 52e1fc47abc3a0123
    
    With the event channel lock no longer disabling interrupts commit
    52e1fc47abc3a0123 ("evtchn/Flask: pre-allocate node on send path") can
    be reverted again.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c  |  6 ----
 xen/include/xsm/xsm.h       |  1 -
 xen/xsm/flask/avc.c         | 78 ++++-----------------------------------------
 xen/xsm/flask/hooks.c       | 10 ------
 xen/xsm/flask/include/avc.h |  2 --
 5 files changed, 7 insertions(+), 90 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 43e3520df6..eacd96b92f 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -740,12 +740,6 @@ int evtchn_send(struct domain *ld, unsigned int lport)
     if ( !port_is_valid(ld, lport) )
         return -EINVAL;
 
-    /*
-     * As the call further down needs to avoid allocations (due to running
-     * with IRQs off), give XSM a chance to pre-allocate if needed.
-     */
-    xsm_evtchn_send(XSM_HOOK, ld, NULL);
-
     lchn = evtchn_from_port(ld, lport);
 
     evtchn_read_lock(lchn);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 358ec13ba8..7bd03d8817 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -59,7 +59,6 @@ struct xsm_operations {
     int (*evtchn_interdomain) (struct domain *d1, struct evtchn *chn1,
                                         struct domain *d2, struct evtchn *chn2);
     void (*evtchn_close_post) (struct evtchn *chn);
-    /* Note: Next hook may be called with 'chn' set to NULL. See call site. */
     int (*evtchn_send) (struct domain *d, struct evtchn *chn);
     int (*evtchn_status) (struct domain *d, struct evtchn *chn);
     int (*evtchn_reset) (struct domain *d1, struct domain *d2);
diff --git a/xen/xsm/flask/avc.c b/xen/xsm/flask/avc.c
index 2dfa1f4295..87ea38b7a0 100644
--- a/xen/xsm/flask/avc.c
+++ b/xen/xsm/flask/avc.c
@@ -24,9 +24,7 @@
 #include <xen/prefetch.h>
 #include <xen/kernel.h>
 #include <xen/sched.h>
-#include <xen/cpu.h>
 #include <xen/init.h>
-#include <xen/percpu.h>
 #include <xen/rcupdate.h>
 #include <asm/atomic.h>
 #include <asm/current.h>
@@ -343,79 +341,17 @@ static inline int avc_reclaim_node(void)
     return ecx;
 }
 
-static struct avc_node *new_node(void)
-{
-    struct avc_node *node = xzalloc(struct avc_node);
-
-    if ( node )
-    {
-        INIT_RCU_HEAD(&node->rhead);
-        INIT_HLIST_NODE(&node->list);
-        avc_cache_stats_incr(allocations);
-    }
-
-    return node;
-}
-
-/*
- * avc_has_perm_noaudit() may consume up to two nodes, which we may not be
- * able to obtain from the allocator at that point. Since the is merely
- * about caching earlier decisions, allow for (just) one pre-allocated node.
- */
-static DEFINE_PER_CPU(struct avc_node *, prealloc_node);
-
-void avc_prealloc(void)
-{
-    struct avc_node **prealloc = &this_cpu(prealloc_node);
-
-    if ( !*prealloc )
-        *prealloc = new_node();
-}
-
-static int cpu_callback(struct notifier_block *nfb, unsigned long action,
-                        void *hcpu)
-{
-    unsigned int cpu = (unsigned long)hcpu;
-    struct avc_node **prealloc = &per_cpu(prealloc_node, cpu);
-
-    if ( action == CPU_DEAD && *prealloc )
-    {
-        xfree(*prealloc);
-        *prealloc = NULL;
-        avc_cache_stats_incr(frees);
-    }
-
-    return NOTIFY_DONE;
-}
-
-static struct notifier_block cpu_nfb = {
-    .notifier_call = cpu_callback,
-    .priority = 99
-};
-
-static int __init cpu_nfb_init(void)
-{
-    register_cpu_notifier(&cpu_nfb);
-    return 0;
-}
-__initcall(cpu_nfb_init);
-
 static struct avc_node *avc_alloc_node(void)
 {
-    struct avc_node *node, **prealloc = &this_cpu(prealloc_node);
+    struct avc_node *node;
 
-    node = *prealloc;
-    *prealloc = NULL;
+    node = xzalloc(struct avc_node);
+    if (!node)
+        goto out;
 
-    if ( !node )
-    {
-        /* Must not call xmalloc() & Co with IRQs off. */
-        if ( !local_irq_is_enabled() )
-            goto out;
-        node = new_node();
-        if ( !node )
-            goto out;
-    }
+    INIT_RCU_HEAD(&node->rhead);
+    INIT_HLIST_NODE(&node->list);
+    avc_cache_stats_incr(allocations);
 
     atomic_inc(&avc_cache.active_nodes);
     if ( atomic_read(&avc_cache.active_nodes) > avc_cache_threshold )
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index de050cc9fe..19b0d9e3eb 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -281,16 +281,6 @@ static int flask_evtchn_send(struct domain *d, struct evtchn *chn)
 {
     int rc;
 
-    /*
-     * When called with non-NULL chn, memory allocation may not be permitted.
-     * Allow AVC to preallocate nodes as necessary upon early notification.
-     */
-    if ( !chn )
-    {
-        avc_prealloc();
-        return 0;
-    }
-
     switch ( chn->state )
     {
     case ECS_INTERDOMAIN:
diff --git a/xen/xsm/flask/include/avc.h b/xen/xsm/flask/include/avc.h
index 722919b762..c14bd07a2b 100644
--- a/xen/xsm/flask/include/avc.h
+++ b/xen/xsm/flask/include/avc.h
@@ -91,8 +91,6 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, u16 tclass, u32 requested,
 int avc_has_perm(u32 ssid, u32 tsid, u16 tclass, u32 requested,
                                              struct avc_audit_data *auditdata);
 
-void avc_prealloc(void);
-
 /* Exported to selinuxfs */
 struct xen_flask_hash_stats;
 int avc_get_hash_stats(struct xen_flask_hash_stats *arg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:45:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:45:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23419.50166 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTyB-0004ui-Dt; Tue, 10 Nov 2020 13:45:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23419.50166; Tue, 10 Nov 2020 13:45: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTyB-0004ua-At; Tue, 10 Nov 2020 13:45:59 +0000
Received: by outflank-mailman (input) for mailman id 23419;
 Tue, 10 Nov 2020 13:45:58 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTyA-0004uU-13
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:58 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 67c7613a-57a3-4dc8-8dcb-a465bf9ceb92;
 Tue, 10 Nov 2020 13:45:57 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTy9-0000ra-DI
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTy9-0000zq-Cl
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:57 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTyA-0004uU-13
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:58 +0000
X-Inumbo-ID: 67c7613a-57a3-4dc8-8dcb-a465bf9ceb92
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 67c7613a-57a3-4dc8-8dcb-a465bf9ceb92;
	Tue, 10 Nov 2020 13:45:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yWff9rHSKABhsNGjPJriWsr325Jqe5dXf9jMYxWlp1c=; b=DtmT5Q9R350y6N+9r6E0FEjWEa
	KFL6PbYqmRdnyBRLs+nS4B0MmkcTtv6Vp5fOftW6kgTOM7ZrolyBMLJHBC2vwsrxkTHVBlYR3bdEY
	2mJ5gQcVCSRAUAqPmL7QnqjigrXyx614DmuLTC9ciISC0kR9i9H5QCfYGRbQtBaHgDIc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTy9-0000ra-DI
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTy9-0000zq-Cl
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:45:57 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CPUID: don't use UB shift when library is built as 32-bit
Message-Id: <E1kcTy9-0000zq-Cl@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:45:57 +0000

commit db1a9fdd554cb1d8a7099af7925318fc06c6875b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 10 14:39:03 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:39:03 2020 +0100

    x86/CPUID: don't use UB shift when library is built as 32-bit
    
    At least the insn emulator test harness will continue to be buildable
    (and ought to continue to be usable) also as a 32-bit binary. (Right now
    the CPU policy test harness is, too, but there it may be less relevant
    to keep it functional, just like e.g. we don't support fuzzing the insn
    emulator in 32-bit mode.) Hence the library code needs to cope with
    this.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/lib/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c
index c7a0508148..8eb88314f5 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -165,7 +165,7 @@ void x86_cpuid_policy_fill_native(struct cpuid_policy *p)
         for ( i = 2; i < min_t(unsigned int, 63,
                                ARRAY_SIZE(p->xstate.raw)); ++i )
         {
-            if ( xstates & (1ul << i) )
+            if ( xstates & (1ull << i) )
                 cpuid_count_leaf(0xd, i, &p->xstate.raw[i]);
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:46:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:46:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23420.50170 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTyL-0004wC-Fc; Tue, 10 Nov 2020 13:46:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23420.50170; Tue, 10 Nov 2020 13:46: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTyL-0004w4-CT; Tue, 10 Nov 2020 13:46:09 +0000
Received: by outflank-mailman (input) for mailman id 23420;
 Tue, 10 Nov 2020 13:46:08 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTyK-0004vy-Jh
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:08 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5f2836a7-e61c-4401-9214-d9dd41cb9be1;
 Tue, 10 Nov 2020 13:46:07 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTyJ-0000rw-GC
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTyJ-00011d-FW
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTyK-0004vy-Jh
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:08 +0000
X-Inumbo-ID: 5f2836a7-e61c-4401-9214-d9dd41cb9be1
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 5f2836a7-e61c-4401-9214-d9dd41cb9be1;
	Tue, 10 Nov 2020 13:46:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SjINUg420NcWpUL/Gkvbd1V2iK8wBSiqwI3bCWG25rc=; b=tnVxZUWkF1yLrD8gB4sselmQWf
	iLuY1LPRsHTwwtnvMkUSgla38ZdEEgRsQtnpANVDgiVEHk/bp3HQWiRis2W80F5nSc3WWNaea06H1
	2R94+srOla2qjliROBSmGtO8TOvVAZ2XvdDkFbYm2OpkD8ZFAhwf4KaU4m92VmZUVNUw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTyJ-0000rw-GC
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTyJ-00011d-FW
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CPUID: suppress IOMMU related hypervisor leaf data
Message-Id: <E1kcTyJ-00011d-FW@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:46:07 +0000

commit f5cfa09856732b1d78ff6a21ca3dc33a010da951
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 10 14:39:30 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:39:30 2020 +0100

    x86/CPUID: suppress IOMMU related hypervisor leaf data
    
    Now that the IOMMU for guests can't be enabled "on demand" anymore,
    there's also no reason to expose the related CPUID bit "just in case".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/traps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index bc5b8f8ea3..c27dd4cd43 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1050,7 +1050,8 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
          * Indicate that memory mapped from other domains (either grants or
          * foreign pages) has valid IOMMU entries.
          */
-        res->a |= XEN_HVM_CPUID_IOMMU_MAPPINGS;
+        if ( is_iommu_enabled(d) )
+            res->a |= XEN_HVM_CPUID_IOMMU_MAPPINGS;
 
         /* Indicate presence of vcpu id and set it in ebx */
         res->a |= XEN_HVM_CPUID_VCPU_ID_PRESENT;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 13:46:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 13:46:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23421.50174 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTyV-0004xX-HF; Tue, 10 Nov 2020 13:46:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23421.50174; Tue, 10 Nov 2020 13:46: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcTyV-0004xP-E8; Tue, 10 Nov 2020 13:46:19 +0000
Received: by outflank-mailman (input) for mailman id 23421;
 Tue, 10 Nov 2020 13:46:18 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcTyU-0004xH-DT
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:18 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3719704b-c92f-46dc-a7d4-95e35c5a35d4;
 Tue, 10 Nov 2020 13:46:17 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTyT-0000s7-Ix
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcTyT-00012v-IH
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcTyU-0004xH-DT
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:18 +0000
X-Inumbo-ID: 3719704b-c92f-46dc-a7d4-95e35c5a35d4
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 3719704b-c92f-46dc-a7d4-95e35c5a35d4;
	Tue, 10 Nov 2020 13:46:17 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QtaPwR8/A8T1NHJwYYbrcOeiSee9cvO+NH8g5PNOc7I=; b=6fcc7yiaqlQ6ebOPEnF/amSWfC
	yYAFrH2KGTjgi+sr2MhHcHE1TgWJFMekrVcZcQNC/AmRxrEB8/+Q+i/cSkhLN4lot1GLy+HElIX9e
	GhgYzv31O4IE511gEor/o4UBGJkk+lreXJjSg4vpps7wWrmWXVnElFwguG1nz0LRfnqI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTyT-0000s7-Ix
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcTyT-00012v-IH
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 13:46:17 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CPUID: also check leaf 7 max subleaf to be compatible
Message-Id: <E1kcTyT-00012v-IH@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 13:46:17 +0000

commit e6e85b662be9eab96f4cfc58e9945580cce8b2bb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 10 14:40:09 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:40:09 2020 +0100

    x86/CPUID: also check leaf 7 max subleaf to be compatible
    
    Just like is done for basic and extended major leaves.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/lib/x86/policy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/lib/x86/policy.c b/xen/lib/x86/policy.c
index 4beca8767a..f6cea4e2f9 100644
--- a/xen/lib/x86/policy.c
+++ b/xen/lib/x86/policy.c
@@ -18,6 +18,9 @@ int x86_cpu_policies_are_compatible(const struct cpu_policy *host,
     if ( guest->cpuid->basic.max_leaf > host->cpuid->basic.max_leaf )
         FAIL_CPUID(0, NA);
 
+    if ( guest->cpuid->feat.max_subleaf > host->cpuid->feat.max_subleaf )
+        FAIL_CPUID(7, 0);
+
     if ( guest->cpuid->extd.max_leaf > host->cpuid->extd.max_leaf )
         FAIL_CPUID(0x80000000, NA);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:11:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23758.50697 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY6m-0007z7-U6; Tue, 10 Nov 2020 18:11:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23758.50697; Tue, 10 Nov 2020 18:11:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY6m-0007yz-Qp; Tue, 10 Nov 2020 18:11:08 +0000
Received: by outflank-mailman (input) for mailman id 23758;
 Tue, 10 Nov 2020 18:11:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY6l-0007yu-Ig
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:07 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bdacdc13-1b4d-434e-b946-552b966a42b8;
 Tue, 10 Nov 2020 18:11:05 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY6j-00075j-1y
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY6i-0002wa-VT
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY6l-0007yu-Ig
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:07 +0000
X-Inumbo-ID: bdacdc13-1b4d-434e-b946-552b966a42b8
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id bdacdc13-1b4d-434e-b946-552b966a42b8;
	Tue, 10 Nov 2020 18:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ChyFtp+EN+xMtHcRypKjhXDSJYwumt83Hc3ZnZ5ZZPs=; b=InxP4ZWIFedMoDRM0bQQRpoLIm
	gLN+Fg8o51ob8O/DMOiZdTm0EuAeIROru0Qxq5dzBIFyCohyL8ZZME8rnjck8KCDAYQZOsjWB1R9J
	DU92DEes6PQPZ8NPQyRCOhn+oMz5W2eub0iryUnAWyCJGZ9ZnqEU2XM8Y5zS7YnEwZ54=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY6j-00075j-1y
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY6i-0002wa-VT
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Always trap AMU system registers
Message-Id: <E1kcY6i-0002wa-VT@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:11:04 +0000

commit 628e1becb6fb121475a6ce68e3f1cb4499851255
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 16:49:27 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index a36f145e67..22bd1bd4c6 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -151,7 +151,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 3ca67f8157..d3d12a9d19 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -351,6 +351,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:11:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:11:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23759.50701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY6w-00080H-VD; Tue, 10 Nov 2020 18:11:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23759.50701; Tue, 10 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY6w-00080A-SQ; Tue, 10 Nov 2020 18:11:18 +0000
Received: by outflank-mailman (input) for mailman id 23759;
 Tue, 10 Nov 2020 18:11:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY6v-0007zu-1j
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:17 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 74239ff1-212f-483d-bddc-613577be0b11;
 Tue, 10 Nov 2020 18:11:16 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY6t-00075o-SM
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY6t-0002yB-Qv
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY6v-0007zu-1j
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:17 +0000
X-Inumbo-ID: 74239ff1-212f-483d-bddc-613577be0b11
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 74239ff1-212f-483d-bddc-613577be0b11;
	Tue, 10 Nov 2020 18:11:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mjtnfQlzRJzIrFNgXMBjFJB6oGdKhNtUbgJRjeM2VIE=; b=v4BM+C21hVIAgWX/JDHGRtWMu3
	3TPaAVzHbeodH0YluPXkcbEEdYUkhM6WxmUJW/fD7c5JZNZ0EzLMn7JyDM40Dwn6C3F3ast9Hxbgn
	m+CakPgmaU7Jwj/pAhzfmkSKATGb/7l/lGIUQrVm1fixLIUqQVA+uuE1bLw15fufFhjQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY6t-00075o-SM
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY6t-0002yB-Qv
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] xen/arm: Always trap AMU system registers
Message-Id: <E1kcY6t-0002yB-Qv@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:11:15 +0000

commit 73a09279de197c509a241ec20fa18c481c8503b2
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:13 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 8f40d0e0b6..2197df2099 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -151,7 +151,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 3ca67f8157..d3d12a9d19 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -351,6 +351,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:11:30 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:11:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23761.50705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY78-00082f-1L; Tue, 10 Nov 2020 18:11:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23761.50705; Tue, 10 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY77-00082W-U5; Tue, 10 Nov 2020 18:11:29 +0000
Received: by outflank-mailman (input) for mailman id 23761;
 Tue, 10 Nov 2020 18:11:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY75-00082F-TJ
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:27 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 42b1b3a0-0fc3-468e-ae0e-74ed915bd92a;
 Tue, 10 Nov 2020 18:11:26 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY73-00075z-Vb
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY73-0002z5-UT
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY75-00082F-TJ
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:27 +0000
X-Inumbo-ID: 42b1b3a0-0fc3-468e-ae0e-74ed915bd92a
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 42b1b3a0-0fc3-468e-ae0e-74ed915bd92a;
	Tue, 10 Nov 2020 18:11:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fcJ0YwES/J/R2TJC5N3GuReHqy+3WPVm8NH4+PmpbZE=; b=bveViEemaA/H2+iEp5ZCSZWn0G
	Vbgef1cBmfjeCaJ7gk2jGqEFlp8jK8THbTQS029N5AloS2TjEOdzD27r/owJYBdHCZPLO12FOBOUB
	3jbmxscBT4RnUn9ZK7Nlx6vub29x54QL2DOgHtuHR0kr3ttWU4EVDDUFP7xpqkwa6aJU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY73-00075z-Vb
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY73-0002z5-UT
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kcY73-0002z5-UT@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:11:25 +0000

commit d95f45073cac2d49c4fd439653b632010ad6c6bb
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:29 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 35 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index d72ab0fa1f..3db26faf08 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -245,6 +245,25 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = msrs->misc_features_enables.raw;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -343,6 +362,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TEST_CTRL:
     case MSR_TSX_FORCE_ABORT:
@@ -454,6 +474,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 85a9fd4767..5c7b9117ae 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -820,12 +820,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1070,14 +1064,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index a0d87ef9d0..97ba8e0795 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1071,6 +1071,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 int cpupool_move_domain(struct domain *d, struct cpupool *c);
 int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op);
 int cpupool_get_id(const struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:11:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:11:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23764.50708 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7H-00084T-43; Tue, 10 Nov 2020 18:11:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23764.50708; Tue, 10 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7H-00084M-16; Tue, 10 Nov 2020 18:11:39 +0000
Received: by outflank-mailman (input) for mailman id 23764;
 Tue, 10 Nov 2020 18:11:37 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY7F-00084B-4H
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:37 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cb25ae93-4451-4e65-a0f9-d04f8c3699a2;
 Tue, 10 Nov 2020 18:11:36 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7E-00077S-2V
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7E-000305-1Z
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:36 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY7F-00084B-4H
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:37 +0000
X-Inumbo-ID: cb25ae93-4451-4e65-a0f9-d04f8c3699a2
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id cb25ae93-4451-4e65-a0f9-d04f8c3699a2;
	Tue, 10 Nov 2020 18:11:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E63dAnHkcbKYXLumaAkiku3J8vshlD4rN4ftrhYOeiQ=; b=MYoK1xJNRHRd2w/7dL2sswa4xo
	UjEHv6cI2cBqvkhJ+yxW1aCNSg39GggGaFNkNezBlyVTVZakvfXsf+WglL/yrPgxMdT+ETtZnCmdi
	SewOcptUcF7e5tasMpyN60L/Jqt2AQcDUXz0exyU4RHyDof8GSc7aa4bfYOFCDTvRhoE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7E-00077S-2V
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7E-000305-1Z
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kcY7E-000305-1Z@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:11:36 +0000

commit d101b417b784a26326fc7800a79cc539ba570b79
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:29 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 3db26faf08..aa107823ac 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -185,6 +185,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -192,6 +199,8 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_AMD64_LWP_CBADDR:
     case MSR_PPIN_CTL:
     case MSR_PPIN:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
     case MSR_AMD_PPIN_CTL:
     case MSR_AMD_PPIN:
         /* Not offered to guests. */
@@ -369,6 +378,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -376,6 +392,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_AMD64_LWP_CBADDR:
     case MSR_PPIN_CTL:
     case MSR_PPIN:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
     case MSR_AMD_PPIN_CTL:
     case MSR_AMD_PPIN:
         /* Not offered to guests. */
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 0fe98af923..5e64ecff91 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -77,6 +77,38 @@
 #define MSR_RTIT_ADDR_A(n)                 (0x00000580 + (n) * 2)
 #define MSR_RTIT_ADDR_B(n)                 (0x00000581 + (n) * 2)
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT                 0x00000606
+
+#define MSR_PKG_POWER_LIMIT                 0x00000610
+#define MSR_PKG_ENERGY_STATUS               0x00000611
+#define MSR_PKG_PERF_STATUS                 0x00000613
+#define MSR_PKG_POWER_INFO                  0x00000614
+
+#define MSR_DRAM_POWER_LIMIT                0x00000618
+#define MSR_DRAM_ENERGY_STATUS              0x00000619
+#define MSR_DRAM_PERF_STATUS                0x0000061b
+#define MSR_DRAM_POWER_INFO                 0x0000061c
+
+#define MSR_PP0_POWER_LIMIT                 0x00000638
+#define MSR_PP0_ENERGY_STATUS               0x00000639
+#define MSR_PP0_POLICY                      0x0000063a
+
+#define MSR_PP1_POWER_LIMIT                 0x00000640
+#define MSR_PP1_ENERGY_STATUS               0x00000641
+#define MSR_PP1_POLICY                      0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER         0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT            0x0000065c
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define  CET_SHSTK_EN                       (_AC(1, ULL) <<  0)
@@ -92,6 +124,13 @@
 #define  PASID_PASID_MASK                   0x000fffff
 #define  PASID_VALID                        (_AC(1, ULL) << 31)
 
+#define MSR_F15H_CU_POWER                   0xc001007a
+#define MSR_F15H_CU_MAX_POWER               0xc001007b
+
+#define MSR_AMD_RAPL_POWER_UNIT             0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS          0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS           0xc001029b
+
 /*
  * Legacy MSR constants in need of cleanup.  No new MSRs below this comment.
  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:11:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:11:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23765.50713 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7R-000861-63; Tue, 10 Nov 2020 18:11:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23765.50713; Tue, 10 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7R-00085u-34; Tue, 10 Nov 2020 18:11:49 +0000
Received: by outflank-mailman (input) for mailman id 23765;
 Tue, 10 Nov 2020 18:11:48 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY7Q-00085j-06
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:48 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id af40c087-ed66-45dd-b13c-f64d0a96c44b;
 Tue, 10 Nov 2020 18:11:47 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7O-00078F-Th
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7O-00031s-Sc
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:46 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY7Q-00085j-06
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:48 +0000
X-Inumbo-ID: af40c087-ed66-45dd-b13c-f64d0a96c44b
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id af40c087-ed66-45dd-b13c-f64d0a96c44b;
	Tue, 10 Nov 2020 18:11:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fCR9V+0K9WPYQ+PUj3+WxpHxeS0dsQoIIO/yQ0h5J3E=; b=bF2Pc7HKyHIzs04xeieWi+DrG3
	QPYFi6Y3Pg68xZpwa/eiqWBQmfftBjsJsXRTc1lor08XjpFEgc0NJu1h1qjSV2c6H2CkIdI9pkOdI
	Ik22V31CaK1ltjxg0te4ZveH/qm8WDi5L8s+H2WTzFBCUXjasgOlDISQlZZ5pWzjnvI4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7O-00078F-Th
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7O-00031s-Sc
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] xen/arm: Always trap AMU system registers
Message-Id: <E1kcY7O-00031s-Sc@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:11:46 +0000

commit 6434a6348dbd01e57b7f5751438ee9ca21cf6cc7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:56 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 1d2b762e22..b7b9547d85 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -150,7 +150,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 3ca67f8157..d3d12a9d19 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -351,6 +351,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:11:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:11:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23766.50717 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7b-00087J-7x; Tue, 10 Nov 2020 18:11:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23766.50717; Tue, 10 Nov 2020 18:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7b-00087B-4u; Tue, 10 Nov 2020 18:11:59 +0000
Received: by outflank-mailman (input) for mailman id 23766;
 Tue, 10 Nov 2020 18:11:58 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY7a-000874-Ik
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:58 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ad05d7b1-2513-43da-931c-29c47d89c325;
 Tue, 10 Nov 2020 18:11:57 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7Z-00078L-0Z
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7Y-00032x-Vu
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:56 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY7a-000874-Ik
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:58 +0000
X-Inumbo-ID: ad05d7b1-2513-43da-931c-29c47d89c325
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id ad05d7b1-2513-43da-931c-29c47d89c325;
	Tue, 10 Nov 2020 18:11:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V93m0WfrH0YFZeybMyDJPzs1zGZZKgI+0UT9eOWYqZQ=; b=tauV8O7YHIo7GqLjuvR0H5MHra
	UF6PDUw+n/89MBYC1dy2eHwzliO3cr2wRpJhpa/S2QvJqmNnn/OJ7+UZubrFzmBLdhKCvUa/kBOyu
	xRdI6b8eBJKQviWGfVpJ0nzZ85G0BDFNYAEgkMGA1Xi+gaFU5y6RBOZ99ngmf7KbLxLE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7Z-00078L-0Z
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7Y-00032x-Vu
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:11:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kcY7Y-00032x-Vu@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:11:56 +0000

commit 33483f81edb9ab4d05fcd136ee6ccdd22d7ba612
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:56 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 35 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 875ac39d30..8c969197aa 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -208,6 +208,25 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = msrs->misc_features_enables.raw;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -305,6 +324,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
@@ -411,6 +431,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 42258c6bf1..6dc4f92a84 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -776,12 +776,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1026,14 +1020,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index d6e27fc4b8..8bb5bd7b38 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1057,6 +1057,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 #define CPUPOOLID_NONE    -1
 
 struct cpupool *cpupool_get_by_id(int poolid);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:12:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:12:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23767.50721 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7m-00088h-9i; Tue, 10 Nov 2020 18:12:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23767.50721; Tue, 10 Nov 2020 18:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7m-00088X-6W; Tue, 10 Nov 2020 18:12:10 +0000
Received: by outflank-mailman (input) for mailman id 23767;
 Tue, 10 Nov 2020 18:12:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY7k-00088P-U4
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:08 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 456b1226-4a7d-4d80-b119-1adb32203ece;
 Tue, 10 Nov 2020 18:12:07 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7j-00078g-3b
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7j-000342-2g
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY7k-00088P-U4
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:08 +0000
X-Inumbo-ID: 456b1226-4a7d-4d80-b119-1adb32203ece
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 456b1226-4a7d-4d80-b119-1adb32203ece;
	Tue, 10 Nov 2020 18:12:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NyqhnM2GE7dfPYSHWsNQUEk5XgNBZfCFJu14EKwMdSg=; b=p3wgE4x3pa1BcMnVHKyuQ0CWHH
	mnK3RE6t4j4JOGyBjIDgQwlJt6d21Iz5l1LeRuViT8ifIzFRsjVfPKB7Kk0AC4l7ZXp5l2KJnf8og
	KHlCMfobzye6qUPIaCcFdwqCpxHxHbBIno2D5eNMeOAVVIhwzVegiKfCwJnEXIaI8WKw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7j-00078g-3b
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7j-000342-2g
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kcY7j-000342-2g@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:12:07 +0000

commit d4c0483c0b87768cd9b95542e98111e4c098d57f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:56 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 8c969197aa..8ab6949a8e 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -152,11 +152,20 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
     case MSR_AMD64_LWP_CFG:
     case MSR_AMD64_LWP_CBADDR:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -330,11 +339,20 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
     case MSR_AMD64_LWP_CFG:
     case MSR_AMD64_LWP_CBADDR:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 0eb6855614..ba9e90af21 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -96,6 +96,38 @@
 /* Lower 6 bits define the format of the address in the LBR stack */
 #define MSR_IA32_PERF_CAP_LBR_FORMAT	0x3f
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT		0x00000606
+
+#define MSR_PKG_POWER_LIMIT		0x00000610
+#define MSR_PKG_ENERGY_STATUS		0x00000611
+#define MSR_PKG_PERF_STATUS		0x00000613
+#define MSR_PKG_POWER_INFO		0x00000614
+
+#define MSR_DRAM_POWER_LIMIT		0x00000618
+#define MSR_DRAM_ENERGY_STATUS		0x00000619
+#define MSR_DRAM_PERF_STATUS		0x0000061b
+#define MSR_DRAM_POWER_INFO		0x0000061c
+
+#define MSR_PP0_POWER_LIMIT		0x00000638
+#define MSR_PP0_ENERGY_STATUS		0x00000639
+#define MSR_PP0_POLICY			0x0000063a
+
+#define MSR_PP1_POWER_LIMIT		0x00000640
+#define MSR_PP1_ENERGY_STATUS		0x00000641
+#define MSR_PP1_POLICY			0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER	0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065c
+
 #define MSR_IA32_BNDCFGS		0x00000d90
 #define IA32_BNDCFGS_ENABLE		0x00000001
 #define IA32_BNDCFGS_PRESERVE		0x00000002
@@ -236,6 +268,8 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_F15H_CU_POWER		0xc001007a
+#define MSR_F15H_CU_MAX_POWER		0xc001007b
 #define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
 #define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
 #define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
@@ -249,6 +283,10 @@
 #define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
 #define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
 
+#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS	0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
+
 #define MSR_AMD_L7S0_FEATURE_MASK	0xc0011002
 #define MSR_AMD_THRM_FEATURE_MASK	0xc0011003
 #define MSR_K8_FEATURE_MASK		0xc0011004
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:12:20 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:12:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23768.50727 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7w-0008A6-C1; Tue, 10 Nov 2020 18:12:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23768.50727; Tue, 10 Nov 2020 18:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY7w-00089w-81; Tue, 10 Nov 2020 18:12:20 +0000
Received: by outflank-mailman (input) for mailman id 23768;
 Tue, 10 Nov 2020 18:12:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY7u-00089j-To
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:18 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4c4c6929-b089-4c95-8d26-f4f4fcaa942b;
 Tue, 10 Nov 2020 18:12:18 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7t-00078q-VC
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY7t-00035Y-Ta
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY7u-00089j-To
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:18 +0000
X-Inumbo-ID: 4c4c6929-b089-4c95-8d26-f4f4fcaa942b
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 4c4c6929-b089-4c95-8d26-f4f4fcaa942b;
	Tue, 10 Nov 2020 18:12:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nQyJGNe7Fn+kgwFvO5Iu7OvrGiaalrMT5ZdPru/mS68=; b=6fU66Id2ACY+4276tqecBpdLgn
	p1DQV8/yqdwdZdEJneUYxpETtdrSn9b1NGZ+b2jquTiuJnzDcl86mmmXEMTN6QPnxFhAKOvj8013C
	kHdwQLlr6zluGSSO1F4EeF6bREZPCnUDsXqfvFlzqExwCntnTRa0NR12dxPfT7C5HMSs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7t-00078q-VC
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY7t-00035Y-Ta
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:17 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] xen/arm: Always trap AMU system registers
Message-Id: <E1kcY7t-00035Y-Ta@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:12:17 +0000

commit 7b2f479639ef20253dec03809fe749dd2e80f24c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:11 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index d0f0189224..4325ea3e6d 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -150,7 +150,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 04838fe6fc..0f35ec59d1 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -295,6 +295,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:12:30 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:12:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23769.50729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY86-0008CF-EP; Tue, 10 Nov 2020 18:12:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23769.50729; Tue, 10 Nov 2020 18:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY86-0008C7-B9; Tue, 10 Nov 2020 18:12:30 +0000
Received: by outflank-mailman (input) for mailman id 23769;
 Tue, 10 Nov 2020 18:12:29 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY85-0008Bu-3E
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:29 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 254f1896-63fc-4ba3-b233-0d4504eb4b8b;
 Tue, 10 Nov 2020 18:12:28 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY84-000790-2f
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY84-00036d-13
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY85-0008Bu-3E
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:29 +0000
X-Inumbo-ID: 254f1896-63fc-4ba3-b233-0d4504eb4b8b
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 254f1896-63fc-4ba3-b233-0d4504eb4b8b;
	Tue, 10 Nov 2020 18:12:28 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s12R1p2vDcH59tG/Zo+ryDFQsES3R/mXV0iMz+/sb5A=; b=aZJK5rRveBNwcfsvzmKnUJj98Q
	n4RDdlZMKNWrGjtp1MYsPFrcdW3l5iHIAxfDg1JE+zgdnIkaBKa9UfDR2HbzRw9jN/r9pHPZqD643
	kKOnB0rJISAqyFmY6SK4uJ1ixLw0+HTM26qOtaI5IWoCScSuVY+RSuJZhYUMM+SuO7h4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY84-000790-2f
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY84-00036d-13
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:28 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kcY84-00036d-13@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:12:28 +0000

commit dee5d47f8d2a821e560dc68a59a7eb57c00aa493
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:11 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 35 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 4677222c40..a427826ba0 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -206,6 +206,25 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = msrs->misc_features_enables.raw;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -290,6 +309,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
@@ -394,6 +414,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 324a2334a2..933036ea34 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -799,12 +799,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1047,14 +1041,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 819f6ede2b..b918624327 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -993,6 +993,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 #define CPUPOOLID_NONE    -1
 
 struct cpupool *cpupool_get_by_id(int poolid);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:12:40 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:12:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23770.50733 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8G-0008DV-Ft; Tue, 10 Nov 2020 18:12:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23770.50733; Tue, 10 Nov 2020 18:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8G-0008DO-Cp; Tue, 10 Nov 2020 18:12:40 +0000
Received: by outflank-mailman (input) for mailman id 23770;
 Tue, 10 Nov 2020 18:12:39 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY8F-0008DG-OW
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:39 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 655f3ffd-3a7a-44c7-94a0-5608c3122407;
 Tue, 10 Nov 2020 18:12:38 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8E-00079D-5f
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8E-00037g-4s
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY8F-0008DG-OW
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:39 +0000
X-Inumbo-ID: 655f3ffd-3a7a-44c7-94a0-5608c3122407
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 655f3ffd-3a7a-44c7-94a0-5608c3122407;
	Tue, 10 Nov 2020 18:12:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BaRPjxe0lAla45TWhnhQmFccaENuxIvX9lvCRFalKZA=; b=cPior6QoGhCvetW6u/5Yft+2TZ
	OTxAnVeVCUQSeg98XwEUGfBlyHdxw8QtIaizY4IY9uzAHTqxz90ZDNJngSrhgAwQVdBN+d+hXAZks
	c8si3zzHdcXUNq4DKzLPKdqpfgzKguw60rMyW/pFHZPIntswtv6hlz6CxEU443a/m60Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8E-00079D-5f
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8E-00037g-4s
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:38 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kcY8E-00037g-4s@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:12:38 +0000

commit 14c9c0fceae92a18dedc3f280ebf8b9f52e39de5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:11 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index a427826ba0..927ed625df 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -151,9 +151,18 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -315,9 +324,18 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 0eb6855614..ba9e90af21 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -96,6 +96,38 @@
 /* Lower 6 bits define the format of the address in the LBR stack */
 #define MSR_IA32_PERF_CAP_LBR_FORMAT	0x3f
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT		0x00000606
+
+#define MSR_PKG_POWER_LIMIT		0x00000610
+#define MSR_PKG_ENERGY_STATUS		0x00000611
+#define MSR_PKG_PERF_STATUS		0x00000613
+#define MSR_PKG_POWER_INFO		0x00000614
+
+#define MSR_DRAM_POWER_LIMIT		0x00000618
+#define MSR_DRAM_ENERGY_STATUS		0x00000619
+#define MSR_DRAM_PERF_STATUS		0x0000061b
+#define MSR_DRAM_POWER_INFO		0x0000061c
+
+#define MSR_PP0_POWER_LIMIT		0x00000638
+#define MSR_PP0_ENERGY_STATUS		0x00000639
+#define MSR_PP0_POLICY			0x0000063a
+
+#define MSR_PP1_POWER_LIMIT		0x00000640
+#define MSR_PP1_ENERGY_STATUS		0x00000641
+#define MSR_PP1_POLICY			0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER	0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065c
+
 #define MSR_IA32_BNDCFGS		0x00000d90
 #define IA32_BNDCFGS_ENABLE		0x00000001
 #define IA32_BNDCFGS_PRESERVE		0x00000002
@@ -236,6 +268,8 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_F15H_CU_POWER		0xc001007a
+#define MSR_F15H_CU_MAX_POWER		0xc001007b
 #define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
 #define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
 #define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
@@ -249,6 +283,10 @@
 #define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
 #define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
 
+#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS	0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
+
 #define MSR_AMD_L7S0_FEATURE_MASK	0xc0011002
 #define MSR_AMD_THRM_FEATURE_MASK	0xc0011003
 #define MSR_K8_FEATURE_MASK		0xc0011004
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:12:50 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:12:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23771.50736 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8Q-0008El-HV; Tue, 10 Nov 2020 18:12:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23771.50736; Tue, 10 Nov 2020 18:12: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8Q-0008Ef-Eb; Tue, 10 Nov 2020 18:12:50 +0000
Received: by outflank-mailman (input) for mailman id 23771;
 Tue, 10 Nov 2020 18:12:49 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY8P-0008EX-SU
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:49 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 489c4241-51b0-4af3-919a-8d0dc0b110f0;
 Tue, 10 Nov 2020 18:12:49 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8P-00079x-0N
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8O-00039D-Vj
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:48 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY8P-0008EX-SU
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:49 +0000
X-Inumbo-ID: 489c4241-51b0-4af3-919a-8d0dc0b110f0
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 489c4241-51b0-4af3-919a-8d0dc0b110f0;
	Tue, 10 Nov 2020 18:12:49 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uV+Tjreiftuj11YMIda+iRfyshaTfgRUctTn0xPhB9g=; b=oAEX1LqMeeAidWHGuruPgk1PDN
	0QOrflkXT2fkxheO27FNKjmjcYbrk0nKN0IQo61VL6R34yGwXoHa5NFQpB+NwjXSJDJnDqNvw3DT/
	TxXNGhB6v6yv1bV9subl8T9JS5RBbOhJRLqkxIPmGaKobE+lxY2ZxN36bRk32bhF1Y5U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8P-00079x-0N
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8O-00039D-Vj
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:48 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.11] xen/arm: Always trap AMU system registers
Message-Id: <E1kcY8O-00039D-Vj@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:12:48 +0000

commit 65fad0a426db082fa4989b7c4567438bfa93b596
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:37 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index e930585ad6..c12010a722 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -179,7 +179,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /* Setup hypervisor traps */
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 222a02dd99..5755cc6434 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -291,6 +291,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:13:01 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:13:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23772.50740 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8b-0008GH-JC; Tue, 10 Nov 2020 18:13:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23772.50740; Tue, 10 Nov 2020 18:13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8b-0008G9-GE; Tue, 10 Nov 2020 18:13:01 +0000
Received: by outflank-mailman (input) for mailman id 23772;
 Tue, 10 Nov 2020 18:13:00 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY8a-0008Fz-7z
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:00 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 31b829a6-88c6-415a-bfa9-39807c07849b;
 Tue, 10 Nov 2020 18:12:59 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8Z-0007A4-3N
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8Z-0003AJ-2V
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:59 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY8a-0008Fz-7z
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:00 +0000
X-Inumbo-ID: 31b829a6-88c6-415a-bfa9-39807c07849b
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 31b829a6-88c6-415a-bfa9-39807c07849b;
	Tue, 10 Nov 2020 18:12:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+naecTgBx6LQj72hQSdw/gygnhHQJhRa/zgQU5P0UPM=; b=ShRkryue3DLrtB7PYrOIwFNb37
	r1eOMX3jRv+X2EBP3fi5WBZAev4/JGNEzBo/8BlP7h6OJ9JLzc5b2AxWgwybOOm1zDFiUF59q3TVK
	p2GOAsUiDCPdRyi2e6oZNeDkEI6AGw1tfVI2Qfh3jxOZWozIdQfiZ5nhQFrYHLPrfe3U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8Z-0007A4-3N
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8Z-0003AJ-2V
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:12:59 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.11] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kcY8Z-0003AJ-2V@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:12:59 +0000

commit 3b5de119f0399cbe745502cb6ebd5e6633cc139c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:37 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 36 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 256e58d82b..3495ac9f4a 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -141,6 +141,7 @@ int init_vcpu_msr_policy(struct vcpu *v)
 
 int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
 {
+    const struct domain *d = v->domain;
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
     const struct msr_domain_policy *dp = v->domain->arch.msr;
     const struct msr_vcpu_policy *vp = v->arch.msr;
@@ -211,6 +212,25 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
                _MSR_MISC_FEATURES_CPUID_FAULTING;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
         /*
          * TODO: Implement when we have better topology representation.
     case MSR_INTEL_CORE_THREAD_COUNT:
@@ -241,6 +261,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
@@ -345,6 +366,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 8120ded330..755f00db33 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -816,12 +816,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1096,14 +1090,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index c0cc5d9336..7e4ad5d51b 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -920,6 +920,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 #define CPUPOOLID_NONE    -1
 
 struct cpupool *cpupool_get_by_id(int poolid);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:13:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:13:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23773.50745 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8l-0008JD-MG; Tue, 10 Nov 2020 18:13:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23773.50745; Tue, 10 Nov 2020 18:13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8l-0008J5-JF; Tue, 10 Nov 2020 18:13:11 +0000
Received: by outflank-mailman (input) for mailman id 23773;
 Tue, 10 Nov 2020 18:13:10 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY8k-0008I4-5r
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:10 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0f453bf9-2a81-46c6-917d-5527f0920aca;
 Tue, 10 Nov 2020 18:13:09 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8j-0007AV-68
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8j-0003Bt-5O
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:09 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY8k-0008I4-5r
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:10 +0000
X-Inumbo-ID: 0f453bf9-2a81-46c6-917d-5527f0920aca
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 0f453bf9-2a81-46c6-917d-5527f0920aca;
	Tue, 10 Nov 2020 18:13:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TwKa9QKZO8UTkK7t53wKfEmLqbLxUO/JeuTx6X73Kw4=; b=Kevrfyma554MRh5nY0UUdOWKat
	pzHeF6wuN97Hy2T+VWfs1D7utJOHdEJNXYIeeT+KDsjautaL23LYy3Ta+/q2siDdYst7FMyU+Z1Dp
	IOVIS6j4auvzgGmKsOpPfD/cWW/tICK4XffgqpfuCA04OsVCkyvftJW7Gq9JcrVdNxKQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8j-0007AV-68
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8j-0003Bt-5O
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:09 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.11] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kcY8j-0003Bt-5O@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:13:09 +0000

commit 1447d449fab7e48c85faf83951842bb60d7dabe5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:37 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 3495ac9f4a..99c848ff41 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -156,6 +156,15 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -266,6 +275,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 480d1d8102..a685dcdcca 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -96,6 +96,38 @@
 /* Lower 6 bits define the format of the address in the LBR stack */
 #define MSR_IA32_PERF_CAP_LBR_FORMAT	0x3f
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT		0x00000606
+
+#define MSR_PKG_POWER_LIMIT		0x00000610
+#define MSR_PKG_ENERGY_STATUS		0x00000611
+#define MSR_PKG_PERF_STATUS		0x00000613
+#define MSR_PKG_POWER_INFO		0x00000614
+
+#define MSR_DRAM_POWER_LIMIT		0x00000618
+#define MSR_DRAM_ENERGY_STATUS		0x00000619
+#define MSR_DRAM_PERF_STATUS		0x0000061b
+#define MSR_DRAM_POWER_INFO		0x0000061c
+
+#define MSR_PP0_POWER_LIMIT		0x00000638
+#define MSR_PP0_ENERGY_STATUS		0x00000639
+#define MSR_PP0_POLICY			0x0000063a
+
+#define MSR_PP1_POWER_LIMIT		0x00000640
+#define MSR_PP1_ENERGY_STATUS		0x00000641
+#define MSR_PP1_POLICY			0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER	0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065c
+
 #define MSR_IA32_BNDCFGS		0x00000d90
 #define IA32_BNDCFGS_ENABLE		0x00000001
 #define IA32_BNDCFGS_PRESERVE		0x00000002
@@ -218,6 +250,8 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_F15H_CU_POWER		0xc001007a
+#define MSR_F15H_CU_MAX_POWER		0xc001007b
 #define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
 #define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
 #define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
@@ -231,6 +265,10 @@
 #define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
 #define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
 
+#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS	0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
+
 #define MSR_AMD_L7S0_FEATURE_MASK	0xc0011002
 #define MSR_AMD_THRM_FEATURE_MASK	0xc0011003
 #define MSR_K8_FEATURE_MASK		0xc0011004
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:13:21 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:13:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23774.50749 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8v-0008KY-Nm; Tue, 10 Nov 2020 18:13:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23774.50749; Tue, 10 Nov 2020 18:13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY8v-0008KQ-Kq; Tue, 10 Nov 2020 18:13:21 +0000
Received: by outflank-mailman (input) for mailman id 23774;
 Tue, 10 Nov 2020 18:13:20 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY8u-0008KL-RO
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:20 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7a0d201b-716f-4e80-abcc-57d7b553e75f;
 Tue, 10 Nov 2020 18:13:20 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8t-0007Af-Vk
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY8t-0003Dc-Uz
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:19 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY8u-0008KL-RO
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:20 +0000
X-Inumbo-ID: 7a0d201b-716f-4e80-abcc-57d7b553e75f
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
	id 7a0d201b-716f-4e80-abcc-57d7b553e75f;
	Tue, 10 Nov 2020 18:13:20 +0000 (UTC)
DKIM-Signature: v=1; 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+g1GUNAJ1LMomykonrX+T79Qb9ryhidEf0QsqlLQVM=; b=Fg/FtWyXa+XP0NTLtcu6zMIzwh
	XQ07x6QwHYGt+T7+s9ZIzIcPoEbUxm3SSzsvMIKP3XpSWgRHBEAT/QhMsKN8k/ANmjItPHAhHLIdx
	j322CUNuFAnsV6A+rc0V+xZnpJiwkOgaMisqA5xYACpTnxgWnlKYhP+w2kFulfiUSpGM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8t-0007Af-Vk
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY8t-0003Dc-Uz
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:19 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.10] xen/arm: Always trap AMU system registers
Message-Id: <E1kcY8t-0003Dc-Uz@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:13:19 +0000

commit 5114e77ef3cbca018fbd4b64c0251a7e7d1d6eeb
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:51:25 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 9ec5b93dc2..f281013fe0 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -182,7 +182,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /* Setup hypervisor traps */
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 222a02dd99..5755cc6434 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -291,6 +291,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:13:32 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:13:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23775.50752 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY96-0008MV-PG; Tue, 10 Nov 2020 18:13:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23775.50752; Tue, 10 Nov 2020 18:13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY96-0008MN-MQ; Tue, 10 Nov 2020 18:13:32 +0000
Received: by outflank-mailman (input) for mailman id 23775;
 Tue, 10 Nov 2020 18:13:31 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY95-0008MA-Io
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:31 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6e5e5877-7f24-47a8-8916-b1a1233683d3;
 Tue, 10 Nov 2020 18:13:30 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY94-0007Aq-2P
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY94-0003Ej-1g
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:30 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY95-0008MA-Io
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:31 +0000
X-Inumbo-ID: 6e5e5877-7f24-47a8-8916-b1a1233683d3
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 6e5e5877-7f24-47a8-8916-b1a1233683d3;
	Tue, 10 Nov 2020 18:13:30 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IcOhMNys1u5Egx5brCFVQV5//iIwF16wIl47So5yVZc=; b=CHvBUX5JmMh22MAQa6zuhqI4cx
	dGmSkLoxaMB0dPkmh0zhyxjhx1zjknYRrkbiXd4RJBZAhpjAK/bC3+B2HBMyASRH+vNk4DL8xyEpy
	8MiF2R2avoYIVh9jWPphXPge8/ZlZ43AU2SiwdNnu8HWp3GtGsEMN6F9HeMpu9wa0eMk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY94-0007Aq-2P
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY94-0003Ej-1g
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:30 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.10] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kcY94-0003Ej-1g@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:13:30 +0000

commit 398f91c505b06e6614ddabde97e71a29affd8015
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:51:25 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 36 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 90561a5392..a2a0634b4b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -122,6 +122,7 @@ int init_vcpu_msr_policy(struct vcpu *v)
 
 int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
 {
+    const struct domain *d = v->domain;
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
     const struct msr_domain_policy *dp = v->domain->arch.msr;
     const struct msr_vcpu_policy *vp = v->arch.msr;
@@ -163,6 +164,25 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
                _MSR_MISC_FEATURES_CPUID_FAULTING;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
         /*
          * TODO: Implement when we have better topology representation.
     case MSR_INTEL_CORE_THREAD_COUNT:
@@ -192,6 +212,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
@@ -283,6 +304,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 0344c987e1..9857a786dd 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -835,12 +835,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1129,14 +1123,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 0a13b81c21..831927fbc4 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -917,6 +917,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 #define CPUPOOLID_NONE    -1
 
 struct cpupool *cpupool_get_by_id(int poolid);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Nov 10 18:13:42 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Nov 2020 18:13:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.23776.50757 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY9G-0008Ni-RR; Tue, 10 Nov 2020 18:13:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 23776.50757; Tue, 10 Nov 2020 18:13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcY9G-0008NY-Nv; Tue, 10 Nov 2020 18:13:42 +0000
Received: by outflank-mailman (input) for mailman id 23776;
 Tue, 10 Nov 2020 18:13:41 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1kcY9F-0008NN-6p
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:41 +0000
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0e582005-9f33-4b95-a32e-7f306d0095cb;
 Tue, 10 Nov 2020 18:13:40 +0000 (UTC)
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY9E-0007Ay-5I
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcY9E-0003Fu-4P
 for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:40 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <SRS0=2+Qr=EQ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
	id 1kcY9F-0008NN-6p
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:41 +0000
X-Inumbo-ID: 0e582005-9f33-4b95-a32e-7f306d0095cb
Received: from mail.xenproject.org (unknown [104.130.215.37])
	by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
	id 0e582005-9f33-4b95-a32e-7f306d0095cb;
	Tue, 10 Nov 2020 18:13:40 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KlYNYY7HymPd/VNXruszS6+ocm9jPA6UPNX7py1Kp+4=; b=Jqc74P/89j/rnmZYSKREdinduB
	QN+DsFs/59Mdo2SyEsKZkZ2o66Zw4YaXpEafgCqeZIztl9zJzE6/y4uwyvuKgnPFoMr2R7Ee1MfSp
	dobJ8drXjJK/iGDPy2Y8ErJ8QIvRWEZ4bijchE7h0+jZlPtAwg4IhduRjQVFaxhd2XGA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY9E-0007Ay-5I
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcY9E-0003Fu-4P
	for xen-changelog@lists.xenproject.org; Tue, 10 Nov 2020 18:13:40 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.10] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kcY9E-0003Fu-4P@xenbits.xenproject.org>
Date: Tue, 10 Nov 2020 18:13:40 +0000

commit 15b298097289f1c11b981454a3dc912b95e2f65b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:51:25 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index a2a0634b4b..d4342c2893 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -137,6 +137,15 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -217,6 +226,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index d1435db6a3..55fea3797b 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -96,6 +96,38 @@
 /* Lower 6 bits define the format of the address in the LBR stack */
 #define MSR_IA32_PERF_CAP_LBR_FORMAT	0x3f
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT		0x00000606
+
+#define MSR_PKG_POWER_LIMIT		0x00000610
+#define MSR_PKG_ENERGY_STATUS		0x00000611
+#define MSR_PKG_PERF_STATUS		0x00000613
+#define MSR_PKG_POWER_INFO		0x00000614
+
+#define MSR_DRAM_POWER_LIMIT		0x00000618
+#define MSR_DRAM_ENERGY_STATUS		0x00000619
+#define MSR_DRAM_PERF_STATUS		0x0000061b
+#define MSR_DRAM_POWER_INFO		0x0000061c
+
+#define MSR_PP0_POWER_LIMIT		0x00000638
+#define MSR_PP0_ENERGY_STATUS		0x00000639
+#define MSR_PP0_POLICY			0x0000063a
+
+#define MSR_PP1_POWER_LIMIT		0x00000640
+#define MSR_PP1_ENERGY_STATUS		0x00000641
+#define MSR_PP1_POLICY			0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER	0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065c
+
 #define MSR_IA32_BNDCFGS		0x00000d90
 #define IA32_BNDCFGS_ENABLE		0x00000001
 #define IA32_BNDCFGS_PRESERVE		0x00000002
@@ -218,6 +250,8 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_F15H_CU_POWER		0xc001007a
+#define MSR_F15H_CU_MAX_POWER		0xc001007b
 #define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
 #define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
 #define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
@@ -231,6 +265,10 @@
 #define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
 #define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
 
+#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS	0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
+
 #define MSR_AMD_L7S0_FEATURE_MASK	0xc0011002
 #define MSR_AMD_THRM_FEATURE_MASK	0xc0011003
 #define MSR_K8_FEATURE_MASK		0xc0011004
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 08:00:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 08:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.24316.51480 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcl31-0008O8-86; Wed, 11 Nov 2020 08:00:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 24316.51480; Wed, 11 Nov 2020 08:00:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcl31-0008O0-29; Wed, 11 Nov 2020 08:00:07 +0000
Received: by outflank-mailman (input) for mailman id 24316;
 Wed, 11 Nov 2020 08:00:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcl2z-0008DX-On
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 08:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcl2z-0004RF-IF
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 08:00:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcl2z-0008DX-On
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 08:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcl2z-0004RF-IF
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 08:00:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/events: fix build
Message-Id: <E1kcl2z-0004RF-IF@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 08:00:05 +0000

commit 53bacb86f496fdb11560d9e3b361bca7de60d268
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 11 08:56:21 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 11 08:56:21 2020 +0100

    xen/events: fix build
    
    Commit 5f2df45ead7c1195 ("xen/evtchn: rework per event channel lock")
    introduced a build failure for NDEBUG builds.
    
    Fixes: 5f2df45ead7c1195 ("xen/evtchn: rework per event channel lock")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index eacd96b92f..54b2e2550e 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -61,13 +61,24 @@ static inline void evtchn_write_lock(struct evtchn *evtchn)
 {
     write_lock(&evtchn->lock);
 
+#ifndef NDEBUG
     evtchn->old_state = evtchn->state;
+#endif
+}
+
+static inline unsigned int old_state(const struct evtchn *evtchn)
+{
+#ifndef NDEBUG
+    return evtchn->old_state;
+#else
+    return ECS_RESERVED; /* Just to allow things to build. */
+#endif
 }
 
 static inline void evtchn_write_unlock(struct evtchn *evtchn)
 {
     /* Enforce lock discipline. */
-    ASSERT(evtchn->old_state == ECS_FREE || evtchn->old_state == ECS_UNBOUND ||
+    ASSERT(old_state(evtchn) == ECS_FREE || old_state(evtchn) == ECS_UNBOUND ||
            evtchn->state == ECS_FREE || evtchn->state == ECS_UNBOUND);
 
     write_unlock(&evtchn->lock);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 08:00:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 08:00:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.24319.51482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcl3B-0008T6-Ai; Wed, 11 Nov 2020 08:00:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 24319.51482; Wed, 11 Nov 2020 08:00:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcl3B-0008Sz-7h; Wed, 11 Nov 2020 08:00:17 +0000
Received: by outflank-mailman (input) for mailman id 24319;
 Wed, 11 Nov 2020 08:00:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcl39-0008Ss-Rr
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 08:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcl39-0004SZ-RA
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 08:00:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcl39-0008Ss-Rr
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 08:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcl39-0004SZ-RA
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 08:00:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: paging_write_p2m_entry() is a private function
Message-Id: <E1kcl39-0004SZ-RA@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 08:00:15 +0000

commit 69634224afaf84474f04e1ab050f216d66bcda68
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 11 08:57:32 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 11 08:57:32 2020 +0100

    x86/p2m: paging_write_p2m_entry() is a private function
    
    As it gets installed by p2m_pt_init(), it doesn't need to live in
    paging.c. The function working in terms of l1_pgentry_t even further
    indicates its non-paging-generic nature. Move it and drop its
    paging_ prefix, not adding any new one now that it's static.
    
    This then also makes more obvious that in the EPT case we wouldn't
    risk mistakenly calling through the NULL hook pointer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pt.c     | 33 +++++++++++++++++++++++++++++----
 xen/arch/x86/mm/paging.c     | 20 --------------------
 xen/include/asm-x86/paging.h | 12 ------------
 3 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index c04a015e2c..bc9c9e2da1 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -108,6 +108,31 @@ static unsigned long p2m_type_to_flags(const struct p2m_domain *p2m,
     }
 }
 
+/*
+ * Atomically write a P2M entry and update the paging-assistance state
+ * appropriately.
+ * Arguments: the domain in question, the GFN whose mapping is being updated,
+ * a pointer to the entry to be written, the MFN in which the entry resides,
+ * the new contents of the entry, and the level in the p2m tree at which
+ * we are writing.
+ */
+static int write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
+                           l1_pgentry_t *p, l1_pgentry_t new,
+                           unsigned int level)
+{
+    struct domain *d = p2m->domain;
+    const struct vcpu *v = current;
+    int rc = 0;
+
+    if ( v->domain != d )
+        v = d->vcpu ? d->vcpu[0] : NULL;
+    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) )
+        rc = paging_get_hostmode(v)->write_p2m_entry(p2m, gfn, p, new, level);
+    else
+        safe_write_pte(p, new);
+
+    return rc;
+}
 
 // Find the next level's P2M entry, checking for out-of-range gfn's...
 // Returns NULL on error.
@@ -594,7 +619,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
         entry_content.l1 = l3e_content.l3;
 
         rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 3);
-        /* NB: paging_write_p2m_entry() handles tlb flushes properly */
+        /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
     }
@@ -631,7 +656,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
 
         /* level 1 entry */
         rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 1);
-        /* NB: paging_write_p2m_entry() handles tlb flushes properly */
+        /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
     }
@@ -666,7 +691,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
         entry_content.l1 = l2e_content.l2;
 
         rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 2);
-        /* NB: paging_write_p2m_entry() handles tlb flushes properly */
+        /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
     }
@@ -1107,7 +1132,7 @@ void p2m_pt_init(struct p2m_domain *p2m)
     p2m->recalc = do_recalc;
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
-    p2m->write_p2m_entry = paging_write_p2m_entry;
+    p2m->write_p2m_entry = write_p2m_entry;
 #if P2M_AUDIT
     p2m->audit_p2m = p2m_pt_audit_p2m;
 #else
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 8beac0e189..3aaec2ee3a 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -941,27 +941,7 @@ void paging_update_nestedmode(struct vcpu *v)
         v->arch.paging.nestedmode = NULL;
     hvm_asid_flush_vcpu(v);
 }
-#endif
-
-int paging_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                           l1_pgentry_t *p, l1_pgentry_t new,
-                           unsigned int level)
-{
-    struct domain *d = p2m->domain;
-    struct vcpu *v = current;
-    int rc = 0;
-
-    if ( v->domain != d )
-        v = d->vcpu ? d->vcpu[0] : NULL;
-    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v) != NULL) )
-        rc = paging_get_hostmode(v)->write_p2m_entry(p2m, gfn, p, new, level);
-    else
-        safe_write_pte(p, new);
 
-    return rc;
-}
-
-#ifdef CONFIG_HVM
 int __init paging_set_allocation(struct domain *d, unsigned int pages,
                                  bool *preempted)
 {
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 726f48339a..ca68afae95 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -369,18 +369,6 @@ static inline void safe_write_pte(l1_pgentry_t *p, l1_pgentry_t new)
     *p = new;
 }
 
-/* Atomically write a P2M entry and update the paging-assistance state 
- * appropriately. 
- * Arguments: the domain in question, the GFN whose mapping is being updated, 
- * a pointer to the entry to be written, the MFN in which the entry resides, 
- * the new contents of the entry, and the level in the p2m tree at which 
- * we are writing. */
-struct p2m_domain;
-
-int paging_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                           l1_pgentry_t *p, l1_pgentry_t new,
-                           unsigned int level);
-
 /*
  * Called from the guest to indicate that the a process is being
  * torn down and its pagetables will soon be discarded.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 14:55:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 14:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.24988.52513 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcrWa-00056z-SG; Wed, 11 Nov 2020 14:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 24988.52513; Wed, 11 Nov 2020 14: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcrWa-00056r-PJ; Wed, 11 Nov 2020 14:55:04 +0000
Received: by outflank-mailman (input) for mailman id 24988;
 Wed, 11 Nov 2020 14:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcrWZ-00056i-5d
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcrWY-00017h-Ou
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcrWZ-00056i-5d
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcrWY-00017h-Ou
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.10] xen/arm: Always trap AMU system registers
Message-Id: <E1kcrWY-00017h-Ou@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 14:55:02 +0000

commit 5114e77ef3cbca018fbd4b64c0251a7e7d1d6eeb
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:51:25 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 9ec5b93dc2..f281013fe0 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -182,7 +182,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /* Setup hypervisor traps */
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 222a02dd99..5755cc6434 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -291,6 +291,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 14:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 14:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.24990.52517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcrWk-000587-Tn; Wed, 11 Nov 2020 14:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 24990.52517; Wed, 11 Nov 2020 14: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcrWk-00057y-Qp; Wed, 11 Nov 2020 14:55:14 +0000
Received: by outflank-mailman (input) for mailman id 24990;
 Wed, 11 Nov 2020 14:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcrWj-00057q-8n
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcrWj-00018R-7u
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcrWj-00057q-8n
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcrWj-00018R-7u
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.10] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kcrWj-00018R-7u@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 14:55:13 +0000

commit 398f91c505b06e6614ddabde97e71a29affd8015
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:51:25 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 36 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 90561a5392..a2a0634b4b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -122,6 +122,7 @@ int init_vcpu_msr_policy(struct vcpu *v)
 
 int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
 {
+    const struct domain *d = v->domain;
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
     const struct msr_domain_policy *dp = v->domain->arch.msr;
     const struct msr_vcpu_policy *vp = v->arch.msr;
@@ -163,6 +164,25 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
                _MSR_MISC_FEATURES_CPUID_FAULTING;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
         /*
          * TODO: Implement when we have better topology representation.
     case MSR_INTEL_CORE_THREAD_COUNT:
@@ -192,6 +212,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
@@ -283,6 +304,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 0344c987e1..9857a786dd 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -835,12 +835,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1129,14 +1123,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 0a13b81c21..831927fbc4 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -917,6 +917,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 #define CPUPOOLID_NONE    -1
 
 struct cpupool *cpupool_get_by_id(int poolid);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 14:55:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 14:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.24991.52521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcrWu-00059b-VE; Wed, 11 Nov 2020 14:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 24991.52521; Wed, 11 Nov 2020 14: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcrWu-00059T-SN; Wed, 11 Nov 2020 14:55:24 +0000
Received: by outflank-mailman (input) for mailman id 24991;
 Wed, 11 Nov 2020 14:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcrWt-00059J-BZ
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcrWt-000196-Ao
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcrWt-00059J-BZ
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcrWt-000196-Ao
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 14:55:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.10] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kcrWt-000196-Ao@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 14:55:23 +0000

commit 15b298097289f1c11b981454a3dc912b95e2f65b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:51:25 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index a2a0634b4b..d4342c2893 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -137,6 +137,15 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -217,6 +226,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index d1435db6a3..55fea3797b 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -96,6 +96,38 @@
 /* Lower 6 bits define the format of the address in the LBR stack */
 #define MSR_IA32_PERF_CAP_LBR_FORMAT	0x3f
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT		0x00000606
+
+#define MSR_PKG_POWER_LIMIT		0x00000610
+#define MSR_PKG_ENERGY_STATUS		0x00000611
+#define MSR_PKG_PERF_STATUS		0x00000613
+#define MSR_PKG_POWER_INFO		0x00000614
+
+#define MSR_DRAM_POWER_LIMIT		0x00000618
+#define MSR_DRAM_ENERGY_STATUS		0x00000619
+#define MSR_DRAM_PERF_STATUS		0x0000061b
+#define MSR_DRAM_POWER_INFO		0x0000061c
+
+#define MSR_PP0_POWER_LIMIT		0x00000638
+#define MSR_PP0_ENERGY_STATUS		0x00000639
+#define MSR_PP0_POLICY			0x0000063a
+
+#define MSR_PP1_POWER_LIMIT		0x00000640
+#define MSR_PP1_ENERGY_STATUS		0x00000641
+#define MSR_PP1_POLICY			0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER	0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065c
+
 #define MSR_IA32_BNDCFGS		0x00000d90
 #define IA32_BNDCFGS_ENABLE		0x00000001
 #define IA32_BNDCFGS_PRESERVE		0x00000002
@@ -218,6 +250,8 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_F15H_CU_POWER		0xc001007a
+#define MSR_F15H_CU_MAX_POWER		0xc001007b
 #define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
 #define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
 #define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
@@ -231,6 +265,10 @@
 #define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
 #define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
 
+#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS	0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
+
 #define MSR_AMD_L7S0_FEATURE_MASK	0xc0011002
 #define MSR_AMD_THRM_FEATURE_MASK	0xc0011003
 #define MSR_K8_FEATURE_MASK		0xc0011004
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 21:55:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 21:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.25345.53053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcy54-0007N0-FZ; Wed, 11 Nov 2020 21:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 25345.53053; Wed, 11 Nov 2020 21:55: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcy54-0007Ms-Cj; Wed, 11 Nov 2020 21:55:06 +0000
Received: by outflank-mailman (input) for mailman id 25345;
 Wed, 11 Nov 2020 21:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcy52-0007Ma-Hx
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 21:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcy52-0000kw-Ez
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 21:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcy52-0007Ma-Hx
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 21:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcy52-0000kw-Ez
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 21:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Add Cortex-A73 erratum 858921 workaround
Message-Id: <E1kcy52-0000kw-Ez@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 21:55:04 +0000

commit 5505f5f8e7e805365cfe70b6a4af6115940bb749
Author:     Penny Zheng <penny.zheng@arm.com>
AuthorDate: Mon Nov 9 16:21:10 2020 +0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed Nov 11 13:44:33 2020 -0800

    xen/arm: Add Cortex-A73 erratum 858921 workaround
    
    CNTVCT_EL0 or CNTPCT_EL0 counter read in Cortex-A73 (all versions)
    might return a wrong value when the counter crosses a 32bit boundary.
    
    Until now, there is no case for Xen itself to access CNTVCT_EL0,
    and it also should be the Guest OS's responsibility to deal with
    this part.
    
    But for CNTPCT, there exists several cases in Xen involving reading
    CNTPCT, so a possible workaround is that performing the read twice,
    and to return one or the other depending on whether a transition has
    taken place.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Reviewed-by: Wei Chen <Wei.Chen@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/misc/arm/silicon-errata.txt |  1 +
 xen/arch/arm/Kconfig             | 18 ++++++++++++++++++
 xen/arch/arm/cpuerrata.c         |  8 ++++++++
 xen/arch/arm/vtimer.c            |  2 +-
 xen/include/asm-arm/cpuerrata.h  |  2 ++
 xen/include/asm-arm/cpufeature.h |  3 ++-
 xen/include/asm-arm/time.h       | 22 +++++++++++++++++++++-
 7 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt
index 1f18a9df58..552c4151d3 100644
--- a/docs/misc/arm/silicon-errata.txt
+++ b/docs/misc/arm/silicon-errata.txt
@@ -51,6 +51,7 @@ stable hypervisors.
 | ARM            | Cortex-A57      | #1319537        | N/A                     |
 | ARM            | Cortex-A72      | #1319367        | N/A                     |
 | ARM            | Cortex-A72      | #853709         | N/A                     |
+| ARM            | Cortex-A73      | #858921         | ARM_ERRATUM_858921      |
 | ARM            | Cortex-A76      | #1165522        | N/A                     |
 | ARM            | Neoverse-N1     | #1165522        | N/A
 | ARM            | MMU-500         | #842869         | N/A                     |
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 2777388265..f938dd21bd 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -226,6 +226,24 @@ config ARM64_ERRATUM_834220
 
 	  If unsure, say Y.
 
+config ARM_ERRATUM_858921
+	bool "Cortex-A73: 858921: Possible wrong read value for CNTVCT or CNTPCT"
+	default y
+	help
+	  This option adds an alternative code sequence to work around ARM
+	  erratum 858921 on Cortex-A73 (all versions).
+
+	  Affected Cortex-A73 might return wrong read value for CNTVCT or CNTPCT
+	  when the counter crosses a 32bit boundary.
+
+	  The workaround involves performing the read twice, and to return
+	  one or the other value depending on whether a transition has taken place.
+	  Please note that this does not necessarily enable the workaround,
+	  as it depends on the alternative framework, which will only patch
+	  the kernel if an affected CPU is detected.
+
+	  If unsure, say Y.
+
 endmenu
 
 config ARM64_HARDEN_BRANCH_PREDICTOR
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 6731d873e8..567911d380 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -469,6 +469,14 @@ static const struct arm_cpu_capabilities arm_errata[] = {
         .capability = ARM_SSBD,
         .matches = has_ssbd_mitigation,
     },
+#endif
+#ifdef CONFIG_ARM_ERRATUM_858921
+    {
+        /* Cortex-A73 (all versions) */
+        .desc = "ARM erratum 858921",
+        .capability = ARM_WORKAROUND_858921,
+        MIDR_ALL_VERSIONS(MIDR_CORTEX_A73),
+    },
 #endif
     {
         /* Neoverse r0p0 - r2p0 */
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index 6d39fc944f..c2b27915c6 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -62,7 +62,7 @@ static void virt_timer_expired(void *data)
 
 int domain_vtimer_init(struct domain *d, struct xen_arch_domainconfig *config)
 {
-    d->arch.virt_timer_base.offset = READ_SYSREG64(CNTPCT_EL0);
+    d->arch.virt_timer_base.offset = get_cycles();
     d->time_offset.seconds = ticks_to_ns(d->arch.virt_timer_base.offset - boot_count);
     do_div(d->time_offset.seconds, 1000000000);
 
diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/asm-arm/cpuerrata.h
index 88ef3ca934..8d7e7b9375 100644
--- a/xen/include/asm-arm/cpuerrata.h
+++ b/xen/include/asm-arm/cpuerrata.h
@@ -28,6 +28,8 @@ static inline bool check_workaround_##erratum(void)             \
 CHECK_WORKAROUND_HELPER(766422, ARM32_WORKAROUND_766422, CONFIG_ARM_32)
 CHECK_WORKAROUND_HELPER(834220, ARM64_WORKAROUND_834220, CONFIG_ARM_64)
 CHECK_WORKAROUND_HELPER(ssbd, ARM_SSBD, CONFIG_ARM_SSBD)
+CHECK_WORKAROUND_HELPER(858921, ARM_WORKAROUND_858921,
+                        CONFIG_ARM_ERRATUM_858921)
 
 #undef CHECK_WORKAROUND_HELPER
 
diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 10878ead8a..016a9fe203 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -45,8 +45,9 @@
 #define ARM_SSBD 7
 #define ARM_SMCCC_1_1 8
 #define ARM64_WORKAROUND_AT_SPECULATE 9
+#define ARM_WORKAROUND_858921 10
 
-#define ARM_NCAPS           10
+#define ARM_NCAPS           11
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index 9cb6f9b0b4..1b2c13614b 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -3,6 +3,7 @@
 
 #include <asm/sysregs.h>
 #include <asm/system.h>
+#include <asm/cpuerrata.h>
 
 #define DT_MATCH_TIMER                      \
     DT_MATCH_COMPATIBLE("arm,armv7-timer"), \
@@ -13,7 +14,26 @@ typedef uint64_t cycles_t;
 static inline cycles_t get_cycles (void)
 {
         isb();
-        return READ_SYSREG64(CNTPCT_EL0);
+        /*
+         * ARM_WORKAROUND_858921: Cortex-A73 (all versions) counter read
+         * can return a wrong value when the counter crosses a 32bit boundary.
+         */
+        if ( !check_workaround_858921() )
+            return READ_SYSREG64(CNTPCT_EL0);
+        else
+        {
+            /*
+             * A recommended workaround for erratum 858921 is to:
+             *  1- Read twice CNTPCT.
+             *  2- Compare bit[32] of the two read values.
+             *      - If bit[32] is different, keep the old value.
+             *      - If bit[32] is the same, keep the new value.
+             */
+            cycles_t old, new;
+            old = READ_SYSREG64(CNTPCT_EL0);
+            new = READ_SYSREG64(CNTPCT_EL0);
+            return (((old ^ new) >> 32) & 1) ? old : new;
+        }
 }
 
 /* List of timer's IRQ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 22:44:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 22:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.25427.53151 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcyqR-0004cw-Q6; Wed, 11 Nov 2020 22:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 25427.53151; Wed, 11 Nov 2020 22:44:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcyqR-0004cm-Mp; Wed, 11 Nov 2020 22:44:03 +0000
Received: by outflank-mailman (input) for mailman id 25427;
 Wed, 11 Nov 2020 22:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcyqR-0004ch-2J
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcyqQ-0004YG-PG
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcyqR-0004ch-2J
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcyqQ-0004YG-PG
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] xen/arm: Always trap AMU system registers
Message-Id: <E1kcyqQ-0004YG-PG@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 22:44:02 +0000

commit 7b2f479639ef20253dec03809fe749dd2e80f24c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:11 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index d0f0189224..4325ea3e6d 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -150,7 +150,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 04838fe6fc..0f35ec59d1 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -295,6 +295,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 22:44:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 22:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.25428.53154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcyqc-0004eY-SX; Wed, 11 Nov 2020 22:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 25428.53154; Wed, 11 Nov 2020 22:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcyqc-0004eQ-Pa; Wed, 11 Nov 2020 22:44:14 +0000
Received: by outflank-mailman (input) for mailman id 25428;
 Wed, 11 Nov 2020 22:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcyqb-0004eF-5m
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcyqb-0004aq-4f
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcyqb-0004eF-5m
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcyqb-0004aq-4f
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kcyqb-0004aq-4f@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 22:44:13 +0000

commit dee5d47f8d2a821e560dc68a59a7eb57c00aa493
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:11 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 35 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 4677222c40..a427826ba0 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -206,6 +206,25 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = msrs->misc_features_enables.raw;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -290,6 +309,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
@@ -394,6 +414,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 324a2334a2..933036ea34 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -799,12 +799,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1047,14 +1041,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 819f6ede2b..b918624327 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -993,6 +993,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 #define CPUPOOLID_NONE    -1
 
 struct cpupool *cpupool_get_by_id(int poolid);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Nov 11 22:44:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Nov 2020 22:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.25429.53158 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcyqm-0004fv-U9; Wed, 11 Nov 2020 22:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 25429.53158; Wed, 11 Nov 2020 22:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kcyqm-0004fn-R4; Wed, 11 Nov 2020 22:44:24 +0000
Received: by outflank-mailman (input) for mailman id 25429;
 Wed, 11 Nov 2020 22:44:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcyql-0004fd-8d
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kcyql-0004bf-7s
 for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcyql-0004fd-8d
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kcyql-0004bf-7s
	for xen-changelog@lists.xenproject.org; Wed, 11 Nov 2020 22:44:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kcyql-0004bf-7s@xenbits.xenproject.org>
Date: Wed, 11 Nov 2020 22:44:23 +0000

commit 14c9c0fceae92a18dedc3f280ebf8b9f52e39de5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:11 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index a427826ba0..927ed625df 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -151,9 +151,18 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -315,9 +324,18 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 0eb6855614..ba9e90af21 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -96,6 +96,38 @@
 /* Lower 6 bits define the format of the address in the LBR stack */
 #define MSR_IA32_PERF_CAP_LBR_FORMAT	0x3f
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT		0x00000606
+
+#define MSR_PKG_POWER_LIMIT		0x00000610
+#define MSR_PKG_ENERGY_STATUS		0x00000611
+#define MSR_PKG_PERF_STATUS		0x00000613
+#define MSR_PKG_POWER_INFO		0x00000614
+
+#define MSR_DRAM_POWER_LIMIT		0x00000618
+#define MSR_DRAM_ENERGY_STATUS		0x00000619
+#define MSR_DRAM_PERF_STATUS		0x0000061b
+#define MSR_DRAM_POWER_INFO		0x0000061c
+
+#define MSR_PP0_POWER_LIMIT		0x00000638
+#define MSR_PP0_ENERGY_STATUS		0x00000639
+#define MSR_PP0_POLICY			0x0000063a
+
+#define MSR_PP1_POWER_LIMIT		0x00000640
+#define MSR_PP1_ENERGY_STATUS		0x00000641
+#define MSR_PP1_POLICY			0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER	0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065c
+
 #define MSR_IA32_BNDCFGS		0x00000d90
 #define IA32_BNDCFGS_ENABLE		0x00000001
 #define IA32_BNDCFGS_PRESERVE		0x00000002
@@ -236,6 +268,8 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_F15H_CU_POWER		0xc001007a
+#define MSR_F15H_CU_MAX_POWER		0xc001007b
 #define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
 #define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
 #define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
@@ -249,6 +283,10 @@
 #define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
 #define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
 
+#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS	0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
+
 #define MSR_AMD_L7S0_FEATURE_MASK	0xc0011002
 #define MSR_AMD_THRM_FEATURE_MASK	0xc0011003
 #define MSR_K8_FEATURE_MASK		0xc0011004
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Thu Nov 12 00:33:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Nov 2020 00:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.25444.53192 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kd0Xv-00078q-7m; Thu, 12 Nov 2020 00:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 25444.53192; Thu, 12 Nov 2020 00:33:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kd0Xv-00078j-4n; Thu, 12 Nov 2020 00:33:03 +0000
Received: by outflank-mailman (input) for mailman id 25444;
 Thu, 12 Nov 2020 00:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kd0Xu-00078d-0Q
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kd0Xt-00055Y-Tt
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kd0Xu-00078d-0Q
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kd0Xt-00055Y-Tt
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] xen/arm: Always trap AMU system registers
Message-Id: <E1kd0Xt-00055Y-Tt@xenbits.xenproject.org>
Date: Thu, 12 Nov 2020 00:33:01 +0000

commit 6434a6348dbd01e57b7f5751438ee9ca21cf6cc7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:56 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 1d2b762e22..b7b9547d85 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -150,7 +150,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 3ca67f8157..d3d12a9d19 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -351,6 +351,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Nov 12 00:33:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Nov 2020 00:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.25445.53197 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kd0Y5-0007BW-Ab; Thu, 12 Nov 2020 00:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 25445.53197; Thu, 12 Nov 2020 00:33:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kd0Y5-0007BG-6c; Thu, 12 Nov 2020 00:33:13 +0000
Received: by outflank-mailman (input) for mailman id 25445;
 Thu, 12 Nov 2020 00:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kd0Y4-0007B7-3K
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kd0Y4-00056O-2e
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kd0Y4-0007B7-3K
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kd0Y4-00056O-2e
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kd0Y4-00056O-2e@xenbits.xenproject.org>
Date: Thu, 12 Nov 2020 00:33:12 +0000

commit 33483f81edb9ab4d05fcd136ee6ccdd22d7ba612
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:56 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 35 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 875ac39d30..8c969197aa 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -208,6 +208,25 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = msrs->misc_features_enables.raw;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -305,6 +324,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
@@ -411,6 +431,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 42258c6bf1..6dc4f92a84 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -776,12 +776,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1026,14 +1020,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index d6e27fc4b8..8bb5bd7b38 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1057,6 +1057,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 #define CPUPOOLID_NONE    -1
 
 struct cpupool *cpupool_get_by_id(int poolid);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Nov 12 00:33:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Nov 2020 00:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.25446.53200 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kd0YF-0007DV-BG; Thu, 12 Nov 2020 00:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 25446.53200; Thu, 12 Nov 2020 00:33:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kd0YF-0007DN-8A; Thu, 12 Nov 2020 00:33:23 +0000
Received: by outflank-mailman (input) for mailman id 25446;
 Thu, 12 Nov 2020 00:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kd0YE-0007DD-6U
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kd0YE-00057G-5Q
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kd0YE-0007DD-6U
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kd0YE-00057G-5Q
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 00:33:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kd0YE-00057G-5Q@xenbits.xenproject.org>
Date: Thu, 12 Nov 2020 00:33:22 +0000

commit d4c0483c0b87768cd9b95542e98111e4c098d57f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:56 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 8c969197aa..8ab6949a8e 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -152,11 +152,20 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
     case MSR_AMD64_LWP_CFG:
     case MSR_AMD64_LWP_CBADDR:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -330,11 +339,20 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
     case MSR_AMD64_LWP_CFG:
     case MSR_AMD64_LWP_CBADDR:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 0eb6855614..ba9e90af21 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -96,6 +96,38 @@
 /* Lower 6 bits define the format of the address in the LBR stack */
 #define MSR_IA32_PERF_CAP_LBR_FORMAT	0x3f
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT		0x00000606
+
+#define MSR_PKG_POWER_LIMIT		0x00000610
+#define MSR_PKG_ENERGY_STATUS		0x00000611
+#define MSR_PKG_PERF_STATUS		0x00000613
+#define MSR_PKG_POWER_INFO		0x00000614
+
+#define MSR_DRAM_POWER_LIMIT		0x00000618
+#define MSR_DRAM_ENERGY_STATUS		0x00000619
+#define MSR_DRAM_PERF_STATUS		0x0000061b
+#define MSR_DRAM_POWER_INFO		0x0000061c
+
+#define MSR_PP0_POWER_LIMIT		0x00000638
+#define MSR_PP0_ENERGY_STATUS		0x00000639
+#define MSR_PP0_POLICY			0x0000063a
+
+#define MSR_PP1_POWER_LIMIT		0x00000640
+#define MSR_PP1_ENERGY_STATUS		0x00000641
+#define MSR_PP1_POLICY			0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER	0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065c
+
 #define MSR_IA32_BNDCFGS		0x00000d90
 #define IA32_BNDCFGS_ENABLE		0x00000001
 #define IA32_BNDCFGS_PRESERVE		0x00000002
@@ -236,6 +268,8 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_F15H_CU_POWER		0xc001007a
+#define MSR_F15H_CU_MAX_POWER		0xc001007b
 #define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
 #define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
 #define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
@@ -249,6 +283,10 @@
 #define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
 #define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
 
+#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS	0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
+
 #define MSR_AMD_L7S0_FEATURE_MASK	0xc0011002
 #define MSR_AMD_THRM_FEATURE_MASK	0xc0011003
 #define MSR_K8_FEATURE_MASK		0xc0011004
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Nov 12 23:00:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Nov 2020 23:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26111.54259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdLZS-0007t4-Q6; Thu, 12 Nov 2020 23:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26111.54259; Thu, 12 Nov 2020 23: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdLZS-0007sR-MQ; Thu, 12 Nov 2020 23:00:02 +0000
Received: by outflank-mailman (input) for mailman id 26111;
 Thu, 12 Nov 2020 23:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdLZS-0007oL-7c
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdLZS-0005kT-32
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdLZS-0007oL-7c
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdLZS-0005kT-32
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.11] xen/arm: Always trap AMU system registers
Message-Id: <E1kdLZS-0005kT-32@xenbits.xenproject.org>
Date: Thu, 12 Nov 2020 23:00:02 +0000

commit 65fad0a426db082fa4989b7c4567438bfa93b596
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:37 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index e930585ad6..c12010a722 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -179,7 +179,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /* Setup hypervisor traps */
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 222a02dd99..5755cc6434 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -291,6 +291,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Thu Nov 12 23:00:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Nov 2020 23:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26112.54262 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdLZc-0008Pn-R7; Thu, 12 Nov 2020 23:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26112.54262; Thu, 12 Nov 2020 23: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdLZc-0008Pf-OA; Thu, 12 Nov 2020 23:00:12 +0000
Received: by outflank-mailman (input) for mailman id 26112;
 Thu, 12 Nov 2020 23:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdLZc-0008Pa-Bo
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdLZc-0005mJ-AC
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdLZc-0008Pa-Bo
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdLZc-0005mJ-AC
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.11] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kdLZc-0005mJ-AC@xenbits.xenproject.org>
Date: Thu, 12 Nov 2020 23:00:12 +0000

commit 3b5de119f0399cbe745502cb6ebd5e6633cc139c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:37 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 36 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 256e58d82b..3495ac9f4a 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -141,6 +141,7 @@ int init_vcpu_msr_policy(struct vcpu *v)
 
 int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
 {
+    const struct domain *d = v->domain;
     const struct cpuid_policy *cp = v->domain->arch.cpuid;
     const struct msr_domain_policy *dp = v->domain->arch.msr;
     const struct msr_vcpu_policy *vp = v->arch.msr;
@@ -211,6 +212,25 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
                _MSR_MISC_FEATURES_CPUID_FAULTING;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
         /*
          * TODO: Implement when we have better topology representation.
     case MSR_INTEL_CORE_THREAD_COUNT:
@@ -241,6 +261,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
@@ -345,6 +366,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 8120ded330..755f00db33 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -816,12 +816,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1096,14 +1090,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index c0cc5d9336..7e4ad5d51b 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -920,6 +920,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 #define CPUPOOLID_NONE    -1
 
 struct cpupool *cpupool_get_by_id(int poolid);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Thu Nov 12 23:00:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Nov 2020 23:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26113.54266 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdLZn-0008R5-Sj; Thu, 12 Nov 2020 23:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26113.54266; Thu, 12 Nov 2020 23:00:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdLZn-0008Qx-Pq; Thu, 12 Nov 2020 23:00:23 +0000
Received: by outflank-mailman (input) for mailman id 26113;
 Thu, 12 Nov 2020 23:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdLZm-0008Qn-Ef
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdLZm-0005n7-Dv
 for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdLZm-0008Qn-Ef
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdLZm-0005n7-Dv
	for xen-changelog@lists.xenproject.org; Thu, 12 Nov 2020 23:00:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.11] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kdLZm-0005n7-Dv@xenbits.xenproject.org>
Date: Thu, 12 Nov 2020 23:00:22 +0000

commit 1447d449fab7e48c85faf83951842bb60d7dabe5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:50:37 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 3495ac9f4a..99c848ff41 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -156,6 +156,15 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
@@ -266,6 +275,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_FORCE_ABORT:
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
         /* Not offered to guests. */
         goto gp_fault;
 
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 480d1d8102..a685dcdcca 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -96,6 +96,38 @@
 /* Lower 6 bits define the format of the address in the LBR stack */
 #define MSR_IA32_PERF_CAP_LBR_FORMAT	0x3f
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT		0x00000606
+
+#define MSR_PKG_POWER_LIMIT		0x00000610
+#define MSR_PKG_ENERGY_STATUS		0x00000611
+#define MSR_PKG_PERF_STATUS		0x00000613
+#define MSR_PKG_POWER_INFO		0x00000614
+
+#define MSR_DRAM_POWER_LIMIT		0x00000618
+#define MSR_DRAM_ENERGY_STATUS		0x00000619
+#define MSR_DRAM_PERF_STATUS		0x0000061b
+#define MSR_DRAM_POWER_INFO		0x0000061c
+
+#define MSR_PP0_POWER_LIMIT		0x00000638
+#define MSR_PP0_ENERGY_STATUS		0x00000639
+#define MSR_PP0_POLICY			0x0000063a
+
+#define MSR_PP1_POWER_LIMIT		0x00000640
+#define MSR_PP1_ENERGY_STATUS		0x00000641
+#define MSR_PP1_POLICY			0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER	0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT	0x0000065c
+
 #define MSR_IA32_BNDCFGS		0x00000d90
 #define IA32_BNDCFGS_ENABLE		0x00000001
 #define IA32_BNDCFGS_PRESERVE		0x00000002
@@ -218,6 +250,8 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_F15H_CU_POWER		0xc001007a
+#define MSR_F15H_CU_MAX_POWER		0xc001007b
 #define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
 #define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
 #define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
@@ -231,6 +265,10 @@
 #define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
 #define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
 
+#define MSR_AMD_RAPL_POWER_UNIT		0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS	0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS	0xc001029b
+
 #define MSR_AMD_L7S0_FEATURE_MASK	0xc0011002
 #define MSR_AMD_THRM_FEATURE_MASK	0xc0011003
 #define MSR_K8_FEATURE_MASK		0xc0011004
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:33:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26427.54782 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKC-0001bT-Fn; Fri, 13 Nov 2020 11:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26427.54782; Fri, 13 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKC-0001bH-C8; Fri, 13 Nov 2020 11:33:04 +0000
Received: by outflank-mailman (input) for mailman id 26427;
 Fri, 13 Nov 2020 11:33:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKA-0001b4-Uw
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKA-0005Gx-S8
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKA-0001b4-Uw
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKA-0005Gx-S8
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] libxl: workaround gcc 10.2 maybe-uninitialized warning
Message-Id: <E1kdXKA-0005Gx-S8@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:33:02 +0000

commit 71a12a97988c516a17aba40bb5df9274133e9e92
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:35 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:13:34 2020 +0000

    libxl: workaround gcc 10.2 maybe-uninitialized warning
    
    It seems xlu_pci_parse_bdf has a state machine that is too complex for
    gcc to understand. The build fails with:
    
        libxlu_pci.c: In function 'xlu_pci_parse_bdf':
        libxlu_pci.c:32:18: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           32 |     pcidev->func = func;
              |     ~~~~~~~~~~~~~^~~~~~
        libxlu_pci.c:51:29: note: 'func' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                             ^~~~
        libxlu_pci.c:31:17: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           31 |     pcidev->dev = dev;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:24: note: 'dev' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                        ^~~
        libxlu_pci.c:30:17: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           30 |     pcidev->bus = bus;
              |     ~~~~~~~~~~~~^~~~~
        libxlu_pci.c:51:19: note: 'bus' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |                   ^~~
        libxlu_pci.c:29:20: error: 'dom' may be used uninitialized in this function [-Werror=maybe-uninitialized]
           29 |     pcidev->domain = domain;
              |     ~~~~~~~~~~~~~~~^~~~~~~~
        libxlu_pci.c:51:14: note: 'dom' was declared here
           51 |     unsigned dom, bus, dev, func, vslot = 0;
              |              ^~~
        cc1: all warnings being treated as errors
    
    Workaround it by setting the initial value to invalid value (0xffffffff)
    and then assert on each value being set. This way we mute the gcc
    warning, while still detecting bugs in the parse code.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit d25cc3ec93ebda030349045d2c7fa14ffde07ed7)
---
 tools/libxl/libxlu_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libxl/libxlu_pci.c b/tools/libxl/libxlu_pci.c
index 7947687661..e2709c5f89 100644
--- a/tools/libxl/libxlu_pci.c
+++ b/tools/libxl/libxlu_pci.c
@@ -45,10 +45,11 @@ static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
 #define STATE_TYPE      9
 #define STATE_RDM_STRATEGY      10
 #define STATE_RESERVE_POLICY    11
+#define INVALID         0xffffffff
 int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
 {
     unsigned state = STATE_DOMAIN;
-    unsigned dom, bus, dev, func, vslot = 0;
+    unsigned dom = INVALID, bus = INVALID, dev = INVALID, func = INVALID, vslot = 0;
     char *buf2, *tok, *ptr, *end, *optkey = NULL;
 
     if ( NULL == (buf2 = ptr = strdup(str)) )
@@ -170,6 +171,8 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str
     if ( tok != ptr || state != STATE_TERMINAL )
         goto parse_error;
 
+    assert(dom != INVALID && bus != INVALID && dev != INVALID && func != INVALID);
+
     /* Just a pretty way to fill in the values */
     pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26428.54785 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKM-0001eT-GU; Fri, 13 Nov 2020 11:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26428.54785; Fri, 13 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKM-0001eL-Dg; Fri, 13 Nov 2020 11:33:14 +0000
Received: by outflank-mailman (input) for mailman id 26428;
 Fri, 13 Nov 2020 11:33:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKL-0001eA-1W
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKL-0005Hp-0m
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKL-0001eA-1W
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKL-0005Hp-0m
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
Message-Id: <E1kdXKL-0005Hp-0m@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:33:13 +0000

commit f728b2d69f426258f37709de9efac5245a597d0d
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Aug 19 04:00:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:13:39 2020 +0000

    libxl: fix -Werror=stringop-truncation in libxl__prepare_sockaddr_un
    
    In file included from /usr/include/string.h:495,
                     from libxl_internal.h:38,
                     from libxl_utils.c:20:
    In function 'strncpy',
        inlined from 'libxl__prepare_sockaddr_un' at libxl_utils.c:1262:5:
    /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit fff1b7f50e75ad9535c86f3fcf425b4945c50a1c)
---
 tools/libxl/libxl_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index f360f5e228..b039143b8a 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -1252,14 +1252,14 @@ int libxl__prepare_sockaddr_un(libxl__gc *gc,
                                struct sockaddr_un *un, const char *path,
                                const char *what)
 {
-    if (sizeof(un->sun_path) <= strlen(path)) {
+    if (sizeof(un->sun_path) - 1 <= strlen(path)) {
         LOG(ERROR, "UNIX socket path '%s' is too long for %s", path, what);
-        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path));
+        LOG(DEBUG, "Path must be less than %zu bytes", sizeof(un->sun_path) - 1);
         return ERROR_INVAL;
     }
     memset(un, 0, sizeof(struct sockaddr_un));
     un->sun_family = AF_UNIX;
-    strncpy(un->sun_path, path, sizeof(un->sun_path));
+    strncpy(un->sun_path, path, sizeof(un->sun_path) - 1);
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:33:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26429.54789 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKW-0001ft-J7; Fri, 13 Nov 2020 11:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26429.54789; Fri, 13 Nov 2020 11:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKW-0001fj-FB; Fri, 13 Nov 2020 11:33:24 +0000
Received: by outflank-mailman (input) for mailman id 26429;
 Fri, 13 Nov 2020 11:33:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKV-0001fY-4G
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKV-0005J5-3a
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKV-0001fY-4G
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKV-0005J5-3a
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] tools/xenpmd: Fix gcc10 snprintf warning
Message-Id: <E1kdXKV-0005J5-3a@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:33:23 +0000

commit 1f9f1cb3a0216a7d41ded3090b4bb2735cc8a8e6
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Oct 15 10:16:09 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:14:23 2020 +0000

    tools/xenpmd: Fix gcc10 snprintf warning
    
    Add a check for snprintf return code and ignore the entry if we get an
    error. This should in fact never happen and is more a trick to make gcc
    happy and prevent compilation errors.
    
    This is solving the following gcc warning when compiling for arm32 host
    platforms with optimization activated:
    xenpmd.c:92:37: error: '%s' directive output may be truncated writing
    between 4 and 2147483645 bytes into a region of size 271
    [-Werror=format-truncation=]
    
    This is also solving the following Debian bug:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970802
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0dfddb2116e3757f77a691a3fe335173088d69dc)
---
 tools/xenpmd/xenpmd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 1c801caa71..50679efa3f 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -102,6 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
     FILE *file = 0;
     struct dirent *dir_entries;
     char file_name[284];
+    int ret;
     
     do 
     {
@@ -111,11 +112,15 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
                      dir_entries->d_name);
+        /* This should not happen but is needed to pass gcc checks */
+        if (ret < 0)
+            continue;
+        file_name[sizeof(file_name) - 1] = '\0';
         file = fopen(file_name, "r");
     } while ( !file );
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:33:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26432.54793 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKg-0001hs-LN; Fri, 13 Nov 2020 11:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26432.54793; Fri, 13 Nov 2020 11:33:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKg-0001hk-IQ; Fri, 13 Nov 2020 11:33:34 +0000
Received: by outflank-mailman (input) for mailman id 26432;
 Fri, 13 Nov 2020 11:33:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKf-0001hb-7S
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKf-0005K7-6X
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKf-0001hb-7S
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKf-0005K7-6X
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
Message-Id: <E1kdXKf-0005K7-6X@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:33:33 +0000

commit 59b83663f925092f60f699147390c6cb77b55e43
Author:     David Woodhouse <dwmw@amazon.co.uk>
AuthorDate: Thu Mar 19 20:40:24 2020 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:16:20 2020 +0000

    tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating
    
    The do_ls() function has somewhat inconsistent handling of errors.
    
    If reading the node's contents with xs_read() fails, then do_ls() will
    just quietly not display the contents.
    
    If reading the node's permissions with xs_get_permissions() fails, then
    do_ls() will print a warning, continue, and ultimately won't exit with
    an error code (unless another error happens).
    
    If recursing into the node with xs_directory() fails, then do_ls() will
    abort immediately, not printing any further nodes.
    
    For persistent failure modes — such as ENOENT because a node has been
    removed, or EACCES because it has had its permisions changed since the
    xs_directory() on the parent directory returned its name — it's
    obviously quite likely that if either of the first two errors occur for
    a given node, then so will the third and thus xenstore-ls will abort.
    
    The ENOENT one is actually a fairly common case, and has caused tools to
    fail to clean up a network device because it *apparently* already
    doesn't exist in xenstore.
    
    There is a school of thought that says, "Well, xenstore-ls returned an
    error. So the tools should not trust its output."
    
    The natural corollary of this would surely be that the tools must re-run
    xenstore-ls as many times as is necessary until its manages to exit
    without hitting the race condition. I am not keen on that conclusion.
    
    For the specific case of ENOENT it seems reasonable to declare that,
    but for the timing, we might as well just not have seen that node at
    all when calling xs_directory() for the parent. By ignoring the error,
    we give acceptable output.
    
    The issue can be reproduced as follows:
    
    (dom0) # for a in `seq 1 1000` ; do
                  xenstore-write /local/domain/2/foo/$a $a ;
             done
    
    Now simultaneously:
    
    (dom0) # for a in `seq 1 999` ; do
                  xenstore-rm /local/domain/2/foo/$a ;
             done
    (dom2) # while true ; do
                  ./xenstore-ls -p /local/domain/2/foo | grep -c 1000 ;
             done
    
    We should expect to see node 1000 in the output, every time.
    
    Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    (cherry picked from commit beb105af19cc3e58e2ed49224cfe190a736e5fa0)
---
 tools/xenstore/xenstore_client.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 3afc630ab8..ae7ed3eb9e 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -148,14 +148,20 @@ static void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms
     int i;
     unsigned int num, len;
 
+    e = xs_directory(h, XBT_NULL, path, &num);
+    if (e == NULL) {
+        if (cur_depth && errno == ENOENT) {
+            /* If a node disappears while recursing, silently move on. */
+            return;
+        }
+
+        err(1, "xs_directory (%s)", path);
+    }
+
     newpath = malloc(STRING_MAX);
     if (!newpath)
       err(1, "malloc in do_ls");
 
-    e = xs_directory(h, XBT_NULL, path, &num);
-    if (e == NULL)
-        err(1, "xs_directory (%s)", path);
-
     for (i = 0; i<num; i++) {
         char buf[MAX_STRLEN(unsigned int)+1];
         struct xs_permissions *perms;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:33:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26434.54801 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKq-0001jR-RI; Fri, 13 Nov 2020 11:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26434.54801; Fri, 13 Nov 2020 11:33:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXKq-0001jA-LQ; Fri, 13 Nov 2020 11:33:44 +0000
Received: by outflank-mailman (input) for mailman id 26434;
 Fri, 13 Nov 2020 11:33:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKp-0001ip-BJ
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKp-0005LC-9d
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKp-0001ip-BJ
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKp-0005LC-9d
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] tools/libs/stat: fix broken build
Message-Id: <E1kdXKp-0005LC-9d@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:33:43 +0000

commit 7398a44e8636c99f6b06fb16d05a64ee06980d10
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Sep 12 15:08:36 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:45:32 2020 +0000

    tools/libs/stat: fix broken build
    
    Making getBridge() static triggered a build error with some gcc versions:
    
    error: 'strncpy' output may be truncated copying 15 bytes from a string of
    length 255 [-Werror=stringop-truncation]
    
    Fix that by using a buffer with 256 bytes instead.
    
    Fixes: 6d0ec053907794 ("tools: split libxenstat into new tools/libs/stat directory")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit c8099e48c3dbb8c7399551a265756ecf354eece2)
---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 7530349eee..0274dc4d07 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -78,7 +78,7 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 				sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
 
 				if (access(tmp, F_OK) == 0) {
-					strncpy(result, de->d_name, resultLen - 1);
+					strncpy(result, de->d_name, resultLen);
 					result[resultLen - 1] = 0;
 				}
 		}
@@ -264,7 +264,7 @@ int xenstat_collect_networks(xenstat_node * node)
 {
 	/* Helper variables for parseNetDevLine() function defined above */
 	int i;
-	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[16] = { 0 }, devNoBridge[17] = { 0 };
+	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[256] = { 0 }, devNoBridge[257] = { 0 };
 	unsigned long long rxBytes, rxPackets, rxErrs, rxDrops, txBytes, txPackets, txErrs, txDrops;
 
 	struct priv_data *priv = get_priv_data(node->handle);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:33:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26435.54804 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXL0-0001lf-RK; Fri, 13 Nov 2020 11:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26435.54804; Fri, 13 Nov 2020 11:33:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXL0-0001lX-OB; Fri, 13 Nov 2020 11:33:54 +0000
Received: by outflank-mailman (input) for mailman id 26435;
 Fri, 13 Nov 2020 11:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKz-0001lH-E3
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXKz-0005Lu-DS
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKz-0001lH-E3
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXKz-0005Lu-DS
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:33:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] tools/libxc: report malloc errors in writev_exact
Message-Id: <E1kdXKz-0005Lu-DS@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:33:53 +0000

commit 89ae1b185a193fea8e86840c48a2711f04042415
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Wed Sep 23 08:48:40 2020 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:45:32 2020 +0000

    tools/libxc: report malloc errors in writev_exact
    
    The caller of writev_exact should be notified about malloc errors
    when dealing with partial writes.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0d8d289af7a679c028462c4ed5d98586f9ef9648)
---
 tools/libxc/xc_private.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 90974d572e..13a2c723c1 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -722,6 +722,7 @@ int writev_exact(int fd, const struct iovec *iov, int iovcnt)
                     if ( !local_iov )
                     {
                         saved_errno = ENOMEM;
+                        rc = -1;
                         goto out;
                     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:34:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26437.54809 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLA-0001nI-Se; Fri, 13 Nov 2020 11:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26437.54809; Fri, 13 Nov 2020 11:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLA-0001nB-Pi; Fri, 13 Nov 2020 11:34:04 +0000
Received: by outflank-mailman (input) for mailman id 26437;
 Fri, 13 Nov 2020 11:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXL9-0001my-Gz
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXL9-0005Ml-GF
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXL9-0001my-Gz
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXL9-0005Ml-GF
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] tool/libs/light: Fix libxenlight gcc warning
Message-Id: <E1kdXL9-0005Ml-GF@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:34:03 +0000

commit 78a53f0ee04bfd14dc21dabd3a0d79343c3b642f
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:02 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:45:32 2020 +0000

    tool/libs/light: Fix libxenlight gcc warning
    
    Fix gcc10 compilation warning about uninitialized variable by setting
    it to 0.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 0241809bf838875615797f52af34222e5ab8e98f)
---
 tools/libxl/libxl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c
index e52a9624ea..c739d00f39 100644
--- a/tools/libxl/libxl_mem.c
+++ b/tools/libxl/libxl_mem.c
@@ -562,7 +562,7 @@ out:
 
 int libxl_get_free_memory_0x040700(libxl_ctx *ctx, uint32_t *memkb)
 {
-    uint64_t my_memkb;
+    uint64_t my_memkb = 0;
     int rc;
 
     rc = libxl_get_free_memory(ctx, &my_memkb);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:34:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26438.54813 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLK-0001pD-Uc; Fri, 13 Nov 2020 11:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26438.54813; Fri, 13 Nov 2020 11:34:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLK-0001p5-RN; Fri, 13 Nov 2020 11:34:14 +0000
Received: by outflank-mailman (input) for mailman id 26438;
 Fri, 13 Nov 2020 11:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXLJ-0001ow-Jh
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXLJ-0005PX-J4
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXLJ-0001ow-Jh
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXLJ-0005PX-J4
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] tools/libs/stat: use memcpy instead of strncpy in getBridge
Message-Id: <E1kdXLJ-0005PX-J4@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:34:13 +0000

commit a38060ece699f22cd317219bec53c0d27279155b
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 7 14:57:01 2020 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 9 17:45:32 2020 +0000

    tools/libs/stat: use memcpy instead of strncpy in getBridge
    
    Use memcpy in getBridge to prevent gcc warnings about truncated
    strings. We know that we might truncate it, so the gcc warning
    here is wrong.
    Revert previous change changing buffer sizes as bigger buffers
    are not needed.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Wei Liu <wl@xen.org>
    (cherry picked from commit 40fe714ca4245a9716264fcb3ee8df42c3650cf6)
---
 tools/xenstat/libxenstat/src/xenstat_linux.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/xenstat/libxenstat/src/xenstat_linux.c b/tools/xenstat/libxenstat/src/xenstat_linux.c
index 0274dc4d07..9c0cb277c5 100644
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <regex.h>
+#include <xen-tools/libs.h>
 
 #include "xenstat_priv.h"
 
@@ -78,8 +79,14 @@ void getBridge(char *excludeName, char *result, size_t resultLen)
 				sprintf(tmp, "/sys/class/net/%s/bridge", de->d_name);
 
 				if (access(tmp, F_OK) == 0) {
-					strncpy(result, de->d_name, resultLen);
-					result[resultLen - 1] = 0;
+					/*
+					 * Do not use strncpy to prevent compiler warning with
+					 * gcc >= 10.0
+					 * If de->d_name is longer then resultLen we truncate it
+					 */
+					memset(result, 0, resultLen);
+					memcpy(result, de->d_name, MIN(strnlen(de->d_name,
+									NAME_MAX),resultLen - 1));
 				}
 		}
 	}
@@ -264,7 +271,7 @@ int xenstat_collect_networks(xenstat_node * node)
 {
 	/* Helper variables for parseNetDevLine() function defined above */
 	int i;
-	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[256] = { 0 }, devNoBridge[257] = { 0 };
+	char line[512] = { 0 }, iface[16] = { 0 }, devBridge[16] = { 0 }, devNoBridge[17] = { 0 };
 	unsigned long long rxBytes, rxPackets, rxErrs, rxDrops, txBytes, txPackets, txErrs, txDrops;
 
 	struct priv_data *priv = get_priv_data(node->handle);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:34:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:34:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26439.54816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLU-0001qV-W4; Fri, 13 Nov 2020 11:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26439.54816; Fri, 13 Nov 2020 11:34:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLU-0001qN-T6; Fri, 13 Nov 2020 11:34:24 +0000
Received: by outflank-mailman (input) for mailman id 26439;
 Fri, 13 Nov 2020 11:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXLT-0001qC-OA
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXLT-0005Qd-NT
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXLT-0001qC-OA
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXLT-0005Qd-NT
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] xen/arm: Always trap AMU system registers
Message-Id: <E1kdXLT-0005Qd-NT@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:34:23 +0000

commit 73a09279de197c509a241ec20fa18c481c8503b2
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:13 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    (cherry picked from commit 628e1becb6fb121475a6ce68e3f1cb4499851255)
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 8f40d0e0b6..2197df2099 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -151,7 +151,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 3ca67f8157..d3d12a9d19 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -351,6 +351,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:34:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:34:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26441.54822 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLf-0001rw-21; Fri, 13 Nov 2020 11:34:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26441.54822; Fri, 13 Nov 2020 11:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLe-0001rm-Ud; Fri, 13 Nov 2020 11:34:34 +0000
Received: by outflank-mailman (input) for mailman id 26441;
 Fri, 13 Nov 2020 11:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXLd-0001rY-R8
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXLd-0005Rh-QN
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXLd-0001rY-R8
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXLd-0005Rh-QN
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kdXLd-0005Rh-QN@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:34:33 +0000

commit d95f45073cac2d49c4fd439653b632010ad6c6bb
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:29 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 3059178798a23ba870ff86ff54d442a07e6651fc)
---
 xen/arch/x86/msr.c             | 35 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 51 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index d72ab0fa1f..3db26faf08 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -245,6 +245,25 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = msrs->misc_features_enables.raw;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -343,6 +362,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_INTEL_CORE_THREAD_COUNT:
     case MSR_INTEL_PLATFORM_INFO:
     case MSR_ARCH_CAPABILITIES:
+    case MSR_IA32_PERF_STATUS:
         /* Read-only */
     case MSR_TEST_CTRL:
     case MSR_TSX_FORCE_ABORT:
@@ -454,6 +474,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 85a9fd4767..5c7b9117ae 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -820,12 +820,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static int read_msr(unsigned int reg, uint64_t *val,
                     struct x86_emulate_ctxt *ctxt)
 {
@@ -1070,14 +1064,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index a0d87ef9d0..97ba8e0795 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1071,6 +1071,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 int cpupool_move_domain(struct domain *d, struct cpupool *c);
 int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op);
 int cpupool_get_id(const struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 13 11:34:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Nov 2020 11:34:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.26442.54825 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLq-0001tH-3d; Fri, 13 Nov 2020 11:34:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 26442.54825; Fri, 13 Nov 2020 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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdXLp-0001t9-WF; Fri, 13 Nov 2020 11:34:46 +0000
Received: by outflank-mailman (input) for mailman id 26442;
 Fri, 13 Nov 2020 11:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXLn-0001st-UU
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdXLn-0005T4-TH
 for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXLn-0001st-UU
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdXLn-0005T4-TH
	for xen-changelog@lists.xenproject.org; Fri, 13 Nov 2020 11:34:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/msr: Disallow guest access to the RAPL MSRs
Message-Id: <E1kdXLn-0005T4-TH@xenbits.xenproject.org>
Date: Fri, 13 Nov 2020 11:34:43 +0000

commit d101b417b784a26326fc7800a79cc539ba570b79
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 23 13:05:46 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 17:43:29 2020 +0000

    x86/msr: Disallow guest access to the RAPL MSRs
    
    Researchers have demonstrated using the RAPL interface to perform a
    differential power analysis attack to recover AES keys used by other cores in
    the system.
    
    Furthermore, even privileged guests cannot use this interface correctly, due
    to MSR scope and vcpu scheduling issues.  The interface would want to be
    paravirtualised to be used sensibly.
    
    Disallow access to the RAPL MSRs completely, as well as other MSRs which
    potentially access fine grain power information.
    
    This is part of XSA-351.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c              | 18 ++++++++++++++++++
 xen/include/asm-x86/msr-index.h | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 3db26faf08..aa107823ac 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -185,6 +185,13 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -192,6 +199,8 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
     case MSR_AMD64_LWP_CBADDR:
     case MSR_PPIN_CTL:
     case MSR_PPIN:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
     case MSR_AMD_PPIN_CTL:
     case MSR_AMD_PPIN:
         /* Not offered to guests. */
@@ -369,6 +378,13 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_TSX_CTRL:
     case MSR_MCU_OPT_CTRL:
     case MSR_RTIT_OUTPUT_BASE ... MSR_RTIT_ADDR_B(7):
+    case MSR_RAPL_POWER_UNIT:
+    case MSR_PKG_POWER_LIMIT  ... MSR_PKG_POWER_INFO:
+    case MSR_DRAM_POWER_LIMIT ... MSR_DRAM_POWER_INFO:
+    case MSR_PP0_POWER_LIMIT  ... MSR_PP0_POLICY:
+    case MSR_PP1_POWER_LIMIT  ... MSR_PP1_POLICY:
+    case MSR_PLATFORM_ENERGY_COUNTER:
+    case MSR_PLATFORM_POWER_LIMIT:
     case MSR_U_CET:
     case MSR_S_CET:
     case MSR_PL0_SSP ... MSR_INTERRUPT_SSP_TABLE:
@@ -376,6 +392,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
     case MSR_AMD64_LWP_CBADDR:
     case MSR_PPIN_CTL:
     case MSR_PPIN:
+    case MSR_F15H_CU_POWER ... MSR_F15H_CU_MAX_POWER:
+    case MSR_AMD_RAPL_POWER_UNIT ... MSR_AMD_PKG_ENERGY_STATUS:
     case MSR_AMD_PPIN_CTL:
     case MSR_AMD_PPIN:
         /* Not offered to guests. */
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 0fe98af923..5e64ecff91 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -77,6 +77,38 @@
 #define MSR_RTIT_ADDR_A(n)                 (0x00000580 + (n) * 2)
 #define MSR_RTIT_ADDR_B(n)                 (0x00000581 + (n) * 2)
 
+/*
+ * Intel Runtime Average Power Limiting (RAPL) interface.  Power plane base
+ * addresses (MSR_*_POWER_LIMIT) are model specific, but have so-far been
+ * consistent since their introduction in SandyBridge.
+ *
+ * Offsets of functionality from the power plane base is architectural, but
+ * not all power planes support all functionality.
+ */
+#define MSR_RAPL_POWER_UNIT                 0x00000606
+
+#define MSR_PKG_POWER_LIMIT                 0x00000610
+#define MSR_PKG_ENERGY_STATUS               0x00000611
+#define MSR_PKG_PERF_STATUS                 0x00000613
+#define MSR_PKG_POWER_INFO                  0x00000614
+
+#define MSR_DRAM_POWER_LIMIT                0x00000618
+#define MSR_DRAM_ENERGY_STATUS              0x00000619
+#define MSR_DRAM_PERF_STATUS                0x0000061b
+#define MSR_DRAM_POWER_INFO                 0x0000061c
+
+#define MSR_PP0_POWER_LIMIT                 0x00000638
+#define MSR_PP0_ENERGY_STATUS               0x00000639
+#define MSR_PP0_POLICY                      0x0000063a
+
+#define MSR_PP1_POWER_LIMIT                 0x00000640
+#define MSR_PP1_ENERGY_STATUS               0x00000641
+#define MSR_PP1_POLICY                      0x00000642
+
+/* Intel Platform-wide power interface. */
+#define MSR_PLATFORM_ENERGY_COUNTER         0x0000064d
+#define MSR_PLATFORM_POWER_LIMIT            0x0000065c
+
 #define MSR_U_CET                           0x000006a0
 #define MSR_S_CET                           0x000006a2
 #define  CET_SHSTK_EN                       (_AC(1, ULL) <<  0)
@@ -92,6 +124,13 @@
 #define  PASID_PASID_MASK                   0x000fffff
 #define  PASID_VALID                        (_AC(1, ULL) << 31)
 
+#define MSR_F15H_CU_POWER                   0xc001007a
+#define MSR_F15H_CU_MAX_POWER               0xc001007b
+
+#define MSR_AMD_RAPL_POWER_UNIT             0xc0010299
+#define MSR_AMD_CORE_ENERGY_STATUS          0xc001029a
+#define MSR_AMD_PKG_ENERGY_STATUS           0xc001029b
+
 /*
  * Legacy MSR constants in need of cleanup.  No new MSRs below this comment.
  */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:33:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27086.55801 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlN9-0008VW-OK; Sat, 14 Nov 2020 02:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27086.55801; Sat, 14 Nov 2020 02:33:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlN9-0008VN-LE; Sat, 14 Nov 2020 02:33:03 +0000
Received: by outflank-mailman (input) for mailman id 27086;
 Sat, 14 Nov 2020 02:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlN8-0008VI-Q1
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlN8-0002Um-Lj
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlN8-0008VI-Q1
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlN8-0002Um-Lj
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/python: pass more -rpath-link options to ld
Message-Id: <E1kdlN8-0002Um-Lj@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:33:02 +0000

commit 2b8314a3c354d04545700c80ff5a5f86799b79c7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 5 16:48:37 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 5 16:48:37 2020 +0100

    tools/python: pass more -rpath-link options to ld
    
    With the split of libraries, I've observed a number of warnings from
    (old?) ld.
    
    Instead of duplicating the additions in two places, introduce a setup.py
    make variable holding all the common parts of the invocations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/python/Makefile | 14 ++++++++------
 tools/python/setup.py |  7 ++++++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/tools/python/Makefile b/tools/python/Makefile
index 5e555acf1c..cc76423647 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -8,19 +8,21 @@ PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
 PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS)
 INSTALL_LOG = build/installed_files.txt
 
+setup.py = CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" \
+           SHLIB_libxenctrl="$(SHLIB_libxenctrl)" \
+           SHLIB_libxenguest="$(SHLIB_libxenguest)" \
+           SHLIB_libxenstore="$(SHLIB_libxenstore)" \
+           $(PYTHON) setup.py
+
 .PHONY: build
 build:
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
+	$(setup.py) build
 
 .PHONY: install
 install:
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \
-		LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \
-		--record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
+	$(setup.py) install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
 		--root="$(DESTDIR)" --force
-
 	$(INSTALL_PYTHON_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PYTHON_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
 
diff --git a/tools/python/setup.py b/tools/python/setup.py
index 1afe800479..8c95db7769 100644
--- a/tools/python/setup.py
+++ b/tools/python/setup.py
@@ -4,6 +4,10 @@ import os, sys
 
 XEN_ROOT = "../.."
 
+SHLIB_libxenctrl = os.environ['SHLIB_libxenctrl'].split()
+SHLIB_libxenguest = os.environ['SHLIB_libxenguest'].split()
+SHLIB_libxenstore = os.environ['SHLIB_libxenstore'].split()
+
 extra_compile_args  = [ "-fno-strict-aliasing", "-Werror" ]
 
 PATH_XEN      = XEN_ROOT + "/tools/include"
@@ -24,7 +28,7 @@ xc = Extension("xc",
                library_dirs       = [ PATH_LIBXENCTRL, PATH_LIBXENGUEST ],
                libraries          = [ "xenctrl", "xenguest" ],
                depends            = [ PATH_LIBXENCTRL + "/libxenctrl.so", PATH_LIBXENGUEST + "/libxenguest.so" ],
-               extra_link_args    = [ "-Wl,-rpath-link="+PATH_LIBXENTOOLLOG ],
+               extra_link_args    = SHLIB_libxenctrl + SHLIB_libxenguest,
                sources            = [ "xen/lowlevel/xc/xc.c" ])
 
 xs = Extension("xs",
@@ -33,6 +37,7 @@ xs = Extension("xs",
                library_dirs       = [ PATH_XENSTORE ],
                libraries          = [ "xenstore" ],
                depends            = [ PATH_XENSTORE + "/libxenstore.so" ],
+               extra_link_args    = SHLIB_libxenstore,
                sources            = [ "xen/lowlevel/xs/xs.c" ])
 
 plat = os.uname()[0]
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:33:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27087.55805 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNJ-00006W-Pm; Sat, 14 Nov 2020 02:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27087.55805; Sat, 14 Nov 2020 02:33:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNJ-00006O-Mn; Sat, 14 Nov 2020 02:33:13 +0000
Received: by outflank-mailman (input) for mailman id 27087;
 Sat, 14 Nov 2020 02:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNI-00006G-T3
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNI-0002Ve-SD
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNI-00006G-T3
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNI-0002Ve-SD
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: fix libacpi dependency
Message-Id: <E1kdlNI-0002Ve-SD@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:33:12 +0000

commit e006b2e3be72e502b86bd9e1405417abd87bdfed
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 5 16:48:55 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 5 16:48:55 2020 +0100

    libxl: fix libacpi dependency
    
    $(DSDT_FILES-y) depends on the recursive make to have run in libacpi/
    such that the file(s) itself/themselves were generated before
    compilation gets attempted. The same, however, is also necessary for
    generated headers, before source files including them would get
    attempted to be compiled.
    
    The dependency specified in libacpi's Makefile, otoh, is entirely
    pointless nowadays - no compilation happens there anymore (except for
    tools involved in building the generated files). Together with it, the
    rule generating acpi.a also can go away.
    
    Reported-by: Olaf Hering <olaf@aepfle.de>
    Fixes: 14c0d328da2b ("libxl/acpi: Build ACPI tables for HVMlite guests")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libacpi/Makefile    | 5 -----
 tools/libs/light/Makefile | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index c17f3924cc..2448687dbb 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -89,11 +89,6 @@ iasl:
 	@echo 
 	@exit 1
 
-build.o: ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h ssdt_laptop_slate.h
-
-acpi.a: $(OBJS)
-	$(AR) rc $@ $(OBJS)
-
 clean:
 	rm -f $(C_SRC) $(H_SRC) $(MK_DSDT) $(C_SRC:=.$(TMP_SUFFIX))
 	rm -f $(patsubst %.c,%.hex,$(C_SRC)) $(patsubst %.c,%.aml,$(C_SRC)) $(patsubst %.c,%.asl,$(C_SRC))
diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 3424fdb61b..68f6fa315f 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -32,7 +32,7 @@ ACPI_PATH  = $(XEN_ROOT)/tools/libacpi
 DSDT_FILES-$(CONFIG_X86) = dsdt_pvh.c
 ACPI_OBJS  = $(patsubst %.c,%.o,$(DSDT_FILES-y)) build.o static_tables.o
 ACPI_PIC_OBJS = $(patsubst %.o,%.opic,$(ACPI_OBJS))
-$(DSDT_FILES-y): acpi
+$(DSDT_FILES-y) build.o: acpi
 vpath build.c $(ACPI_PATH)/
 vpath static_tables.c $(ACPI_PATH)/
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:33:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27088.55809 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNT-00008M-RF; Sat, 14 Nov 2020 02:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27088.55809; Sat, 14 Nov 2020 02:33:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNT-00008B-OI; Sat, 14 Nov 2020 02:33:23 +0000
Received: by outflank-mailman (input) for mailman id 27088;
 Sat, 14 Nov 2020 02:33:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNT-000084-0U
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNS-0002WU-VC
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNT-000084-0U
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNS-0002WU-VC
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: traps: Don't panic when receiving an unknown debug trap
Message-Id: <E1kdlNS-0002WU-VC@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:33:22 +0000

commit 957708c2d1ae25d7375abd5e5e70c3043d64f1f1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Nov 5 22:31:06 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 5 18:00:10 2020 -0800

    xen/arm: traps: Don't panic when receiving an unknown debug trap
    
    Even if debug trap are only meant for debugging purpose, it is quite
    harsh to crash Xen if one of the trap sent by the guest is not handled.
    
    So switch from a panic() to a printk().
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 8f40d0e0b6..a36f145e67 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1410,7 +1410,7 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
         show_execution_state(regs);
         break;
     default:
-        panic("DOM%d: Unhandled debug trap %#x\n", domid, code);
+        printk("DOM%d: Unhandled debug trap %#x\n", domid, code);
         break;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:33:33 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27090.55813 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNd-0000AL-Sj; Sat, 14 Nov 2020 02:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27090.55813; Sat, 14 Nov 2020 02:33:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNd-0000AC-Po; Sat, 14 Nov 2020 02:33:33 +0000
Received: by outflank-mailman (input) for mailman id 27090;
 Sat, 14 Nov 2020 02:33:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNd-0000A5-3R
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNd-0002XN-2e
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNd-0000A5-3R
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNd-0002XN-2e
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/locking: harmonize spinlocks and rwlocks regarding preemption
Message-Id: <E1kdlNd-0002XN-2e@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:33:33 +0000

commit c3453a23f7905d24f2404787543e26ec7d02301c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Nov 6 10:47:09 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 6 10:47:09 2020 +0100

    xen/locking: harmonize spinlocks and rwlocks regarding preemption
    
    Spinlocks and rwlocks behave differently in the try variants regarding
    preemption: rwlocks are switching preemption off before testing the
    lock, while spinlocks do so only after the first check.
    
    Modify _spin_trylock() to disable preemption before testing the lock
    to be held in order to be preemption-ready.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/spinlock.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index b4aaf6bce6..f4eb50f030 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -240,13 +240,16 @@ int _spin_trylock(spinlock_t *lock)
 {
     spinlock_tickets_t old, new;
 
+    preempt_disable();
     check_lock(&lock->debug, true);
     old = observe_lock(&lock->tickets);
     if ( old.head != old.tail )
+    {
+        preempt_enable();
         return 0;
+    }
     new = old;
     new.tail++;
-    preempt_disable();
     if ( cmpxchg(&lock->tickets.head_tail,
                  old.head_tail, new.head_tail) != old.head_tail )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:33:43 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27091.55818 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNn-0000Bq-Up; Sat, 14 Nov 2020 02:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27091.55818; Sat, 14 Nov 2020 02:33:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNn-0000Bi-RL; Sat, 14 Nov 2020 02:33:43 +0000
Received: by outflank-mailman (input) for mailman id 27091;
 Sat, 14 Nov 2020 02:33:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNn-0000Bb-6W
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNn-0002YU-5m
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNn-0000Bb-6W
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNn-0002YU-5m
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/rwlock: add check_lock() handling to rwlocks
Message-Id: <E1kdlNn-0002YU-5m@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:33:43 +0000

commit e19bcb626f50a652fb1854a8b2f2c9c371687a11
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Nov 6 10:48:07 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 6 10:48:07 2020 +0100

    xen/rwlock: add check_lock() handling to rwlocks
    
    Checking whether a lock is consistently used regarding interrupts on
    or off is beneficial for rwlocks, too.
    
    So add check_lock() calls to rwlock functions. For this purpose make
    check_lock() globally accessible.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/spinlock.c      |  3 +--
 xen/include/xen/rwlock.h   | 15 +++++++++++++++
 xen/include/xen/spinlock.h |  2 ++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index f4eb50f030..b90981bb27 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -13,7 +13,7 @@
 
 static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0);
 
-static void check_lock(union lock_debug *debug, bool try)
+void check_lock(union lock_debug *debug, bool try)
 {
     bool irq_safe = !local_irq_is_enabled();
 
@@ -108,7 +108,6 @@ void spin_debug_disable(void)
 
 #else /* CONFIG_DEBUG_LOCKS */
 
-#define check_lock(l, t) ((void)0)
 #define check_barrier(l) ((void)0)
 #define got_lock(l) ((void)0)
 #define rel_lock(l) ((void)0)
diff --git a/xen/include/xen/rwlock.h b/xen/include/xen/rwlock.h
index 427664037a..0cc9167715 100644
--- a/xen/include/xen/rwlock.h
+++ b/xen/include/xen/rwlock.h
@@ -56,6 +56,7 @@ static inline int _read_trylock(rwlock_t *lock)
     u32 cnts;
 
     preempt_disable();
+    check_lock(&lock->lock.debug, true);
     cnts = atomic_read(&lock->cnts);
     if ( likely(_can_read_lock(cnts)) )
     {
@@ -87,7 +88,11 @@ static inline void _read_lock(rwlock_t *lock)
      * arch_lock_acquire_barrier().
      */
     if ( likely(_can_read_lock(cnts)) )
+    {
+        /* The slow path calls check_lock() via spin_lock(). */
+        check_lock(&lock->lock.debug, false);
         return;
+    }
 
     /* The slowpath will decrement the reader count, if necessary. */
     queue_read_lock_slowpath(lock);
@@ -162,7 +167,11 @@ static inline void _write_lock(rwlock_t *lock)
      * arch_lock_acquire_barrier().
      */
     if ( atomic_cmpxchg(&lock->cnts, 0, _write_lock_val()) == 0 )
+    {
+        /* The slow path calls check_lock() via spin_lock(). */
+        check_lock(&lock->lock.debug, false);
         return;
+    }
 
     queue_write_lock_slowpath(lock);
     /*
@@ -197,6 +206,7 @@ static inline int _write_trylock(rwlock_t *lock)
     u32 cnts;
 
     preempt_disable();
+    check_lock(&lock->lock.debug, true);
     cnts = atomic_read(&lock->cnts);
     if ( unlikely(cnts) ||
          unlikely(atomic_cmpxchg(&lock->cnts, 0, _write_lock_val()) != 0) )
@@ -328,6 +338,11 @@ static inline void _percpu_read_lock(percpu_rwlock_t **per_cpudata,
         /* Drop the read lock because we don't need it anymore. */
         read_unlock(&percpu_rwlock->rwlock);
     }
+    else
+    {
+        /* All other paths have implicit check_lock() calls via read_lock(). */
+        check_lock(&percpu_rwlock->rwlock.lock.debug, false);
+    }
 }
 
 static inline void _percpu_read_unlock(percpu_rwlock_t **per_cpudata,
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index ca13b600a0..9fa4e600c1 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -21,11 +21,13 @@ union lock_debug {
     };
 };
 #define _LOCK_DEBUG { LOCK_DEBUG_INITVAL }
+void check_lock(union lock_debug *debug, bool try);
 void spin_debug_enable(void);
 void spin_debug_disable(void);
 #else
 union lock_debug { };
 #define _LOCK_DEBUG { }
+#define check_lock(l, t) ((void)0)
 #define spin_debug_enable() ((void)0)
 #define spin_debug_disable() ((void)0)
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:33:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27092.55821 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNx-0000D6-Vn; Sat, 14 Nov 2020 02:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27092.55821; Sat, 14 Nov 2020 02:33:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlNx-0000Cy-Sw; Sat, 14 Nov 2020 02:33:53 +0000
Received: by outflank-mailman (input) for mailman id 27092;
 Sat, 14 Nov 2020 02:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNx-0000Co-9U
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlNx-0002ZJ-8e
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNx-0000Co-9U
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlNx-0002ZJ-8e
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:33:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] PCI: remove unused pcidevs_trylock()
Message-Id: <E1kdlNx-0002ZJ-8e@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:33:53 +0000

commit 2a5f9f6a6932214fda76b9b3c03e024772882d34
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Nov 6 10:48:44 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 6 10:48:44 2020 +0100

    PCI: remove unused pcidevs_trylock()
    
    pcidevs_trylock() is used nowhere, so remove it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/drivers/passthrough/pci.c | 5 -----
 xen/include/xen/pci.h         | 1 -
 2 files changed, 6 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 2a3bce1462..51e584127e 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -69,11 +69,6 @@ bool_t pcidevs_locked(void)
     return !!spin_is_locked(&_pcidevs_lock);
 }
 
-bool_t pcidevs_trylock(void)
-{
-    return !!spin_trylock_recursive(&_pcidevs_lock);
-}
-
 static struct radix_tree_root pci_segments;
 
 static inline struct pci_seg *get_pseg(u16 seg)
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index c4d3879761..20a54a5bb4 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -148,7 +148,6 @@ struct pci_dev {
 void pcidevs_lock(void);
 void pcidevs_unlock(void);
 bool_t __must_check pcidevs_locked(void);
-bool_t __must_check pcidevs_trylock(void);
 
 bool_t pci_known_segment(u16 seg);
 bool_t pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:34:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27093.55825 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlO8-0000EP-1R; Sat, 14 Nov 2020 02:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27093.55825; Sat, 14 Nov 2020 02:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlO7-0000EH-UT; Sat, 14 Nov 2020 02:34:03 +0000
Received: by outflank-mailman (input) for mailman id 27093;
 Sat, 14 Nov 2020 02:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlO7-0000EA-Ca
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlO7-0002aM-Bn
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlO7-0000EA-Ca
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlO7-0002aM-Bn
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/xl: fix cpupool-cpu-remove
Message-Id: <E1kdlO7-0002aM-Bn@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:34:03 +0000

commit 8aac8e0ef43a452d0b565d63e4943c275badba3f
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Fri Nov 6 14:05:17 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Nov 6 16:03:18 2020 +0000

    docs/xl: fix cpupool-cpu-remove
    
    The cpu-pool must be specified.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Wei Liu <wl@xen.org>
---
 docs/man/xl.1.pod.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 5f7d3a7134..f92bacfa72 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -1351,7 +1351,7 @@ All the specified CPUs that can be added to the cpupool will be added
 to it. If some CPU can't (e.g., because they're already part of another
 cpupool), an error is reported about each one of them.
 
-=item B<cpupool-cpu-remove> I<cpus|node:nodes>
+=item B<cpupool-cpu-remove> I<cpu-pool> I<cpus|node:nodes>
 
 Removes one or more CPUs or NUMA nodes from I<cpu-pool>. CPUs and NUMA
 nodes can be specified as single CPU/node IDs or as ranges, using the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:34:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27094.55829 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOI-0000G3-2i; Sat, 14 Nov 2020 02:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27094.55829; Sat, 14 Nov 2020 02:34:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOH-0000Fv-W1; Sat, 14 Nov 2020 02:34:13 +0000
Received: by outflank-mailman (input) for mailman id 27094;
 Sat, 14 Nov 2020 02:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOH-0000Fm-FQ
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOH-0002cr-Ek
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOH-0000Fm-FQ
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOH-0002cr-Ek
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/light: correct bitmap operations
Message-Id: <E1kdlOH-0002cr-Ek@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:34:13 +0000

commit 4196b1523aebe0ed929accba318d5e833d7ff6b3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Nov 6 15:05:04 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Nov 6 16:03:33 2020 +0000

    tools/libs/light: correct bitmap operations
    
    Libxl bitmap operations for single bits (test, set, reset) take the bit
    number as a signed integer without testing the value to be larger than
    0.
    
    Correct that by adding the appropriate tests.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index b039143b8a..4699c4a0a3 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -688,21 +688,21 @@ int libxl_bitmap_is_empty(const libxl_bitmap *bitmap)
 
 int libxl_bitmap_test(const libxl_bitmap *bitmap, int bit)
 {
-    if (bit >= bitmap->size * 8)
+    if (bit >= bitmap->size * 8 || bit < 0)
         return 0;
     return (bitmap->map[bit / 8] & (1 << (bit & 7))) ? 1 : 0;
 }
 
 void libxl_bitmap_set(libxl_bitmap *bitmap, int bit)
 {
-    if (bit >= bitmap->size * 8)
+    if (bit >= bitmap->size * 8 || bit < 0)
         return;
     bitmap->map[bit / 8] |= 1 << (bit & 7);
 }
 
 void libxl_bitmap_reset(libxl_bitmap *bitmap, int bit)
 {
-    if (bit >= bitmap->size * 8)
+    if (bit >= bitmap->size * 8 || bit < 0)
         return;
     bitmap->map[bit / 8] &= ~(1 << (bit & 7));
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:34:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:34:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27095.55833 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOT-0000HX-4k; Sat, 14 Nov 2020 02:34:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27095.55833; Sat, 14 Nov 2020 02:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOT-0000HP-1D; Sat, 14 Nov 2020 02:34:25 +0000
Received: by outflank-mailman (input) for mailman id 27095;
 Sat, 14 Nov 2020 02:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOR-0000HD-IO
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOR-0002e6-He
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOR-0000HD-IO
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOR-0002e6-He
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: set vuart_gfn in libxl__build_hvm
Message-Id: <E1kdlOR-0002e6-He@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:34:23 +0000

commit cd800ce442eeba5bc0857ade70a075367c01c350
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Nov 6 16:12:56 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Nov 6 16:12:56 2020 +0000

    libxl: set vuart_gfn in libxl__build_hvm
    
    Setting vuart_gfn was missed when switching ARM guests to the PVH build.
    Like libxl__build_pv, libxl__build_hvm should set state->vuart_gfn to
    dom->vuart_gfn.
    
    Without this change, xl console cannot connect to the vuart console (-t
    vuart), see https://marc.info/?l=xen-devel&m=160402342101366.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_dom.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 01d989a976..19168572fd 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -1177,6 +1177,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
         LOG(ERROR, "hvm build set params failed");
         goto out;
     }
+    state->vuart_gfn = dom->vuart_gfn;
 
     rc = hvm_build_set_xs_values(gc, domid, dom, info);
     if (rc != 0) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:34:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:34:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27096.55837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOd-0000Ju-7X; Sat, 14 Nov 2020 02:34:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27096.55837; Sat, 14 Nov 2020 02:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOd-0000Jl-4I; Sat, 14 Nov 2020 02:34:35 +0000
Received: by outflank-mailman (input) for mailman id 27096;
 Sat, 14 Nov 2020 02:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOb-0000JV-LJ
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOb-0002ew-Kb
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOb-0000JV-LJ
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOb-0002ew-Kb
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Add suppress-vmdesc to QEMU machine
Message-Id: <E1kdlOb-0002ew-Kb@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:34:33 +0000

commit 0a5e0ce0fb7e5a3b5dfdc936058d2c0e04e5e258
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu Oct 29 15:03:32 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Fri Nov 6 16:20:36 2020 +0000

    libxl: Add suppress-vmdesc to QEMU machine
    
    The device model state saved by QMP xen-save-devices-state doesn't
    include the vmdesc json.  When restoring an HVM, xen-load-devices-state
    always triggers "Expected vmdescription section, but got 0".  This is
    not a problem when restore comes from a file.  However, when QEMU runs
    in a linux stubdom and comes over a console, EOF is not received.  This
    causes a delay restoring - though it does restore.
    
    Setting suppress-vmdesc skips looking for the vmdesc during restore and
    avoids the wait.
    
    QEMU 5.2 enables suppress-vmdesc by default for xenfv, but this change
    sets it manually for xenfv and xen_platform_pci=0 when -machine pc is
    use.
    
    QEMU commit 9850c6047b8b "migration: Allow to suppress vmdesc
    submission" added suppress-vmdesc in QEMU 2.3.
    
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index d1ff35dda3..3da83259c0 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1778,9 +1778,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
             /* Switching here to the machine "pc" which does not add
              * the xen-platform device instead of the default "xenfv" machine.
              */
-            machinearg = libxl__strdup(gc, "pc,accel=xen");
+            machinearg = libxl__strdup(gc, "pc,accel=xen,suppress-vmdesc=on");
         } else {
-            machinearg = libxl__strdup(gc, "xenfv");
+            machinearg = libxl__strdup(gc, "xenfv,suppress-vmdesc=on");
         }
         if (b_info->u.hvm.mmio_hole_memkb) {
             uint64_t max_ram_below_4g = (1ULL << 32) -
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:34:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:34:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27097.55841 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOn-0000LE-8l; Sat, 14 Nov 2020 02:34:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27097.55841; Sat, 14 Nov 2020 02:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOn-0000L6-5l; Sat, 14 Nov 2020 02:34:45 +0000
Received: by outflank-mailman (input) for mailman id 27097;
 Sat, 14 Nov 2020 02:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOl-0000Kw-OC
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOl-0002g6-NV
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOl-0000Kw-OC
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOl-0002g6-NV
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
Message-Id: <E1kdlOl-0002g6-NV@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:34:43 +0000

commit 3059178798a23ba870ff86ff54d442a07e6651fc
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 6 18:23:27 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 11:20:14 2020 +0000

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL}
    
    Currently a PV hardware domain can also be given control over the CPU
    frequency, and such guest is allowed to write to MSR_IA32_PERF_CTL.
    However since commit 322ec7c89f6 the default behavior has been changed
    to reject accesses to not explicitly handled MSRs, preventing PV
    guests that manage CPU frequency from reading
    MSR_IA32_PERF_{STATUS/CTL}.
    
    Additionally some HVM guests (Windows at least) will attempt to read
    MSR_IA32_PERF_CTL and will panic if given back a #GP fault:
    
      vmx.c:3035:d8v0 RDMSR 0x00000199 unimplemented
      d8v0 VIRIDIAN CRASH: 3b c0000096 fffff806871c1651 ffffda0253683720 0
    
    Move the handling of MSR_IA32_PERF_{STATUS/CTL} to the common MSR
    handling shared between HVM and PV guests, and add an explicit case
    for reads to MSR_IA32_PERF_{STATUS/CTL}.
    
    Restore previous behavior and allow PV guests with the required
    permissions to read the contents of the mentioned MSRs. Non privileged
    guests will get 0 when trying to read those registers, as writes to
    MSR_IA32_PERF_CTL by such guest will already be silently dropped.
    
    Fixes: 322ec7c89f6 ('x86/pv: disallow access to unknown MSRs')
    Fixes: 84e848fd7a1 ('x86/hvm: disallow access to unknown MSRs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c             | 34 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 14 --------------
 xen/include/xen/sched.h        | 16 ++++++++++++++++
 3 files changed, 50 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 9c69ef8792..be8e363862 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -242,6 +242,25 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
             goto gp_fault;
         break;
 
+        /*
+         * These MSRs are not enumerated in CPUID.  They have been around
+         * since the Pentium 4, and implemented by other vendors.
+         *
+         * Some versions of Windows try reading these before setting up a #GP
+         * handler, and Linux has several unguarded reads as well.  Provide
+         * RAZ semantics, in general, but permit a cpufreq controller dom0 to
+         * have full access.
+         */
+    case MSR_IA32_PERF_STATUS:
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        *val = 0;
+        if ( likely(!is_cpufreq_controller(d)) || rdmsr_safe(msr, *val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_IA32_THERM_STATUS:
         if ( cp->x86_vendor != X86_VENDOR_INTEL )
             goto gp_fault;
@@ -448,6 +467,21 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             goto gp_fault;
         break;
 
+        /*
+         * This MSR is not enumerated in CPUID.  It has been around since the
+         * Pentium 4, and implemented by other vendors.
+         *
+         * To match the RAZ semantics, implement as write-discard, except for
+         * a cpufreq controller dom0 which has full access.
+         */
+    case MSR_IA32_PERF_CTL:
+        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+            goto gp_fault;
+
+        if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
+            break;
+        goto gp_fault;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 7cc16d6eda..dbceed8a05 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -849,12 +849,6 @@ static inline uint64_t guest_misc_enable(uint64_t val)
     return val;
 }
 
-static inline bool is_cpufreq_controller(const struct domain *d)
-{
-    return ((cpufreq_controller == FREQCTL_dom0_kernel) &&
-            is_hardware_domain(d));
-}
-
 static uint64_t guest_efer(const struct domain *d)
 {
     uint64_t val;
@@ -1121,14 +1115,6 @@ static int write_msr(unsigned int reg, uint64_t val,
             return X86EMUL_OKAY;
         break;
 
-    case MSR_IA32_PERF_CTL:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-        if ( likely(!is_cpufreq_controller(currd)) ||
-             wrmsr_safe(reg, val) == 0 )
-            return X86EMUL_OKAY;
-        break;
-
     case MSR_IA32_THERM_CONTROL:
     case MSR_IA32_ENERGY_PERF_BIAS:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index d8ed83f869..ff8d0772b3 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1069,6 +1069,22 @@ extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
 } cpufreq_controller;
 
+static always_inline bool is_cpufreq_controller(const struct domain *d)
+{
+    /*
+     * A PV dom0 can be nominated as the cpufreq controller, instead of using
+     * Xen's cpufreq driver, at which point dom0 gets direct access to certain
+     * MSRs.
+     *
+     * This interface only works when dom0 is identity pinned and has the same
+     * number of vCPUs as pCPUs on the system.
+     *
+     * It would be far better to paravirtualise the interface.
+     */
+    return (is_pv_domain(d) && is_hardware_domain(d) &&
+            cpufreq_controller == FREQCTL_dom0_kernel);
+}
+
 int cpupool_move_domain(struct domain *d, struct cpupool *c);
 int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op);
 int cpupool_get_id(const struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:34:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:34:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27098.55845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOx-0000MY-Ad; Sat, 14 Nov 2020 02:34:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27098.55845; Sat, 14 Nov 2020 02:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlOx-0000MQ-7L; Sat, 14 Nov 2020 02:34:55 +0000
Received: by outflank-mailman (input) for mailman id 27098;
 Sat, 14 Nov 2020 02:34:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOv-0000MH-RF
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlOv-0002hC-Qb
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOv-0000MH-RF
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlOv-0002hC-Qb
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:34:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/evtchn: rework per event channel lock
Message-Id: <E1kdlOv-0002hC-Qb@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:34:53 +0000

commit 5f2df45ead7c1195142f68b7923047a1e9479d54
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Nov 10 14:36:15 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:36:15 2020 +0100

    xen/evtchn: rework per event channel lock
    
    Currently the lock for a single event channel needs to be taken with
    interrupts off, which causes deadlocks in some cases.
    
    Rework the per event channel lock to be non-blocking for the case of
    sending an event and removing the need for disabling interrupts for
    taking the lock.
    
    The lock is needed for avoiding races between event channel state
    changes (creation, closing, binding) against normal operations (set
    pending, [un]masking, priority changes).
    
    Use a rwlock, but with some restrictions:
    
    - Changing the state of an event channel (creation, closing, binding)
      needs to use write_lock(), with ASSERT()ing that the lock is taken as
      writer only when the state of the event channel is either before or
      after the locked region appropriate (either free or unbound).
    
    - Sending an event needs to use read_trylock() mostly, in case of not
      obtaining the lock the operation is omitted. This is needed as
      sending an event can happen with interrupts off (at least in some
      cases).
    
    - Dumping the event channel state for debug purposes is using
      read_trylock(), too, in order to avoid blocking in case the lock is
      taken as writer for a long time.
    
    - All other cases can use read_lock().
    
    Fixes: e045199c7c9c54 ("evtchn: address races with evtchn_reset()")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/x86/irq.c         |   6 +-
 xen/arch/x86/pv/shim.c     |   9 +--
 xen/common/event_channel.c | 138 +++++++++++++++++++++++++--------------------
 xen/include/xen/event.h    |  29 ++++++++--
 xen/include/xen/sched.h    |   5 +-
 5 files changed, 112 insertions(+), 75 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 93c4fb9a79..8d1f9a9fc6 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2495,14 +2495,12 @@ static void dump_irqs(unsigned char key)
                 pirq = domain_irq_to_pirq(d, irq);
                 info = pirq_info(d, pirq);
                 evtchn = evtchn_from_port(d, info->evtchn);
-                local_irq_disable();
-                if ( spin_trylock(&evtchn->lock) )
+                if ( evtchn_read_trylock(evtchn) )
                 {
                     pending = evtchn_is_pending(d, evtchn);
                     masked = evtchn_is_masked(d, evtchn);
-                    spin_unlock(&evtchn->lock);
+                    evtchn_read_unlock(evtchn);
                 }
-                local_irq_enable();
                 printk("d%d:%3d(%c%c%c)%c",
                        d->domain_id, pirq, "-P?"[pending],
                        "-M?"[masked], info->masked ? 'M' : '-',
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 9aef7a860a..b4e83e0778 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -660,11 +660,12 @@ void pv_shim_inject_evtchn(unsigned int port)
     if ( port_is_valid(guest, port) )
     {
         struct evtchn *chn = evtchn_from_port(guest, port);
-        unsigned long flags;
 
-        spin_lock_irqsave(&chn->lock, flags);
-        evtchn_port_set_pending(guest, chn->notify_vcpu_id, chn);
-        spin_unlock_irqrestore(&chn->lock, flags);
+        if ( evtchn_read_trylock(chn) )
+        {
+            evtchn_port_set_pending(guest, chn->notify_vcpu_id, chn);
+            evtchn_read_unlock(chn);
+        }
     }
 }
 
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index cd4a2c0501..43e3520df6 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -50,6 +50,29 @@
 
 #define consumer_is_xen(e) (!!(e)->xen_consumer)
 
+/*
+ * Lock an event channel exclusively. This is allowed only when the channel is
+ * free or unbound either when taking or when releasing the lock, as any
+ * concurrent operation on the event channel using evtchn_read_trylock() will
+ * just assume the event channel is free or unbound at the moment when the
+ * evtchn_read_trylock() returns false.
+ */
+static inline void evtchn_write_lock(struct evtchn *evtchn)
+{
+    write_lock(&evtchn->lock);
+
+    evtchn->old_state = evtchn->state;
+}
+
+static inline void evtchn_write_unlock(struct evtchn *evtchn)
+{
+    /* Enforce lock discipline. */
+    ASSERT(evtchn->old_state == ECS_FREE || evtchn->old_state == ECS_UNBOUND ||
+           evtchn->state == ECS_FREE || evtchn->state == ECS_UNBOUND);
+
+    write_unlock(&evtchn->lock);
+}
+
 /*
  * The function alloc_unbound_xen_event_channel() allows an arbitrary
  * notifier function to be specified. However, very few unique functions
@@ -133,7 +156,7 @@ static struct evtchn *alloc_evtchn_bucket(struct domain *d, unsigned int port)
             return NULL;
         }
         chn[i].port = port + i;
-        spin_lock_init(&chn[i].lock);
+        rwlock_init(&chn[i].lock);
     }
     return chn;
 }
@@ -255,7 +278,6 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
     int            port;
     domid_t        dom = alloc->dom;
     long           rc;
-    unsigned long  flags;
 
     d = rcu_lock_domain_by_any_id(dom);
     if ( d == NULL )
@@ -271,14 +293,14 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
     if ( rc )
         goto out;
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state = ECS_UNBOUND;
     if ( (chn->u.unbound.remote_domid = alloc->remote_dom) == DOMID_SELF )
         chn->u.unbound.remote_domid = current->domain->domain_id;
     evtchn_port_init(d, chn);
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     alloc->port = port;
 
@@ -291,32 +313,26 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
 }
 
 
-static unsigned long double_evtchn_lock(struct evtchn *lchn,
-                                        struct evtchn *rchn)
+static void double_evtchn_lock(struct evtchn *lchn, struct evtchn *rchn)
 {
-    unsigned long flags;
-
     if ( lchn <= rchn )
     {
-        spin_lock_irqsave(&lchn->lock, flags);
+        evtchn_write_lock(lchn);
         if ( lchn != rchn )
-            spin_lock(&rchn->lock);
+            evtchn_write_lock(rchn);
     }
     else
     {
-        spin_lock_irqsave(&rchn->lock, flags);
-        spin_lock(&lchn->lock);
+        evtchn_write_lock(rchn);
+        evtchn_write_lock(lchn);
     }
-
-    return flags;
 }
 
-static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn,
-                                 unsigned long flags)
+static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn)
 {
     if ( lchn != rchn )
-        spin_unlock(&lchn->lock);
-    spin_unlock_irqrestore(&rchn->lock, flags);
+        evtchn_write_unlock(lchn);
+    evtchn_write_unlock(rchn);
 }
 
 static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
@@ -326,7 +342,6 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
     int            lport, rport = bind->remote_port;
     domid_t        rdom = bind->remote_dom;
     long           rc;
-    unsigned long  flags;
 
     if ( rdom == DOMID_SELF )
         rdom = current->domain->domain_id;
@@ -362,7 +377,7 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
     if ( rc )
         goto out;
 
-    flags = double_evtchn_lock(lchn, rchn);
+    double_evtchn_lock(lchn, rchn);
 
     lchn->u.interdomain.remote_dom  = rd;
     lchn->u.interdomain.remote_port = rport;
@@ -379,7 +394,7 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
      */
     evtchn_port_set_pending(ld, lchn->notify_vcpu_id, lchn);
 
-    double_evtchn_unlock(lchn, rchn, flags);
+    double_evtchn_unlock(lchn, rchn);
 
     bind->local_port = lport;
 
@@ -402,7 +417,6 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     struct domain *d = current->domain;
     int            virq = bind->virq, vcpu = bind->vcpu;
     int            rc = 0;
-    unsigned long  flags;
 
     if ( (virq < 0) || (virq >= ARRAY_SIZE(v->virq_to_evtchn)) )
         return -EINVAL;
@@ -440,14 +454,14 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
 
     chn = evtchn_from_port(d, port);
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state          = ECS_VIRQ;
     chn->notify_vcpu_id = vcpu;
     chn->u.virq         = virq;
     evtchn_port_init(d, chn);
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     v->virq_to_evtchn[virq] = bind->port = port;
 
@@ -464,7 +478,6 @@ static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
     struct domain *d = current->domain;
     int            port, vcpu = bind->vcpu;
     long           rc = 0;
-    unsigned long  flags;
 
     if ( domain_vcpu(d, vcpu) == NULL )
         return -ENOENT;
@@ -476,13 +489,13 @@ static long evtchn_bind_ipi(evtchn_bind_ipi_t *bind)
 
     chn = evtchn_from_port(d, port);
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state          = ECS_IPI;
     chn->notify_vcpu_id = vcpu;
     evtchn_port_init(d, chn);
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     bind->port = port;
 
@@ -526,7 +539,6 @@ static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
     struct pirq   *info;
     int            port = 0, pirq = bind->pirq;
     long           rc;
-    unsigned long  flags;
 
     if ( (pirq < 0) || (pirq >= d->nr_pirqs) )
         return -EINVAL;
@@ -559,14 +571,14 @@ static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
         goto out;
     }
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state  = ECS_PIRQ;
     chn->u.pirq.irq = pirq;
     link_pirq_port(port, chn, v);
     evtchn_port_init(d, chn);
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     bind->port = port;
 
@@ -587,7 +599,6 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
     struct evtchn *chn1, *chn2;
     int            port2;
     long           rc = 0;
-    unsigned long  flags;
 
  again:
     spin_lock(&d1->event_lock);
@@ -688,14 +699,14 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         BUG_ON(chn2->state != ECS_INTERDOMAIN);
         BUG_ON(chn2->u.interdomain.remote_dom != d1);
 
-        flags = double_evtchn_lock(chn1, chn2);
+        double_evtchn_lock(chn1, chn2);
 
         evtchn_free(d1, chn1);
 
         chn2->state = ECS_UNBOUND;
         chn2->u.unbound.remote_domid = d1->domain_id;
 
-        double_evtchn_unlock(chn1, chn2, flags);
+        double_evtchn_unlock(chn1, chn2);
 
         goto out;
 
@@ -703,9 +714,9 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         BUG();
     }
 
-    spin_lock_irqsave(&chn1->lock, flags);
+    evtchn_write_lock(chn1);
     evtchn_free(d1, chn1);
-    spin_unlock_irqrestore(&chn1->lock, flags);
+    evtchn_write_unlock(chn1);
 
  out:
     if ( d2 != NULL )
@@ -725,7 +736,6 @@ int evtchn_send(struct domain *ld, unsigned int lport)
     struct evtchn *lchn, *rchn;
     struct domain *rd;
     int            rport, ret = 0;
-    unsigned long  flags;
 
     if ( !port_is_valid(ld, lport) )
         return -EINVAL;
@@ -738,7 +748,7 @@ int evtchn_send(struct domain *ld, unsigned int lport)
 
     lchn = evtchn_from_port(ld, lport);
 
-    spin_lock_irqsave(&lchn->lock, flags);
+    evtchn_read_lock(lchn);
 
     /* Guest cannot send via a Xen-attached event channel. */
     if ( unlikely(consumer_is_xen(lchn)) )
@@ -773,7 +783,7 @@ int evtchn_send(struct domain *ld, unsigned int lport)
     }
 
 out:
-    spin_unlock_irqrestore(&lchn->lock, flags);
+    evtchn_read_unlock(lchn);
 
     return ret;
 }
@@ -806,9 +816,11 @@ void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
 
     d = v->domain;
     chn = evtchn_from_port(d, port);
-    spin_lock(&chn->lock);
-    evtchn_port_set_pending(d, v->vcpu_id, chn);
-    spin_unlock(&chn->lock);
+    if ( evtchn_read_trylock(chn) )
+    {
+        evtchn_port_set_pending(d, v->vcpu_id, chn);
+        evtchn_read_unlock(chn);
+    }
 
  out:
     spin_unlock_irqrestore(&v->virq_lock, flags);
@@ -837,9 +849,11 @@ void send_guest_global_virq(struct domain *d, uint32_t virq)
         goto out;
 
     chn = evtchn_from_port(d, port);
-    spin_lock(&chn->lock);
-    evtchn_port_set_pending(d, chn->notify_vcpu_id, chn);
-    spin_unlock(&chn->lock);
+    if ( evtchn_read_trylock(chn) )
+    {
+        evtchn_port_set_pending(d, chn->notify_vcpu_id, chn);
+        evtchn_read_unlock(chn);
+    }
 
  out:
     spin_unlock_irqrestore(&v->virq_lock, flags);
@@ -849,7 +863,6 @@ void send_guest_pirq(struct domain *d, const struct pirq *pirq)
 {
     int port;
     struct evtchn *chn;
-    unsigned long flags;
 
     /*
      * PV guests: It should not be possible to race with __evtchn_close(). The
@@ -864,9 +877,11 @@ void send_guest_pirq(struct domain *d, const struct pirq *pirq)
     }
 
     chn = evtchn_from_port(d, port);
-    spin_lock_irqsave(&chn->lock, flags);
-    evtchn_port_set_pending(d, chn->notify_vcpu_id, chn);
-    spin_unlock_irqrestore(&chn->lock, flags);
+    if ( evtchn_read_trylock(chn) )
+    {
+        evtchn_port_set_pending(d, chn->notify_vcpu_id, chn);
+        evtchn_read_unlock(chn);
+    }
 }
 
 static struct domain *global_virq_handlers[NR_VIRQS] __read_mostly;
@@ -1068,15 +1083,17 @@ int evtchn_unmask(unsigned int port)
 {
     struct domain *d = current->domain;
     struct evtchn *evtchn;
-    unsigned long flags;
 
     if ( unlikely(!port_is_valid(d, port)) )
         return -EINVAL;
 
     evtchn = evtchn_from_port(d, port);
-    spin_lock_irqsave(&evtchn->lock, flags);
+
+    evtchn_read_lock(evtchn);
+
     evtchn_port_unmask(d, evtchn);
-    spin_unlock_irqrestore(&evtchn->lock, flags);
+
+    evtchn_read_unlock(evtchn);
 
     return 0;
 }
@@ -1156,15 +1173,17 @@ static long evtchn_set_priority(const struct evtchn_set_priority *set_priority)
     unsigned int port = set_priority->port;
     struct evtchn *chn;
     long ret;
-    unsigned long flags;
 
     if ( !port_is_valid(d, port) )
         return -EINVAL;
 
     chn = evtchn_from_port(d, port);
-    spin_lock_irqsave(&chn->lock, flags);
+
+    evtchn_read_lock(chn);
+
     ret = evtchn_port_set_priority(d, chn, set_priority->priority);
-    spin_unlock_irqrestore(&chn->lock, flags);
+
+    evtchn_read_unlock(chn);
 
     return ret;
 }
@@ -1332,7 +1351,6 @@ int alloc_unbound_xen_event_channel(
 {
     struct evtchn *chn;
     int            port, rc;
-    unsigned long  flags;
 
     spin_lock(&ld->event_lock);
 
@@ -1345,14 +1363,14 @@ int alloc_unbound_xen_event_channel(
     if ( rc )
         goto out;
 
-    spin_lock_irqsave(&chn->lock, flags);
+    evtchn_write_lock(chn);
 
     chn->state = ECS_UNBOUND;
     chn->xen_consumer = get_xen_consumer(notification_fn);
     chn->notify_vcpu_id = lvcpu;
     chn->u.unbound.remote_domid = remote_domid;
 
-    spin_unlock_irqrestore(&chn->lock, flags);
+    evtchn_write_unlock(chn);
 
     /*
      * Increment ->xen_evtchns /after/ ->active_evtchns. No explicit
@@ -1388,7 +1406,6 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)
 {
     struct evtchn *lchn, *rchn;
     struct domain *rd;
-    unsigned long flags;
 
     if ( !port_is_valid(ld, lport) )
     {
@@ -1403,7 +1420,8 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)
 
     lchn = evtchn_from_port(ld, lport);
 
-    spin_lock_irqsave(&lchn->lock, flags);
+    if ( !evtchn_read_trylock(lchn) )
+        return;
 
     if ( likely(lchn->state == ECS_INTERDOMAIN) )
     {
@@ -1413,7 +1431,7 @@ void notify_via_xen_event_channel(struct domain *ld, int lport)
         evtchn_port_set_pending(rd, rchn->notify_vcpu_id, rchn);
     }
 
-    spin_unlock_irqrestore(&lchn->lock, flags);
+    evtchn_read_unlock(lchn);
 }
 
 void evtchn_check_pollers(struct domain *d, unsigned int port)
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 2ed4be78f6..a0a85cdda8 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -105,6 +105,21 @@ void notify_via_xen_event_channel(struct domain *ld, int lport);
 #define bucket_from_port(d, p) \
     ((group_from_port(d, p))[((p) % EVTCHNS_PER_GROUP) / EVTCHNS_PER_BUCKET])
 
+static inline void evtchn_read_lock(struct evtchn *evtchn)
+{
+    read_lock(&evtchn->lock);
+}
+
+static inline bool evtchn_read_trylock(struct evtchn *evtchn)
+{
+    return read_trylock(&evtchn->lock);
+}
+
+static inline void evtchn_read_unlock(struct evtchn *evtchn)
+{
+    read_unlock(&evtchn->lock);
+}
+
 static inline bool_t port_is_valid(struct domain *d, unsigned int p)
 {
     if ( p >= read_atomic(&d->valid_evtchns) )
@@ -235,11 +250,12 @@ static inline bool evtchn_port_is_masked(struct domain *d, evtchn_port_t port)
 {
     struct evtchn *evtchn = evtchn_from_port(d, port);
     bool rc;
-    unsigned long flags;
 
-    spin_lock_irqsave(&evtchn->lock, flags);
+    evtchn_read_lock(evtchn);
+
     rc = evtchn_is_masked(d, evtchn);
-    spin_unlock_irqrestore(&evtchn->lock, flags);
+
+    evtchn_read_unlock(evtchn);
 
     return rc;
 }
@@ -252,12 +268,13 @@ static inline int evtchn_port_poll(struct domain *d, evtchn_port_t port)
     if ( port_is_valid(d, port) )
     {
         struct evtchn *evtchn = evtchn_from_port(d, port);
-        unsigned long flags;
 
-        spin_lock_irqsave(&evtchn->lock, flags);
+        evtchn_read_lock(evtchn);
+
         if ( evtchn_usable(evtchn) )
             rc = evtchn_is_pending(d, evtchn);
-        spin_unlock_irqrestore(&evtchn->lock, flags);
+
+        evtchn_read_unlock(evtchn);
     }
 
     return rc;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index ff8d0772b3..7251b3ae3e 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -85,7 +85,7 @@ extern domid_t hardware_domid;
 
 struct evtchn
 {
-    spinlock_t lock;
+    rwlock_t lock;
 #define ECS_FREE         0 /* Channel is available for use.                  */
 #define ECS_RESERVED     1 /* Channel is reserved.                           */
 #define ECS_UNBOUND      2 /* Channel is waiting to bind to a remote domain. */
@@ -114,6 +114,9 @@ struct evtchn
         u16 virq;      /* state == ECS_VIRQ */
     } u;
     u8 priority;
+#ifndef NDEBUG
+    u8 old_state;      /* State when taking lock in write mode. */
+#endif
     u8 last_priority;
     u16 last_vcpu_id;
 #ifdef CONFIG_XSM
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:35:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:35:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27099.55849 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlP7-0000Ny-Dp; Sat, 14 Nov 2020 02:35:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27099.55849; Sat, 14 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlP7-0000Nq-Ar; Sat, 14 Nov 2020 02:35:05 +0000
Received: by outflank-mailman (input) for mailman id 27099;
 Sat, 14 Nov 2020 02:35:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlP5-0000Nf-UY
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlP5-0002ic-Tn
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlP5-0000Nf-UY
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlP5-0002ic-Tn
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/evtchn: revert 52e1fc47abc3a0123
Message-Id: <E1kdlP5-0002ic-Tn@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:35:03 +0000

commit b5ad37f8e9284cc147218f7a5193d739ae7b956f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Nov 10 14:37:15 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:37:15 2020 +0100

    xen/evtchn: revert 52e1fc47abc3a0123
    
    With the event channel lock no longer disabling interrupts commit
    52e1fc47abc3a0123 ("evtchn/Flask: pre-allocate node on send path") can
    be reverted again.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c  |  6 ----
 xen/include/xsm/xsm.h       |  1 -
 xen/xsm/flask/avc.c         | 78 ++++-----------------------------------------
 xen/xsm/flask/hooks.c       | 10 ------
 xen/xsm/flask/include/avc.h |  2 --
 5 files changed, 7 insertions(+), 90 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 43e3520df6..eacd96b92f 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -740,12 +740,6 @@ int evtchn_send(struct domain *ld, unsigned int lport)
     if ( !port_is_valid(ld, lport) )
         return -EINVAL;
 
-    /*
-     * As the call further down needs to avoid allocations (due to running
-     * with IRQs off), give XSM a chance to pre-allocate if needed.
-     */
-    xsm_evtchn_send(XSM_HOOK, ld, NULL);
-
     lchn = evtchn_from_port(ld, lport);
 
     evtchn_read_lock(lchn);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 358ec13ba8..7bd03d8817 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -59,7 +59,6 @@ struct xsm_operations {
     int (*evtchn_interdomain) (struct domain *d1, struct evtchn *chn1,
                                         struct domain *d2, struct evtchn *chn2);
     void (*evtchn_close_post) (struct evtchn *chn);
-    /* Note: Next hook may be called with 'chn' set to NULL. See call site. */
     int (*evtchn_send) (struct domain *d, struct evtchn *chn);
     int (*evtchn_status) (struct domain *d, struct evtchn *chn);
     int (*evtchn_reset) (struct domain *d1, struct domain *d2);
diff --git a/xen/xsm/flask/avc.c b/xen/xsm/flask/avc.c
index 2dfa1f4295..87ea38b7a0 100644
--- a/xen/xsm/flask/avc.c
+++ b/xen/xsm/flask/avc.c
@@ -24,9 +24,7 @@
 #include <xen/prefetch.h>
 #include <xen/kernel.h>
 #include <xen/sched.h>
-#include <xen/cpu.h>
 #include <xen/init.h>
-#include <xen/percpu.h>
 #include <xen/rcupdate.h>
 #include <asm/atomic.h>
 #include <asm/current.h>
@@ -343,79 +341,17 @@ static inline int avc_reclaim_node(void)
     return ecx;
 }
 
-static struct avc_node *new_node(void)
-{
-    struct avc_node *node = xzalloc(struct avc_node);
-
-    if ( node )
-    {
-        INIT_RCU_HEAD(&node->rhead);
-        INIT_HLIST_NODE(&node->list);
-        avc_cache_stats_incr(allocations);
-    }
-
-    return node;
-}
-
-/*
- * avc_has_perm_noaudit() may consume up to two nodes, which we may not be
- * able to obtain from the allocator at that point. Since the is merely
- * about caching earlier decisions, allow for (just) one pre-allocated node.
- */
-static DEFINE_PER_CPU(struct avc_node *, prealloc_node);
-
-void avc_prealloc(void)
-{
-    struct avc_node **prealloc = &this_cpu(prealloc_node);
-
-    if ( !*prealloc )
-        *prealloc = new_node();
-}
-
-static int cpu_callback(struct notifier_block *nfb, unsigned long action,
-                        void *hcpu)
-{
-    unsigned int cpu = (unsigned long)hcpu;
-    struct avc_node **prealloc = &per_cpu(prealloc_node, cpu);
-
-    if ( action == CPU_DEAD && *prealloc )
-    {
-        xfree(*prealloc);
-        *prealloc = NULL;
-        avc_cache_stats_incr(frees);
-    }
-
-    return NOTIFY_DONE;
-}
-
-static struct notifier_block cpu_nfb = {
-    .notifier_call = cpu_callback,
-    .priority = 99
-};
-
-static int __init cpu_nfb_init(void)
-{
-    register_cpu_notifier(&cpu_nfb);
-    return 0;
-}
-__initcall(cpu_nfb_init);
-
 static struct avc_node *avc_alloc_node(void)
 {
-    struct avc_node *node, **prealloc = &this_cpu(prealloc_node);
+    struct avc_node *node;
 
-    node = *prealloc;
-    *prealloc = NULL;
+    node = xzalloc(struct avc_node);
+    if (!node)
+        goto out;
 
-    if ( !node )
-    {
-        /* Must not call xmalloc() & Co with IRQs off. */
-        if ( !local_irq_is_enabled() )
-            goto out;
-        node = new_node();
-        if ( !node )
-            goto out;
-    }
+    INIT_RCU_HEAD(&node->rhead);
+    INIT_HLIST_NODE(&node->list);
+    avc_cache_stats_incr(allocations);
 
     atomic_inc(&avc_cache.active_nodes);
     if ( atomic_read(&avc_cache.active_nodes) > avc_cache_threshold )
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index de050cc9fe..19b0d9e3eb 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -281,16 +281,6 @@ static int flask_evtchn_send(struct domain *d, struct evtchn *chn)
 {
     int rc;
 
-    /*
-     * When called with non-NULL chn, memory allocation may not be permitted.
-     * Allow AVC to preallocate nodes as necessary upon early notification.
-     */
-    if ( !chn )
-    {
-        avc_prealloc();
-        return 0;
-    }
-
     switch ( chn->state )
     {
     case ECS_INTERDOMAIN:
diff --git a/xen/xsm/flask/include/avc.h b/xen/xsm/flask/include/avc.h
index 722919b762..c14bd07a2b 100644
--- a/xen/xsm/flask/include/avc.h
+++ b/xen/xsm/flask/include/avc.h
@@ -91,8 +91,6 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, u16 tclass, u32 requested,
 int avc_has_perm(u32 ssid, u32 tsid, u16 tclass, u32 requested,
                                              struct avc_audit_data *auditdata);
 
-void avc_prealloc(void);
-
 /* Exported to selinuxfs */
 struct xen_flask_hash_stats;
 int avc_get_hash_stats(struct xen_flask_hash_stats *arg);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:35:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:35:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27101.55853 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPH-0000PP-FG; Sat, 14 Nov 2020 02:35:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27101.55853; Sat, 14 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPH-0000PG-CL; Sat, 14 Nov 2020 02:35:15 +0000
Received: by outflank-mailman (input) for mailman id 27101;
 Sat, 14 Nov 2020 02:35:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPG-0000P6-1I
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPG-0002js-0b
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPG-0000P6-1I
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPG-0002js-0b
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CPUID: don't use UB shift when library is built as 32-bit
Message-Id: <E1kdlPG-0002js-0b@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:35:14 +0000

commit db1a9fdd554cb1d8a7099af7925318fc06c6875b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 10 14:39:03 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:39:03 2020 +0100

    x86/CPUID: don't use UB shift when library is built as 32-bit
    
    At least the insn emulator test harness will continue to be buildable
    (and ought to continue to be usable) also as a 32-bit binary. (Right now
    the CPU policy test harness is, too, but there it may be less relevant
    to keep it functional, just like e.g. we don't support fuzzing the insn
    emulator in 32-bit mode.) Hence the library code needs to cope with
    this.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/lib/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c
index c7a0508148..8eb88314f5 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -165,7 +165,7 @@ void x86_cpuid_policy_fill_native(struct cpuid_policy *p)
         for ( i = 2; i < min_t(unsigned int, 63,
                                ARRAY_SIZE(p->xstate.raw)); ++i )
         {
-            if ( xstates & (1ul << i) )
+            if ( xstates & (1ull << i) )
                 cpuid_count_leaf(0xd, i, &p->xstate.raw[i]);
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:35:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:35:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27102.55857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPR-0000Qj-Gn; Sat, 14 Nov 2020 02:35:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27102.55857; Sat, 14 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPR-0000Qb-Dn; Sat, 14 Nov 2020 02:35:25 +0000
Received: by outflank-mailman (input) for mailman id 27102;
 Sat, 14 Nov 2020 02:35:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPQ-0000QP-4G
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPQ-0002l6-3Y
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPQ-0000QP-4G
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPQ-0002l6-3Y
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CPUID: suppress IOMMU related hypervisor leaf data
Message-Id: <E1kdlPQ-0002l6-3Y@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:35:24 +0000

commit f5cfa09856732b1d78ff6a21ca3dc33a010da951
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 10 14:39:30 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:39:30 2020 +0100

    x86/CPUID: suppress IOMMU related hypervisor leaf data
    
    Now that the IOMMU for guests can't be enabled "on demand" anymore,
    there's also no reason to expose the related CPUID bit "just in case".
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/traps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index bc5b8f8ea3..c27dd4cd43 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1050,7 +1050,8 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
          * Indicate that memory mapped from other domains (either grants or
          * foreign pages) has valid IOMMU entries.
          */
-        res->a |= XEN_HVM_CPUID_IOMMU_MAPPINGS;
+        if ( is_iommu_enabled(d) )
+            res->a |= XEN_HVM_CPUID_IOMMU_MAPPINGS;
 
         /* Indicate presence of vcpu id and set it in ebx */
         res->a |= XEN_HVM_CPUID_VCPU_ID_PRESENT;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:35:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:35:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27103.55861 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPb-0000SW-IZ; Sat, 14 Nov 2020 02:35:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27103.55861; Sat, 14 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPb-0000SM-FM; Sat, 14 Nov 2020 02:35:35 +0000
Received: by outflank-mailman (input) for mailman id 27103;
 Sat, 14 Nov 2020 02:35:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPa-0000SE-73
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPa-0002mI-6L
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPa-0000SE-73
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPa-0002mI-6L
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CPUID: also check leaf 7 max subleaf to be compatible
Message-Id: <E1kdlPa-0002mI-6L@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:35:34 +0000

commit e6e85b662be9eab96f4cfc58e9945580cce8b2bb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 10 14:40:09 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 10 14:40:09 2020 +0100

    x86/CPUID: also check leaf 7 max subleaf to be compatible
    
    Just like is done for basic and extended major leaves.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/lib/x86/policy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/lib/x86/policy.c b/xen/lib/x86/policy.c
index 4beca8767a..f6cea4e2f9 100644
--- a/xen/lib/x86/policy.c
+++ b/xen/lib/x86/policy.c
@@ -18,6 +18,9 @@ int x86_cpu_policies_are_compatible(const struct cpu_policy *host,
     if ( guest->cpuid->basic.max_leaf > host->cpuid->basic.max_leaf )
         FAIL_CPUID(0, NA);
 
+    if ( guest->cpuid->feat.max_subleaf > host->cpuid->feat.max_subleaf )
+        FAIL_CPUID(7, 0);
+
     if ( guest->cpuid->extd.max_leaf > host->cpuid->extd.max_leaf )
         FAIL_CPUID(0x80000000, NA);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:35:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:35:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27104.55865 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPl-0000Tn-Js; Sat, 14 Nov 2020 02:35:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27104.55865; Sat, 14 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPl-0000Tf-Gr; Sat, 14 Nov 2020 02:35:45 +0000
Received: by outflank-mailman (input) for mailman id 27104;
 Sat, 14 Nov 2020 02:35:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPk-0000TV-A3
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPk-0002ne-9I
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPk-0000TV-A3
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPk-0002ne-9I
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Always trap AMU system registers
Message-Id: <E1kdlPk-0002ne-9I@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:35:44 +0000

commit 628e1becb6fb121475a6ce68e3f1cb4499851255
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 9 20:28:59 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Nov 10 16:49:27 2020 +0000

    xen/arm: Always trap AMU system registers
    
    The Activity Monitors Unit (AMU) has been introduced by ARMv8.4. It is
    considered to be unsafe to be expose to guests as they might expose
    information about code executed by other guests or the host.
    
    Arm provided a way to trap all the AMU system registers by setting
    CPTR_EL2.TAM to 1.
    
    Unfortunately, on older revision of the specification, the bit 30 (now
    CPTR_EL1.TAM) was RES0. Because of that, Xen is setting it to 0 and
    therefore the system registers would be exposed to the guest when it is
    run on processors with AMU.
    
    As the bit is mark as UNKNOWN at boot in Armv8.4, the only safe solution
    for us is to always set CPTR_EL1.TAM to 1.
    
    Guest trying to access the AMU system registers will now receive an
    undefined instruction. Unfortunately, this means that even well-behaved
    guest may fail to boot because we don't sanitize the ID registers.
    
    This is a known issues with other Armv8.0+ features (e.g. SVE, Pointer
    Auth). This will taken care separately.
    
    This is part of XSA-351 (or XSA-93 re-born).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andre Przywara <andre.przywara@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/traps.c            | 3 ++-
 xen/include/asm-arm/processor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index a36f145e67..22bd1bd4c6 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -151,7 +151,8 @@ void init_traps(void)
      * On ARM64 the TCPx bits which we set here (0..9,12,13) are all
      * RES1, i.e. they would trap whether we did this write or not.
      */
-    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) | HCPTR_TTA,
+    WRITE_SYSREG((HCPTR_CP_MASK & ~(HCPTR_CP(10) | HCPTR_CP(11))) |
+                 HCPTR_TTA | HCPTR_TAM,
                  CPTR_EL2);
 
     /*
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 3ca67f8157..d3d12a9d19 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -351,6 +351,7 @@
 #define VTCR_RES1       (_AC(1,UL)<<31)
 
 /* HCPTR Hyp. Coprocessor Trap Register */
+#define HCPTR_TAM       ((_AC(1,U)<<30))
 #define HCPTR_TTA       ((_AC(1,U)<<20))        /* Trap trace registers */
 #define HCPTR_CP(x)     ((_AC(1,U)<<(x)))       /* Trap Coprocessor x */
 #define HCPTR_CP_MASK   ((_AC(1,U)<<14)-1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:35:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:35:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27105.55870 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPv-0000V3-M5; Sat, 14 Nov 2020 02:35:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27105.55870; Sat, 14 Nov 2020 02:35: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlPv-0000Uv-II; Sat, 14 Nov 2020 02:35:55 +0000
Received: by outflank-mailman (input) for mailman id 27105;
 Sat, 14 Nov 2020 02:35:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPu-0000Um-Cs
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlPu-0002os-CB
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPu-0000Um-Cs
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlPu-0002os-CB
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:35:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/events: fix build
Message-Id: <E1kdlPu-0002os-CB@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:35:54 +0000

commit 53bacb86f496fdb11560d9e3b361bca7de60d268
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 11 08:56:21 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 11 08:56:21 2020 +0100

    xen/events: fix build
    
    Commit 5f2df45ead7c1195 ("xen/evtchn: rework per event channel lock")
    introduced a build failure for NDEBUG builds.
    
    Fixes: 5f2df45ead7c1195 ("xen/evtchn: rework per event channel lock")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index eacd96b92f..54b2e2550e 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -61,13 +61,24 @@ static inline void evtchn_write_lock(struct evtchn *evtchn)
 {
     write_lock(&evtchn->lock);
 
+#ifndef NDEBUG
     evtchn->old_state = evtchn->state;
+#endif
+}
+
+static inline unsigned int old_state(const struct evtchn *evtchn)
+{
+#ifndef NDEBUG
+    return evtchn->old_state;
+#else
+    return ECS_RESERVED; /* Just to allow things to build. */
+#endif
 }
 
 static inline void evtchn_write_unlock(struct evtchn *evtchn)
 {
     /* Enforce lock discipline. */
-    ASSERT(evtchn->old_state == ECS_FREE || evtchn->old_state == ECS_UNBOUND ||
+    ASSERT(old_state(evtchn) == ECS_FREE || old_state(evtchn) == ECS_UNBOUND ||
            evtchn->state == ECS_FREE || evtchn->state == ECS_UNBOUND);
 
     write_unlock(&evtchn->lock);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:36:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:36:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27106.55875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlQ5-0000WJ-Ou; Sat, 14 Nov 2020 02:36:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27106.55875; Sat, 14 Nov 2020 02:36: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlQ5-0000WB-Jt; Sat, 14 Nov 2020 02:36:05 +0000
Received: by outflank-mailman (input) for mailman id 27106;
 Sat, 14 Nov 2020 02:36:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlQ4-0000W3-Fs
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:36:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlQ4-0002q0-F7
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:36:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlQ4-0000W3-Fs
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:36:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlQ4-0002q0-F7
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:36:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: paging_write_p2m_entry() is a private function
Message-Id: <E1kdlQ4-0002q0-F7@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:36:04 +0000

commit 69634224afaf84474f04e1ab050f216d66bcda68
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 11 08:57:32 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 11 08:57:32 2020 +0100

    x86/p2m: paging_write_p2m_entry() is a private function
    
    As it gets installed by p2m_pt_init(), it doesn't need to live in
    paging.c. The function working in terms of l1_pgentry_t even further
    indicates its non-paging-generic nature. Move it and drop its
    paging_ prefix, not adding any new one now that it's static.
    
    This then also makes more obvious that in the EPT case we wouldn't
    risk mistakenly calling through the NULL hook pointer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pt.c     | 33 +++++++++++++++++++++++++++++----
 xen/arch/x86/mm/paging.c     | 20 --------------------
 xen/include/asm-x86/paging.h | 12 ------------
 3 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index c04a015e2c..bc9c9e2da1 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -108,6 +108,31 @@ static unsigned long p2m_type_to_flags(const struct p2m_domain *p2m,
     }
 }
 
+/*
+ * Atomically write a P2M entry and update the paging-assistance state
+ * appropriately.
+ * Arguments: the domain in question, the GFN whose mapping is being updated,
+ * a pointer to the entry to be written, the MFN in which the entry resides,
+ * the new contents of the entry, and the level in the p2m tree at which
+ * we are writing.
+ */
+static int write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
+                           l1_pgentry_t *p, l1_pgentry_t new,
+                           unsigned int level)
+{
+    struct domain *d = p2m->domain;
+    const struct vcpu *v = current;
+    int rc = 0;
+
+    if ( v->domain != d )
+        v = d->vcpu ? d->vcpu[0] : NULL;
+    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) )
+        rc = paging_get_hostmode(v)->write_p2m_entry(p2m, gfn, p, new, level);
+    else
+        safe_write_pte(p, new);
+
+    return rc;
+}
 
 // Find the next level's P2M entry, checking for out-of-range gfn's...
 // Returns NULL on error.
@@ -594,7 +619,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
         entry_content.l1 = l3e_content.l3;
 
         rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 3);
-        /* NB: paging_write_p2m_entry() handles tlb flushes properly */
+        /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
     }
@@ -631,7 +656,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
 
         /* level 1 entry */
         rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 1);
-        /* NB: paging_write_p2m_entry() handles tlb flushes properly */
+        /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
     }
@@ -666,7 +691,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
         entry_content.l1 = l2e_content.l2;
 
         rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 2);
-        /* NB: paging_write_p2m_entry() handles tlb flushes properly */
+        /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
     }
@@ -1107,7 +1132,7 @@ void p2m_pt_init(struct p2m_domain *p2m)
     p2m->recalc = do_recalc;
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
-    p2m->write_p2m_entry = paging_write_p2m_entry;
+    p2m->write_p2m_entry = write_p2m_entry;
 #if P2M_AUDIT
     p2m->audit_p2m = p2m_pt_audit_p2m;
 #else
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 8beac0e189..3aaec2ee3a 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -941,27 +941,7 @@ void paging_update_nestedmode(struct vcpu *v)
         v->arch.paging.nestedmode = NULL;
     hvm_asid_flush_vcpu(v);
 }
-#endif
-
-int paging_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                           l1_pgentry_t *p, l1_pgentry_t new,
-                           unsigned int level)
-{
-    struct domain *d = p2m->domain;
-    struct vcpu *v = current;
-    int rc = 0;
-
-    if ( v->domain != d )
-        v = d->vcpu ? d->vcpu[0] : NULL;
-    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v) != NULL) )
-        rc = paging_get_hostmode(v)->write_p2m_entry(p2m, gfn, p, new, level);
-    else
-        safe_write_pte(p, new);
 
-    return rc;
-}
-
-#ifdef CONFIG_HVM
 int __init paging_set_allocation(struct domain *d, unsigned int pages,
                                  bool *preempted)
 {
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 726f48339a..ca68afae95 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -369,18 +369,6 @@ static inline void safe_write_pte(l1_pgentry_t *p, l1_pgentry_t new)
     *p = new;
 }
 
-/* Atomically write a P2M entry and update the paging-assistance state 
- * appropriately. 
- * Arguments: the domain in question, the GFN whose mapping is being updated, 
- * a pointer to the entry to be written, the MFN in which the entry resides, 
- * the new contents of the entry, and the level in the p2m tree at which 
- * we are writing. */
-struct p2m_domain;
-
-int paging_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                           l1_pgentry_t *p, l1_pgentry_t new,
-                           unsigned int level);
-
 /*
  * Called from the guest to indicate that the a process is being
  * torn down and its pagetables will soon be discarded.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 14 02:36:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Nov 2020 02:36:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.27107.55877 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlQF-0000Xq-QD; Sat, 14 Nov 2020 02:36:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 27107.55877; Sat, 14 Nov 2020 02:36:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kdlQF-0000Xh-NG; Sat, 14 Nov 2020 02:36:15 +0000
Received: by outflank-mailman (input) for mailman id 27107;
 Sat, 14 Nov 2020 02:36:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlQE-0000XZ-Ig
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:36:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kdlQE-0002r9-I3
 for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:36:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlQE-0000XZ-Ig
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:36:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kdlQE-0002r9-I3
	for xen-changelog@lists.xenproject.org; Sat, 14 Nov 2020 02:36:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Add Cortex-A73 erratum 858921 workaround
Message-Id: <E1kdlQE-0002r9-I3@xenbits.xenproject.org>
Date: Sat, 14 Nov 2020 02:36:14 +0000

commit 5505f5f8e7e805365cfe70b6a4af6115940bb749
Author:     Penny Zheng <penny.zheng@arm.com>
AuthorDate: Mon Nov 9 16:21:10 2020 +0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed Nov 11 13:44:33 2020 -0800

    xen/arm: Add Cortex-A73 erratum 858921 workaround
    
    CNTVCT_EL0 or CNTPCT_EL0 counter read in Cortex-A73 (all versions)
    might return a wrong value when the counter crosses a 32bit boundary.
    
    Until now, there is no case for Xen itself to access CNTVCT_EL0,
    and it also should be the Guest OS's responsibility to deal with
    this part.
    
    But for CNTPCT, there exists several cases in Xen involving reading
    CNTPCT, so a possible workaround is that performing the read twice,
    and to return one or the other depending on whether a transition has
    taken place.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Reviewed-by: Wei Chen <Wei.Chen@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/misc/arm/silicon-errata.txt |  1 +
 xen/arch/arm/Kconfig             | 18 ++++++++++++++++++
 xen/arch/arm/cpuerrata.c         |  8 ++++++++
 xen/arch/arm/vtimer.c            |  2 +-
 xen/include/asm-arm/cpuerrata.h  |  2 ++
 xen/include/asm-arm/cpufeature.h |  3 ++-
 xen/include/asm-arm/time.h       | 22 +++++++++++++++++++++-
 7 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt
index 1f18a9df58..552c4151d3 100644
--- a/docs/misc/arm/silicon-errata.txt
+++ b/docs/misc/arm/silicon-errata.txt
@@ -51,6 +51,7 @@ stable hypervisors.
 | ARM            | Cortex-A57      | #1319537        | N/A                     |
 | ARM            | Cortex-A72      | #1319367        | N/A                     |
 | ARM            | Cortex-A72      | #853709         | N/A                     |
+| ARM            | Cortex-A73      | #858921         | ARM_ERRATUM_858921      |
 | ARM            | Cortex-A76      | #1165522        | N/A                     |
 | ARM            | Neoverse-N1     | #1165522        | N/A
 | ARM            | MMU-500         | #842869         | N/A                     |
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 2777388265..f938dd21bd 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -226,6 +226,24 @@ config ARM64_ERRATUM_834220
 
 	  If unsure, say Y.
 
+config ARM_ERRATUM_858921
+	bool "Cortex-A73: 858921: Possible wrong read value for CNTVCT or CNTPCT"
+	default y
+	help
+	  This option adds an alternative code sequence to work around ARM
+	  erratum 858921 on Cortex-A73 (all versions).
+
+	  Affected Cortex-A73 might return wrong read value for CNTVCT or CNTPCT
+	  when the counter crosses a 32bit boundary.
+
+	  The workaround involves performing the read twice, and to return
+	  one or the other value depending on whether a transition has taken place.
+	  Please note that this does not necessarily enable the workaround,
+	  as it depends on the alternative framework, which will only patch
+	  the kernel if an affected CPU is detected.
+
+	  If unsure, say Y.
+
 endmenu
 
 config ARM64_HARDEN_BRANCH_PREDICTOR
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 6731d873e8..567911d380 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -469,6 +469,14 @@ static const struct arm_cpu_capabilities arm_errata[] = {
         .capability = ARM_SSBD,
         .matches = has_ssbd_mitigation,
     },
+#endif
+#ifdef CONFIG_ARM_ERRATUM_858921
+    {
+        /* Cortex-A73 (all versions) */
+        .desc = "ARM erratum 858921",
+        .capability = ARM_WORKAROUND_858921,
+        MIDR_ALL_VERSIONS(MIDR_CORTEX_A73),
+    },
 #endif
     {
         /* Neoverse r0p0 - r2p0 */
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index 6d39fc944f..c2b27915c6 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -62,7 +62,7 @@ static void virt_timer_expired(void *data)
 
 int domain_vtimer_init(struct domain *d, struct xen_arch_domainconfig *config)
 {
-    d->arch.virt_timer_base.offset = READ_SYSREG64(CNTPCT_EL0);
+    d->arch.virt_timer_base.offset = get_cycles();
     d->time_offset.seconds = ticks_to_ns(d->arch.virt_timer_base.offset - boot_count);
     do_div(d->time_offset.seconds, 1000000000);
 
diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/asm-arm/cpuerrata.h
index 88ef3ca934..8d7e7b9375 100644
--- a/xen/include/asm-arm/cpuerrata.h
+++ b/xen/include/asm-arm/cpuerrata.h
@@ -28,6 +28,8 @@ static inline bool check_workaround_##erratum(void)             \
 CHECK_WORKAROUND_HELPER(766422, ARM32_WORKAROUND_766422, CONFIG_ARM_32)
 CHECK_WORKAROUND_HELPER(834220, ARM64_WORKAROUND_834220, CONFIG_ARM_64)
 CHECK_WORKAROUND_HELPER(ssbd, ARM_SSBD, CONFIG_ARM_SSBD)
+CHECK_WORKAROUND_HELPER(858921, ARM_WORKAROUND_858921,
+                        CONFIG_ARM_ERRATUM_858921)
 
 #undef CHECK_WORKAROUND_HELPER
 
diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 10878ead8a..016a9fe203 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -45,8 +45,9 @@
 #define ARM_SSBD 7
 #define ARM_SMCCC_1_1 8
 #define ARM64_WORKAROUND_AT_SPECULATE 9
+#define ARM_WORKAROUND_858921 10
 
-#define ARM_NCAPS           10
+#define ARM_NCAPS           11
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index 9cb6f9b0b4..1b2c13614b 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -3,6 +3,7 @@
 
 #include <asm/sysregs.h>
 #include <asm/system.h>
+#include <asm/cpuerrata.h>
 
 #define DT_MATCH_TIMER                      \
     DT_MATCH_COMPATIBLE("arm,armv7-timer"), \
@@ -13,7 +14,26 @@ typedef uint64_t cycles_t;
 static inline cycles_t get_cycles (void)
 {
         isb();
-        return READ_SYSREG64(CNTPCT_EL0);
+        /*
+         * ARM_WORKAROUND_858921: Cortex-A73 (all versions) counter read
+         * can return a wrong value when the counter crosses a 32bit boundary.
+         */
+        if ( !check_workaround_858921() )
+            return READ_SYSREG64(CNTPCT_EL0);
+        else
+        {
+            /*
+             * A recommended workaround for erratum 858921 is to:
+             *  1- Read twice CNTPCT.
+             *  2- Compare bit[32] of the two read values.
+             *      - If bit[32] is different, keep the old value.
+             *      - If bit[32] is the same, keep the new value.
+             */
+            cycles_t old, new;
+            old = READ_SYSREG64(CNTPCT_EL0);
+            new = READ_SYSREG64(CNTPCT_EL0);
+            return (((old ^ new) >> 32) & 1) ? old : new;
+        }
 }
 
 /* List of timer's IRQ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 11:44:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 11:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.29741.59360 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLsc-0003lq-HX; Wed, 18 Nov 2020 11:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 29741.59360; Wed, 18 Nov 2020 11:44:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLsc-0003li-ES; Wed, 18 Nov 2020 11:44:06 +0000
Received: by outflank-mailman (input) for mailman id 29741;
 Wed, 18 Nov 2020 11:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLsb-0003ld-3Z
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLsa-0006ut-Ua
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLsb-0003ld-3Z
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLsa-0006ut-Ua
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: collapse the two ->write_p2m_entry() hooks
Message-Id: <E1kfLsa-0006ut-Ua@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 11:44:04 +0000

commit 192b45e0e4180326b1312ae8bdabf477d086c400
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:33:18 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:33:18 2020 +0100

    x86/p2m: collapse the two ->write_p2m_entry() hooks
    
    The struct paging_mode instances get set to the same functions
    regardless of mode by both HAP and shadow code, hence there's no point
    having this hook there. The hook also doesn't need moving elsewhere - we
    can directly use struct p2m_domain's. This merely requires (from a
    strictly formal pov; in practice this may not even be needed) making
    sure we don't end up using safe_write_pte() for nested P2Ms.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c        |  9 +++++----
 xen/arch/x86/mm/p2m-pt.c         | 38 ++++++++++++++++++++++----------------
 xen/arch/x86/mm/shadow/common.c  |  7 ++++++-
 xen/arch/x86/mm/shadow/multi.c   |  1 -
 xen/arch/x86/mm/shadow/none.c    |  9 ---------
 xen/arch/x86/mm/shadow/private.h |  5 -----
 xen/include/asm-x86/p2m.h        |  3 +++
 xen/include/asm-x86/paging.h     |  4 ----
 8 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 4eedd1a995..69b06f19b5 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -823,6 +823,11 @@ hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
     return 0;
 }
 
+void hap_p2m_init(struct p2m_domain *p2m)
+{
+    p2m->write_p2m_entry = hap_write_p2m_entry;
+}
+
 static unsigned long hap_gva_to_gfn_real_mode(
     struct vcpu *v, struct p2m_domain *p2m, unsigned long gva, uint32_t *pfec)
 {
@@ -846,7 +851,6 @@ static const struct paging_mode hap_paging_real_mode = {
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_real_mode,
     .update_cr3             = hap_update_cr3,
     .update_paging_modes    = hap_update_paging_modes,
-    .write_p2m_entry        = hap_write_p2m_entry,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 1
 };
@@ -858,7 +862,6 @@ static const struct paging_mode hap_paging_protected_mode = {
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_2_levels,
     .update_cr3             = hap_update_cr3,
     .update_paging_modes    = hap_update_paging_modes,
-    .write_p2m_entry        = hap_write_p2m_entry,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 2
 };
@@ -870,7 +873,6 @@ static const struct paging_mode hap_paging_pae_mode = {
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_3_levels,
     .update_cr3             = hap_update_cr3,
     .update_paging_modes    = hap_update_paging_modes,
-    .write_p2m_entry        = hap_write_p2m_entry,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 3
 };
@@ -882,7 +884,6 @@ static const struct paging_mode hap_paging_long_mode = {
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_4_levels,
     .update_cr3             = hap_update_cr3,
     .update_paging_modes    = hap_update_paging_modes,
-    .write_p2m_entry        = hap_write_p2m_entry,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 4
 };
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index bc9c9e2da1..6887b254f3 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -126,8 +126,9 @@ static int write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
 
     if ( v->domain != d )
         v = d->vcpu ? d->vcpu[0] : NULL;
-    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) )
-        rc = paging_get_hostmode(v)->write_p2m_entry(p2m, gfn, p, new, level);
+    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) ||
+         p2m_is_nestedp2m(p2m) )
+        rc = p2m->write_p2m_entry(p2m, gfn, p, new, level);
     else
         safe_write_pte(p, new);
 
@@ -209,7 +210,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
 
         new_entry = l1e_from_mfn(mfn, P2M_BASE_FLAGS | _PAGE_RW);
 
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
         if ( rc )
             goto error;
     }
@@ -251,7 +252,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
         {
             new_entry = l1e_from_pfn(pfn | (i << ((level - 1) * PAGETABLE_ORDER)),
                                      flags);
-            rc = p2m->write_p2m_entry(p2m, gfn, l1_entry + i, new_entry, level);
+            rc = write_p2m_entry(p2m, gfn, l1_entry + i, new_entry, level);
             if ( rc )
             {
                 unmap_domain_page(l1_entry);
@@ -262,8 +263,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
         unmap_domain_page(l1_entry);
 
         new_entry = l1e_from_mfn(mfn, P2M_BASE_FLAGS | _PAGE_RW);
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry,
-                                  level + 1);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
         if ( rc )
             goto error;
     }
@@ -335,7 +335,7 @@ static int p2m_pt_set_recalc_range(struct p2m_domain *p2m,
             if ( (l1e_get_flags(e) & _PAGE_PRESENT) && !needs_recalc(l1, e) )
             {
                 set_recalc(l1, e);
-                err = p2m->write_p2m_entry(p2m, first_gfn, pent, e, level);
+                err = write_p2m_entry(p2m, first_gfn, pent, e, level);
                 if ( err )
                 {
                     ASSERT_UNREACHABLE();
@@ -412,8 +412,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                      !needs_recalc(l1, ent) )
                 {
                     set_recalc(l1, ent);
-                    err = p2m->write_p2m_entry(p2m, gfn - remainder, &ptab[i],
-                                               ent, level);
+                    err = write_p2m_entry(p2m, gfn - remainder, &ptab[i], ent,
+                                          level);
                     if ( err )
                     {
                         ASSERT_UNREACHABLE();
@@ -426,7 +426,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             if ( !err )
             {
                 clear_recalc(l1, e);
-                err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
+                err = write_p2m_entry(p2m, gfn, pent, e, level + 1);
                 ASSERT(!err);
 
                 recalc_done = true;
@@ -474,7 +474,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
         }
         else
             clear_recalc(l1, e);
-        err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
+        err = write_p2m_entry(p2m, gfn, pent, e, level + 1);
         ASSERT(!err);
 
         recalc_done = true;
@@ -618,7 +618,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
             : l3e_empty();
         entry_content.l1 = l3e_content.l3;
 
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 3);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 3);
         /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
@@ -655,7 +655,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
             entry_content = l1e_empty();
 
         /* level 1 entry */
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 1);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 1);
         /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
@@ -690,7 +690,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
             : l2e_empty();
         entry_content.l1 = l2e_content.l2;
 
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 2);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 2);
         /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
@@ -914,7 +914,7 @@ static void p2m_pt_change_entry_type_global(struct p2m_domain *p2m,
             int rc;
 
             set_recalc(l1, e);
-            rc = p2m->write_p2m_entry(p2m, gfn, &tab[i], e, 4);
+            rc = write_p2m_entry(p2m, gfn, &tab[i], e, 4);
             if ( rc )
             {
                 ASSERT_UNREACHABLE();
@@ -1132,7 +1132,13 @@ void p2m_pt_init(struct p2m_domain *p2m)
     p2m->recalc = do_recalc;
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
-    p2m->write_p2m_entry = write_p2m_entry;
+
+    /* Still too early to use paging_mode_hap(). */
+    if ( hap_enabled(p2m->domain) )
+        hap_p2m_init(p2m);
+    else if ( IS_ENABLED(CONFIG_SHADOW_PAGING) )
+        shadow_p2m_init(p2m);
+
 #if P2M_AUDIT
     p2m->audit_p2m = p2m_pt_audit_p2m;
 #else
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 9c3d9a7cfd..300191450a 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3144,7 +3144,7 @@ static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
     }
 }
 
-int
+static int
 shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
                        l1_pgentry_t *p, l1_pgentry_t new,
                        unsigned int level)
@@ -3190,6 +3190,11 @@ shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
     return 0;
 }
 
+void shadow_p2m_init(struct p2m_domain *p2m)
+{
+    p2m->write_p2m_entry = shadow_write_p2m_entry;
+}
+
 /**************************************************************************/
 /* Log-dirty mode support */
 
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index eba5164a27..d24ccde035 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4574,7 +4574,6 @@ const struct paging_mode sh_paging_mode = {
     .gva_to_gfn                    = sh_gva_to_gfn,
     .update_cr3                    = sh_update_cr3,
     .update_paging_modes           = shadow_update_paging_modes,
-    .write_p2m_entry               = shadow_write_p2m_entry,
     .flush_tlb                     = shadow_flush_tlb,
     .guest_levels                  = GUEST_PAGING_LEVELS,
     .shadow.detach_old_tables      = sh_detach_old_tables,
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index 2fddf4274c..691269a59e 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -60,21 +60,12 @@ static void _update_paging_modes(struct vcpu *v)
     ASSERT_UNREACHABLE();
 }
 
-static int _write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                            l1_pgentry_t *p, l1_pgentry_t new,
-                            unsigned int level)
-{
-    ASSERT_UNREACHABLE();
-    return -EOPNOTSUPP;
-}
-
 static const struct paging_mode sh_paging_none = {
     .page_fault                    = _page_fault,
     .invlpg                        = _invlpg,
     .gva_to_gfn                    = _gva_to_gfn,
     .update_cr3                    = _update_cr3,
     .update_paging_modes           = _update_paging_modes,
-    .write_p2m_entry               = _write_p2m_entry,
 };
 
 void shadow_vcpu_init(struct vcpu *v)
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index e9b304f755..911db46e73 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -387,11 +387,6 @@ static inline int sh_remove_write_access(struct domain *d, mfn_t readonly_mfn,
 }
 #endif
 
-/* Functions that atomically write PT/P2M entries and update state */
-int shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                           l1_pgentry_t *p, l1_pgentry_t new,
-                           unsigned int level);
-
 /* Functions that atomically write PV guest PT entries */
 void sh_write_guest_entry(struct vcpu *v, intpte_t *p, intpte_t new,
                           mfn_t gmfn);
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 8abae345e8..3d518cba3b 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -836,6 +836,9 @@ void p2m_flush_nestedp2m(struct domain *d);
 /* Flushes the np2m specified by np2m_base (if it exists) */
 void np2m_flush_base(struct vcpu *v, unsigned long np2m_base);
 
+void hap_p2m_init(struct p2m_domain *p2m);
+void shadow_p2m_init(struct p2m_domain *p2m);
+
 int nestedp2m_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
     l1_pgentry_t *p, l1_pgentry_t new, unsigned int level);
 
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index ca68afae95..5cf128cf34 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -139,10 +139,6 @@ struct paging_mode {
     void          (*update_cr3            )(struct vcpu *v, int do_locking,
                                             bool noflush);
     void          (*update_paging_modes   )(struct vcpu *v);
-    int           (*write_p2m_entry       )(struct p2m_domain *p2m,
-                                            unsigned long gfn,
-                                            l1_pgentry_t *p, l1_pgentry_t new,
-                                            unsigned int level);
     bool          (*flush_tlb             )(bool (*flush_vcpu)(void *ctxt,
                                                                struct vcpu *v),
                                             void *ctxt);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 11:44:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 11:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.29742.59364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLsm-0003md-JQ; Wed, 18 Nov 2020 11:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 29742.59364; Wed, 18 Nov 2020 11:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLsm-0003mU-G5; Wed, 18 Nov 2020 11:44:16 +0000
Received: by outflank-mailman (input) for mailman id 29742;
 Wed, 18 Nov 2020 11:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLsl-0003mN-6q
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLsl-0006wa-61
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLsl-0003mN-6q
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLsl-0006wa-61
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: suppress audit_p2m hook when possible
Message-Id: <E1kfLsl-0006wa-61@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 11:44:15 +0000

commit 7aa7629fa0ff9a4077d2ae092d49ca6cc69bc8d3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:34:14 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:34:14 2020 +0100

    x86/p2m: suppress audit_p2m hook when possible
    
    When P2M_AUDIT is false, it's unused, so instead of having a dangling
    NULL pointer sit there, omit the field altogether.
    
    Instead of adding "#if P2M_AUDIT && defined(CONFIG_HVM)" in even more
    places, fold the latter part right into the definition of P2M_AUDIT.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/domctl.c     |  2 +-
 xen/arch/x86/mm/p2m-ept.c |  2 ++
 xen/arch/x86/mm/p2m-pt.c  |  8 ++------
 xen/arch/x86/mm/p2m.c     |  2 +-
 xen/include/asm-x86/p2m.h | 18 ++++++++++--------
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 2ee29a0f78..b28cfe9817 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1012,7 +1012,7 @@ long arch_do_domctl(
         break;
 #endif
 
-#if P2M_AUDIT && defined(CONFIG_HVM)
+#if P2M_AUDIT
     case XEN_DOMCTL_audit_p2m:
         if ( d == currd )
             ret = -EPERM;
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 476458b1e0..975ab403f2 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -1260,7 +1260,9 @@ int ept_p2m_init(struct p2m_domain *p2m)
     p2m->change_entry_type_global = ept_change_entry_type_global;
     p2m->change_entry_type_range = ept_change_entry_type_range;
     p2m->memory_type_changed = ept_memory_type_changed;
+#if P2M_AUDIT
     p2m->audit_p2m = NULL;
+#endif
     p2m->tlb_flush = ept_tlb_flush;
 
     /* Set the memory type used when accessing EPT paging structures. */
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 6887b254f3..41be7fbd61 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -971,8 +971,8 @@ static int p2m_pt_change_entry_type_range(struct p2m_domain *p2m,
     return err;
 }
 
-#if P2M_AUDIT && defined(CONFIG_HVM)
-long p2m_pt_audit_p2m(struct p2m_domain *p2m)
+#if P2M_AUDIT
+static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
 {
     unsigned long entry_count = 0, pmbad = 0;
     unsigned long mfn, gfn, m2pfn;
@@ -1120,8 +1120,6 @@ long p2m_pt_audit_p2m(struct p2m_domain *p2m)
 
     return pmbad;
 }
-#else
-# define p2m_pt_audit_p2m NULL
 #endif /* P2M_AUDIT */
 
 /* Set up the p2m function pointers for pagetable format */
@@ -1141,8 +1139,6 @@ void p2m_pt_init(struct p2m_domain *p2m)
 
 #if P2M_AUDIT
     p2m->audit_p2m = p2m_pt_audit_p2m;
-#else
-    p2m->audit_p2m = NULL;
 #endif
 }
 
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 928344be30..f198355a56 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2435,7 +2435,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t gfn,
 
 /*** Audit ***/
 
-#if P2M_AUDIT && defined(CONFIG_HVM)
+#if P2M_AUDIT
 void audit_p2m(struct domain *d,
                uint64_t *orphans,
                 uint64_t *m2p_bad,
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 3d518cba3b..2d68ed3843 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -31,6 +31,14 @@
 #include <asm/mem_sharing.h>
 #include <asm/page.h>    /* for pagetable_t */
 
+/* Debugging and auditing of the P2M code? */
+#if !defined(NDEBUG) && defined(CONFIG_HVM)
+#define P2M_AUDIT     1
+#else
+#define P2M_AUDIT     0
+#endif
+#define P2M_DEBUGGING 0
+
 extern bool_t opt_hap_1gb, opt_hap_2mb;
 
 /*
@@ -268,7 +276,9 @@ struct p2m_domain {
     int                (*write_p2m_entry)(struct p2m_domain *p2m,
                                           unsigned long gfn, l1_pgentry_t *p,
                                           l1_pgentry_t new, unsigned int level);
+#if P2M_AUDIT
     long               (*audit_p2m)(struct p2m_domain *p2m);
+#endif
 
     /*
      * P2M updates may require TLBs to be flushed (invalidated).
@@ -758,14 +768,6 @@ extern void p2m_pt_init(struct p2m_domain *p2m);
 void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn,
                      p2m_query_t q, uint32_t *pfec);
 
-/* Debugging and auditing of the P2M code? */
-#ifndef NDEBUG
-#define P2M_AUDIT     1
-#else
-#define P2M_AUDIT     0
-#endif
-#define P2M_DEBUGGING 0
-
 #if P2M_AUDIT
 extern void audit_p2m(struct domain *d,
                       uint64_t *orphans,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 11:44:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 11:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.29743.59368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLsw-0003oW-L2; Wed, 18 Nov 2020 11:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 29743.59368; Wed, 18 Nov 2020 11:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLsw-0003oN-Hu; Wed, 18 Nov 2020 11:44:26 +0000
Received: by outflank-mailman (input) for mailman id 29743;
 Wed, 18 Nov 2020 11:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLsv-0003oC-A6
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLsv-0006xY-91
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLsv-0003oC-A6
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLsv-0006xY-91
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HAP: move nested-P2M flush calculations out of locked region
Message-Id: <E1kfLsv-0006xY-91@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 11:44:25 +0000

commit a7ab52f9e87c5140b8f0c5444c79d061a6985a2b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:34:54 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:34:54 2020 +0100

    x86/HAP: move nested-P2M flush calculations out of locked region
    
    By latching the old MFN into a local variable, these calculations don't
    depend on anything but local variables anymore. Hence the point in time
    when they get performed doesn't matter anymore, so they can be moved
    past the locked region.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 69b06f19b5..d1ad10003c 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -780,7 +780,7 @@ hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
 {
     struct domain *d = p2m->domain;
     uint32_t old_flags;
-    bool_t flush_nestedp2m = 0;
+    mfn_t omfn;
     int rc;
 
     /* We know always use the host p2m here, regardless if the vcpu
@@ -790,21 +790,11 @@ hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
 
     paging_lock(d);
     old_flags = l1e_get_flags(*p);
-
-    if ( nestedhvm_enabled(d) && (old_flags & _PAGE_PRESENT) 
-         && !p2m_get_hostp2m(d)->defer_nested_flush ) {
-        /* We are replacing a valid entry so we need to flush nested p2ms,
-         * unless the only change is an increase in access rights. */
-        mfn_t omfn = l1e_get_mfn(*p);
-        mfn_t nmfn = l1e_get_mfn(new);
-
-        flush_nestedp2m = !(mfn_eq(omfn, nmfn)
-            && perms_strictly_increased(old_flags, l1e_get_flags(new)) );
-    }
+    omfn = l1e_get_mfn(*p);
 
     rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)),
                           p2m_flags_to_type(old_flags), l1e_get_mfn(new),
-                          l1e_get_mfn(*p), level);
+                          omfn, level);
     if ( rc )
     {
         paging_unlock(d);
@@ -817,7 +807,14 @@ hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
 
     paging_unlock(d);
 
-    if ( flush_nestedp2m )
+    if ( nestedhvm_enabled(d) && (old_flags & _PAGE_PRESENT) &&
+         !p2m_get_hostp2m(d)->defer_nested_flush &&
+         /*
+          * We are replacing a valid entry so we need to flush nested p2ms,
+          * unless the only change is an increase in access rights.
+          */
+         (!mfn_eq(omfn, l1e_get_mfn(new)) ||
+          !perms_strictly_increased(old_flags, l1e_get_flags(new))) )
         p2m_flush_nestedp2m(d);
 
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 11:44:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 11:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.29744.59372 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLt6-0003py-Ml; Wed, 18 Nov 2020 11:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 29744.59372; Wed, 18 Nov 2020 11:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLt6-0003pq-Jh; Wed, 18 Nov 2020 11:44:36 +0000
Received: by outflank-mailman (input) for mailman id 29744;
 Wed, 18 Nov 2020 11:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLt5-0003pe-DH
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLt5-0006yc-Cb
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLt5-0003pe-DH
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLt5-0006yc-Cb
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: split write_p2m_entry() hook
Message-Id: <E1kfLt5-0006yc-Cb@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 11:44:35 +0000

commit dc5616e126714e7987cc1caf9bc7a95de0046ef7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:37:24 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:37:24 2020 +0100

    x86/p2m: split write_p2m_entry() hook
    
    Fair parts of the present handlers are identical; in fact
    nestedp2m_write_p2m_entry() lacks a call to p2m_entry_modify(). Move
    common parts right into write_p2m_entry(), splitting the hooks into a
    "pre" one (needed just by shadow code) and a "post" one.
    
    For the common parts moved I think that the p2m_flush_nestedp2m() is,
    at least from an abstract perspective, also applicable in the shadow
    case. Hence it doesn't get a 3rd hook put in place.
    
    The initial comment that was in hap_write_p2m_entry() gets dropped: Its
    placement was bogus, and looking back the the commit introducing it
    (dd6de3ab9985 "Implement Nested-on-Nested") I can't see either what use
    of a p2m it was meant to be associated with.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c        | 45 ++++------------------------------------
 xen/arch/x86/mm/hap/nested_hap.c | 21 ++++---------------
 xen/arch/x86/mm/p2m-pt.c         | 44 ++++++++++++++++++++++++++++++++++++---
 xen/arch/x86/mm/p2m.c            |  3 ++-
 xen/arch/x86/mm/shadow/common.c  | 41 +++++++++++++-----------------------
 xen/include/asm-x86/p2m.h        | 17 ++++++++-------
 6 files changed, 75 insertions(+), 96 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index d1ad10003c..0fdb7d4a59 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -774,55 +774,18 @@ static void hap_update_paging_modes(struct vcpu *v)
     put_gfn(d, cr3_gfn);
 }
 
-static int
-hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
-                    l1_pgentry_t new, unsigned int level)
+static void
+hap_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
 {
     struct domain *d = p2m->domain;
-    uint32_t old_flags;
-    mfn_t omfn;
-    int rc;
-
-    /* We know always use the host p2m here, regardless if the vcpu
-     * is in host or guest mode. The vcpu can be in guest mode by
-     * a hypercall which passes a domain and chooses mostly the first
-     * vcpu. */
-
-    paging_lock(d);
-    old_flags = l1e_get_flags(*p);
-    omfn = l1e_get_mfn(*p);
-
-    rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)),
-                          p2m_flags_to_type(old_flags), l1e_get_mfn(new),
-                          omfn, level);
-    if ( rc )
-    {
-        paging_unlock(d);
-        return rc;
-    }
 
-    safe_write_pte(p, new);
-    if ( old_flags & _PAGE_PRESENT )
+    if ( oflags & _PAGE_PRESENT )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-
-    paging_unlock(d);
-
-    if ( nestedhvm_enabled(d) && (old_flags & _PAGE_PRESENT) &&
-         !p2m_get_hostp2m(d)->defer_nested_flush &&
-         /*
-          * We are replacing a valid entry so we need to flush nested p2ms,
-          * unless the only change is an increase in access rights.
-          */
-         (!mfn_eq(omfn, l1e_get_mfn(new)) ||
-          !perms_strictly_increased(old_flags, l1e_get_flags(new))) )
-        p2m_flush_nestedp2m(d);
-
-    return 0;
 }
 
 void hap_p2m_init(struct p2m_domain *p2m)
 {
-    p2m->write_p2m_entry = hap_write_p2m_entry;
+    p2m->write_p2m_entry_post = hap_write_p2m_entry_post;
 }
 
 static unsigned long hap_gva_to_gfn_real_mode(
diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c
index f92ddc5206..50fa2dd9f4 100644
--- a/xen/arch/x86/mm/hap/nested_hap.c
+++ b/xen/arch/x86/mm/hap/nested_hap.c
@@ -71,24 +71,11 @@
 /*        NESTED VIRT P2M FUNCTIONS         */
 /********************************************/
 
-int
-nestedp2m_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-    l1_pgentry_t *p, l1_pgentry_t new, unsigned int level)
+void
+nestedp2m_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
 {
-    struct domain *d = p2m->domain;
-    uint32_t old_flags;
-
-    paging_lock(d);
-
-    old_flags = l1e_get_flags(*p);
-    safe_write_pte(p, new);
-
-    if (old_flags & _PAGE_PRESENT)
-        guest_flush_tlb_mask(d, p2m->dirty_cpumask);
-
-    paging_unlock(d);
-
-    return 0;
+    if ( oflags & _PAGE_PRESENT )
+        guest_flush_tlb_mask(p2m->domain, p2m->dirty_cpumask);
 }
 
 /********************************************/
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 41be7fbd61..5fa0d30ce7 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -122,17 +122,55 @@ static int write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
 {
     struct domain *d = p2m->domain;
     const struct vcpu *v = current;
-    int rc = 0;
 
     if ( v->domain != d )
         v = d->vcpu ? d->vcpu[0] : NULL;
     if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) ||
          p2m_is_nestedp2m(p2m) )
-        rc = p2m->write_p2m_entry(p2m, gfn, p, new, level);
+    {
+        unsigned int oflags;
+        mfn_t omfn;
+        int rc;
+
+        paging_lock(d);
+
+        if ( p2m->write_p2m_entry_pre )
+            p2m->write_p2m_entry_pre(d, gfn, p, new, level);
+
+        oflags = l1e_get_flags(*p);
+        omfn = l1e_get_mfn(*p);
+
+        rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)),
+                              p2m_flags_to_type(oflags), l1e_get_mfn(new),
+                              omfn, level);
+        if ( rc )
+        {
+            paging_unlock(d);
+            return rc;
+        }
+
+        safe_write_pte(p, new);
+
+        if ( p2m->write_p2m_entry_post )
+            p2m->write_p2m_entry_post(p2m, oflags);
+
+        paging_unlock(d);
+
+        if ( nestedhvm_enabled(d) && !p2m_is_nestedp2m(p2m) &&
+             (oflags & _PAGE_PRESENT) &&
+             !p2m_get_hostp2m(d)->defer_nested_flush &&
+             /*
+              * We are replacing a valid entry so we need to flush nested p2ms,
+              * unless the only change is an increase in access rights.
+              */
+             (!mfn_eq(omfn, l1e_get_mfn(new)) ||
+              !perms_strictly_increased(oflags, l1e_get_flags(new))) )
+            p2m_flush_nestedp2m(d);
+    }
     else
         safe_write_pte(p, new);
 
-    return rc;
+    return 0;
 }
 
 // Find the next level's P2M entry, checking for out-of-range gfn's...
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index f198355a56..d9cc1856bb 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -198,7 +198,8 @@ static int p2m_init_nestedp2m(struct domain *d)
             return -ENOMEM;
         }
         p2m->p2m_class = p2m_nested;
-        p2m->write_p2m_entry = nestedp2m_write_p2m_entry;
+        p2m->write_p2m_entry_pre = NULL;
+        p2m->write_p2m_entry_post = nestedp2m_write_p2m_entry_post;
         list_add(&p2m->np2m_list, &p2m_get_hostp2m(d)->np2m_list);
     }
 
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 300191450a..a33e100861 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3144,34 +3144,22 @@ static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
     }
 }
 
-static int
-shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                       l1_pgentry_t *p, l1_pgentry_t new,
-                       unsigned int level)
+static void
+sh_write_p2m_entry_pre(struct domain *d, unsigned long gfn, l1_pgentry_t *p,
+                       l1_pgentry_t new, unsigned int level)
 {
-    struct domain *d = p2m->domain;
-    int rc;
-
-    paging_lock(d);
-
     /* If there are any shadows, update them.  But if shadow_teardown()
      * has already been called then it's not safe to try. */
     if ( likely(d->arch.paging.shadow.total_pages != 0) )
          sh_unshadow_for_p2m_change(d, gfn, p, new, level);
-
-    rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)),
-                          p2m_flags_to_type(l1e_get_flags(*p)),
-                          l1e_get_mfn(new), l1e_get_mfn(*p), level);
-    if ( rc )
-    {
-        paging_unlock(d);
-        return rc;
-    }
-
-    /* Update the entry with new content */
-    safe_write_pte(p, new);
+}
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
+static void
+sh_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
+{
+    struct domain *d = p2m->domain;
+
     /* If we're doing FAST_FAULT_PATH, then shadow mode may have
        cached the fact that this is an mmio region in the shadow
        page tables.  Blow the tables away to remove the cache.
@@ -3183,16 +3171,15 @@ shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
         shadow_blow_tables(d);
         d->arch.paging.shadow.has_fast_mmio_entries = false;
     }
-#endif
-
-    paging_unlock(d);
-
-    return 0;
 }
+#else
+# define sh_write_p2m_entry_post NULL
+#endif
 
 void shadow_p2m_init(struct p2m_domain *p2m)
 {
-    p2m->write_p2m_entry = shadow_write_p2m_entry;
+    p2m->write_p2m_entry_pre  = sh_write_p2m_entry_pre;
+    p2m->write_p2m_entry_post = sh_write_p2m_entry_post;
 }
 
 /**************************************************************************/
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 2d68ed3843..8d6fd1aa01 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -272,10 +272,13 @@ struct p2m_domain {
                                                   unsigned long first_gfn,
                                                   unsigned long last_gfn);
     void               (*memory_type_changed)(struct p2m_domain *p2m);
-    
-    int                (*write_p2m_entry)(struct p2m_domain *p2m,
-                                          unsigned long gfn, l1_pgentry_t *p,
-                                          l1_pgentry_t new, unsigned int level);
+    void               (*write_p2m_entry_pre)(struct domain *d,
+                                              unsigned long gfn,
+                                              l1_pgentry_t *p,
+                                              l1_pgentry_t new,
+                                              unsigned int level);
+    void               (*write_p2m_entry_post)(struct p2m_domain *p2m,
+                                               unsigned int oflags);
 #if P2M_AUDIT
     long               (*audit_p2m)(struct p2m_domain *p2m);
 #endif
@@ -472,7 +475,7 @@ void __put_gfn(struct p2m_domain *p2m, unsigned long gfn);
  *
  * This is also used in the shadow code whenever the paging lock is
  * held -- in those cases, the caller is protected against concurrent
- * p2m updates by the fact that shadow_write_p2m_entry() also takes
+ * p2m updates by the fact that write_p2m_entry() also takes
  * the paging lock.
  *
  * Note that an unlocked accessor only makes sense for a "query" lookup.
@@ -841,8 +844,8 @@ void np2m_flush_base(struct vcpu *v, unsigned long np2m_base);
 void hap_p2m_init(struct p2m_domain *p2m);
 void shadow_p2m_init(struct p2m_domain *p2m);
 
-int nestedp2m_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-    l1_pgentry_t *p, l1_pgentry_t new, unsigned int level);
+void nestedp2m_write_p2m_entry_post(struct p2m_domain *p2m,
+                                    unsigned int oflags);
 
 /*
  * Alternate p2m: shadow p2m tables used for alternate memory views
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 11:44:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 11:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.29745.59376 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLtG-0003re-Ph; Wed, 18 Nov 2020 11:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 29745.59376; Wed, 18 Nov 2020 11:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLtG-0003rW-Mn; Wed, 18 Nov 2020 11:44:46 +0000
Received: by outflank-mailman (input) for mailman id 29745;
 Wed, 18 Nov 2020 11:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLtF-0003rN-G5
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLtF-000700-FL
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLtF-0003rN-G5
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLtF-000700-FL
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vpt: fix build with old gcc
Message-Id: <E1kfLtF-000700-FL@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 11:44:45 +0000

commit f2c620aa062767b318267d678ae249dcb637b870
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:38:01 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:38:01 2020 +0100

    x86/vpt: fix build with old gcc
    
    I believe it was the XSA-336 fix (42fcdd42328f "x86/vpt: fix race when
    migrating timers between vCPUs") which has unmasked a bogus
    uninitialized variable warning. This is observable with gcc 4.3.4, but
    only on 4.13 and older; it's hidden on newer versions apparently due to
    the addition to _read_unlock() done by 12509bbeb9e3 ("rwlocks: call
    preempt_disable() when taking a rwlock").
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vpt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 867deb4da5..4c2afe2e91 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -401,7 +401,7 @@ int pt_update_irq(struct vcpu *v)
                  * associated with the timer.
                  */
                 time_cb *cb = NULL;
-                void *cb_priv;
+                void *cb_priv = NULL;
 
                 pt_vcpu_lock(v);
                 /* Make sure the timer is still on the list. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 11:44:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 11:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.29746.59379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLtQ-0003sv-R3; Wed, 18 Nov 2020 11:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 29746.59379; Wed, 18 Nov 2020 11:44: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLtQ-0003so-OF; Wed, 18 Nov 2020 11:44:56 +0000
Received: by outflank-mailman (input) for mailman id 29746;
 Wed, 18 Nov 2020 11:44:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLtP-0003se-JP
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLtP-00071J-IK
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLtP-0003se-JP
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLtP-00071J-IK
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:44:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/x86: add nmi continuation framework
Message-Id: <E1kfLtP-00071J-IK@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 11:44:55 +0000

commit 665c940d24b53e52a32a38571bc7a58a165409d9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 18 12:38:29 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:38:29 2020 +0100

    xen/x86: add nmi continuation framework
    
    Actions in NMI context are rather limited as e.g. locking is rather
    fragile.
    
    Add a framework to continue processing in normal interrupt context
    after leaving NMI processing.
    
    This is done by a high priority interrupt vector triggered via a
    self IPI from NMI context, which will then call the continuation
    function specified during NMI handling.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c       | 13 ++++++++++---
 xen/arch/x86/smp.c        |  1 +
 xen/arch/x86/traps.c      | 21 +++++++++++++++++++++
 xen/include/asm-x86/nmi.h | 11 ++++++++++-
 4 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 60627fd6e6..7497ddb5da 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -40,6 +40,7 @@
 #include <irq_vectors.h>
 #include <xen/kexec.h>
 #include <asm/guest.h>
+#include <asm/nmi.h>
 #include <asm/time.h>
 
 static bool __read_mostly tdt_enabled;
@@ -1376,16 +1377,22 @@ void spurious_interrupt(struct cpu_user_regs *regs)
 {
     /*
      * Check if this is a vectored interrupt (most likely, as this is probably
-     * a request to dump local CPU state). Vectored interrupts are ACKed;
-     * spurious interrupts are not.
+     * a request to dump local CPU state or to continue NMI handling).
+     * Vectored interrupts are ACKed; spurious interrupts are not.
      */
     if (apic_isr_read(SPURIOUS_APIC_VECTOR)) {
+        bool is_spurious;
+
         ack_APIC_irq();
+        is_spurious = !nmi_check_continuation();
         if (this_cpu(state_dump_pending)) {
             this_cpu(state_dump_pending) = false;
             dump_execstate(regs);
-            return;
+            is_spurious = false;
         }
+
+        if ( !is_spurious )
+            return;
     }
 
     /* see sw-dev-man vol 3, chapter 7.4.13.5 */
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 14aa355a6b..eef0f9c6cb 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -163,6 +163,7 @@ void send_IPI_self(int vector)
 
 void send_IPI_self_legacy(uint8_t vector)
 {
+    /* NMI continuation handling relies on using a shorthand here. */
     send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
 }
 
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index c27dd4cd43..5cbaa49031 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -79,6 +79,7 @@
 #include <public/hvm/params.h>
 #include <asm/cpuid.h>
 #include <xsm/xsm.h>
+#include <asm/mach-default/irq_vectors.h>
 #include <asm/pv/traps.h>
 #include <asm/pv/mm.h>
 
@@ -1800,6 +1801,26 @@ void unset_nmi_callback(void)
     nmi_callback = dummy_nmi_callback;
 }
 
+bool nmi_check_continuation(void)
+{
+    bool ret = false;
+
+    return ret;
+}
+
+void trigger_nmi_continuation(void)
+{
+    /*
+     * Issue a self-IPI. Handling is done in spurious_interrupt().
+     * NMI could have happened in IPI sequence, so wait for ICR being idle
+     * again before leaving NMI handler.
+     * This relies on self-IPI using a simple shorthand, thus avoiding any
+     * use of locking or percpu cpumasks.
+     */
+    send_IPI_self(SPURIOUS_APIC_VECTOR);
+    apic_wait_icr_idle();
+}
+
 void do_device_not_available(struct cpu_user_regs *regs)
 {
 #ifdef CONFIG_PV
diff --git a/xen/include/asm-x86/nmi.h b/xen/include/asm-x86/nmi.h
index a288f02a50..9a5da14162 100644
--- a/xen/include/asm-x86/nmi.h
+++ b/xen/include/asm-x86/nmi.h
@@ -33,5 +33,14 @@ nmi_callback_t *set_nmi_callback(nmi_callback_t *callback);
 void unset_nmi_callback(void);
 
 DECLARE_PER_CPU(unsigned int, nmi_count);
- 
+
+/**
+ * trigger_nmi_continuation
+ *
+ * Schedule continuation to be started in interrupt context after NMI handling.
+ */
+void trigger_nmi_continuation(void);
+
+/* Check for NMI continuation pending. */
+bool nmi_check_continuation(void);
 #endif /* ASM_NMI_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 11:45:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 11:45:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.29747.59384 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLta-0003uG-TK; Wed, 18 Nov 2020 11:45:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 29747.59384; Wed, 18 Nov 2020 11:45:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLta-0003u9-QB; Wed, 18 Nov 2020 11:45:06 +0000
Received: by outflank-mailman (input) for mailman id 29747;
 Wed, 18 Nov 2020 11:45:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLtZ-0003tx-MY
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLtZ-00072v-Lh
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:45:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLtZ-0003tx-MY
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLtZ-00072v-Lh
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:45:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/oprofile: use NMI continuation for sending virq to guest
Message-Id: <E1kfLtZ-00072v-Lh@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 11:45:05 +0000

commit 2743174ffb6c6435b5d79673fb374645d1cdfd55
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 18 12:38:53 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:38:53 2020 +0100

    xen/oprofile: use NMI continuation for sending virq to guest
    
    Instead of calling send_guest_vcpu_virq() from NMI context use the
    NMI continuation framework for that purpose. This avoids taking locks
    in NMI mode.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/oprofile/nmi_int.c | 19 +++++++++++++++++--
 xen/arch/x86/traps.c            |  4 ++++
 xen/include/asm-x86/xenoprof.h  |  7 +++++++
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/oprofile/nmi_int.c b/xen/arch/x86/oprofile/nmi_int.c
index 0f103d80a6..a13bd82915 100644
--- a/xen/arch/x86/oprofile/nmi_int.c
+++ b/xen/arch/x86/oprofile/nmi_int.c
@@ -38,6 +38,8 @@ static unsigned long saved_lvtpc[NR_CPUS];
 
 static char *cpu_type;
 
+static DEFINE_PER_CPU(struct vcpu *, nmi_cont_vcpu);
+
 static int passive_domain_msr_op_checks(unsigned int msr, int *typep, int *indexp)
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(current);
@@ -83,14 +85,27 @@ void passive_domain_destroy(struct vcpu *v)
 		model->free_msr(v);
 }
 
+bool nmi_oprofile_send_virq(void)
+{
+	struct vcpu *v = xchg(&this_cpu(nmi_cont_vcpu), NULL);
+
+	if (v)
+		send_guest_vcpu_virq(v, VIRQ_XENOPROF);
+
+	return v;
+}
+
 static int nmi_callback(const struct cpu_user_regs *regs, int cpu)
 {
 	int xen_mode, ovf;
 
 	ovf = model->check_ctrs(cpu, &cpu_msrs[cpu], regs);
 	xen_mode = ring_0(regs);
-	if ( ovf && is_active(current->domain) && !xen_mode )
-		send_guest_vcpu_virq(current, VIRQ_XENOPROF);
+	if (ovf && is_active(current->domain) && !xen_mode &&
+	    !this_cpu(nmi_cont_vcpu)) {
+		this_cpu(nmi_cont_vcpu) = current;
+		trigger_nmi_continuation();
+	}
 
 	if ( ovf == 2 )
 		current->arch.nmi_pending = true;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 5cbaa49031..240fd1b089 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -65,6 +65,7 @@
 #include <asm/debugger.h>
 #include <asm/msr.h>
 #include <asm/nmi.h>
+#include <asm/xenoprof.h>
 #include <asm/shared.h>
 #include <asm/x86_emulate.h>
 #include <asm/traps.h>
@@ -1805,6 +1806,9 @@ bool nmi_check_continuation(void)
 {
     bool ret = false;
 
+    if ( nmi_oprofile_send_virq() )
+        ret = true;
+
     return ret;
 }
 
diff --git a/xen/include/asm-x86/xenoprof.h b/xen/include/asm-x86/xenoprof.h
index 1026ba2e1f..cf6af8c5df 100644
--- a/xen/include/asm-x86/xenoprof.h
+++ b/xen/include/asm-x86/xenoprof.h
@@ -69,6 +69,8 @@ int passive_domain_do_rdmsr(unsigned int msr, uint64_t *msr_content);
 int passive_domain_do_wrmsr(unsigned int msr, uint64_t msr_content);
 void passive_domain_destroy(struct vcpu *v);
 
+bool nmi_oprofile_send_virq(void);
+
 #else
 
 static inline int passive_domain_do_rdmsr(unsigned int msr,
@@ -85,6 +87,11 @@ static inline int passive_domain_do_wrmsr(unsigned int msr,
 
 static inline void passive_domain_destroy(struct vcpu *v) {}
 
+static inline bool nmi_oprofile_send_virq(void)
+{
+    return false;
+}
+
 #endif /* CONFIG_XENOPROF */
 
 #endif /* __ASM_X86_XENOPROF_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 11:45:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 11:45:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.29749.59388 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLtl-0003vh-VB; Wed, 18 Nov 2020 11:45:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 29749.59388; Wed, 18 Nov 2020 11:45: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfLtl-0003vY-Ry; Wed, 18 Nov 2020 11:45:17 +0000
Received: by outflank-mailman (input) for mailman id 29749;
 Wed, 18 Nov 2020 11:45:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLtj-0003vN-PX
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:45:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfLtj-00074D-Op
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:45:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLtj-0003vN-PX
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:45:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfLtj-00074D-Op
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 11:45:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/x86: issue pci_serr error message via NMI continuation
Message-Id: <E1kfLtj-00074D-Op@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 11:45:15 +0000

commit 5200fba9ce534fc55ec40ab622b6058600090415
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 18 12:39:21 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:39:21 2020 +0100

    xen/x86: issue pci_serr error message via NMI continuation
    
    Instead of using a softirq pci_serr_error() can use NMI continuation
    for issuing an error message.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c          | 21 +++++++++++++++------
 xen/include/asm-x86/softirq.h |  5 ++---
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 240fd1b089..0459cee9fb 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1661,10 +1661,18 @@ void do_general_protection(struct cpu_user_regs *regs)
     panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
 }
 
-static void pci_serr_softirq(void)
+static bool pci_serr_cont;
+
+static bool pci_serr_nmicont(void)
 {
+    if ( !pci_serr_cont )
+        return false;
+
+    pci_serr_cont = false;
     printk("\n\nNMI - PCI system error (SERR)\n");
     outb(inb(0x61) & 0x0b, 0x61); /* re-enable the PCI SERR error line. */
+
+    return true;
 }
 
 static void nmi_hwdom_report(unsigned int reason_idx)
@@ -1689,9 +1697,9 @@ static void pci_serr_error(const struct cpu_user_regs *regs)
         nmi_hwdom_report(_XEN_NMIREASON_pci_serr);
         /* fallthrough */
     case 'i': /* 'ignore' */
-        /* Would like to print a diagnostic here but can't call printk()
-           from NMI context -- raise a softirq instead. */
-        raise_softirq(PCI_SERR_SOFTIRQ);
+        /* Issue error message in NMI continuation. */
+        pci_serr_cont = true;
+        trigger_nmi_continuation();
         break;
     default:  /* 'fatal' */
         console_force_unlock();
@@ -1806,6 +1814,9 @@ bool nmi_check_continuation(void)
 {
     bool ret = false;
 
+    if ( pci_serr_nmicont() )
+        ret = true;
+
     if ( nmi_oprofile_send_virq() )
         ret = true;
 
@@ -2157,8 +2168,6 @@ void __init trap_init(void)
     percpu_traps_init();
 
     cpu_init();
-
-    open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq);
 }
 
 void activate_debugregs(const struct vcpu *curr)
diff --git a/xen/include/asm-x86/softirq.h b/xen/include/asm-x86/softirq.h
index 0b7a77f11f..415ee866c7 100644
--- a/xen/include/asm-x86/softirq.h
+++ b/xen/include/asm-x86/softirq.h
@@ -6,9 +6,8 @@
 #define VCPU_KICK_SOFTIRQ      (NR_COMMON_SOFTIRQS + 2)
 
 #define MACHINE_CHECK_SOFTIRQ  (NR_COMMON_SOFTIRQS + 3)
-#define PCI_SERR_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
-#define HVM_DPCI_SOFTIRQ       (NR_COMMON_SOFTIRQS + 5)
-#define NR_ARCH_SOFTIRQS       6
+#define HVM_DPCI_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
+#define NR_ARCH_SOFTIRQS       5
 
 bool arch_skip_send_event_check(unsigned int cpu);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 15:22:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 15:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30043.59756 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfPHa-0002wh-4V; Wed, 18 Nov 2020 15:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30043.59756; Wed, 18 Nov 2020 15: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfPHa-0002wZ-1a; Wed, 18 Nov 2020 15:22:06 +0000
Received: by outflank-mailman (input) for mailman id 30043;
 Wed, 18 Nov 2020 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 1kfPHY-0002wU-Lk
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 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 1kfPHY-0003hV-Hq
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 15:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfPHY-0006sq-FS
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 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 1kfPHY-0002wU-Lk
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 15:22:04 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Rj5DLMBOUHsuRfEkFk9nhE8ZxTU6Zz9wnU3gQkNv89s=; b=1uiHY5wiC7CLfLGg2hiXF25tbL
	LEmpqHRK4YDL0+YsMx/YOvtwHtiGN1uOQ1Sw/AzrU2pn30xUnpRjsq07yKeGmLuUyMEJHhBrq0k3i
	A3CdbFdc9WGEYvMHcsnMA+95z59n1d6CYsLe0TZBiyFL4jDP5/qtersHeForg1NROOkk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfPHY-0003hV-Hq
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 15:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfPHY-0006sq-FS
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 15:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Add workaround for Cortex-A76/Neoverse-N1 erratum #1286807
Message-Id: <E1kfPHY-0006sq-FS@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 15:22:04 +0000

commit 22e323d115d8f26d5926c20c66e11f85a46837d7
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Mon Nov 16 13:11:40 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Nov 18 15:21:24 2020 +0000

    xen/arm: Add workaround for Cortex-A76/Neoverse-N1 erratum #1286807
    
    On the affected Cortex-A76/Neoverse-N1 cores (r0p0 to r3p0),
    if a virtual address for a cacheable mapping of a location is being
    accessed by a core while another core is remapping the virtual
    address to a new physical page using the recommended break-before-make
    sequence, then under very rare circumstances TLBI+DSB completes before
    a read using the translation being invalidated has been observed by
    other observers. The workaround repeats the TLBI+DSB operation for all
    the TLB flush operations. While this is stricly not necessary, we don't
    want to take any risk.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/silicon-errata.txt     |  2 ++
 xen/arch/arm/Kconfig                 | 23 +++++++++++++++++++++++
 xen/arch/arm/cpuerrata.c             | 14 ++++++++++++++
 xen/include/asm-arm/arm64/flushtlb.h | 30 +++++++++++++++++++++---------
 xen/include/asm-arm/cpufeature.h     |  3 ++-
 5 files changed, 62 insertions(+), 10 deletions(-)

diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt
index 552c4151d3..d183ba543f 100644
--- a/docs/misc/arm/silicon-errata.txt
+++ b/docs/misc/arm/silicon-errata.txt
@@ -53,5 +53,7 @@ stable hypervisors.
 | ARM            | Cortex-A72      | #853709         | N/A                     |
 | ARM            | Cortex-A73      | #858921         | ARM_ERRATUM_858921      |
 | ARM            | Cortex-A76      | #1165522        | N/A                     |
+| ARM            | Cortex-A76      | #1286807        | ARM64_ERRATUM_1286807   |
 | ARM            | Neoverse-N1     | #1165522        | N/A
+| ARM            | Neoverse-N1     | #1286807        | ARM64_ERRATUM_1286807   |
 | ARM            | MMU-500         | #842869         | N/A                     |
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index f938dd21bd..f5b1bcda03 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -244,6 +244,29 @@ config ARM_ERRATUM_858921
 
 	  If unsure, say Y.
 
+config ARM64_WORKAROUND_REPEAT_TLBI
+	bool
+
+config ARM64_ERRATUM_1286807
+	bool "Cortex-A76/Neoverse-N1: 1286807: Modification of the translation table for a virtual address might lead to read-after-read ordering violation"
+	default y
+	select ARM64_WORKAROUND_REPEAT_TLBI
+	depends on ARM_64
+	help
+	  This option adds a workaround for ARM Cortex-A76/Neoverse-N1 erratum 1286807.
+
+	  On the affected Cortex-A76/Neoverse-N1 cores (r0p0 to r3p0), if a virtual
+	  address for a cacheable mapping of a location is being
+	  accessed by a core while another core is remapping the virtual
+	  address to a new physical page using the recommended
+	  break-before-make sequence, then under very rare circumstances
+	  TLBI+DSB completes before a read using the translation being
+	  invalidated has been observed by other observers. The
+	  workaround repeats the TLBI+DSB operation for all the TLB flush
+	  operations.
+
+	  If unsure, say Y.
+
 endmenu
 
 config ARM64_HARDEN_BRANCH_PREDICTOR
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 567911d380..cb4795beec 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -424,6 +424,20 @@ static const struct arm_cpu_capabilities arm_errata[] = {
                    (1 << MIDR_VARIANT_SHIFT) | 2),
     },
 #endif
+#ifdef CONFIG_ARM64_ERRATUM_1286807
+    {
+        /* Cortex-A76 r0p0 - r3p0 */
+        .desc = "ARM erratum 1286807",
+        .capability = ARM64_WORKAROUND_REPEAT_TLBI,
+        MIDR_RANGE(MIDR_CORTEX_A76, 0, 3 << MIDR_VARIANT_SHIFT),
+    },
+    {
+        /* Neoverse-N1 r0p0 - r3p0 */
+        .desc = "ARM erratum 1286807",
+        .capability = ARM64_WORKAROUND_REPEAT_TLBI,
+        MIDR_RANGE(MIDR_NEOVERSE_N1, 0, 3 << MIDR_VARIANT_SHIFT),
+    },
+#endif
 #ifdef CONFIG_ARM64_HARDEN_BRANCH_PREDICTOR
     {
         .capability = ARM_HARDEN_BRANCH_PREDICTOR,
diff --git a/xen/include/asm-arm/arm64/flushtlb.h b/xen/include/asm-arm/arm64/flushtlb.h
index ceec59542e..7c54315187 100644
--- a/xen/include/asm-arm/arm64/flushtlb.h
+++ b/xen/include/asm-arm/arm64/flushtlb.h
@@ -9,6 +9,12 @@
  * DSB ISH          // Ensure the TLB invalidation has completed
  * ISB              // See explanation below
  *
+ * ARM64_WORKAROUND_REPEAT_TLBI:
+ * Modification of the translation table for a virtual address might lead to
+ * read-after-read ordering violation.
+ * The workaround repeats TLBI+DSB operation for all the TLB flush operations.
+ * While this is stricly not necessary, we don't want to take any risk.
+ *
  * For Xen page-tables the ISB will discard any instructions fetched
  * from the old mappings.
  *
@@ -16,15 +22,21 @@
  * (and therefore the TLB invalidation) before continuing. So we know
  * the TLBs cannot contain an entry for a mapping we may have removed.
  */
-#define TLB_HELPER(name, tlbop) \
-static inline void name(void)   \
-{                               \
-    asm volatile(               \
-        "dsb  ishst;"           \
-        "tlbi "  # tlbop  ";"   \
-        "dsb  ish;"             \
-        "isb;"                  \
-        : : : "memory");        \
+#define TLB_HELPER(name, tlbop)                  \
+static inline void name(void)                    \
+{                                                \
+    asm volatile(                                \
+        "dsb  ishst;"                            \
+        "tlbi "  # tlbop  ";"                    \
+        ALTERNATIVE(                             \
+            "nop; nop;",                         \
+            "dsb  ish;"                          \
+            "tlbi "  # tlbop  ";",               \
+            ARM64_WORKAROUND_REPEAT_TLBI,        \
+            CONFIG_ARM64_WORKAROUND_REPEAT_TLBI) \
+        "dsb  ish;"                              \
+        "isb;"                                   \
+        : : : "memory");                         \
 }
 
 /* Flush local TLBs, current VMID only. */
diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 016a9fe203..c7b5052992 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -46,8 +46,9 @@
 #define ARM_SMCCC_1_1 8
 #define ARM64_WORKAROUND_AT_SPECULATE 9
 #define ARM_WORKAROUND_858921 10
+#define ARM64_WORKAROUND_REPEAT_TLBI 11
 
-#define ARM_NCAPS           11
+#define ARM_NCAPS           12
 
 #ifndef __ASSEMBLY__
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 17:00:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 17:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30134.59901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfQoR-0005tp-9c; Wed, 18 Nov 2020 17:00:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30134.59901; Wed, 18 Nov 2020 17:00:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfQoR-0005th-5g; Wed, 18 Nov 2020 17:00:07 +0000
Received: by outflank-mailman (input) for mailman id 30134;
 Wed, 18 Nov 2020 17:00: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 1kfQoP-0005ii-I3
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00: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 1kfQoP-0006H0-Ed
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfQoP-0002xv-DA
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00: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 1kfQoP-0005ii-I3
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00:05 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cUMI6aMDCMnvXMgF66ab381o8Rhpw40enGZ+ZwyJ88w=; b=btVbYREOw0jq5QbdN9EiU2NS3Q
	G1XoWOD7Z4hI70aySX6U/8rf8TnGCSzMXkKu6URoN4xAZI6Hio6y5PCDmsTbyLyWRDx1c1QT9bln4
	YxQg2WBDItyogWONB7rg5WSovSGHCF6Te+4Sbnf+TLBWpgt82fKpVLp4Q1fcw1wY0wes=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfQoP-0006H0-Ed
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfQoP-0002xv-DA
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ci: drop CentOS 6
Message-Id: <E1kfQoP-0002xv-DA@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 17:00:05 +0000

commit 7872b493f9db0e6361354bed82b0b4d92a7cd861
Author:     Doug Goldstein <cardoe@cardoe.com>
AuthorDate: Wed Nov 18 10:27:06 2020 -0600
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Nov 18 16:55:30 2020 +0000

    ci: drop CentOS 6
    
    CentOS 6 is no longer supported by upstream so we cannot test against it
    for future Xen releases.
    
    Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/centos/6.dockerfile | 51 ------------------------------------
 automation/gitlab-ci/build.yaml      | 10 -------
 automation/scripts/containerize      |  1 -
 3 files changed, 62 deletions(-)

diff --git a/automation/build/centos/6.dockerfile b/automation/build/centos/6.dockerfile
deleted file mode 100644
index 54d022be86..0000000000
--- a/automation/build/centos/6.dockerfile
+++ /dev/null
@@ -1,51 +0,0 @@
-FROM centos:6
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-RUN mkdir /build
-WORKDIR /build
-
-# work around https://github.com/moby/moby/issues/10180
-# and add EPEL for dev86
-RUN rpm --rebuilddb && \
-    yum -y install \
-        yum-plugin-ovl \
-        epel-release \
-    && yum clean all && \
-    rm -rf /var/cache/yum
-
-# install Xen depends
-RUN yum -y install \
-        gcc \
-        gcc-c++ \
-        ncurses-devel \
-        zlib-devel \
-        openssl-devel \
-        python-devel \
-        libuuid-devel \
-        pciutils-devel \
-        pkgconfig \
-        gettext \
-        flex \
-        bison \
-        libaio-devel \
-        glib2-devel \
-        yajl-devel \
-        pixman-devel \
-        glibc-devel \
-        glibc-devel.i686 \
-        make \
-        binutils \
-        git \
-        wget \
-        acpica-tools \
-        python-markdown \
-        patch \
-        checkpolicy \
-        dev86 \
-        iasl \
-        xz-devel \
-        bzip2 \
-        nasm \
-    && yum clean all && \
-    rm -rf /var/cache/yum
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 1e61d30c85..4bd1cfc1c0 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -176,16 +176,6 @@ centos-7-gcc-debug:
   variables:
     CONTAINER: centos:7
 
-centos-6-gcc:
-  extends: .gcc-x86-64-build
-  variables:
-    CONTAINER: centos:6
-
-centos-6-gcc-debug:
-  extends: .gcc-x86-64-build-debug
-  variables:
-    CONTAINER: centos:6
-
 debian-jessie-clang:
   extends: .clang-x86-64-build
   variables:
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index a75d54566c..58b83653b1 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -25,7 +25,6 @@ die() {
 BASE="registry.gitlab.com/xen-project/xen"
 case "_${CONTAINER}" in
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
-    _centos6) CONTAINER="${BASE}/centos:6" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
     _centos72) CONTAINER="${BASE}/centos:7.2" ;;
     _fedora) CONTAINER="${BASE}/fedora:29";;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 18 17:00:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Nov 2020 17:00:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30135.59905 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfQob-0005yL-AL; Wed, 18 Nov 2020 17:00:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30135.59905; Wed, 18 Nov 2020 17:00:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfQob-0005yE-7O; Wed, 18 Nov 2020 17:00:17 +0000
Received: by outflank-mailman (input) for mailman id 30135;
 Wed, 18 Nov 2020 17: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 1kfQoZ-0005y0-KP
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17: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 1kfQoZ-0006H3-JE
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfQoZ-0002zH-Gk
 for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17: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 1kfQoZ-0005y0-KP
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00:15 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0Ex5O/canp9RS5BRVULNDBLcApvsHzIuzvGKM7opx08=; b=IXIqVGSYcvShok9IosugzJKli4
	qwG26vwTzLHpMIYdCiD/QRvwmtpPv9ei13zWU1UnwZOGQJnZK5s2II3Wa/H9gJbBAk+jQCK8fPcCi
	SDrIZy2bM6iOquodQdMzR2bxNpU6BBzRHBeo2E4DW328sp5HiQs51if+CEIsIWsE8wiI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfQoZ-0006H3-JE
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfQoZ-0002zH-Gk
	for xen-changelog@lists.xenproject.org; Wed, 18 Nov 2020 17:00:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/scripts/containerize: fix DOCKER_CMD=podman
Message-Id: <E1kfQoZ-0002zH-Gk@xenbits.xenproject.org>
Date: Wed, 18 Nov 2020 17:00:15 +0000

commit 415f904254b7343a90db895134980cbb7f7f0479
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 17 18:24:09 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Nov 18 16:55:30 2020 +0000

    automation/scripts/containerize: fix DOCKER_CMD=podman
    
    On CentOS 8 with SELinux containerize doesn't work at all:
    
    Make sure that the source code and SSH agent directories are passed on
    with SELinux relabeling enabled.
    (`-security-opt label=disabled` would be another option)
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Doug Goldstein <cardoe@cardoe.com>
---
 automation/scripts/containerize | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 58b83653b1..c8c3c20fa2 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -7,7 +7,7 @@
 # and /etc/subgid.
 #
 docker_cmd=${DOCKER_CMD:-"docker"}
-[ "$DOCKER_CMD" = "podman" ] && userns_podman="--userns=keep-id"
+[ "$DOCKER_CMD" = "podman" ] && userns_podman="--userns=keep-id" selinux=",z"
 
 einfo() {
     echo "$*" >&2
@@ -94,9 +94,9 @@ einfo "*** Launching container ..."
 exec ${docker_cmd} run \
     ${userarg} \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
-    -v "${CONTAINER_PATH}":/build:rw \
+    -v "${CONTAINER_PATH}":/build:rw${selinux} \
     -v "${HOME}/.ssh":/root/.ssh:ro \
-    ${SSH_AUTH_DIR:+-v "${SSH_AUTH_DIR}":/tmp/ssh-agent} \
+    ${SSH_AUTH_DIR:+-v "${SSH_AUTH_DIR}":/tmp/ssh-agent${selinux}} \
     ${XEN_CONFIG_EXPERT:+-e XEN_CONFIG_EXPERT=${XEN_CONFIG_EXPERT}} \
     ${CONTAINER_ARGS} \
     -${termint}i --rm -- \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 01:00:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 01:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30336.60260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYIu-0005VB-AD; Thu, 19 Nov 2020 01:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30336.60260; Thu, 19 Nov 2020 01: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYIu-0005UG-5r; Thu, 19 Nov 2020 01:00:04 +0000
Received: by outflank-mailman (input) for mailman id 30336;
 Thu, 19 Nov 2020 01: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 1kfYIs-0004q3-Pt
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01: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 1kfYIs-0000EJ-In
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYIs-0006sW-H7
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01: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 1kfYIs-0004q3-Pt
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OUztMwiNtEsxE2VQOvPV86Hsat0V3mXOVU5FPBIxow4=; b=2zXszFWKJVTqAiJEKAMPR1sfwY
	KDL5v2rCW+KvpU+pS78nrnXrsXCaZLQD0fWUVMHWCoHsDeewAKk2E6f1TFxVi8efNDeI30eMqU47K
	qUr+LXuEfSvawMlfvy3pNoZMWZG++AHqqd0lcWQX6Ojd2gtFf2oFQQIp6dG436TvkNBw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYIs-0000EJ-In
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYIs-0006sW-H7
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: collapse the two ->write_p2m_entry() hooks
Message-Id: <E1kfYIs-0006sW-H7@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 01:00:02 +0000

commit 192b45e0e4180326b1312ae8bdabf477d086c400
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:33:18 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:33:18 2020 +0100

    x86/p2m: collapse the two ->write_p2m_entry() hooks
    
    The struct paging_mode instances get set to the same functions
    regardless of mode by both HAP and shadow code, hence there's no point
    having this hook there. The hook also doesn't need moving elsewhere - we
    can directly use struct p2m_domain's. This merely requires (from a
    strictly formal pov; in practice this may not even be needed) making
    sure we don't end up using safe_write_pte() for nested P2Ms.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c        |  9 +++++----
 xen/arch/x86/mm/p2m-pt.c         | 38 ++++++++++++++++++++++----------------
 xen/arch/x86/mm/shadow/common.c  |  7 ++++++-
 xen/arch/x86/mm/shadow/multi.c   |  1 -
 xen/arch/x86/mm/shadow/none.c    |  9 ---------
 xen/arch/x86/mm/shadow/private.h |  5 -----
 xen/include/asm-x86/p2m.h        |  3 +++
 xen/include/asm-x86/paging.h     |  4 ----
 8 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 4eedd1a995..69b06f19b5 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -823,6 +823,11 @@ hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
     return 0;
 }
 
+void hap_p2m_init(struct p2m_domain *p2m)
+{
+    p2m->write_p2m_entry = hap_write_p2m_entry;
+}
+
 static unsigned long hap_gva_to_gfn_real_mode(
     struct vcpu *v, struct p2m_domain *p2m, unsigned long gva, uint32_t *pfec)
 {
@@ -846,7 +851,6 @@ static const struct paging_mode hap_paging_real_mode = {
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_real_mode,
     .update_cr3             = hap_update_cr3,
     .update_paging_modes    = hap_update_paging_modes,
-    .write_p2m_entry        = hap_write_p2m_entry,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 1
 };
@@ -858,7 +862,6 @@ static const struct paging_mode hap_paging_protected_mode = {
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_2_levels,
     .update_cr3             = hap_update_cr3,
     .update_paging_modes    = hap_update_paging_modes,
-    .write_p2m_entry        = hap_write_p2m_entry,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 2
 };
@@ -870,7 +873,6 @@ static const struct paging_mode hap_paging_pae_mode = {
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_3_levels,
     .update_cr3             = hap_update_cr3,
     .update_paging_modes    = hap_update_paging_modes,
-    .write_p2m_entry        = hap_write_p2m_entry,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 3
 };
@@ -882,7 +884,6 @@ static const struct paging_mode hap_paging_long_mode = {
     .p2m_ga_to_gfn          = hap_p2m_ga_to_gfn_4_levels,
     .update_cr3             = hap_update_cr3,
     .update_paging_modes    = hap_update_paging_modes,
-    .write_p2m_entry        = hap_write_p2m_entry,
     .flush_tlb              = flush_tlb,
     .guest_levels           = 4
 };
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index bc9c9e2da1..6887b254f3 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -126,8 +126,9 @@ static int write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
 
     if ( v->domain != d )
         v = d->vcpu ? d->vcpu[0] : NULL;
-    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) )
-        rc = paging_get_hostmode(v)->write_p2m_entry(p2m, gfn, p, new, level);
+    if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) ||
+         p2m_is_nestedp2m(p2m) )
+        rc = p2m->write_p2m_entry(p2m, gfn, p, new, level);
     else
         safe_write_pte(p, new);
 
@@ -209,7 +210,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
 
         new_entry = l1e_from_mfn(mfn, P2M_BASE_FLAGS | _PAGE_RW);
 
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
         if ( rc )
             goto error;
     }
@@ -251,7 +252,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
         {
             new_entry = l1e_from_pfn(pfn | (i << ((level - 1) * PAGETABLE_ORDER)),
                                      flags);
-            rc = p2m->write_p2m_entry(p2m, gfn, l1_entry + i, new_entry, level);
+            rc = write_p2m_entry(p2m, gfn, l1_entry + i, new_entry, level);
             if ( rc )
             {
                 unmap_domain_page(l1_entry);
@@ -262,8 +263,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
         unmap_domain_page(l1_entry);
 
         new_entry = l1e_from_mfn(mfn, P2M_BASE_FLAGS | _PAGE_RW);
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry,
-                                  level + 1);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
         if ( rc )
             goto error;
     }
@@ -335,7 +335,7 @@ static int p2m_pt_set_recalc_range(struct p2m_domain *p2m,
             if ( (l1e_get_flags(e) & _PAGE_PRESENT) && !needs_recalc(l1, e) )
             {
                 set_recalc(l1, e);
-                err = p2m->write_p2m_entry(p2m, first_gfn, pent, e, level);
+                err = write_p2m_entry(p2m, first_gfn, pent, e, level);
                 if ( err )
                 {
                     ASSERT_UNREACHABLE();
@@ -412,8 +412,8 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                      !needs_recalc(l1, ent) )
                 {
                     set_recalc(l1, ent);
-                    err = p2m->write_p2m_entry(p2m, gfn - remainder, &ptab[i],
-                                               ent, level);
+                    err = write_p2m_entry(p2m, gfn - remainder, &ptab[i], ent,
+                                          level);
                     if ( err )
                     {
                         ASSERT_UNREACHABLE();
@@ -426,7 +426,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
             if ( !err )
             {
                 clear_recalc(l1, e);
-                err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
+                err = write_p2m_entry(p2m, gfn, pent, e, level + 1);
                 ASSERT(!err);
 
                 recalc_done = true;
@@ -474,7 +474,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
         }
         else
             clear_recalc(l1, e);
-        err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
+        err = write_p2m_entry(p2m, gfn, pent, e, level + 1);
         ASSERT(!err);
 
         recalc_done = true;
@@ -618,7 +618,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
             : l3e_empty();
         entry_content.l1 = l3e_content.l3;
 
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 3);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 3);
         /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
@@ -655,7 +655,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
             entry_content = l1e_empty();
 
         /* level 1 entry */
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 1);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 1);
         /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
@@ -690,7 +690,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
             : l2e_empty();
         entry_content.l1 = l2e_content.l2;
 
-        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 2);
+        rc = write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 2);
         /* NB: write_p2m_entry() handles tlb flushes properly */
         if ( rc )
             goto out;
@@ -914,7 +914,7 @@ static void p2m_pt_change_entry_type_global(struct p2m_domain *p2m,
             int rc;
 
             set_recalc(l1, e);
-            rc = p2m->write_p2m_entry(p2m, gfn, &tab[i], e, 4);
+            rc = write_p2m_entry(p2m, gfn, &tab[i], e, 4);
             if ( rc )
             {
                 ASSERT_UNREACHABLE();
@@ -1132,7 +1132,13 @@ void p2m_pt_init(struct p2m_domain *p2m)
     p2m->recalc = do_recalc;
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
-    p2m->write_p2m_entry = write_p2m_entry;
+
+    /* Still too early to use paging_mode_hap(). */
+    if ( hap_enabled(p2m->domain) )
+        hap_p2m_init(p2m);
+    else if ( IS_ENABLED(CONFIG_SHADOW_PAGING) )
+        shadow_p2m_init(p2m);
+
 #if P2M_AUDIT
     p2m->audit_p2m = p2m_pt_audit_p2m;
 #else
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 9c3d9a7cfd..300191450a 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3144,7 +3144,7 @@ static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
     }
 }
 
-int
+static int
 shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
                        l1_pgentry_t *p, l1_pgentry_t new,
                        unsigned int level)
@@ -3190,6 +3190,11 @@ shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
     return 0;
 }
 
+void shadow_p2m_init(struct p2m_domain *p2m)
+{
+    p2m->write_p2m_entry = shadow_write_p2m_entry;
+}
+
 /**************************************************************************/
 /* Log-dirty mode support */
 
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index eba5164a27..d24ccde035 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4574,7 +4574,6 @@ const struct paging_mode sh_paging_mode = {
     .gva_to_gfn                    = sh_gva_to_gfn,
     .update_cr3                    = sh_update_cr3,
     .update_paging_modes           = shadow_update_paging_modes,
-    .write_p2m_entry               = shadow_write_p2m_entry,
     .flush_tlb                     = shadow_flush_tlb,
     .guest_levels                  = GUEST_PAGING_LEVELS,
     .shadow.detach_old_tables      = sh_detach_old_tables,
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index 2fddf4274c..691269a59e 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -60,21 +60,12 @@ static void _update_paging_modes(struct vcpu *v)
     ASSERT_UNREACHABLE();
 }
 
-static int _write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                            l1_pgentry_t *p, l1_pgentry_t new,
-                            unsigned int level)
-{
-    ASSERT_UNREACHABLE();
-    return -EOPNOTSUPP;
-}
-
 static const struct paging_mode sh_paging_none = {
     .page_fault                    = _page_fault,
     .invlpg                        = _invlpg,
     .gva_to_gfn                    = _gva_to_gfn,
     .update_cr3                    = _update_cr3,
     .update_paging_modes           = _update_paging_modes,
-    .write_p2m_entry               = _write_p2m_entry,
 };
 
 void shadow_vcpu_init(struct vcpu *v)
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index e9b304f755..911db46e73 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -387,11 +387,6 @@ static inline int sh_remove_write_access(struct domain *d, mfn_t readonly_mfn,
 }
 #endif
 
-/* Functions that atomically write PT/P2M entries and update state */
-int shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                           l1_pgentry_t *p, l1_pgentry_t new,
-                           unsigned int level);
-
 /* Functions that atomically write PV guest PT entries */
 void sh_write_guest_entry(struct vcpu *v, intpte_t *p, intpte_t new,
                           mfn_t gmfn);
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 8abae345e8..3d518cba3b 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -836,6 +836,9 @@ void p2m_flush_nestedp2m(struct domain *d);
 /* Flushes the np2m specified by np2m_base (if it exists) */
 void np2m_flush_base(struct vcpu *v, unsigned long np2m_base);
 
+void hap_p2m_init(struct p2m_domain *p2m);
+void shadow_p2m_init(struct p2m_domain *p2m);
+
 int nestedp2m_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
     l1_pgentry_t *p, l1_pgentry_t new, unsigned int level);
 
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index ca68afae95..5cf128cf34 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -139,10 +139,6 @@ struct paging_mode {
     void          (*update_cr3            )(struct vcpu *v, int do_locking,
                                             bool noflush);
     void          (*update_paging_modes   )(struct vcpu *v);
-    int           (*write_p2m_entry       )(struct p2m_domain *p2m,
-                                            unsigned long gfn,
-                                            l1_pgentry_t *p, l1_pgentry_t new,
-                                            unsigned int level);
     bool          (*flush_tlb             )(bool (*flush_vcpu)(void *ctxt,
                                                                struct vcpu *v),
                                             void *ctxt);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 01:00:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 01:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30337.60265 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJ4-0000wt-Dk; Thu, 19 Nov 2020 01:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30337.60265; Thu, 19 Nov 2020 01: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJ4-0000wK-A6; Thu, 19 Nov 2020 01:00:14 +0000
Received: by outflank-mailman (input) for mailman id 30337;
 Thu, 19 Nov 2020 01: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 1kfYJ2-0000Po-QX
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01: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 1kfYJ2-0004HI-OV
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJ2-0006u9-LU
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01: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 1kfYJ2-0000Po-QX
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:12 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BOLW4kv+ZIPnIDvSa/xKFva419nGkLwwLVpWhJ/Vnc8=; b=deVaPMIK3BAm210Z8lLN9yDYS0
	5pE2UaobVE7QvQVUX054Pa4i0xbEIizDdaXKhfcAkp8TbixiV52pysNa1Z+zeEf4tg40IyPPxFKVT
	fV7gju0mfVWExFO03HJLz7kAgBEleG1yiMBR5+fc8H/dLr+1KJCEdufuyhxv+7tskDpY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJ2-0004HI-OV
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJ2-0006u9-LU
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: suppress audit_p2m hook when possible
Message-Id: <E1kfYJ2-0006u9-LU@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 01:00:12 +0000

commit 7aa7629fa0ff9a4077d2ae092d49ca6cc69bc8d3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:34:14 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:34:14 2020 +0100

    x86/p2m: suppress audit_p2m hook when possible
    
    When P2M_AUDIT is false, it's unused, so instead of having a dangling
    NULL pointer sit there, omit the field altogether.
    
    Instead of adding "#if P2M_AUDIT && defined(CONFIG_HVM)" in even more
    places, fold the latter part right into the definition of P2M_AUDIT.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/domctl.c     |  2 +-
 xen/arch/x86/mm/p2m-ept.c |  2 ++
 xen/arch/x86/mm/p2m-pt.c  |  8 ++------
 xen/arch/x86/mm/p2m.c     |  2 +-
 xen/include/asm-x86/p2m.h | 18 ++++++++++--------
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 2ee29a0f78..b28cfe9817 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1012,7 +1012,7 @@ long arch_do_domctl(
         break;
 #endif
 
-#if P2M_AUDIT && defined(CONFIG_HVM)
+#if P2M_AUDIT
     case XEN_DOMCTL_audit_p2m:
         if ( d == currd )
             ret = -EPERM;
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 476458b1e0..975ab403f2 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -1260,7 +1260,9 @@ int ept_p2m_init(struct p2m_domain *p2m)
     p2m->change_entry_type_global = ept_change_entry_type_global;
     p2m->change_entry_type_range = ept_change_entry_type_range;
     p2m->memory_type_changed = ept_memory_type_changed;
+#if P2M_AUDIT
     p2m->audit_p2m = NULL;
+#endif
     p2m->tlb_flush = ept_tlb_flush;
 
     /* Set the memory type used when accessing EPT paging structures. */
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 6887b254f3..41be7fbd61 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -971,8 +971,8 @@ static int p2m_pt_change_entry_type_range(struct p2m_domain *p2m,
     return err;
 }
 
-#if P2M_AUDIT && defined(CONFIG_HVM)
-long p2m_pt_audit_p2m(struct p2m_domain *p2m)
+#if P2M_AUDIT
+static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
 {
     unsigned long entry_count = 0, pmbad = 0;
     unsigned long mfn, gfn, m2pfn;
@@ -1120,8 +1120,6 @@ long p2m_pt_audit_p2m(struct p2m_domain *p2m)
 
     return pmbad;
 }
-#else
-# define p2m_pt_audit_p2m NULL
 #endif /* P2M_AUDIT */
 
 /* Set up the p2m function pointers for pagetable format */
@@ -1141,8 +1139,6 @@ void p2m_pt_init(struct p2m_domain *p2m)
 
 #if P2M_AUDIT
     p2m->audit_p2m = p2m_pt_audit_p2m;
-#else
-    p2m->audit_p2m = NULL;
 #endif
 }
 
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 928344be30..f198355a56 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2435,7 +2435,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t gfn,
 
 /*** Audit ***/
 
-#if P2M_AUDIT && defined(CONFIG_HVM)
+#if P2M_AUDIT
 void audit_p2m(struct domain *d,
                uint64_t *orphans,
                 uint64_t *m2p_bad,
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 3d518cba3b..2d68ed3843 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -31,6 +31,14 @@
 #include <asm/mem_sharing.h>
 #include <asm/page.h>    /* for pagetable_t */
 
+/* Debugging and auditing of the P2M code? */
+#if !defined(NDEBUG) && defined(CONFIG_HVM)
+#define P2M_AUDIT     1
+#else
+#define P2M_AUDIT     0
+#endif
+#define P2M_DEBUGGING 0
+
 extern bool_t opt_hap_1gb, opt_hap_2mb;
 
 /*
@@ -268,7 +276,9 @@ struct p2m_domain {
     int                (*write_p2m_entry)(struct p2m_domain *p2m,
                                           unsigned long gfn, l1_pgentry_t *p,
                                           l1_pgentry_t new, unsigned int level);
+#if P2M_AUDIT
     long               (*audit_p2m)(struct p2m_domain *p2m);
+#endif
 
     /*
      * P2M updates may require TLBs to be flushed (invalidated).
@@ -758,14 +768,6 @@ extern void p2m_pt_init(struct p2m_domain *p2m);
 void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn,
                      p2m_query_t q, uint32_t *pfec);
 
-/* Debugging and auditing of the P2M code? */
-#ifndef NDEBUG
-#define P2M_AUDIT     1
-#else
-#define P2M_AUDIT     0
-#endif
-#define P2M_DEBUGGING 0
-
 #if P2M_AUDIT
 extern void audit_p2m(struct domain *d,
                       uint64_t *orphans,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 01:00:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 01:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30338.60269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJD-0004AQ-F2; Thu, 19 Nov 2020 01:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30338.60269; Thu, 19 Nov 2020 01:00:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJD-00049r-BX; Thu, 19 Nov 2020 01:00:23 +0000
Received: by outflank-mailman (input) for mailman id 30338;
 Thu, 19 Nov 2020 01: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 1kfYJC-0003yn-TI
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01: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 1kfYJC-00083b-SQ
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJC-0006un-QZ
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01: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 1kfYJC-0003yn-TI
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:22 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IoGilPCfTpsNmDLErV0+tszcFyXTMZEaH70b9GPAVq0=; b=yGda/Xhe3ohb2nDXhodB3GtBHu
	63InaAmpd331sLwZuEiiBSrVJNvVUEFqVGr/bx7fnGuE2T4g3mBDY62NpzzeiKluMwYu0xK2+wGyZ
	BS5Xo3RhP+f86OGyrqE/jWBU9AkatU/NLqjD6QJKhOcQURToxEDX8Ewo7szlYNABN2KA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJC-00083b-SQ
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJC-0006un-QZ
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HAP: move nested-P2M flush calculations out of locked region
Message-Id: <E1kfYJC-0006un-QZ@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 01:00:22 +0000

commit a7ab52f9e87c5140b8f0c5444c79d061a6985a2b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:34:54 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:34:54 2020 +0100

    x86/HAP: move nested-P2M flush calculations out of locked region
    
    By latching the old MFN into a local variable, these calculations don't
    depend on anything but local variables anymore. Hence the point in time
    when they get performed doesn't matter anymore, so they can be moved
    past the locked region.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 69b06f19b5..d1ad10003c 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -780,7 +780,7 @@ hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
 {
     struct domain *d = p2m->domain;
     uint32_t old_flags;
-    bool_t flush_nestedp2m = 0;
+    mfn_t omfn;
     int rc;
 
     /* We know always use the host p2m here, regardless if the vcpu
@@ -790,21 +790,11 @@ hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
 
     paging_lock(d);
     old_flags = l1e_get_flags(*p);
-
-    if ( nestedhvm_enabled(d) && (old_flags & _PAGE_PRESENT) 
-         && !p2m_get_hostp2m(d)->defer_nested_flush ) {
-        /* We are replacing a valid entry so we need to flush nested p2ms,
-         * unless the only change is an increase in access rights. */
-        mfn_t omfn = l1e_get_mfn(*p);
-        mfn_t nmfn = l1e_get_mfn(new);
-
-        flush_nestedp2m = !(mfn_eq(omfn, nmfn)
-            && perms_strictly_increased(old_flags, l1e_get_flags(new)) );
-    }
+    omfn = l1e_get_mfn(*p);
 
     rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)),
                           p2m_flags_to_type(old_flags), l1e_get_mfn(new),
-                          l1e_get_mfn(*p), level);
+                          omfn, level);
     if ( rc )
     {
         paging_unlock(d);
@@ -817,7 +807,14 @@ hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
 
     paging_unlock(d);
 
-    if ( flush_nestedp2m )
+    if ( nestedhvm_enabled(d) && (old_flags & _PAGE_PRESENT) &&
+         !p2m_get_hostp2m(d)->defer_nested_flush &&
+         /*
+          * We are replacing a valid entry so we need to flush nested p2ms,
+          * unless the only change is an increase in access rights.
+          */
+         (!mfn_eq(omfn, l1e_get_mfn(new)) ||
+          !perms_strictly_increased(old_flags, l1e_get_flags(new))) )
         p2m_flush_nestedp2m(d);
 
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 01:00:33 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 01:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30339.60271 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJN-0007ri-GV; Thu, 19 Nov 2020 01:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30339.60271; Thu, 19 Nov 2020 01:00:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJN-0007rQ-D8; Thu, 19 Nov 2020 01:00:33 +0000
Received: by outflank-mailman (input) for mailman id 30339;
 Thu, 19 Nov 2020 01:00:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJN-0007kV-1y
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJN-0003Qo-0n
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJM-0006vV-V9
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01: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 1kfYJN-0007kV-1y
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:33 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bfq6zAwZoe8/IfI4XH8Th/MvV9JvOAPwHs5gi/xjx0U=; b=OL66HvwOLC5f24OLV5vr6FsR/R
	5kiOfYmhapequtUZUOxkXm2G5b4dzziLk2pmGN5KbWKwEwJBqftvFw3LASX6ojRto9AnW4l0Ekhwt
	nlPDB8ukPDHdqaXMxitl2JudB6g3wusoen7HnOqMTLP+412S+n9oKdQX20IU67YO+UTI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJN-0003Qo-0n
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJM-0006vV-V9
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: split write_p2m_entry() hook
Message-Id: <E1kfYJM-0006vV-V9@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 01:00:32 +0000

commit dc5616e126714e7987cc1caf9bc7a95de0046ef7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:37:24 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:37:24 2020 +0100

    x86/p2m: split write_p2m_entry() hook
    
    Fair parts of the present handlers are identical; in fact
    nestedp2m_write_p2m_entry() lacks a call to p2m_entry_modify(). Move
    common parts right into write_p2m_entry(), splitting the hooks into a
    "pre" one (needed just by shadow code) and a "post" one.
    
    For the common parts moved I think that the p2m_flush_nestedp2m() is,
    at least from an abstract perspective, also applicable in the shadow
    case. Hence it doesn't get a 3rd hook put in place.
    
    The initial comment that was in hap_write_p2m_entry() gets dropped: Its
    placement was bogus, and looking back the the commit introducing it
    (dd6de3ab9985 "Implement Nested-on-Nested") I can't see either what use
    of a p2m it was meant to be associated with.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/hap/hap.c        | 45 ++++------------------------------------
 xen/arch/x86/mm/hap/nested_hap.c | 21 ++++---------------
 xen/arch/x86/mm/p2m-pt.c         | 44 ++++++++++++++++++++++++++++++++++++---
 xen/arch/x86/mm/p2m.c            |  3 ++-
 xen/arch/x86/mm/shadow/common.c  | 41 +++++++++++++-----------------------
 xen/include/asm-x86/p2m.h        | 17 ++++++++-------
 6 files changed, 75 insertions(+), 96 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index d1ad10003c..0fdb7d4a59 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -774,55 +774,18 @@ static void hap_update_paging_modes(struct vcpu *v)
     put_gfn(d, cr3_gfn);
 }
 
-static int
-hap_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, l1_pgentry_t *p,
-                    l1_pgentry_t new, unsigned int level)
+static void
+hap_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
 {
     struct domain *d = p2m->domain;
-    uint32_t old_flags;
-    mfn_t omfn;
-    int rc;
-
-    /* We know always use the host p2m here, regardless if the vcpu
-     * is in host or guest mode. The vcpu can be in guest mode by
-     * a hypercall which passes a domain and chooses mostly the first
-     * vcpu. */
-
-    paging_lock(d);
-    old_flags = l1e_get_flags(*p);
-    omfn = l1e_get_mfn(*p);
-
-    rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)),
-                          p2m_flags_to_type(old_flags), l1e_get_mfn(new),
-                          omfn, level);
-    if ( rc )
-    {
-        paging_unlock(d);
-        return rc;
-    }
 
-    safe_write_pte(p, new);
-    if ( old_flags & _PAGE_PRESENT )
+    if ( oflags & _PAGE_PRESENT )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-
-    paging_unlock(d);
-
-    if ( nestedhvm_enabled(d) && (old_flags & _PAGE_PRESENT) &&
-         !p2m_get_hostp2m(d)->defer_nested_flush &&
-         /*
-          * We are replacing a valid entry so we need to flush nested p2ms,
-          * unless the only change is an increase in access rights.
-          */
-         (!mfn_eq(omfn, l1e_get_mfn(new)) ||
-          !perms_strictly_increased(old_flags, l1e_get_flags(new))) )
-        p2m_flush_nestedp2m(d);
-
-    return 0;
 }
 
 void hap_p2m_init(struct p2m_domain *p2m)
 {
-    p2m->write_p2m_entry = hap_write_p2m_entry;
+    p2m->write_p2m_entry_post = hap_write_p2m_entry_post;
 }
 
 static unsigned long hap_gva_to_gfn_real_mode(
diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c
index f92ddc5206..50fa2dd9f4 100644
--- a/xen/arch/x86/mm/hap/nested_hap.c
+++ b/xen/arch/x86/mm/hap/nested_hap.c
@@ -71,24 +71,11 @@
 /*        NESTED VIRT P2M FUNCTIONS         */
 /********************************************/
 
-int
-nestedp2m_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-    l1_pgentry_t *p, l1_pgentry_t new, unsigned int level)
+void
+nestedp2m_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
 {
-    struct domain *d = p2m->domain;
-    uint32_t old_flags;
-
-    paging_lock(d);
-
-    old_flags = l1e_get_flags(*p);
-    safe_write_pte(p, new);
-
-    if (old_flags & _PAGE_PRESENT)
-        guest_flush_tlb_mask(d, p2m->dirty_cpumask);
-
-    paging_unlock(d);
-
-    return 0;
+    if ( oflags & _PAGE_PRESENT )
+        guest_flush_tlb_mask(p2m->domain, p2m->dirty_cpumask);
 }
 
 /********************************************/
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index 41be7fbd61..5fa0d30ce7 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -122,17 +122,55 @@ static int write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
 {
     struct domain *d = p2m->domain;
     const struct vcpu *v = current;
-    int rc = 0;
 
     if ( v->domain != d )
         v = d->vcpu ? d->vcpu[0] : NULL;
     if ( likely(v && paging_mode_enabled(d) && paging_get_hostmode(v)) ||
          p2m_is_nestedp2m(p2m) )
-        rc = p2m->write_p2m_entry(p2m, gfn, p, new, level);
+    {
+        unsigned int oflags;
+        mfn_t omfn;
+        int rc;
+
+        paging_lock(d);
+
+        if ( p2m->write_p2m_entry_pre )
+            p2m->write_p2m_entry_pre(d, gfn, p, new, level);
+
+        oflags = l1e_get_flags(*p);
+        omfn = l1e_get_mfn(*p);
+
+        rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)),
+                              p2m_flags_to_type(oflags), l1e_get_mfn(new),
+                              omfn, level);
+        if ( rc )
+        {
+            paging_unlock(d);
+            return rc;
+        }
+
+        safe_write_pte(p, new);
+
+        if ( p2m->write_p2m_entry_post )
+            p2m->write_p2m_entry_post(p2m, oflags);
+
+        paging_unlock(d);
+
+        if ( nestedhvm_enabled(d) && !p2m_is_nestedp2m(p2m) &&
+             (oflags & _PAGE_PRESENT) &&
+             !p2m_get_hostp2m(d)->defer_nested_flush &&
+             /*
+              * We are replacing a valid entry so we need to flush nested p2ms,
+              * unless the only change is an increase in access rights.
+              */
+             (!mfn_eq(omfn, l1e_get_mfn(new)) ||
+              !perms_strictly_increased(oflags, l1e_get_flags(new))) )
+            p2m_flush_nestedp2m(d);
+    }
     else
         safe_write_pte(p, new);
 
-    return rc;
+    return 0;
 }
 
 // Find the next level's P2M entry, checking for out-of-range gfn's...
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index f198355a56..d9cc1856bb 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -198,7 +198,8 @@ static int p2m_init_nestedp2m(struct domain *d)
             return -ENOMEM;
         }
         p2m->p2m_class = p2m_nested;
-        p2m->write_p2m_entry = nestedp2m_write_p2m_entry;
+        p2m->write_p2m_entry_pre = NULL;
+        p2m->write_p2m_entry_post = nestedp2m_write_p2m_entry_post;
         list_add(&p2m->np2m_list, &p2m_get_hostp2m(d)->np2m_list);
     }
 
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 300191450a..a33e100861 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3144,34 +3144,22 @@ static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn,
     }
 }
 
-static int
-shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-                       l1_pgentry_t *p, l1_pgentry_t new,
-                       unsigned int level)
+static void
+sh_write_p2m_entry_pre(struct domain *d, unsigned long gfn, l1_pgentry_t *p,
+                       l1_pgentry_t new, unsigned int level)
 {
-    struct domain *d = p2m->domain;
-    int rc;
-
-    paging_lock(d);
-
     /* If there are any shadows, update them.  But if shadow_teardown()
      * has already been called then it's not safe to try. */
     if ( likely(d->arch.paging.shadow.total_pages != 0) )
          sh_unshadow_for_p2m_change(d, gfn, p, new, level);
-
-    rc = p2m_entry_modify(p2m, p2m_flags_to_type(l1e_get_flags(new)),
-                          p2m_flags_to_type(l1e_get_flags(*p)),
-                          l1e_get_mfn(new), l1e_get_mfn(*p), level);
-    if ( rc )
-    {
-        paging_unlock(d);
-        return rc;
-    }
-
-    /* Update the entry with new content */
-    safe_write_pte(p, new);
+}
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
+static void
+sh_write_p2m_entry_post(struct p2m_domain *p2m, unsigned int oflags)
+{
+    struct domain *d = p2m->domain;
+
     /* If we're doing FAST_FAULT_PATH, then shadow mode may have
        cached the fact that this is an mmio region in the shadow
        page tables.  Blow the tables away to remove the cache.
@@ -3183,16 +3171,15 @@ shadow_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
         shadow_blow_tables(d);
         d->arch.paging.shadow.has_fast_mmio_entries = false;
     }
-#endif
-
-    paging_unlock(d);
-
-    return 0;
 }
+#else
+# define sh_write_p2m_entry_post NULL
+#endif
 
 void shadow_p2m_init(struct p2m_domain *p2m)
 {
-    p2m->write_p2m_entry = shadow_write_p2m_entry;
+    p2m->write_p2m_entry_pre  = sh_write_p2m_entry_pre;
+    p2m->write_p2m_entry_post = sh_write_p2m_entry_post;
 }
 
 /**************************************************************************/
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index 2d68ed3843..8d6fd1aa01 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -272,10 +272,13 @@ struct p2m_domain {
                                                   unsigned long first_gfn,
                                                   unsigned long last_gfn);
     void               (*memory_type_changed)(struct p2m_domain *p2m);
-    
-    int                (*write_p2m_entry)(struct p2m_domain *p2m,
-                                          unsigned long gfn, l1_pgentry_t *p,
-                                          l1_pgentry_t new, unsigned int level);
+    void               (*write_p2m_entry_pre)(struct domain *d,
+                                              unsigned long gfn,
+                                              l1_pgentry_t *p,
+                                              l1_pgentry_t new,
+                                              unsigned int level);
+    void               (*write_p2m_entry_post)(struct p2m_domain *p2m,
+                                               unsigned int oflags);
 #if P2M_AUDIT
     long               (*audit_p2m)(struct p2m_domain *p2m);
 #endif
@@ -472,7 +475,7 @@ void __put_gfn(struct p2m_domain *p2m, unsigned long gfn);
  *
  * This is also used in the shadow code whenever the paging lock is
  * held -- in those cases, the caller is protected against concurrent
- * p2m updates by the fact that shadow_write_p2m_entry() also takes
+ * p2m updates by the fact that write_p2m_entry() also takes
  * the paging lock.
  *
  * Note that an unlocked accessor only makes sense for a "query" lookup.
@@ -841,8 +844,8 @@ void np2m_flush_base(struct vcpu *v, unsigned long np2m_base);
 void hap_p2m_init(struct p2m_domain *p2m);
 void shadow_p2m_init(struct p2m_domain *p2m);
 
-int nestedp2m_write_p2m_entry(struct p2m_domain *p2m, unsigned long gfn,
-    l1_pgentry_t *p, l1_pgentry_t new, unsigned int level);
+void nestedp2m_write_p2m_entry_post(struct p2m_domain *p2m,
+                                    unsigned int oflags);
 
 /*
  * Alternate p2m: shadow p2m tables used for alternate memory views
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 01:00:43 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 01:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30340.60276 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJX-00036x-I6; Thu, 19 Nov 2020 01:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30340.60276; Thu, 19 Nov 2020 01:00:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJX-00036Q-Eg; Thu, 19 Nov 2020 01:00:43 +0000
Received: by outflank-mailman (input) for mailman id 30340;
 Thu, 19 Nov 2020 01:00:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJX-0002zm-4q
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJX-00078K-3y
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJX-0006wL-32
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJX-0002zm-4q
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:43 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3vrgKgBPCnYFeFwgA98Klp+l0TCDZdkDdJIUeFzsS0A=; b=AmlDhzDrswAkHkl/srdSw1bYl7
	eJ7JEn4ztcxkqlTBHYFeDd4buo1Sswfv5pRONbOEy0B2AvessK9TDo30CBXQetgNNyLoEdt5tNUrT
	ugB0lkFHTZASwBbZzbuX1I6NTH4/FxUqvQsw9cC2NaR69M7xGLD4fvVd44c0tchkji3c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJX-00078K-3y
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJX-0006wL-32
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpt: fix build with old gcc
Message-Id: <E1kfYJX-0006wL-32@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 01:00:43 +0000

commit f2c620aa062767b318267d678ae249dcb637b870
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 18 12:38:01 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:38:01 2020 +0100

    x86/vpt: fix build with old gcc
    
    I believe it was the XSA-336 fix (42fcdd42328f "x86/vpt: fix race when
    migrating timers between vCPUs") which has unmasked a bogus
    uninitialized variable warning. This is observable with gcc 4.3.4, but
    only on 4.13 and older; it's hidden on newer versions apparently due to
    the addition to _read_unlock() done by 12509bbeb9e3 ("rwlocks: call
    preempt_disable() when taking a rwlock").
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vpt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 867deb4da5..4c2afe2e91 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -401,7 +401,7 @@ int pt_update_irq(struct vcpu *v)
                  * associated with the timer.
                  */
                 time_cb *cb = NULL;
-                void *cb_priv;
+                void *cb_priv = NULL;
 
                 pt_vcpu_lock(v);
                 /* Make sure the timer is still on the list. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 01:00:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 01:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30343.60295 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJi-0007BZ-TX; Thu, 19 Nov 2020 01:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30343.60295; Thu, 19 Nov 2020 01:00:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJi-0007B7-QC; Thu, 19 Nov 2020 01:00:54 +0000
Received: by outflank-mailman (input) for mailman id 30343;
 Thu, 19 Nov 2020 01:00: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 1kfYJh-0006ZX-8n
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00: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 1kfYJh-0002Oi-7E
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJh-0006x9-6K
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00: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 1kfYJh-0006ZX-8n
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:53 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NnTleH4IllS3xR6dFFl0OldDlkH6Q07aZFAmj5mDG/g=; b=tmQjSDkBIXkllR6AMdmn9T1V6B
	iarS8tzhQzB7sTwjbaFFJQCwPBe2S13duSe7K7wFmzJ2De6tVdVE70HCpbneg9/rhIk1x7ofQXuzY
	Vju+7I/a49fDQYZUNi+aKGRgc/c1knWO1ruuXkNa2M6mkOhcjoaeafCT3A/Ls67FsDgI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJh-0002Oi-7E
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJh-0006x9-6K
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:00:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: add nmi continuation framework
Message-Id: <E1kfYJh-0006x9-6K@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 01:00:53 +0000

commit 665c940d24b53e52a32a38571bc7a58a165409d9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 18 12:38:29 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:38:29 2020 +0100

    xen/x86: add nmi continuation framework
    
    Actions in NMI context are rather limited as e.g. locking is rather
    fragile.
    
    Add a framework to continue processing in normal interrupt context
    after leaving NMI processing.
    
    This is done by a high priority interrupt vector triggered via a
    self IPI from NMI context, which will then call the continuation
    function specified during NMI handling.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c       | 13 ++++++++++---
 xen/arch/x86/smp.c        |  1 +
 xen/arch/x86/traps.c      | 21 +++++++++++++++++++++
 xen/include/asm-x86/nmi.h | 11 ++++++++++-
 4 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 60627fd6e6..7497ddb5da 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -40,6 +40,7 @@
 #include <irq_vectors.h>
 #include <xen/kexec.h>
 #include <asm/guest.h>
+#include <asm/nmi.h>
 #include <asm/time.h>
 
 static bool __read_mostly tdt_enabled;
@@ -1376,16 +1377,22 @@ void spurious_interrupt(struct cpu_user_regs *regs)
 {
     /*
      * Check if this is a vectored interrupt (most likely, as this is probably
-     * a request to dump local CPU state). Vectored interrupts are ACKed;
-     * spurious interrupts are not.
+     * a request to dump local CPU state or to continue NMI handling).
+     * Vectored interrupts are ACKed; spurious interrupts are not.
      */
     if (apic_isr_read(SPURIOUS_APIC_VECTOR)) {
+        bool is_spurious;
+
         ack_APIC_irq();
+        is_spurious = !nmi_check_continuation();
         if (this_cpu(state_dump_pending)) {
             this_cpu(state_dump_pending) = false;
             dump_execstate(regs);
-            return;
+            is_spurious = false;
         }
+
+        if ( !is_spurious )
+            return;
     }
 
     /* see sw-dev-man vol 3, chapter 7.4.13.5 */
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 14aa355a6b..eef0f9c6cb 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -163,6 +163,7 @@ void send_IPI_self(int vector)
 
 void send_IPI_self_legacy(uint8_t vector)
 {
+    /* NMI continuation handling relies on using a shorthand here. */
     send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
 }
 
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index c27dd4cd43..5cbaa49031 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -79,6 +79,7 @@
 #include <public/hvm/params.h>
 #include <asm/cpuid.h>
 #include <xsm/xsm.h>
+#include <asm/mach-default/irq_vectors.h>
 #include <asm/pv/traps.h>
 #include <asm/pv/mm.h>
 
@@ -1800,6 +1801,26 @@ void unset_nmi_callback(void)
     nmi_callback = dummy_nmi_callback;
 }
 
+bool nmi_check_continuation(void)
+{
+    bool ret = false;
+
+    return ret;
+}
+
+void trigger_nmi_continuation(void)
+{
+    /*
+     * Issue a self-IPI. Handling is done in spurious_interrupt().
+     * NMI could have happened in IPI sequence, so wait for ICR being idle
+     * again before leaving NMI handler.
+     * This relies on self-IPI using a simple shorthand, thus avoiding any
+     * use of locking or percpu cpumasks.
+     */
+    send_IPI_self(SPURIOUS_APIC_VECTOR);
+    apic_wait_icr_idle();
+}
+
 void do_device_not_available(struct cpu_user_regs *regs)
 {
 #ifdef CONFIG_PV
diff --git a/xen/include/asm-x86/nmi.h b/xen/include/asm-x86/nmi.h
index a288f02a50..9a5da14162 100644
--- a/xen/include/asm-x86/nmi.h
+++ b/xen/include/asm-x86/nmi.h
@@ -33,5 +33,14 @@ nmi_callback_t *set_nmi_callback(nmi_callback_t *callback);
 void unset_nmi_callback(void);
 
 DECLARE_PER_CPU(unsigned int, nmi_count);
- 
+
+/**
+ * trigger_nmi_continuation
+ *
+ * Schedule continuation to be started in interrupt context after NMI handling.
+ */
+void trigger_nmi_continuation(void);
+
+/* Check for NMI continuation pending. */
+bool nmi_check_continuation(void);
 #endif /* ASM_NMI_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 01:01:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 01:01:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30344.60299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJs-0002VU-W8; Thu, 19 Nov 2020 01:01:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30344.60299; Thu, 19 Nov 2020 01:01:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYJs-0002Uy-T0; Thu, 19 Nov 2020 01:01:04 +0000
Received: by outflank-mailman (input) for mailman id 30344;
 Thu, 19 Nov 2020 01:01: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 1kfYJr-0001uF-B3
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01: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 1kfYJr-0005vN-AG
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYJr-0006yJ-9V
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01: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 1kfYJr-0001uF-B3
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01:03 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/jrvOfa4Z/sQ2qVMFUQ2iYtB2i5FF+7y2RDNddW0Lwk=; b=p6hmlw21IBGZFHSVJ7mlRMSuq4
	2qIsKSk6njHlLGkTKOYShxpzFWeg0NVwYq/Q4ZizRyhMCds0NZkWI0bJT4aPlLCiLM84o4RPslffL
	pnMO6R7kjpzl7VBBeSrJADvoxQ+xf0RA/0Fr6QuabSCez9hf8D7MpqluRpB360u9Iv7Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJr-0005vN-AG
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYJr-0006yJ-9V
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/oprofile: use NMI continuation for sending virq to guest
Message-Id: <E1kfYJr-0006yJ-9V@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 01:01:03 +0000

commit 2743174ffb6c6435b5d79673fb374645d1cdfd55
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 18 12:38:53 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:38:53 2020 +0100

    xen/oprofile: use NMI continuation for sending virq to guest
    
    Instead of calling send_guest_vcpu_virq() from NMI context use the
    NMI continuation framework for that purpose. This avoids taking locks
    in NMI mode.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/oprofile/nmi_int.c | 19 +++++++++++++++++--
 xen/arch/x86/traps.c            |  4 ++++
 xen/include/asm-x86/xenoprof.h  |  7 +++++++
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/oprofile/nmi_int.c b/xen/arch/x86/oprofile/nmi_int.c
index 0f103d80a6..a13bd82915 100644
--- a/xen/arch/x86/oprofile/nmi_int.c
+++ b/xen/arch/x86/oprofile/nmi_int.c
@@ -38,6 +38,8 @@ static unsigned long saved_lvtpc[NR_CPUS];
 
 static char *cpu_type;
 
+static DEFINE_PER_CPU(struct vcpu *, nmi_cont_vcpu);
+
 static int passive_domain_msr_op_checks(unsigned int msr, int *typep, int *indexp)
 {
 	struct vpmu_struct *vpmu = vcpu_vpmu(current);
@@ -83,14 +85,27 @@ void passive_domain_destroy(struct vcpu *v)
 		model->free_msr(v);
 }
 
+bool nmi_oprofile_send_virq(void)
+{
+	struct vcpu *v = xchg(&this_cpu(nmi_cont_vcpu), NULL);
+
+	if (v)
+		send_guest_vcpu_virq(v, VIRQ_XENOPROF);
+
+	return v;
+}
+
 static int nmi_callback(const struct cpu_user_regs *regs, int cpu)
 {
 	int xen_mode, ovf;
 
 	ovf = model->check_ctrs(cpu, &cpu_msrs[cpu], regs);
 	xen_mode = ring_0(regs);
-	if ( ovf && is_active(current->domain) && !xen_mode )
-		send_guest_vcpu_virq(current, VIRQ_XENOPROF);
+	if (ovf && is_active(current->domain) && !xen_mode &&
+	    !this_cpu(nmi_cont_vcpu)) {
+		this_cpu(nmi_cont_vcpu) = current;
+		trigger_nmi_continuation();
+	}
 
 	if ( ovf == 2 )
 		current->arch.nmi_pending = true;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 5cbaa49031..240fd1b089 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -65,6 +65,7 @@
 #include <asm/debugger.h>
 #include <asm/msr.h>
 #include <asm/nmi.h>
+#include <asm/xenoprof.h>
 #include <asm/shared.h>
 #include <asm/x86_emulate.h>
 #include <asm/traps.h>
@@ -1805,6 +1806,9 @@ bool nmi_check_continuation(void)
 {
     bool ret = false;
 
+    if ( nmi_oprofile_send_virq() )
+        ret = true;
+
     return ret;
 }
 
diff --git a/xen/include/asm-x86/xenoprof.h b/xen/include/asm-x86/xenoprof.h
index 1026ba2e1f..cf6af8c5df 100644
--- a/xen/include/asm-x86/xenoprof.h
+++ b/xen/include/asm-x86/xenoprof.h
@@ -69,6 +69,8 @@ int passive_domain_do_rdmsr(unsigned int msr, uint64_t *msr_content);
 int passive_domain_do_wrmsr(unsigned int msr, uint64_t msr_content);
 void passive_domain_destroy(struct vcpu *v);
 
+bool nmi_oprofile_send_virq(void);
+
 #else
 
 static inline int passive_domain_do_rdmsr(unsigned int msr,
@@ -85,6 +87,11 @@ static inline int passive_domain_do_wrmsr(unsigned int msr,
 
 static inline void passive_domain_destroy(struct vcpu *v) {}
 
+static inline bool nmi_oprofile_send_virq(void)
+{
+    return false;
+}
+
 #endif /* CONFIG_XENOPROF */
 
 #endif /* __ASM_X86_XENOPROF_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 01:01:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 01:01:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30347.60302 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYK3-0006Du-1M; Thu, 19 Nov 2020 01:01:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30347.60302; Thu, 19 Nov 2020 01:01: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfYK2-0006DO-Uh; Thu, 19 Nov 2020 01:01:14 +0000
Received: by outflank-mailman (input) for mailman id 30347;
 Thu, 19 Nov 2020 01:01: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 1kfYK1-0005cb-E2
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01: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 1kfYK1-00015H-DC
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfYK1-0006zO-CR
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01: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 1kfYK1-0005cb-E2
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01:13 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5SIRcSZ9o5zV8AudkExWBIF+/HOG077P2AU88mwp9yU=; b=FwOov71QXHDMB3M8aRNP//T8hO
	XZyb1Nx3AGDjEiwdJfttxNwCFeP1jNdrDwz2xQFoImneBKvZDdojTYU1jI1XNh0U5uAHnRD0v+MuW
	NSOI0tGS9Hchfga+buWAsNi9NNlYznu6tAYff4vDrtZT8jHvaZaWXkA0BYO1STIy0kgQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYK1-00015H-DC
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfYK1-0006zO-CR
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 01:01:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: issue pci_serr error message via NMI continuation
Message-Id: <E1kfYK1-0006zO-CR@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 01:01:13 +0000

commit 5200fba9ce534fc55ec40ab622b6058600090415
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 18 12:39:21 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 18 12:39:21 2020 +0100

    xen/x86: issue pci_serr error message via NMI continuation
    
    Instead of using a softirq pci_serr_error() can use NMI continuation
    for issuing an error message.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c          | 21 +++++++++++++++------
 xen/include/asm-x86/softirq.h |  5 ++---
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 240fd1b089..0459cee9fb 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1661,10 +1661,18 @@ void do_general_protection(struct cpu_user_regs *regs)
     panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
 }
 
-static void pci_serr_softirq(void)
+static bool pci_serr_cont;
+
+static bool pci_serr_nmicont(void)
 {
+    if ( !pci_serr_cont )
+        return false;
+
+    pci_serr_cont = false;
     printk("\n\nNMI - PCI system error (SERR)\n");
     outb(inb(0x61) & 0x0b, 0x61); /* re-enable the PCI SERR error line. */
+
+    return true;
 }
 
 static void nmi_hwdom_report(unsigned int reason_idx)
@@ -1689,9 +1697,9 @@ static void pci_serr_error(const struct cpu_user_regs *regs)
         nmi_hwdom_report(_XEN_NMIREASON_pci_serr);
         /* fallthrough */
     case 'i': /* 'ignore' */
-        /* Would like to print a diagnostic here but can't call printk()
-           from NMI context -- raise a softirq instead. */
-        raise_softirq(PCI_SERR_SOFTIRQ);
+        /* Issue error message in NMI continuation. */
+        pci_serr_cont = true;
+        trigger_nmi_continuation();
         break;
     default:  /* 'fatal' */
         console_force_unlock();
@@ -1806,6 +1814,9 @@ bool nmi_check_continuation(void)
 {
     bool ret = false;
 
+    if ( pci_serr_nmicont() )
+        ret = true;
+
     if ( nmi_oprofile_send_virq() )
         ret = true;
 
@@ -2157,8 +2168,6 @@ void __init trap_init(void)
     percpu_traps_init();
 
     cpu_init();
-
-    open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq);
 }
 
 void activate_debugregs(const struct vcpu *curr)
diff --git a/xen/include/asm-x86/softirq.h b/xen/include/asm-x86/softirq.h
index 0b7a77f11f..415ee866c7 100644
--- a/xen/include/asm-x86/softirq.h
+++ b/xen/include/asm-x86/softirq.h
@@ -6,9 +6,8 @@
 #define VCPU_KICK_SOFTIRQ      (NR_COMMON_SOFTIRQS + 2)
 
 #define MACHINE_CHECK_SOFTIRQ  (NR_COMMON_SOFTIRQS + 3)
-#define PCI_SERR_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
-#define HVM_DPCI_SOFTIRQ       (NR_COMMON_SOFTIRQS + 5)
-#define NR_ARCH_SOFTIRQS       6
+#define HVM_DPCI_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
+#define NR_ARCH_SOFTIRQS       5
 
 bool arch_skip_send_event_check(unsigned int cpu);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 15:11:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 15:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30919.61128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kflaS-0008VV-6w; Thu, 19 Nov 2020 15:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30919.61128; Thu, 19 Nov 2020 15: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kflaS-0008VM-3p; Thu, 19 Nov 2020 15:11:04 +0000
Received: by outflank-mailman (input) for mailman id 30919;
 Thu, 19 Nov 2020 15: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 1kflaQ-0008VA-LY
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15: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 1kflaQ-0006K4-J6
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kflaQ-0004qi-Gt
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15: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 1kflaQ-0008VA-LY
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FNJdevcXKgsmfd9jlu7sRhgx86lHLBQRxlsEBgUn7p4=; b=X0WDQT4wbUKdca83xdhQnhJB+d
	XuNtYIU+oJh6vSDOvw8TJ+NHIyfUpUFZG2vZTfbF96WBUCTbqBipcpk3OyYEmv8/6Hh9bTfSIM5l8
	whKoePXWtnyl2U/XFTEG4L/69vpBnLqm/Gppsc4vIX6xVIdMT/cWkqJwfpSFz1fDK8z8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kflaQ-0006K4-J6
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kflaQ-0004qi-Gt
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Add workaround for Cortex-A76/Neoverse-N1 erratum #1286807
Message-Id: <E1kflaQ-0004qi-Gt@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 15:11:02 +0000

commit 22e323d115d8f26d5926c20c66e11f85a46837d7
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Mon Nov 16 13:11:40 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Nov 18 15:21:24 2020 +0000

    xen/arm: Add workaround for Cortex-A76/Neoverse-N1 erratum #1286807
    
    On the affected Cortex-A76/Neoverse-N1 cores (r0p0 to r3p0),
    if a virtual address for a cacheable mapping of a location is being
    accessed by a core while another core is remapping the virtual
    address to a new physical page using the recommended break-before-make
    sequence, then under very rare circumstances TLBI+DSB completes before
    a read using the translation being invalidated has been observed by
    other observers. The workaround repeats the TLBI+DSB operation for all
    the TLB flush operations. While this is stricly not necessary, we don't
    want to take any risk.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/silicon-errata.txt     |  2 ++
 xen/arch/arm/Kconfig                 | 23 +++++++++++++++++++++++
 xen/arch/arm/cpuerrata.c             | 14 ++++++++++++++
 xen/include/asm-arm/arm64/flushtlb.h | 30 +++++++++++++++++++++---------
 xen/include/asm-arm/cpufeature.h     |  3 ++-
 5 files changed, 62 insertions(+), 10 deletions(-)

diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt
index 552c4151d3..d183ba543f 100644
--- a/docs/misc/arm/silicon-errata.txt
+++ b/docs/misc/arm/silicon-errata.txt
@@ -53,5 +53,7 @@ stable hypervisors.
 | ARM            | Cortex-A72      | #853709         | N/A                     |
 | ARM            | Cortex-A73      | #858921         | ARM_ERRATUM_858921      |
 | ARM            | Cortex-A76      | #1165522        | N/A                     |
+| ARM            | Cortex-A76      | #1286807        | ARM64_ERRATUM_1286807   |
 | ARM            | Neoverse-N1     | #1165522        | N/A
+| ARM            | Neoverse-N1     | #1286807        | ARM64_ERRATUM_1286807   |
 | ARM            | MMU-500         | #842869         | N/A                     |
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index f938dd21bd..f5b1bcda03 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -244,6 +244,29 @@ config ARM_ERRATUM_858921
 
 	  If unsure, say Y.
 
+config ARM64_WORKAROUND_REPEAT_TLBI
+	bool
+
+config ARM64_ERRATUM_1286807
+	bool "Cortex-A76/Neoverse-N1: 1286807: Modification of the translation table for a virtual address might lead to read-after-read ordering violation"
+	default y
+	select ARM64_WORKAROUND_REPEAT_TLBI
+	depends on ARM_64
+	help
+	  This option adds a workaround for ARM Cortex-A76/Neoverse-N1 erratum 1286807.
+
+	  On the affected Cortex-A76/Neoverse-N1 cores (r0p0 to r3p0), if a virtual
+	  address for a cacheable mapping of a location is being
+	  accessed by a core while another core is remapping the virtual
+	  address to a new physical page using the recommended
+	  break-before-make sequence, then under very rare circumstances
+	  TLBI+DSB completes before a read using the translation being
+	  invalidated has been observed by other observers. The
+	  workaround repeats the TLBI+DSB operation for all the TLB flush
+	  operations.
+
+	  If unsure, say Y.
+
 endmenu
 
 config ARM64_HARDEN_BRANCH_PREDICTOR
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 567911d380..cb4795beec 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -424,6 +424,20 @@ static const struct arm_cpu_capabilities arm_errata[] = {
                    (1 << MIDR_VARIANT_SHIFT) | 2),
     },
 #endif
+#ifdef CONFIG_ARM64_ERRATUM_1286807
+    {
+        /* Cortex-A76 r0p0 - r3p0 */
+        .desc = "ARM erratum 1286807",
+        .capability = ARM64_WORKAROUND_REPEAT_TLBI,
+        MIDR_RANGE(MIDR_CORTEX_A76, 0, 3 << MIDR_VARIANT_SHIFT),
+    },
+    {
+        /* Neoverse-N1 r0p0 - r3p0 */
+        .desc = "ARM erratum 1286807",
+        .capability = ARM64_WORKAROUND_REPEAT_TLBI,
+        MIDR_RANGE(MIDR_NEOVERSE_N1, 0, 3 << MIDR_VARIANT_SHIFT),
+    },
+#endif
 #ifdef CONFIG_ARM64_HARDEN_BRANCH_PREDICTOR
     {
         .capability = ARM_HARDEN_BRANCH_PREDICTOR,
diff --git a/xen/include/asm-arm/arm64/flushtlb.h b/xen/include/asm-arm/arm64/flushtlb.h
index ceec59542e..7c54315187 100644
--- a/xen/include/asm-arm/arm64/flushtlb.h
+++ b/xen/include/asm-arm/arm64/flushtlb.h
@@ -9,6 +9,12 @@
  * DSB ISH          // Ensure the TLB invalidation has completed
  * ISB              // See explanation below
  *
+ * ARM64_WORKAROUND_REPEAT_TLBI:
+ * Modification of the translation table for a virtual address might lead to
+ * read-after-read ordering violation.
+ * The workaround repeats TLBI+DSB operation for all the TLB flush operations.
+ * While this is stricly not necessary, we don't want to take any risk.
+ *
  * For Xen page-tables the ISB will discard any instructions fetched
  * from the old mappings.
  *
@@ -16,15 +22,21 @@
  * (and therefore the TLB invalidation) before continuing. So we know
  * the TLBs cannot contain an entry for a mapping we may have removed.
  */
-#define TLB_HELPER(name, tlbop) \
-static inline void name(void)   \
-{                               \
-    asm volatile(               \
-        "dsb  ishst;"           \
-        "tlbi "  # tlbop  ";"   \
-        "dsb  ish;"             \
-        "isb;"                  \
-        : : : "memory");        \
+#define TLB_HELPER(name, tlbop)                  \
+static inline void name(void)                    \
+{                                                \
+    asm volatile(                                \
+        "dsb  ishst;"                            \
+        "tlbi "  # tlbop  ";"                    \
+        ALTERNATIVE(                             \
+            "nop; nop;",                         \
+            "dsb  ish;"                          \
+            "tlbi "  # tlbop  ";",               \
+            ARM64_WORKAROUND_REPEAT_TLBI,        \
+            CONFIG_ARM64_WORKAROUND_REPEAT_TLBI) \
+        "dsb  ish;"                              \
+        "isb;"                                   \
+        : : : "memory");                         \
 }
 
 /* Flush local TLBs, current VMID only. */
diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 016a9fe203..c7b5052992 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -46,8 +46,9 @@
 #define ARM_SMCCC_1_1 8
 #define ARM64_WORKAROUND_AT_SPECULATE 9
 #define ARM_WORKAROUND_858921 10
+#define ARM64_WORKAROUND_REPEAT_TLBI 11
 
-#define ARM_NCAPS           11
+#define ARM_NCAPS           12
 
 #ifndef __ASSEMBLY__
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 15:11:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 15:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30921.61132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kflac-00005g-8j; Thu, 19 Nov 2020 15:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30921.61132; Thu, 19 Nov 2020 15:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kflac-00005X-5d; Thu, 19 Nov 2020 15:11:14 +0000
Received: by outflank-mailman (input) for mailman id 30921;
 Thu, 19 Nov 2020 15: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 1kflaa-00005M-Pj
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15: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 1kflaa-0006K8-Ng
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kflaa-0004rQ-LF
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15: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 1kflaa-00005M-Pj
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:12 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QGUUk+PSk8hkPlW67xVLkKN4q9FpCabyMZSZNR7b31U=; b=KA+E5mdqjUqZLG5O8GGXogQjnh
	FT87r0kNVLdTAPqbYrV+5pcRvAJa7udx5J5/mmBYVLHtH34c9pR4Xo/C81A+8kTn///G4kADAVUAE
	HB5EqBnhjrs46ygFWrStjtcDG/7OJpQehONflpu0pJKn6yKOk392dP/DNZUVXI4WqISM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kflaa-0006K8-Ng
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kflaa-0004rQ-LF
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ci: drop CentOS 6
Message-Id: <E1kflaa-0004rQ-LF@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 15:11:12 +0000

commit 7872b493f9db0e6361354bed82b0b4d92a7cd861
Author:     Doug Goldstein <cardoe@cardoe.com>
AuthorDate: Wed Nov 18 10:27:06 2020 -0600
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Nov 18 16:55:30 2020 +0000

    ci: drop CentOS 6
    
    CentOS 6 is no longer supported by upstream so we cannot test against it
    for future Xen releases.
    
    Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/centos/6.dockerfile | 51 ------------------------------------
 automation/gitlab-ci/build.yaml      | 10 -------
 automation/scripts/containerize      |  1 -
 3 files changed, 62 deletions(-)

diff --git a/automation/build/centos/6.dockerfile b/automation/build/centos/6.dockerfile
deleted file mode 100644
index 54d022be86..0000000000
--- a/automation/build/centos/6.dockerfile
+++ /dev/null
@@ -1,51 +0,0 @@
-FROM centos:6
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-RUN mkdir /build
-WORKDIR /build
-
-# work around https://github.com/moby/moby/issues/10180
-# and add EPEL for dev86
-RUN rpm --rebuilddb && \
-    yum -y install \
-        yum-plugin-ovl \
-        epel-release \
-    && yum clean all && \
-    rm -rf /var/cache/yum
-
-# install Xen depends
-RUN yum -y install \
-        gcc \
-        gcc-c++ \
-        ncurses-devel \
-        zlib-devel \
-        openssl-devel \
-        python-devel \
-        libuuid-devel \
-        pciutils-devel \
-        pkgconfig \
-        gettext \
-        flex \
-        bison \
-        libaio-devel \
-        glib2-devel \
-        yajl-devel \
-        pixman-devel \
-        glibc-devel \
-        glibc-devel.i686 \
-        make \
-        binutils \
-        git \
-        wget \
-        acpica-tools \
-        python-markdown \
-        patch \
-        checkpolicy \
-        dev86 \
-        iasl \
-        xz-devel \
-        bzip2 \
-        nasm \
-    && yum clean all && \
-    rm -rf /var/cache/yum
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 1e61d30c85..4bd1cfc1c0 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -176,16 +176,6 @@ centos-7-gcc-debug:
   variables:
     CONTAINER: centos:7
 
-centos-6-gcc:
-  extends: .gcc-x86-64-build
-  variables:
-    CONTAINER: centos:6
-
-centos-6-gcc-debug:
-  extends: .gcc-x86-64-build-debug
-  variables:
-    CONTAINER: centos:6
-
 debian-jessie-clang:
   extends: .clang-x86-64-build
   variables:
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index a75d54566c..58b83653b1 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -25,7 +25,6 @@ die() {
 BASE="registry.gitlab.com/xen-project/xen"
 case "_${CONTAINER}" in
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
-    _centos6) CONTAINER="${BASE}/centos:6" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
     _centos72) CONTAINER="${BASE}/centos:7.2" ;;
     _fedora) CONTAINER="${BASE}/fedora:29";;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 19 15:11:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Nov 2020 15:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.30922.61136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kflam-00007X-AI; Thu, 19 Nov 2020 15:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 30922.61136; Thu, 19 Nov 2020 15:11:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kflam-00007O-7C; Thu, 19 Nov 2020 15:11:24 +0000
Received: by outflank-mailman (input) for mailman id 30922;
 Thu, 19 Nov 2020 15: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 1kflak-000073-SU
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15: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 1kflak-0006KN-QW
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kflak-0004sQ-Pg
 for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15: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 1kflak-000073-SU
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:22 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U6WUkfk6FV94cwa1kyK7wIOgOUX1bCAKXaXy9AJuKVs=; b=l14vuqlUvmz5Qv3TedxNGQMuom
	razERUDmxPNCYIT5RDUUyZ0ch3M4rkIgcGWQgT01EJVfaTptzVg0nBPvFIaD7PKUiJZRrK3Uqfcts
	wY75i6m8I/XMjuyttC9aYrwYd13MuWQ4VQuDukKGgfz0lVZL/kDiUs0yu4Tskv/gNmAQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kflak-0006KN-QW
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kflak-0004sQ-Pg
	for xen-changelog@lists.xenproject.org; Thu, 19 Nov 2020 15:11:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/scripts/containerize: fix DOCKER_CMD=podman
Message-Id: <E1kflak-0004sQ-Pg@xenbits.xenproject.org>
Date: Thu, 19 Nov 2020 15:11:22 +0000

commit 415f904254b7343a90db895134980cbb7f7f0479
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 17 18:24:09 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Nov 18 16:55:30 2020 +0000

    automation/scripts/containerize: fix DOCKER_CMD=podman
    
    On CentOS 8 with SELinux containerize doesn't work at all:
    
    Make sure that the source code and SSH agent directories are passed on
    with SELinux relabeling enabled.
    (`-security-opt label=disabled` would be another option)
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Doug Goldstein <cardoe@cardoe.com>
---
 automation/scripts/containerize | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 58b83653b1..c8c3c20fa2 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -7,7 +7,7 @@
 # and /etc/subgid.
 #
 docker_cmd=${DOCKER_CMD:-"docker"}
-[ "$DOCKER_CMD" = "podman" ] && userns_podman="--userns=keep-id"
+[ "$DOCKER_CMD" = "podman" ] && userns_podman="--userns=keep-id" selinux=",z"
 
 einfo() {
     echo "$*" >&2
@@ -94,9 +94,9 @@ einfo "*** Launching container ..."
 exec ${docker_cmd} run \
     ${userarg} \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
-    -v "${CONTAINER_PATH}":/build:rw \
+    -v "${CONTAINER_PATH}":/build:rw${selinux} \
     -v "${HOME}/.ssh":/root/.ssh:ro \
-    ${SSH_AUTH_DIR:+-v "${SSH_AUTH_DIR}":/tmp/ssh-agent} \
+    ${SSH_AUTH_DIR:+-v "${SSH_AUTH_DIR}":/tmp/ssh-agent${selinux}} \
     ${XEN_CONFIG_EXPERT:+-e XEN_CONFIG_EXPERT=${XEN_CONFIG_EXPERT}} \
     ${CONTAINER_ARGS} \
     -${termint}i --rm -- \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 20 00:33:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Nov 2020 00:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.31496.61901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfuMM-0001Fl-W1; Fri, 20 Nov 2020 00:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 31496.61901; Fri, 20 Nov 2020 00:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfuMM-0001Fd-St; Fri, 20 Nov 2020 00:33:06 +0000
Received: by outflank-mailman (input) for mailman id 31496;
 Fri, 20 Nov 2020 00:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfuML-0001FY-Lz
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00: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 1kfuML-0002KZ-IU
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfuML-0005K9-Gx
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfuML-0001FY-Lz
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:05 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P6WcCM7rOm/65Kqp5URqr2HaRVvdOXzejcf4rfRkPb4=; b=FnnYpjXk3ysXLPfRzcVIzlDR+k
	IXbq+mcLFWGh6U3L64mzZlsqsB9GFfh2ZioHz19hSiZdWjgBDOzQRss3Kfui7AuxpwGMXstWqklaG
	s+rh/VD1zPROIxRoj3500SILwhhghboF9PUQ9emTgxx4apGNHnK83tJ0CbK74F8wSi9w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfuML-0002KZ-IU
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfuML-0005K9-Gx
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: gic: acpi: Guard helpers to build the MADT with CONFIG_ACPI
Message-Id: <E1kfuML-0005K9-Gx@xenbits.xenproject.org>
Date: Fri, 20 Nov 2020 00:33:05 +0000

commit 1965c171a4a791bbed1cf84c097177117bb02dac
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Nov 19 17:08:27 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 19 16:23:08 2020 -0800

    xen/arm: gic: acpi: Guard helpers to build the MADT with CONFIG_ACPI
    
    gic_make_hwdom_madt() and gic_get_hwdom_madt_size() are ACPI specific.
    
    While they build fine today, this will change in a follow-up patch.
    Rather than trying to fix the build on ACPI, it is best to avoid
    compiling the helpers and the associated callbacks when CONFIG_ACPI=n.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/gic-v2.c     |  8 +++-----
 xen/arch/arm/gic-v3.c     | 11 ++---------
 xen/arch/arm/gic.c        |  2 ++
 xen/include/asm-arm/gic.h | 10 ++++++++--
 4 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 0f747538db..581ea5ba6b 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1114,12 +1114,12 @@ static int gicv2_iomem_deny_access(const struct domain *d)
     return iomem_deny_access(d, mfn, mfn + nr);
 }
 
+#ifdef CONFIG_ACPI
 static unsigned long gicv2_get_hwdom_extra_madt_size(const struct domain *d)
 {
     return 0;
 }
 
-#ifdef CONFIG_ACPI
 static int gicv2_make_hwdom_madt(const struct domain *d, u32 offset)
 {
     struct acpi_subtable_header *header;
@@ -1248,10 +1248,6 @@ static void __init gicv2_acpi_init(void)
 }
 #else
 static void __init gicv2_acpi_init(void) { }
-static int gicv2_make_hwdom_madt(const struct domain *d, u32 offset)
-{
-    return 0;
-}
 #endif
 
 static int __init gicv2_init(void)
@@ -1357,8 +1353,10 @@ const static struct gic_hw_operations gicv2_ops = {
     .read_apr            = gicv2_read_apr,
     .read_pending_state  = gicv2_read_pending_state,
     .make_hwdom_dt_node  = gicv2_make_hwdom_dt_node,
+#ifdef CONFIG_ACPI
     .make_hwdom_madt     = gicv2_make_hwdom_madt,
     .get_hwdom_extra_madt_size = gicv2_get_hwdom_extra_madt_size,
+#endif
     .map_hwdom_extra_mappings = gicv2_map_hwdown_extra_mappings,
     .iomem_deny_access   = gicv2_iomem_deny_access,
     .do_LPI              = gicv2_do_LPI,
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 0f6cbf6224..2a344393a0 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1735,15 +1735,6 @@ static void __init gicv3_acpi_init(void)
 }
 #else
 static void __init gicv3_acpi_init(void) { }
-static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
-{
-    return 0;
-}
-
-static unsigned long gicv3_get_hwdom_extra_madt_size(const struct domain *d)
-{
-    return 0;
-}
 #endif
 
 static bool gic_dist_supports_lpis(void)
@@ -1858,8 +1849,10 @@ static const struct gic_hw_operations gicv3_ops = {
     .read_pending_state  = gicv3_read_pending_state,
     .secondary_init      = gicv3_secondary_cpu_init,
     .make_hwdom_dt_node  = gicv3_make_hwdom_dt_node,
+#ifdef CONFIG_ACPI
     .make_hwdom_madt     = gicv3_make_hwdom_madt,
     .get_hwdom_extra_madt_size = gicv3_get_hwdom_extra_madt_size,
+#endif
     .iomem_deny_access   = gicv3_iomem_deny_access,
     .do_LPI              = gicv3_do_LPI,
 };
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index d623c57cb9..fe60619e99 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -443,6 +443,7 @@ int gic_make_hwdom_dt_node(const struct domain *d,
     return gic_hw_ops->make_hwdom_dt_node(d, gic, fdt);
 }
 
+#ifdef CONFIG_ACPI
 int gic_make_hwdom_madt(const struct domain *d, u32 offset)
 {
     return gic_hw_ops->make_hwdom_madt(d, offset);
@@ -459,6 +460,7 @@ unsigned long gic_get_hwdom_madt_size(const struct domain *d)
 
     return madt_size;
 }
+#endif
 
 int gic_iomem_deny_access(const struct domain *d)
 {
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index ba870523bb..ad0f7452d0 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -378,12 +378,14 @@ struct gic_hw_operations {
     /* Create GIC node for the hardware domain */
     int (*make_hwdom_dt_node)(const struct domain *d,
                               const struct dt_device_node *gic, void *fdt);
+#ifdef CONFIG_ACPI
     /* Create MADT table for the hardware domain */
     int (*make_hwdom_madt)(const struct domain *d, u32 offset);
-    /* Map extra GIC MMIO, irqs and other hw stuffs to the hardware domain. */
-    int (*map_hwdom_extra_mappings)(struct domain *d);
     /* Query the size of hardware domain madt table */
     unsigned long (*get_hwdom_extra_madt_size)(const struct domain *d);
+#endif
+    /* Map extra GIC MMIO, irqs and other hw stuffs to the hardware domain. */
+    int (*map_hwdom_extra_mappings)(struct domain *d);
     /* Deny access to GIC regions */
     int (*iomem_deny_access)(const struct domain *d);
     /* Handle LPIs, which require special handling */
@@ -435,8 +437,12 @@ void register_gic_ops(const struct gic_hw_operations *ops);
 int gic_make_hwdom_dt_node(const struct domain *d,
                            const struct dt_device_node *gic,
                            void *fdt);
+
+#ifdef CONFIG_ACPI
 int gic_make_hwdom_madt(const struct domain *d, u32 offset);
 unsigned long gic_get_hwdom_madt_size(const struct domain *d);
+#endif
+
 int gic_map_hwdom_extra_mappings(struct domain *d);
 int gic_iomem_deny_access(const struct domain *d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 20 00:33:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Nov 2020 00:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.31497.61905 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfuMX-0001I8-1e; Fri, 20 Nov 2020 00:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 31497.61905; Fri, 20 Nov 2020 00:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfuMW-0001I0-Uc; Fri, 20 Nov 2020 00:33:16 +0000
Received: by outflank-mailman (input) for mailman id 31497;
 Fri, 20 Nov 2020 00:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfuMV-0001Hr-Pd
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00: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 1kfuMV-0002Kf-NZ
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfuMV-0005Kx-Lg
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfuMV-0001Hr-Pd
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:15 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l0GBHX1/QP7p4uMDgNC6gqmMcINEEzUQvOrL+NtgcpM=; b=Zx9u0rO3g42SMaDtiOVAAH3CtQ
	jDSTl3t5pxKpaE1fMJZwvLMPnouKvG5HfJ8KW1udodh2smERpOaoVWg+shlYS+Qtw/AstFgyud9pn
	w5hqgPs4Au14E6uDOqOUDSmvvgNyrcDl0Lms9eyCfBfa5L04Ctssvdm1sDWqZoFtYjs0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfuMV-0002Kf-NZ
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfuMV-0005Kx-Lg
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: gic: acpi: Use the correct length for the GICC structure
Message-Id: <E1kfuMV-0005Kx-Lg@xenbits.xenproject.org>
Date: Fri, 20 Nov 2020 00:33:15 +0000

commit 9a3c25b6562416dfb3708b0e61a4e4761db06e4f
Author:     Julien Grall <julien.grall@arm.com>
AuthorDate: Thu Nov 19 17:08:28 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 19 16:25:02 2020 -0800

    xen/arm: gic: acpi: Use the correct length for the GICC structure
    
    The length of the GICC structure in the MADT ACPI table differs between
    version 5.1 and 6.0, although there are no other relevant differences.
    
    Use the BAD_MADT_GICC_ENTRY macro, which was specifically designed to
    overcome this issue.
    
    Signed-off-by: Julien Grall <julien.grall@arm.com>
    Signed-off-by: Andre Przywara <andre.przywara@arm.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/acpi/boot.c | 2 +-
 xen/arch/arm/gic-v2.c    | 5 +++--
 xen/arch/arm/gic-v3.c    | 6 +++---
 xen/arch/arm/gic.c       | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
index 30e4bd1bc5..55c3e5cbc8 100644
--- a/xen/arch/arm/acpi/boot.c
+++ b/xen/arch/arm/acpi/boot.c
@@ -131,7 +131,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
     struct acpi_madt_generic_interrupt *processor =
                container_of(header, struct acpi_madt_generic_interrupt, header);
 
-    if ( BAD_MADT_ENTRY(processor, end) )
+    if ( BAD_MADT_GICC_ENTRY(processor, end) )
         return -EINVAL;
 
     acpi_table_print_madt_entry(header);
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 581ea5ba6b..b2adc8ec9a 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1136,7 +1136,8 @@ static int gicv2_make_hwdom_madt(const struct domain *d, u32 offset)
 
     host_gicc = container_of(header, struct acpi_madt_generic_interrupt,
                              header);
-    size = sizeof(struct acpi_madt_generic_interrupt);
+
+    size = ACPI_MADT_GICC_LENGTH;
     /* Add Generic Interrupt */
     for ( i = 0; i < d->max_vcpus; i++ )
     {
@@ -1165,7 +1166,7 @@ gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header,
     struct acpi_madt_generic_interrupt *processor =
                container_of(header, struct acpi_madt_generic_interrupt, header);
 
-    if ( BAD_MADT_ENTRY(processor, end) )
+    if ( BAD_MADT_GICC_ENTRY(processor, end) )
         return -EINVAL;
 
     /* Read from APIC table and fill up the GIC variables */
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 2a344393a0..ac28013c19 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1499,7 +1499,7 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
 
     host_gicc = container_of(header, struct acpi_madt_generic_interrupt,
                              header);
-    size = sizeof(struct acpi_madt_generic_interrupt);
+    size = ACPI_MADT_GICC_LENGTH;
     for ( i = 0; i < d->max_vcpus; i++ )
     {
         gicc = (struct acpi_madt_generic_interrupt *)(base_ptr + table_len);
@@ -1558,7 +1558,7 @@ gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header,
     struct acpi_madt_generic_interrupt *processor =
                container_of(header, struct acpi_madt_generic_interrupt, header);
 
-    if ( BAD_MADT_ENTRY(processor, end) )
+    if ( BAD_MADT_GICC_ENTRY(processor, end) )
         return -EINVAL;
 
     /* Read from APIC table and fill up the GIC variables */
@@ -1628,7 +1628,7 @@ gic_acpi_get_madt_cpu_num(struct acpi_subtable_header *header,
     struct acpi_madt_generic_interrupt *cpuif;
 
     cpuif = (struct acpi_madt_generic_interrupt *)header;
-    if ( BAD_MADT_ENTRY(cpuif, end) || !cpuif->gicr_base_address )
+    if ( BAD_MADT_GICC_ENTRY(cpuif, end) || !cpuif->gicr_base_address )
         return -EINVAL;
 
     return 0;
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index fe60619e99..3b0331b538 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -454,7 +454,7 @@ unsigned long gic_get_hwdom_madt_size(const struct domain *d)
     unsigned long madt_size;
 
     madt_size = sizeof(struct acpi_table_madt)
-                + sizeof(struct acpi_madt_generic_interrupt) * d->max_vcpus
+                + ACPI_MADT_GICC_LENGTH * d->max_vcpus
                 + sizeof(struct acpi_madt_generic_distributor)
                 + gic_hw_ops->get_hwdom_extra_madt_size(d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 20 00:33:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Nov 2020 00:33:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.31498.61908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfuMh-0001KI-4k; Fri, 20 Nov 2020 00:33:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 31498.61908; Fri, 20 Nov 2020 00:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kfuMh-0001KC-1o; Fri, 20 Nov 2020 00:33:27 +0000
Received: by outflank-mailman (input) for mailman id 31498;
 Fri, 20 Nov 2020 00: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 1kfuMf-0001Jv-Sn
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00: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 1kfuMf-0002Kv-Ry
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kfuMf-0005Lr-Q7
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00: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 1kfuMf-0001Jv-Sn
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:25 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S5RuARzZv+wT0Di43eMYkAfnqrAFGvZTSBmxkQy5A2s=; b=4YTKhUo/UZEbIzCy2LAeNGAbEb
	zQxr+mHmr7+Km4nZqpVBAbyz+Y2A9LyR+jdhNlND7RIZbBL6JEeZsaR5y1iixoxEfMvm5zbMnl6ND
	IEExuK7oleUHWHE2GNO3JQGQA+PCR/HQ16KNY+V0W8fjBSd9MVcz/JePywXH4Bla1yRA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfuMf-0002Kv-Ry
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kfuMf-0005Lr-Q7
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 00:33:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: acpi: Allow Xen to boot with ACPI 5.1
Message-Id: <E1kfuMf-0005Lr-Q7@xenbits.xenproject.org>
Date: Fri, 20 Nov 2020 00:33:25 +0000

commit 0ff2c7e5b4ff9b3066d6cbba9adf95b948b418c9
Author:     Julien Grall <julien.grall@arm.com>
AuthorDate: Thu Nov 19 17:08:29 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 19 16:25:28 2020 -0800

    xen/arm: acpi: Allow Xen to boot with ACPI 5.1
    
    At the moment Xen requires the FADT ACPI table to be at least version
    6.0, apparently because of some reliance on other ACPI v6.0 features.
    
    But actually this is overzealous, and Xen works now fine with ACPI v5.1.
    
    Let's relax the version check for the FADT table to allow QEMU to
    run the hypervisor with ACPI.
    
    Signed-off-by: Julien Grall <julien.grall@arm.com>
    Signed-off-by: Andre Przywara <andre.przywara@arm.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/acpi/boot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
index 55c3e5cbc8..7ea2990cb8 100644
--- a/xen/arch/arm/acpi/boot.c
+++ b/xen/arch/arm/acpi/boot.c
@@ -181,8 +181,8 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
      * we only deal with ACPI 6.0 or newer revision to get GIC and SMP
      * boot protocol configuration data, or we will disable ACPI.
      */
-    if ( table->revision > 6
-         || (table->revision == 6 && fadt->minor_revision >= 0) )
+    if ( table->revision > 5
+         || (table->revision == 5 && fadt->minor_revision >= 1) )
         return 0;
 
     printk("Unsupported FADT revision %d.%d, should be 6.0+, will disable ACPI\n",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 20 07:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Nov 2020 07:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.31620.62141 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kg0uq-0003K7-3G; Fri, 20 Nov 2020 07:33:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 31620.62141; Fri, 20 Nov 2020 07:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kg0uq-0003Jz-0E; Fri, 20 Nov 2020 07:33:08 +0000
Received: by outflank-mailman (input) for mailman id 31620;
 Fri, 20 Nov 2020 07:33: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 1kg0uo-0003Jt-31
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33: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 1kg0uo-0007a0-0o
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kg0un-0001gq-Vv
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07: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 1kg0uo-0003Jt-31
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:06 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wul38znfvQ4H1+97Rw/Lf79VadYNje3tC2oYfNDQ6w4=; b=Eu1y1A6Qr+OrGf/F1UiuJzkSZr
	7jmdThOE1L2XJbxI2sQjKgCPqCg+o9T1La5ADnY3mECdMFh+XqoB2puoPGN52t4ik4cKPduLF/mBv
	GZrePK6iyCOA6U+OX1ZBya9Q254LS/YWUgN0MTiNPzSQvNGuPcVKuPtqUq+UMUcN115w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kg0uo-0007a0-0o
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kg0un-0001gq-Vv
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: split _ctype[] into its own object, under lib/
Message-Id: <E1kg0un-0001gq-Vv@xenbits.xenproject.org>
Date: Fri, 20 Nov 2020 07:33:05 +0000

commit 318a9175d5b145ab5b6a1f26b8312a88f9fb4d94
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 20 08:25:17 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 20 08:25:17 2020 +0100

    lib: split _ctype[] into its own object, under lib/
    
    This is, besides for tidying, in preparation of then starting to use an
    archive rather than an object file for generic library code which
    arch-es (or even specific configurations within a single arch) may or
    may not need.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/Makefile     |  3 ++-
 xen/Rules.mk     |  2 +-
 xen/common/lib.c | 29 -----------------------------
 xen/lib/Makefile |  1 +
 xen/lib/ctype.c  | 38 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index bf0c804d43..73bdc326c5 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -331,6 +331,7 @@ _clean: delete-unfresh-files
 	$(MAKE) $(clean) include
 	$(MAKE) $(clean) common
 	$(MAKE) $(clean) drivers
+	$(MAKE) $(clean) lib
 	$(MAKE) $(clean) xsm
 	$(MAKE) $(clean) crypto
 	$(MAKE) $(clean) arch/arm
@@ -414,7 +415,7 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
 	  echo ""; \
 	  echo "#endif") <$< >$@
 
-SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers test
+SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
     ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
       find include -name 'asm-*' -prune -o -name '*.h' -print; \
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 891c94e6ad..333e19bec3 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -36,7 +36,7 @@ TARGET := $(BASEDIR)/xen
 # Note that link order matters!
 ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
-ALL_OBJS-$(CONFIG_X86)   += $(BASEDIR)/lib/built_in.o
+ALL_OBJS-y               += $(BASEDIR)/lib/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/xsm/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
 ALL_OBJS-$(CONFIG_CRYPTO)   += $(BASEDIR)/crypto/built_in.o
diff --git a/xen/common/lib.c b/xen/common/lib.c
index b2b799da44..a224efa8f6 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -1,37 +1,8 @@
-
-#include <xen/ctype.h>
 #include <xen/lib.h>
 #include <xen/types.h>
 #include <xen/init.h>
 #include <asm/byteorder.h>
 
-/* for ctype.h */
-const unsigned char _ctype[] = {
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
-    _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
-    _S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
-    _P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
-    _D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
-    _D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
-    _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
-    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
-    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
-    _U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
-    _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
-    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
-    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
-    _L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
-    _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
-    _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
-    _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
-    _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
-    _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
-    _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
-
 /*
  * A couple of 64 bit operations ported from FreeBSD.
  * The code within the '#if BITS_PER_LONG == 32' block below, and no other
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 7019ca00e8..53b1da025e 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -1 +1,2 @@
+obj-y += ctype.o
 obj-$(CONFIG_X86) += x86/
diff --git a/xen/lib/ctype.c b/xen/lib/ctype.c
new file mode 100644
index 0000000000..7b233a335f
--- /dev/null
+++ b/xen/lib/ctype.c
@@ -0,0 +1,38 @@
+#include <xen/ctype.h>
+
+/* for ctype.h */
+const unsigned char _ctype[] = {
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
+    _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
+    _S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
+    _P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
+    _D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
+    _D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
+    _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
+    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
+    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
+    _U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
+    _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
+    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
+    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
+    _L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
+    _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
+    _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
+    _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
+    _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
+    _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
+    _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 20 07:33:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Nov 2020 07:33:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.31621.62146 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kg0v0-0003Mu-5L; Fri, 20 Nov 2020 07:33:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 31621.62146; Fri, 20 Nov 2020 07:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kg0v0-0003Mm-1r; Fri, 20 Nov 2020 07:33:18 +0000
Received: by outflank-mailman (input) for mailman id 31621;
 Fri, 20 Nov 2020 07:33: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 1kg0uy-0003MW-6Y
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33: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 1kg0uy-0007a9-4e
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kg0uy-0001hY-3Q
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33: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 1kg0uy-0003MW-6Y
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:16 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=quAZKLBFFcWDxlbree79tLHrByUmCB/N563AKqTylFg=; b=X5S4V+qok0RiTI/zId5etfsRE9
	gB7UbOAUGL4thMejVoZuB5evdWwiUfhOowiLvz4S2UKvSnPyPDFTyCjxn/n17jylUioWymsPXZps4
	/NRtlD6F9aE6/ZXmtHAlMWFoMvfZOKIL8R3CLYVQuz3DzJX98vC5/uOjK6DQkICBj838=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kg0uy-0007a9-4e
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kg0uy-0001hY-3Q
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/nmi: avoid UB for P4-era watchdogs
Message-Id: <E1kg0uy-0001hY-3Q@xenbits.xenproject.org>
Date: Fri, 20 Nov 2020 07:33:16 +0000

commit bebb49125fd305ae7814d7d4fcc05a85cc2a21e0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 20 08:28:11 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 20 08:28:11 2020 +0100

    x86/nmi: avoid UB for P4-era watchdogs
    
    Found by looking for patterns similar to the one Julien did spot in
    pci_vtd_quirks().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/nmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 014524486f..ab94a96c4d 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -132,7 +132,7 @@ int nmi_active;
 #define P4_ESCR_EVENT_SELECT(N)	((N)<<25)
 #define P4_CCCR_OVF_PMI0	(1<<26)
 #define P4_CCCR_OVF_PMI1	(1<<27)
-#define P4_CCCR_OVF		(1<<31)
+#define P4_CCCR_OVF		(1u << 31)
 #define P4_CCCR_THRESHOLD(N)	((N)<<20)
 #define P4_CCCR_COMPLEMENT	(1<<19)
 #define P4_CCCR_COMPARE		(1<<18)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 20 07:33:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Nov 2020 07:33:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.31622.62149 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kg0vA-0003OP-6Q; Fri, 20 Nov 2020 07:33:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 31622.62149; Fri, 20 Nov 2020 07:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kg0vA-0003OH-3W; Fri, 20 Nov 2020 07:33:28 +0000
Received: by outflank-mailman (input) for mailman id 31622;
 Fri, 20 Nov 2020 07:33: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 1kg0v8-0003O0-8u
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33: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 1kg0v8-0007aO-8A
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kg0v8-0001iF-75
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33: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 1kg0v8-0003O0-8u
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:26 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Nbj7mO+hxn6UoHX154rNQjXdcDxmDUUrfElTk0ixig=; b=Ib2wq9jkcDdAGSYlt4lcM38qiY
	ZcyfW/KVL8FPvgbRe7RJ0rtbs+SPysIZKJKNTGKQk/gOmEW+LLgzKfJZzRCJDo9iQ9D79byns86b+
	6Umm7Ai8oWZNL+evfH+4OZmd6UUh52/+pVtsZqDxzNJeh2cD5kIFLplb5tfsLRrXlDc4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kg0v8-0007aO-8A
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kg0v8-0001iF-75
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SVM: avoid UB in intercept mask definitions
Message-Id: <E1kg0v8-0001iF-75@xenbits.xenproject.org>
Date: Fri, 20 Nov 2020 07:33:26 +0000

commit dee7d981b99435b6c37126821af7826bd9a9d36c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 20 08:28:27 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 20 08:28:27 2020 +0100

    SVM: avoid UB in intercept mask definitions
    
    Found by looking for patterns similar to the one Julien did spot in
    pci_vtd_quirks().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-x86/hvm/svm/vmcb.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h
index c4fda389b3..0b03a8f076 100644
--- a/xen/include/asm-x86/hvm/svm/vmcb.h
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -55,7 +55,7 @@ enum GenericIntercept1bits
     GENERAL1_INTERCEPT_MSR_PROT      = 1 << 28,
     GENERAL1_INTERCEPT_TASK_SWITCH   = 1 << 29,
     GENERAL1_INTERCEPT_FERR_FREEZE   = 1 << 30,
-    GENERAL1_INTERCEPT_SHUTDOWN_EVT  = 1 << 31
+    GENERAL1_INTERCEPT_SHUTDOWN_EVT  = 1u << 31
 };
 
 /* general 2 intercepts */
@@ -112,7 +112,7 @@ enum CRInterceptBits
     CR_INTERCEPT_CR12_WRITE = 1 << 28,
     CR_INTERCEPT_CR13_WRITE = 1 << 29,
     CR_INTERCEPT_CR14_WRITE = 1 << 30,
-    CR_INTERCEPT_CR15_WRITE = 1 << 31,
+    CR_INTERCEPT_CR15_WRITE = 1u << 31,
 };
 
 
@@ -150,7 +150,7 @@ enum DRInterceptBits
     DR_INTERCEPT_DR12_WRITE = 1 << 28,
     DR_INTERCEPT_DR13_WRITE = 1 << 29,
     DR_INTERCEPT_DR14_WRITE = 1 << 30,
-    DR_INTERCEPT_DR15_WRITE = 1 << 31,
+    DR_INTERCEPT_DR15_WRITE = 1u << 31,
 };
 
 enum VMEXIT_EXITCODE
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 20 07:33:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Nov 2020 07:33:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.31623.62154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kg0vK-0003QJ-81; Fri, 20 Nov 2020 07:33:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 31623.62154; Fri, 20 Nov 2020 07:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kg0vK-0003QA-51; Fri, 20 Nov 2020 07:33:38 +0000
Received: by outflank-mailman (input) for mailman id 31623;
 Fri, 20 Nov 2020 07: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 1kg0vI-0003Pw-CO
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33: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 1kg0vI-0007aV-Bk
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kg0vI-0001iy-An
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07: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 1kg0vI-0003Pw-CO
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:36 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QpyndE+XPiIF9CfkbXiaDgE/zY0SmyJ5hAcI3tzo7Ys=; b=dOBn4zJjCi/FD2t7Twl/rT4nEG
	ZBZ2qi4uZGh62WYJY9kZJ10j3kUSPytCcjvSvQUXzQGrltz6ilEvmaM4kS/7RDDbfR91A9Pcxjedq
	Za8SuAh6hBMiSqDno4hzuA3oW4G852lsQm+aMbiihwDeLykuVBU0DG2WBzkzQ65ZuKno=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kg0vI-0007aV-Bk
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kg0vI-0001iy-An
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 07:33:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] AMD/IOMMU: avoid UB in guest CR3 retrieval
Message-Id: <E1kg0vI-0001iy-An@xenbits.xenproject.org>
Date: Fri, 20 Nov 2020 07:33:36 +0000

commit 846d22d54f24f336fb80d052338e0cd030d54fee
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 20 08:28:58 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 20 08:28:58 2020 +0100

    AMD/IOMMU: avoid UB in guest CR3 retrieval
    
    Found by looking for patterns similar to the one Julien did spot in
    pci_vtd_quirks(). (Not that it matters much here, considering the code
    is dead right now.)
    
    Fixes: 3a7947b69011 ("amd-iommu: use a bitfield for DTE")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/passthrough/amd/iommu_guest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
index 30b7353cd6..2a3def9a5d 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -70,7 +70,8 @@ static void guest_iommu_disable(struct guest_iommu *iommu)
 
 static uint64_t get_guest_cr3_from_dte(struct amd_iommu_dte *dte)
 {
-    return ((dte->gcr3_trp_51_31 << 31) | (dte->gcr3_trp_30_15 << 15) |
+    return (((uint64_t)dte->gcr3_trp_51_31 << 31) |
+            (dte->gcr3_trp_30_15 << 15) |
             (dte->gcr3_trp_14_12 << 12)) >> PAGE_SHIFT;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 20 19:33:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Nov 2020 19:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.32630.63725 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgC9b-0005pU-1W; Fri, 20 Nov 2020 19:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 32630.63725; Fri, 20 Nov 2020 19:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgC9a-0005pM-Un; Fri, 20 Nov 2020 19:33:06 +0000
Received: by outflank-mailman (input) for mailman id 32630;
 Fri, 20 Nov 2020 19: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 1kgC9Z-0005pG-Je
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 19: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 1kgC9Z-000715-I1
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 19:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgC9Z-0008U1-GY
 for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 19: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 1kgC9Z-0005pG-Je
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 19:33:05 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zjMIF9OcdL9HXI/a1XvC1Z8TneJn8cUUvhZuNX2rhDU=; b=I9wTlOER1uVIG1aGCijm7fWkG4
	LcLrpzDgWJ1sHJAIcq6ZY9redMVjxCbvHRaXwi4XJHJaS8EdJXMDA7Z0Urys4GTQfLcUw4oK7xBN9
	m09k7up7zcva9P550YospssI9HfW88rdOkHl4zbS9a36ONRSRE/aYTzHZ55h/rGBO86E=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgC9Z-000715-I1
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 19:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgC9Z-0008U1-GY
	for xen-changelog@lists.xenproject.org; Fri, 20 Nov 2020 19:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] amd-iommu: Fix Guest CR3 Table following c/s 3a7947b6901
Message-Id: <E1kgC9Z-0008U1-GY@xenbits.xenproject.org>
Date: Fri, 20 Nov 2020 19:33:05 +0000

commit b659a5cebd611dbe698e63c03485b5fe8cd964ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 3 17:53:15 2019 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Nov 20 19:25:58 2020 +0000

    amd-iommu: Fix Guest CR3 Table following c/s 3a7947b6901
    
    "amd-iommu: use a bitfield for DTE" renamed iommu_dte_set_guest_cr3()'s gcr3
    parameter to gcr3_mfn but ended up with an off-by-PAGE_SIZE error when
    extracting bits from the address.
    
    get_guest_cr3_from_dte() and iommu_dte_set_guest_cr3() are (almost) getters
    and setters for the same field, so should live together.
    
    Rename them to dte_{get,set}_gcr3_table() to specifically avoid 'guest_cr3' in
    the name.  This field actually points to a table in memory containing an array
    of guest CR3 values.  As these functions are used for different logical
    indirections, they shouldn't use gfn/mfn terminology for their parameters.
    Switch them to use straight uint64_t full addresses.
    
    Fixes: 3a7947b6901 ("amd-iommu: use a bitfield for DTE")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu.h       |  2 --
 xen/drivers/passthrough/amd/iommu_guest.c | 36 +++++++++++++++++++++++++++----
 xen/drivers/passthrough/amd/iommu_map.c   | 21 ------------------
 3 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index 28a44ceb85..ad089cb095 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -246,8 +246,6 @@ void amd_iommu_set_root_page_table(struct amd_iommu_dte *dte,
 				   uint8_t paging_mode, bool valid);
 void iommu_dte_add_device_entry(struct amd_iommu_dte *dte,
                                 const struct ivrs_mappings *ivrs_dev);
-void iommu_dte_set_guest_cr3(struct amd_iommu_dte *dte, uint16_t dom_id,
-                             uint64_t gcr3_mfn, bool gv, uint8_t glx);
 
 /* send cmd to iommu */
 void amd_iommu_flush_all_pages(struct domain *d);
diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
index 2a3def9a5d..00c5ccd7b5 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -68,11 +68,39 @@ static void guest_iommu_disable(struct guest_iommu *iommu)
     iommu->enabled = 0;
 }
 
-static uint64_t get_guest_cr3_from_dte(struct amd_iommu_dte *dte)
+/*
+ * The Guest CR3 Table is a table written by the guest kernel, pointing at
+ * gCR3 values for PASID transactions to use.  The Device Table Entry points
+ * at a system physical address.
+ *
+ * However, these helpers deliberately use untyped parameters without
+ * reference to gfn/mfn because they are used both for programming the real
+ * IOMMU, and interpreting a guests programming of its vIOMMU.
+ */
+static uint64_t dte_get_gcr3_table(const struct amd_iommu_dte *dte)
 {
     return (((uint64_t)dte->gcr3_trp_51_31 << 31) |
             (dte->gcr3_trp_30_15 << 15) |
-            (dte->gcr3_trp_14_12 << 12)) >> PAGE_SHIFT;
+            (dte->gcr3_trp_14_12 << 12));
+}
+
+static void dte_set_gcr3_table(struct amd_iommu_dte *dte, uint16_t dom_id,
+                               uint64_t addr, bool gv, uint8_t glx)
+{
+#define GCR3_MASK(hi, lo) (((1ul << ((hi) + 1)) - 1) & ~((1ul << (lo)) - 1))
+
+    /* I bit must be set when gcr3 is enabled */
+    dte->i = true;
+
+    dte->gcr3_trp_14_12 = MASK_EXTR(addr, GCR3_MASK(14, 12));
+    dte->gcr3_trp_30_15 = MASK_EXTR(addr, GCR3_MASK(30, 15));
+    dte->gcr3_trp_51_31 = MASK_EXTR(addr, GCR3_MASK(51, 31));
+
+    dte->domain_id = dom_id;
+    dte->glx = glx;
+    dte->gv = gv;
+
+#undef GCR3_MASK
 }
 
 static unsigned int host_domid(struct domain *d, uint64_t g_domid)
@@ -389,7 +417,7 @@ static int do_invalidate_dte(struct domain *d, cmd_entry_t *cmd)
     gdte = &dte_base[gbdf % (PAGE_SIZE / sizeof(struct amd_iommu_dte))];
 
     gdom_id = gdte->domain_id;
-    gcr3_gfn = get_guest_cr3_from_dte(gdte);
+    gcr3_gfn = dte_get_gcr3_table(gdte) >> PAGE_SHIFT;
     glx = gdte->glx;
     gv = gdte->gv;
 
@@ -419,7 +447,7 @@ static int do_invalidate_dte(struct domain *d, cmd_entry_t *cmd)
     mdte = &dte_base[req_id];
 
     spin_lock_irqsave(&iommu->lock, flags);
-    iommu_dte_set_guest_cr3(mdte, hdom_id, gcr3_mfn, gv, glx);
+    dte_set_gcr3_table(mdte, hdom_id, gcr3_mfn << PAGE_SHIFT, gv, glx);
 
     amd_iommu_flush_device(iommu, req_id);
     spin_unlock_irqrestore(&iommu->lock, flags);
diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c
index f773ab33fd..d3a8b1aec7 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -173,27 +173,6 @@ void __init iommu_dte_add_device_entry(struct amd_iommu_dte *dte,
     };
 }
 
-void iommu_dte_set_guest_cr3(struct amd_iommu_dte *dte, uint16_t dom_id,
-                             uint64_t gcr3_mfn, bool gv, uint8_t glx)
-{
-#define GCR3_MASK(hi, lo) (((1ul << ((hi) + 1)) - 1) & ~((1ul << (lo)) - 1))
-#define GCR3_SHIFT(lo) ((lo) - PAGE_SHIFT)
-
-    /* I bit must be set when gcr3 is enabled */
-    dte->i = true;
-
-    dte->gcr3_trp_14_12 = (gcr3_mfn & GCR3_MASK(14, 12)) >> GCR3_SHIFT(12);
-    dte->gcr3_trp_30_15 = (gcr3_mfn & GCR3_MASK(30, 15)) >> GCR3_SHIFT(15);
-    dte->gcr3_trp_51_31 = (gcr3_mfn & GCR3_MASK(51, 31)) >> GCR3_SHIFT(31);
-
-    dte->domain_id = dom_id;
-    dte->glx = glx;
-    dte->gv = gv;
-
-#undef GCR3_SHIFT
-#undef GCR3_MASK
-}
-
 /* Walk io page tables and build level page tables if necessary
  * {Re, un}mapping super page frames causes re-allocation of io
  * page tables.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Nov 21 07:00:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Nov 2020 07:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.32768.63886 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMsN-0002qX-A5; Sat, 21 Nov 2020 07:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 32768.63886; Sat, 21 Nov 2020 07:00:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMsN-0002qN-5R; Sat, 21 Nov 2020 07:00:03 +0000
Received: by outflank-mailman (input) for mailman id 32768;
 Sat, 21 Nov 2020 07:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMsM-0002kU-8i
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMsM-0001O6-6B
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMsM-0006ET-4W
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsM-0002kU-8i
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=enPmTgTGWtxmF/PGNgJKF+ipd7JcWHU3PBGa0AoFgTQ=; b=fl6MUOGosnKIQi/dzYSwse/BX0
	50IkyPTFMoKOip9boAVZR19b4najotRDMzxZJ9MZvhNsqeHFH/ih5eIYyPtrPdv5O0j15HCOGhsbD
	r5RDkBbeDkYd0GV7mOkpRvYGlWhMvmKAf4nLapN466Tu7AqKjZ5p/sQ8qsDWm5Y7MHUA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsM-0001O6-6B
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsM-0006ET-4W
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: gic: acpi: Guard helpers to build the MADT with CONFIG_ACPI
Message-Id: <E1kgMsM-0006ET-4W@xenbits.xenproject.org>
Date: Sat, 21 Nov 2020 07:00:02 +0000

commit 1965c171a4a791bbed1cf84c097177117bb02dac
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Nov 19 17:08:27 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 19 16:23:08 2020 -0800

    xen/arm: gic: acpi: Guard helpers to build the MADT with CONFIG_ACPI
    
    gic_make_hwdom_madt() and gic_get_hwdom_madt_size() are ACPI specific.
    
    While they build fine today, this will change in a follow-up patch.
    Rather than trying to fix the build on ACPI, it is best to avoid
    compiling the helpers and the associated callbacks when CONFIG_ACPI=n.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/gic-v2.c     |  8 +++-----
 xen/arch/arm/gic-v3.c     | 11 ++---------
 xen/arch/arm/gic.c        |  2 ++
 xen/include/asm-arm/gic.h | 10 ++++++++--
 4 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 0f747538db..581ea5ba6b 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1114,12 +1114,12 @@ static int gicv2_iomem_deny_access(const struct domain *d)
     return iomem_deny_access(d, mfn, mfn + nr);
 }
 
+#ifdef CONFIG_ACPI
 static unsigned long gicv2_get_hwdom_extra_madt_size(const struct domain *d)
 {
     return 0;
 }
 
-#ifdef CONFIG_ACPI
 static int gicv2_make_hwdom_madt(const struct domain *d, u32 offset)
 {
     struct acpi_subtable_header *header;
@@ -1248,10 +1248,6 @@ static void __init gicv2_acpi_init(void)
 }
 #else
 static void __init gicv2_acpi_init(void) { }
-static int gicv2_make_hwdom_madt(const struct domain *d, u32 offset)
-{
-    return 0;
-}
 #endif
 
 static int __init gicv2_init(void)
@@ -1357,8 +1353,10 @@ const static struct gic_hw_operations gicv2_ops = {
     .read_apr            = gicv2_read_apr,
     .read_pending_state  = gicv2_read_pending_state,
     .make_hwdom_dt_node  = gicv2_make_hwdom_dt_node,
+#ifdef CONFIG_ACPI
     .make_hwdom_madt     = gicv2_make_hwdom_madt,
     .get_hwdom_extra_madt_size = gicv2_get_hwdom_extra_madt_size,
+#endif
     .map_hwdom_extra_mappings = gicv2_map_hwdown_extra_mappings,
     .iomem_deny_access   = gicv2_iomem_deny_access,
     .do_LPI              = gicv2_do_LPI,
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 0f6cbf6224..2a344393a0 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1735,15 +1735,6 @@ static void __init gicv3_acpi_init(void)
 }
 #else
 static void __init gicv3_acpi_init(void) { }
-static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
-{
-    return 0;
-}
-
-static unsigned long gicv3_get_hwdom_extra_madt_size(const struct domain *d)
-{
-    return 0;
-}
 #endif
 
 static bool gic_dist_supports_lpis(void)
@@ -1858,8 +1849,10 @@ static const struct gic_hw_operations gicv3_ops = {
     .read_pending_state  = gicv3_read_pending_state,
     .secondary_init      = gicv3_secondary_cpu_init,
     .make_hwdom_dt_node  = gicv3_make_hwdom_dt_node,
+#ifdef CONFIG_ACPI
     .make_hwdom_madt     = gicv3_make_hwdom_madt,
     .get_hwdom_extra_madt_size = gicv3_get_hwdom_extra_madt_size,
+#endif
     .iomem_deny_access   = gicv3_iomem_deny_access,
     .do_LPI              = gicv3_do_LPI,
 };
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index d623c57cb9..fe60619e99 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -443,6 +443,7 @@ int gic_make_hwdom_dt_node(const struct domain *d,
     return gic_hw_ops->make_hwdom_dt_node(d, gic, fdt);
 }
 
+#ifdef CONFIG_ACPI
 int gic_make_hwdom_madt(const struct domain *d, u32 offset)
 {
     return gic_hw_ops->make_hwdom_madt(d, offset);
@@ -459,6 +460,7 @@ unsigned long gic_get_hwdom_madt_size(const struct domain *d)
 
     return madt_size;
 }
+#endif
 
 int gic_iomem_deny_access(const struct domain *d)
 {
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index ba870523bb..ad0f7452d0 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -378,12 +378,14 @@ struct gic_hw_operations {
     /* Create GIC node for the hardware domain */
     int (*make_hwdom_dt_node)(const struct domain *d,
                               const struct dt_device_node *gic, void *fdt);
+#ifdef CONFIG_ACPI
     /* Create MADT table for the hardware domain */
     int (*make_hwdom_madt)(const struct domain *d, u32 offset);
-    /* Map extra GIC MMIO, irqs and other hw stuffs to the hardware domain. */
-    int (*map_hwdom_extra_mappings)(struct domain *d);
     /* Query the size of hardware domain madt table */
     unsigned long (*get_hwdom_extra_madt_size)(const struct domain *d);
+#endif
+    /* Map extra GIC MMIO, irqs and other hw stuffs to the hardware domain. */
+    int (*map_hwdom_extra_mappings)(struct domain *d);
     /* Deny access to GIC regions */
     int (*iomem_deny_access)(const struct domain *d);
     /* Handle LPIs, which require special handling */
@@ -435,8 +437,12 @@ void register_gic_ops(const struct gic_hw_operations *ops);
 int gic_make_hwdom_dt_node(const struct domain *d,
                            const struct dt_device_node *gic,
                            void *fdt);
+
+#ifdef CONFIG_ACPI
 int gic_make_hwdom_madt(const struct domain *d, u32 offset);
 unsigned long gic_get_hwdom_madt_size(const struct domain *d);
+#endif
+
 int gic_map_hwdom_extra_mappings(struct domain *d);
 int gic_iomem_deny_access(const struct domain *d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 21 07:00:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Nov 2020 07:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.32769.63889 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMsX-0003JZ-AA; Sat, 21 Nov 2020 07:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 32769.63889; Sat, 21 Nov 2020 07:00:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMsX-0003JQ-75; Sat, 21 Nov 2020 07:00:13 +0000
Received: by outflank-mailman (input) for mailman id 32769;
 Sat, 21 Nov 2020 07:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMsW-0003JK-CW
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMsW-0001O9-Ap
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMsW-0006GN-92
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsW-0003JK-CW
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:12 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GZsthhXStQf+OKrI5dRi3zW6fwE/cQzo4Xj2FzaRTMo=; b=RUjo8f7uWxSe4ZTJzLmI15c9n/
	4jVJ/zq7wCo8zp0IV1CjXXp+s2ZHaLYDnWpp4oudmncsxPaCjjRlufKwtmCHIdNYlFn2oLQru2nY0
	CNXgFJJddl1Z7giOp9biOkYsrpJVr5O5NTO9KYWMyvrq9gaDjBQDPJYZrRQhMssKZRQg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsW-0001O9-Ap
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsW-0006GN-92
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: gic: acpi: Use the correct length for the GICC structure
Message-Id: <E1kgMsW-0006GN-92@xenbits.xenproject.org>
Date: Sat, 21 Nov 2020 07:00:12 +0000

commit 9a3c25b6562416dfb3708b0e61a4e4761db06e4f
Author:     Julien Grall <julien.grall@arm.com>
AuthorDate: Thu Nov 19 17:08:28 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 19 16:25:02 2020 -0800

    xen/arm: gic: acpi: Use the correct length for the GICC structure
    
    The length of the GICC structure in the MADT ACPI table differs between
    version 5.1 and 6.0, although there are no other relevant differences.
    
    Use the BAD_MADT_GICC_ENTRY macro, which was specifically designed to
    overcome this issue.
    
    Signed-off-by: Julien Grall <julien.grall@arm.com>
    Signed-off-by: Andre Przywara <andre.przywara@arm.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/acpi/boot.c | 2 +-
 xen/arch/arm/gic-v2.c    | 5 +++--
 xen/arch/arm/gic-v3.c    | 6 +++---
 xen/arch/arm/gic.c       | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
index 30e4bd1bc5..55c3e5cbc8 100644
--- a/xen/arch/arm/acpi/boot.c
+++ b/xen/arch/arm/acpi/boot.c
@@ -131,7 +131,7 @@ acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header,
     struct acpi_madt_generic_interrupt *processor =
                container_of(header, struct acpi_madt_generic_interrupt, header);
 
-    if ( BAD_MADT_ENTRY(processor, end) )
+    if ( BAD_MADT_GICC_ENTRY(processor, end) )
         return -EINVAL;
 
     acpi_table_print_madt_entry(header);
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 581ea5ba6b..b2adc8ec9a 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1136,7 +1136,8 @@ static int gicv2_make_hwdom_madt(const struct domain *d, u32 offset)
 
     host_gicc = container_of(header, struct acpi_madt_generic_interrupt,
                              header);
-    size = sizeof(struct acpi_madt_generic_interrupt);
+
+    size = ACPI_MADT_GICC_LENGTH;
     /* Add Generic Interrupt */
     for ( i = 0; i < d->max_vcpus; i++ )
     {
@@ -1165,7 +1166,7 @@ gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header,
     struct acpi_madt_generic_interrupt *processor =
                container_of(header, struct acpi_madt_generic_interrupt, header);
 
-    if ( BAD_MADT_ENTRY(processor, end) )
+    if ( BAD_MADT_GICC_ENTRY(processor, end) )
         return -EINVAL;
 
     /* Read from APIC table and fill up the GIC variables */
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 2a344393a0..ac28013c19 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1499,7 +1499,7 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
 
     host_gicc = container_of(header, struct acpi_madt_generic_interrupt,
                              header);
-    size = sizeof(struct acpi_madt_generic_interrupt);
+    size = ACPI_MADT_GICC_LENGTH;
     for ( i = 0; i < d->max_vcpus; i++ )
     {
         gicc = (struct acpi_madt_generic_interrupt *)(base_ptr + table_len);
@@ -1558,7 +1558,7 @@ gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header,
     struct acpi_madt_generic_interrupt *processor =
                container_of(header, struct acpi_madt_generic_interrupt, header);
 
-    if ( BAD_MADT_ENTRY(processor, end) )
+    if ( BAD_MADT_GICC_ENTRY(processor, end) )
         return -EINVAL;
 
     /* Read from APIC table and fill up the GIC variables */
@@ -1628,7 +1628,7 @@ gic_acpi_get_madt_cpu_num(struct acpi_subtable_header *header,
     struct acpi_madt_generic_interrupt *cpuif;
 
     cpuif = (struct acpi_madt_generic_interrupt *)header;
-    if ( BAD_MADT_ENTRY(cpuif, end) || !cpuif->gicr_base_address )
+    if ( BAD_MADT_GICC_ENTRY(cpuif, end) || !cpuif->gicr_base_address )
         return -EINVAL;
 
     return 0;
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index fe60619e99..3b0331b538 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -454,7 +454,7 @@ unsigned long gic_get_hwdom_madt_size(const struct domain *d)
     unsigned long madt_size;
 
     madt_size = sizeof(struct acpi_table_madt)
-                + sizeof(struct acpi_madt_generic_interrupt) * d->max_vcpus
+                + ACPI_MADT_GICC_LENGTH * d->max_vcpus
                 + sizeof(struct acpi_madt_generic_distributor)
                 + gic_hw_ops->get_hwdom_extra_madt_size(d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 21 07:00:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Nov 2020 07:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.32770.63893 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMsh-0003Km-Bu; Sat, 21 Nov 2020 07:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 32770.63893; Sat, 21 Nov 2020 07:00:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMsh-0003Kg-8a; Sat, 21 Nov 2020 07:00:23 +0000
Received: by outflank-mailman (input) for mailman id 32770;
 Sat, 21 Nov 2020 07: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 1kgMsg-0003KY-Gs
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMsg-0001OK-FC
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMsg-0006H5-DD
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMsg-0003KY-Gs
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:22 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i5U8SDZTAXZT+l4miySgq7EmZ2/WppYCAZL1vdZQjy8=; b=RYPTEuJ9aOSheb9bqW6CLRLt5C
	VSxjsaoHBe5erxyfKE3f/k/4WYgXczOfM82XaJbP8qDc/r2t+mFt2Fd+kX42Ad6xkAnRlXI76/Oez
	7yy0BagMfTJF5Viu1jWPHdlWfU2/ZitUzVP1BMZmK9Bj1vXbUXLWU90LNcm0H0nkAVVM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsg-0001OK-FC
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsg-0006H5-DD
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: acpi: Allow Xen to boot with ACPI 5.1
Message-Id: <E1kgMsg-0006H5-DD@xenbits.xenproject.org>
Date: Sat, 21 Nov 2020 07:00:22 +0000

commit 0ff2c7e5b4ff9b3066d6cbba9adf95b948b418c9
Author:     Julien Grall <julien.grall@arm.com>
AuthorDate: Thu Nov 19 17:08:29 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Nov 19 16:25:28 2020 -0800

    xen/arm: acpi: Allow Xen to boot with ACPI 5.1
    
    At the moment Xen requires the FADT ACPI table to be at least version
    6.0, apparently because of some reliance on other ACPI v6.0 features.
    
    But actually this is overzealous, and Xen works now fine with ACPI v5.1.
    
    Let's relax the version check for the FADT table to allow QEMU to
    run the hypervisor with ACPI.
    
    Signed-off-by: Julien Grall <julien.grall@arm.com>
    Signed-off-by: Andre Przywara <andre.przywara@arm.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/acpi/boot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/acpi/boot.c b/xen/arch/arm/acpi/boot.c
index 55c3e5cbc8..7ea2990cb8 100644
--- a/xen/arch/arm/acpi/boot.c
+++ b/xen/arch/arm/acpi/boot.c
@@ -181,8 +181,8 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
      * we only deal with ACPI 6.0 or newer revision to get GIC and SMP
      * boot protocol configuration data, or we will disable ACPI.
      */
-    if ( table->revision > 6
-         || (table->revision == 6 && fadt->minor_revision >= 0) )
+    if ( table->revision > 5
+         || (table->revision == 5 && fadt->minor_revision >= 1) )
         return 0;
 
     printk("Unsupported FADT revision %d.%d, should be 6.0+, will disable ACPI\n",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 21 07:00:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Nov 2020 07:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.32772.63897 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMss-0003MZ-DK; Sat, 21 Nov 2020 07:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 32772.63897; Sat, 21 Nov 2020 07:00:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMss-0003MR-AE; Sat, 21 Nov 2020 07:00:34 +0000
Received: by outflank-mailman (input) for mailman id 32772;
 Sat, 21 Nov 2020 07: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 1kgMsq-0003MI-LX
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMsq-0001OW-Jq
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMsq-0006Hl-Hv
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMsq-0003MI-LX
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:32 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QFtlYZOYVY13XCbHnWs8bjhiWBSV9nb9DrXwfTNFxAE=; b=G8dZnfmaRIvk5nSq5e28D3xPZr
	njD9X9XQ8nYv/rws6pMT1jE7YDdBIMKQw9YmBltkLlf7nP6Pg4PBXciyrlWd+SfIFaDVVPoORaaVk
	1hmkXDYGxD9HFsf7fBQn2otkwpy6OqwyokF2KrHrmkzAbblfecpJsepRLPqp/YWiuYoY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsq-0001OW-Jq
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMsq-0006Hl-Hv
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: split _ctype[] into its own object, under lib/
Message-Id: <E1kgMsq-0006Hl-Hv@xenbits.xenproject.org>
Date: Sat, 21 Nov 2020 07:00:32 +0000

commit 318a9175d5b145ab5b6a1f26b8312a88f9fb4d94
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 20 08:25:17 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 20 08:25:17 2020 +0100

    lib: split _ctype[] into its own object, under lib/
    
    This is, besides for tidying, in preparation of then starting to use an
    archive rather than an object file for generic library code which
    arch-es (or even specific configurations within a single arch) may or
    may not need.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/Makefile     |  3 ++-
 xen/Rules.mk     |  2 +-
 xen/common/lib.c | 29 -----------------------------
 xen/lib/Makefile |  1 +
 xen/lib/ctype.c  | 38 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index bf0c804d43..73bdc326c5 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -331,6 +331,7 @@ _clean: delete-unfresh-files
 	$(MAKE) $(clean) include
 	$(MAKE) $(clean) common
 	$(MAKE) $(clean) drivers
+	$(MAKE) $(clean) lib
 	$(MAKE) $(clean) xsm
 	$(MAKE) $(clean) crypto
 	$(MAKE) $(clean) arch/arm
@@ -414,7 +415,7 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s
 	  echo ""; \
 	  echo "#endif") <$< >$@
 
-SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers test
+SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
     ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
       find include -name 'asm-*' -prune -o -name '*.h' -print; \
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 891c94e6ad..333e19bec3 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -36,7 +36,7 @@ TARGET := $(BASEDIR)/xen
 # Note that link order matters!
 ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
-ALL_OBJS-$(CONFIG_X86)   += $(BASEDIR)/lib/built_in.o
+ALL_OBJS-y               += $(BASEDIR)/lib/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/xsm/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
 ALL_OBJS-$(CONFIG_CRYPTO)   += $(BASEDIR)/crypto/built_in.o
diff --git a/xen/common/lib.c b/xen/common/lib.c
index b2b799da44..a224efa8f6 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -1,37 +1,8 @@
-
-#include <xen/ctype.h>
 #include <xen/lib.h>
 #include <xen/types.h>
 #include <xen/init.h>
 #include <asm/byteorder.h>
 
-/* for ctype.h */
-const unsigned char _ctype[] = {
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
-    _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
-    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
-    _S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
-    _P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
-    _D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
-    _D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
-    _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
-    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
-    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
-    _U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
-    _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
-    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
-    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
-    _L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
-    _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
-    _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
-    _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
-    _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
-    _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
-    _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
-
 /*
  * A couple of 64 bit operations ported from FreeBSD.
  * The code within the '#if BITS_PER_LONG == 32' block below, and no other
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 7019ca00e8..53b1da025e 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -1 +1,2 @@
+obj-y += ctype.o
 obj-$(CONFIG_X86) += x86/
diff --git a/xen/lib/ctype.c b/xen/lib/ctype.c
new file mode 100644
index 0000000000..7b233a335f
--- /dev/null
+++ b/xen/lib/ctype.c
@@ -0,0 +1,38 @@
+#include <xen/ctype.h>
+
+/* for ctype.h */
+const unsigned char _ctype[] = {
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
+    _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 16-23 */
+    _C,_C,_C,_C,_C,_C,_C,_C,                        /* 24-31 */
+    _S|_SP,_P,_P,_P,_P,_P,_P,_P,                    /* 32-39 */
+    _P,_P,_P,_P,_P,_P,_P,_P,                        /* 40-47 */
+    _D,_D,_D,_D,_D,_D,_D,_D,                        /* 48-55 */
+    _D,_D,_P,_P,_P,_P,_P,_P,                        /* 56-63 */
+    _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,      /* 64-71 */
+    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 72-79 */
+    _U,_U,_U,_U,_U,_U,_U,_U,                        /* 80-87 */
+    _U,_U,_U,_P,_P,_P,_P,_P,                        /* 88-95 */
+    _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,      /* 96-103 */
+    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 104-111 */
+    _L,_L,_L,_L,_L,_L,_L,_L,                        /* 112-119 */
+    _L,_L,_L,_P,_P,_P,_P,_C,                        /* 120-127 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 128-143 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 144-159 */
+    _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
+    _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
+    _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
+    _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
+    _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
+    _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 21 07:00:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Nov 2020 07:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.32773.63900 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMt2-0003OC-GS; Sat, 21 Nov 2020 07:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 32773.63900; Sat, 21 Nov 2020 07:00:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMt2-0003O4-DW; Sat, 21 Nov 2020 07:00:44 +0000
Received: by outflank-mailman (input) for mailman id 32773;
 Sat, 21 Nov 2020 07: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 1kgMt0-0003Nm-OK
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMt0-0001P9-NS
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMt0-0006IS-MU
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMt0-0003Nm-OK
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:42 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0QQ1D3CEVjnoavUqdHDW+BqkcqOocqSN0UzfJGhPc+k=; b=WGhI3kiQ0YvuLePooZSI8hgHST
	8CZmYTdycQtrmTcuFa4YNPn1AYzQ4IqFnb5wPsIqL9mA/o7ni1vHvUQokkvW8F97nUFTJhgF9e24V
	qWc+yesZmoQIONvk6E1qx0VvjE71EXAD6n1S/XOxyvVyPG1TYA42nQBYRWltGPAOcjso=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMt0-0001P9-NS
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMt0-0006IS-MU
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/nmi: avoid UB for P4-era watchdogs
Message-Id: <E1kgMt0-0006IS-MU@xenbits.xenproject.org>
Date: Sat, 21 Nov 2020 07:00:42 +0000

commit bebb49125fd305ae7814d7d4fcc05a85cc2a21e0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 20 08:28:11 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 20 08:28:11 2020 +0100

    x86/nmi: avoid UB for P4-era watchdogs
    
    Found by looking for patterns similar to the one Julien did spot in
    pci_vtd_quirks().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/nmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 014524486f..ab94a96c4d 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -132,7 +132,7 @@ int nmi_active;
 #define P4_ESCR_EVENT_SELECT(N)	((N)<<25)
 #define P4_CCCR_OVF_PMI0	(1<<26)
 #define P4_CCCR_OVF_PMI1	(1<<27)
-#define P4_CCCR_OVF		(1<<31)
+#define P4_CCCR_OVF		(1u << 31)
 #define P4_CCCR_THRESHOLD(N)	((N)<<20)
 #define P4_CCCR_COMPLEMENT	(1<<19)
 #define P4_CCCR_COMPARE		(1<<18)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 21 07:00:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Nov 2020 07:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.32774.63905 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMtC-0003Ps-I2; Sat, 21 Nov 2020 07:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 32774.63905; Sat, 21 Nov 2020 07:00:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMtC-0003Pk-F7; Sat, 21 Nov 2020 07:00:54 +0000
Received: by outflank-mailman (input) for mailman id 32774;
 Sat, 21 Nov 2020 07: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 1kgMtA-0003PY-S2
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMtA-0001PJ-RD
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMtA-0006JD-QD
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMtA-0003PY-S2
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:52 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qNYNb9QvQxP77OZVEiuZdxcMYroKlxS7gr+k7DRFg7g=; b=DyJzLm87FbRvxJohBYuCpcJ0Oq
	sI7KSnqxSYijwD8zJJjXX4i1B9rUCzv66rdIe/V/dGtzW7UG8NTr1wIYPPa1G09AoR4tYZeKl/rRg
	qDA3FgDw5NTank7uS9PkL8me6+zjJ3R77P5DFdQlYtY/HK/2Gf7rjSDXvJY0ED/KmUbw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMtA-0001PJ-RD
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMtA-0006JD-QD
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:00:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SVM: avoid UB in intercept mask definitions
Message-Id: <E1kgMtA-0006JD-QD@xenbits.xenproject.org>
Date: Sat, 21 Nov 2020 07:00:52 +0000

commit dee7d981b99435b6c37126821af7826bd9a9d36c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 20 08:28:27 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 20 08:28:27 2020 +0100

    SVM: avoid UB in intercept mask definitions
    
    Found by looking for patterns similar to the one Julien did spot in
    pci_vtd_quirks().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-x86/hvm/svm/vmcb.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h
index c4fda389b3..0b03a8f076 100644
--- a/xen/include/asm-x86/hvm/svm/vmcb.h
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -55,7 +55,7 @@ enum GenericIntercept1bits
     GENERAL1_INTERCEPT_MSR_PROT      = 1 << 28,
     GENERAL1_INTERCEPT_TASK_SWITCH   = 1 << 29,
     GENERAL1_INTERCEPT_FERR_FREEZE   = 1 << 30,
-    GENERAL1_INTERCEPT_SHUTDOWN_EVT  = 1 << 31
+    GENERAL1_INTERCEPT_SHUTDOWN_EVT  = 1u << 31
 };
 
 /* general 2 intercepts */
@@ -112,7 +112,7 @@ enum CRInterceptBits
     CR_INTERCEPT_CR12_WRITE = 1 << 28,
     CR_INTERCEPT_CR13_WRITE = 1 << 29,
     CR_INTERCEPT_CR14_WRITE = 1 << 30,
-    CR_INTERCEPT_CR15_WRITE = 1 << 31,
+    CR_INTERCEPT_CR15_WRITE = 1u << 31,
 };
 
 
@@ -150,7 +150,7 @@ enum DRInterceptBits
     DR_INTERCEPT_DR12_WRITE = 1 << 28,
     DR_INTERCEPT_DR13_WRITE = 1 << 29,
     DR_INTERCEPT_DR14_WRITE = 1 << 30,
-    DR_INTERCEPT_DR15_WRITE = 1 << 31,
+    DR_INTERCEPT_DR15_WRITE = 1u << 31,
 };
 
 enum VMEXIT_EXITCODE
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 21 07:01:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Nov 2020 07:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.32775.63909 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMtM-0003Sy-Jb; Sat, 21 Nov 2020 07:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 32775.63909; Sat, 21 Nov 2020 07:01:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgMtM-0003Sq-Gg; Sat, 21 Nov 2020 07:01:04 +0000
Received: by outflank-mailman (input) for mailman id 32775;
 Sat, 21 Nov 2020 07:01: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 1kgMtK-0003Sh-Vl
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMtK-0001Pf-Uw
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgMtK-0006KN-Tn
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07: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 1kgMtK-0003Sh-Vl
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:01:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aEFkKG/8ETfFW87RXqo4bmVXUvjpgKfarhGyzpq8N7Y=; b=LFKIml1CT64os2yFHAUvW42Cwd
	vrX8pUIw5UPgH3qrUBrvZkDG0W1/XA0cqNRixb0ExtNHWNOAxPiTYIM88T4lL4KHUyAatqVB58AhQ
	e/cg4XX2oWVCURWqLGt9O+C2xEeZrpAK8s2UdeJ8yjQcMK0pDcEDaCeP1JiLZMDTx1IU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMtK-0001Pf-Uw
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgMtK-0006KN-Tn
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 07:01:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] AMD/IOMMU: avoid UB in guest CR3 retrieval
Message-Id: <E1kgMtK-0006KN-Tn@xenbits.xenproject.org>
Date: Sat, 21 Nov 2020 07:01:02 +0000

commit 846d22d54f24f336fb80d052338e0cd030d54fee
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 20 08:28:58 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 20 08:28:58 2020 +0100

    AMD/IOMMU: avoid UB in guest CR3 retrieval
    
    Found by looking for patterns similar to the one Julien did spot in
    pci_vtd_quirks(). (Not that it matters much here, considering the code
    is dead right now.)
    
    Fixes: 3a7947b69011 ("amd-iommu: use a bitfield for DTE")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/passthrough/amd/iommu_guest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
index 30b7353cd6..2a3def9a5d 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -70,7 +70,8 @@ static void guest_iommu_disable(struct guest_iommu *iommu)
 
 static uint64_t get_guest_cr3_from_dte(struct amd_iommu_dte *dte)
 {
-    return ((dte->gcr3_trp_51_31 << 31) | (dte->gcr3_trp_30_15 << 15) |
+    return (((uint64_t)dte->gcr3_trp_51_31 << 31) |
+            (dte->gcr3_trp_30_15 << 15) |
             (dte->gcr3_trp_14_12 << 12)) >> PAGE_SHIFT;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 21 17:33:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Nov 2020 17:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.33040.64139 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgWkw-0006Tv-Jv; Sat, 21 Nov 2020 17:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 33040.64139; Sat, 21 Nov 2020 17: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kgWkw-0006Tn-H0; Sat, 21 Nov 2020 17:33:02 +0000
Received: by outflank-mailman (input) for mailman id 33040;
 Sat, 21 Nov 2020 17: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 1kgWkv-0006Ti-UO
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 17: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 1kgWkv-0000PM-Sy
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 17:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kgWkv-0005OP-Ra
 for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 17: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 1kgWkv-0006Ti-UO
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 17:33:01 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sbyUwPGvifv4t+2ipTt7DBd2KX4i9Stgi3PE12hH2X8=; b=aiSsFd8NcyZZbRsNxftmW71Dl0
	t/uQm5U0zSN9nK8Hl2v3uUAk1r+fTwGxYFOP6Ux7/16vvHDuiyEv1jckG9BNoElW7lBNKwm83uCAH
	tAUgjBq7MqpKGyqebeSNL7ipAkipuaGgVZqMbuJ80hUsTo7j1l/SnbpyqJ1fj3JRfoLY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgWkv-0000PM-Sy
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 17:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kgWkv-0005OP-Ra
	for xen-changelog@lists.xenproject.org; Sat, 21 Nov 2020 17:33:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] amd-iommu: Fix Guest CR3 Table following c/s 3a7947b6901
Message-Id: <E1kgWkv-0005OP-Ra@xenbits.xenproject.org>
Date: Sat, 21 Nov 2020 17:33:01 +0000

commit b659a5cebd611dbe698e63c03485b5fe8cd964ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 3 17:53:15 2019 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Nov 20 19:25:58 2020 +0000

    amd-iommu: Fix Guest CR3 Table following c/s 3a7947b6901
    
    "amd-iommu: use a bitfield for DTE" renamed iommu_dte_set_guest_cr3()'s gcr3
    parameter to gcr3_mfn but ended up with an off-by-PAGE_SIZE error when
    extracting bits from the address.
    
    get_guest_cr3_from_dte() and iommu_dte_set_guest_cr3() are (almost) getters
    and setters for the same field, so should live together.
    
    Rename them to dte_{get,set}_gcr3_table() to specifically avoid 'guest_cr3' in
    the name.  This field actually points to a table in memory containing an array
    of guest CR3 values.  As these functions are used for different logical
    indirections, they shouldn't use gfn/mfn terminology for their parameters.
    Switch them to use straight uint64_t full addresses.
    
    Fixes: 3a7947b6901 ("amd-iommu: use a bitfield for DTE")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu.h       |  2 --
 xen/drivers/passthrough/amd/iommu_guest.c | 36 +++++++++++++++++++++++++++----
 xen/drivers/passthrough/amd/iommu_map.c   | 21 ------------------
 3 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index 28a44ceb85..ad089cb095 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -246,8 +246,6 @@ void amd_iommu_set_root_page_table(struct amd_iommu_dte *dte,
 				   uint8_t paging_mode, bool valid);
 void iommu_dte_add_device_entry(struct amd_iommu_dte *dte,
                                 const struct ivrs_mappings *ivrs_dev);
-void iommu_dte_set_guest_cr3(struct amd_iommu_dte *dte, uint16_t dom_id,
-                             uint64_t gcr3_mfn, bool gv, uint8_t glx);
 
 /* send cmd to iommu */
 void amd_iommu_flush_all_pages(struct domain *d);
diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c
index 2a3def9a5d..00c5ccd7b5 100644
--- a/xen/drivers/passthrough/amd/iommu_guest.c
+++ b/xen/drivers/passthrough/amd/iommu_guest.c
@@ -68,11 +68,39 @@ static void guest_iommu_disable(struct guest_iommu *iommu)
     iommu->enabled = 0;
 }
 
-static uint64_t get_guest_cr3_from_dte(struct amd_iommu_dte *dte)
+/*
+ * The Guest CR3 Table is a table written by the guest kernel, pointing at
+ * gCR3 values for PASID transactions to use.  The Device Table Entry points
+ * at a system physical address.
+ *
+ * However, these helpers deliberately use untyped parameters without
+ * reference to gfn/mfn because they are used both for programming the real
+ * IOMMU, and interpreting a guests programming of its vIOMMU.
+ */
+static uint64_t dte_get_gcr3_table(const struct amd_iommu_dte *dte)
 {
     return (((uint64_t)dte->gcr3_trp_51_31 << 31) |
             (dte->gcr3_trp_30_15 << 15) |
-            (dte->gcr3_trp_14_12 << 12)) >> PAGE_SHIFT;
+            (dte->gcr3_trp_14_12 << 12));
+}
+
+static void dte_set_gcr3_table(struct amd_iommu_dte *dte, uint16_t dom_id,
+                               uint64_t addr, bool gv, uint8_t glx)
+{
+#define GCR3_MASK(hi, lo) (((1ul << ((hi) + 1)) - 1) & ~((1ul << (lo)) - 1))
+
+    /* I bit must be set when gcr3 is enabled */
+    dte->i = true;
+
+    dte->gcr3_trp_14_12 = MASK_EXTR(addr, GCR3_MASK(14, 12));
+    dte->gcr3_trp_30_15 = MASK_EXTR(addr, GCR3_MASK(30, 15));
+    dte->gcr3_trp_51_31 = MASK_EXTR(addr, GCR3_MASK(51, 31));
+
+    dte->domain_id = dom_id;
+    dte->glx = glx;
+    dte->gv = gv;
+
+#undef GCR3_MASK
 }
 
 static unsigned int host_domid(struct domain *d, uint64_t g_domid)
@@ -389,7 +417,7 @@ static int do_invalidate_dte(struct domain *d, cmd_entry_t *cmd)
     gdte = &dte_base[gbdf % (PAGE_SIZE / sizeof(struct amd_iommu_dte))];
 
     gdom_id = gdte->domain_id;
-    gcr3_gfn = get_guest_cr3_from_dte(gdte);
+    gcr3_gfn = dte_get_gcr3_table(gdte) >> PAGE_SHIFT;
     glx = gdte->glx;
     gv = gdte->gv;
 
@@ -419,7 +447,7 @@ static int do_invalidate_dte(struct domain *d, cmd_entry_t *cmd)
     mdte = &dte_base[req_id];
 
     spin_lock_irqsave(&iommu->lock, flags);
-    iommu_dte_set_guest_cr3(mdte, hdom_id, gcr3_mfn, gv, glx);
+    dte_set_gcr3_table(mdte, hdom_id, gcr3_mfn << PAGE_SHIFT, gv, glx);
 
     amd_iommu_flush_device(iommu, req_id);
     spin_unlock_irqrestore(&iommu->lock, flags);
diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c
index f773ab33fd..d3a8b1aec7 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -173,27 +173,6 @@ void __init iommu_dte_add_device_entry(struct amd_iommu_dte *dte,
     };
 }
 
-void iommu_dte_set_guest_cr3(struct amd_iommu_dte *dte, uint16_t dom_id,
-                             uint64_t gcr3_mfn, bool gv, uint8_t glx)
-{
-#define GCR3_MASK(hi, lo) (((1ul << ((hi) + 1)) - 1) & ~((1ul << (lo)) - 1))
-#define GCR3_SHIFT(lo) ((lo) - PAGE_SHIFT)
-
-    /* I bit must be set when gcr3 is enabled */
-    dte->i = true;
-
-    dte->gcr3_trp_14_12 = (gcr3_mfn & GCR3_MASK(14, 12)) >> GCR3_SHIFT(12);
-    dte->gcr3_trp_30_15 = (gcr3_mfn & GCR3_MASK(30, 15)) >> GCR3_SHIFT(15);
-    dte->gcr3_trp_51_31 = (gcr3_mfn & GCR3_MASK(51, 31)) >> GCR3_SHIFT(31);
-
-    dte->domain_id = dom_id;
-    dte->glx = glx;
-    dte->gv = gv;
-
-#undef GCR3_SHIFT
-#undef GCR3_MASK
-}
-
 /* Walk io page tables and build level page tables if necessary
  * {Re, un}mapping super page frames causes re-allocation of io
  * page tables.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 10:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 10:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35723.67332 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdC-0007sx-Ha; Tue, 24 Nov 2020 10:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35723.67332; Tue, 24 Nov 2020 10:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdC-0007sp-Ec; Tue, 24 Nov 2020 10:33:06 +0000
Received: by outflank-mailman (input) for mailman id 35723;
 Tue, 24 Nov 2020 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 1khVdB-0007sk-Lf
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdB-0000p5-Fp
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khVdB-0003ob-Cq
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdB-0007sk-Lf
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:05 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oOcfdNnGeOpoaVlPZTAm3jA45rV6kZg76y0dbRm7UMs=; b=ZXZywLhLNfVNowPQNl7jAvY2Cs
	DaL7LJPc/LMypjvvqHTXG4g0Ovd27wZna/ob4dX5wbvmlsMzhuMF4d90n3UxKxjEAbcYMP1bXGsJK
	wgNWKJizFp4Rc4pvV1LjmeTpH8AEn4uXxrMU4Ze5Qfs1IBFavuLvBsiscpx0SMzNj+Ag=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdB-0000p5-Fp
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdB-0003ob-Cq
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/events: access last_priority and last_vcpu_id together
Message-Id: <E1khVdB-0003ob-Cq@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 10:33:05 +0000

commit 1277cb9dc5e966f1faf665bcded02b7533e38078
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Nov 24 11:23:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:23:42 2020 +0100

    xen/events: access last_priority and last_vcpu_id together
    
    The queue for a fifo event is depending on the vcpu_id and the
    priority of the event. When sending an event it might happen the
    event needs to change queues and the old queue needs to be kept for
    keeping the links between queue elements intact. For this purpose
    the event channel contains last_priority and last_vcpu_id values
    elements for being able to identify the old queue.
    
    In order to avoid races always access last_priority and last_vcpu_id
    with a single atomic operation avoiding any inconsistencies.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/event_fifo.c | 25 +++++++++++++++++++------
 xen/include/xen/sched.h |  3 +--
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
index c6e58d2a1a..79090c04ca 100644
--- a/xen/common/event_fifo.c
+++ b/xen/common/event_fifo.c
@@ -42,6 +42,14 @@ struct evtchn_fifo_domain {
     unsigned int num_evtchns;
 };
 
+union evtchn_fifo_lastq {
+    uint32_t raw;
+    struct {
+        uint8_t last_priority;
+        uint16_t last_vcpu_id;
+    };
+};
+
 static inline event_word_t *evtchn_fifo_word_from_port(const struct domain *d,
                                                        unsigned int port)
 {
@@ -86,16 +94,18 @@ static struct evtchn_fifo_queue *lock_old_queue(const struct domain *d,
     struct vcpu *v;
     struct evtchn_fifo_queue *q, *old_q;
     unsigned int try;
+    union evtchn_fifo_lastq lastq;
 
     for ( try = 0; try < 3; try++ )
     {
-        v = d->vcpu[evtchn->last_vcpu_id];
-        old_q = &v->evtchn_fifo->queue[evtchn->last_priority];
+        lastq.raw = read_atomic(&evtchn->fifo_lastq);
+        v = d->vcpu[lastq.last_vcpu_id];
+        old_q = &v->evtchn_fifo->queue[lastq.last_priority];
 
         spin_lock_irqsave(&old_q->lock, *flags);
 
-        v = d->vcpu[evtchn->last_vcpu_id];
-        q = &v->evtchn_fifo->queue[evtchn->last_priority];
+        v = d->vcpu[lastq.last_vcpu_id];
+        q = &v->evtchn_fifo->queue[lastq.last_priority];
 
         if ( old_q == q )
             return old_q;
@@ -246,8 +256,11 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
         /* Moved to a different queue? */
         if ( old_q != q )
         {
-            evtchn->last_vcpu_id = v->vcpu_id;
-            evtchn->last_priority = q->priority;
+            union evtchn_fifo_lastq lastq = { };
+
+            lastq.last_vcpu_id = v->vcpu_id;
+            lastq.last_priority = q->priority;
+            write_atomic(&evtchn->fifo_lastq, lastq.raw);
 
             spin_unlock_irqrestore(&old_q->lock, flags);
             spin_lock_irqsave(&q->lock, flags);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 7251b3ae3e..a345cc01f8 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -117,8 +117,7 @@ struct evtchn
 #ifndef NDEBUG
     u8 old_state;      /* State when taking lock in write mode. */
 #endif
-    u8 last_priority;
-    u16 last_vcpu_id;
+    u32 fifo_lastq;    /* Data for fifo events identifying last queue. */
 #ifdef CONFIG_XSM
     union {
 #ifdef XSM_NEED_GENERIC_EVTCHN_SSID
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 10:33:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 10:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35724.67336 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdM-0007vr-JB; Tue, 24 Nov 2020 10:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35724.67336; Tue, 24 Nov 2020 10:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdM-0007vj-G9; Tue, 24 Nov 2020 10:33:16 +0000
Received: by outflank-mailman (input) for mailman id 35724;
 Tue, 24 Nov 2020 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 1khVdL-0007vd-Lk
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdL-0000pB-Kx
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khVdL-0003pR-IL
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdL-0007vd-Lk
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:15 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1UkWQarT1FwIge412uSG7YNhbJMzd4CbMyz2RJ0vg0Y=; b=ZQDLfvv2N4HPcxJJey4J1Xy9Rz
	ADKsR3OCKrkEDgH0f9nW7MSLbVvTDMfRWBCs6hbHvmH2w8qQD4qUHzYRVc6uzRuysghB8LZwoZZfn
	GJ8pyokS2eZX15H2WHrVJX6MOrBvNIUl7v9+TAdZVtDzk4jDl3mdNGZwTIhljDM6EWPM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdL-0000pB-Kx
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdL-0003pR-IL
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/DMI: fix SMBIOS pointer range check
Message-Id: <E1khVdL-0003pR-IL@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 10:33:15 +0000

commit 6befe598706218673b14710d90d00ce90763b372
Author:     Jan Beulich <JBeulich@suse.com>
AuthorDate: Tue Nov 24 11:25:29 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:25:29 2020 +0100

    x86/DMI: fix SMBIOS pointer range check
    
    Forever since its introduction this has been using an inverted relation
    operator.
    
    Fixes: 54057a28f22b ("x86: support SMBIOS v3")
    Signed-off-by: Jan Beulich <JBeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/dmi_scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index d24da1c53a..e5930d27ea 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -357,7 +357,7 @@ static int __init dmi_iterate(void (*decode)(struct dmi_header *))
 			memcpy_fromio(&smbios3, q, sizeof(smbios3));
 			if (memcmp(smbios3.anchor, "_SM3_", 5) ||
 			    smbios3.length < sizeof(smbios3) ||
-			    q < p + 0x10000 - smbios3.length ||
+			    q > p + 0x10000 - smbios3.length ||
 			    !dmi_checksum(q, smbios3.length))
 				smbios3.length = 0;
 		}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 10:33:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 10:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35725.67340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdW-0007xL-Kk; Tue, 24 Nov 2020 10:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35725.67340; Tue, 24 Nov 2020 10:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdW-0007xD-Hf; Tue, 24 Nov 2020 10:33:26 +0000
Received: by outflank-mailman (input) for mailman id 35725;
 Tue, 24 Nov 2020 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 1khVdV-0007x4-Pn
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdV-0000pP-P3
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khVdV-0003q5-Nc
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdV-0007x4-Pn
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:25 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FR8rPwwKPZyuZff7+UZcWUYd6uNY+mJqS7POoJ+UBlE=; b=NbrGOLuIGkhLrTHNsreoPWsjGb
	epo+SsNCxtPbuj+NvEIq1LrdOd2xNIiJQG0yH6aEZFpFLNn/zyClR1vHn3OncHaWlHZbdy95nXv1A
	WH43C1PKMUXy2w47NyyyiWCVL/Fq2p+nMhIzmaittrQh5XInbdtpT213ew//ZhNvjejg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdV-0000pP-P3
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdV-0003q5-Nc
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ACPI: fix mapping of FACS
Message-Id: <E1khVdV-0003q5-Nc@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 10:33:25 +0000

commit 8b6d55c1261820bb9db8d867ce9ee77397d05203
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:26:02 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:26:02 2020 +0100

    x86/ACPI: fix mapping of FACS
    
    acpi_fadt_parse_sleep_info() runs when the system is already in
    SYS_STATE_boot. Hence its direct call to __acpi_map_table() won't work
    anymore. This call should probably have been replaced long ago already,
    as the layering violation hasn't been necessary for quite some time.
    
    Fixes: 1c4aa69ca1e1 ("xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/acpi/boot.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index ed40ce56b4..cecb414681 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -422,8 +422,7 @@ acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
 	if (!facs_pa)
 		goto bad;
 
-	facs = (struct acpi_table_facs *)
-		__acpi_map_table(facs_pa, sizeof(struct acpi_table_facs));
+	facs = acpi_os_map_memory(facs_pa, sizeof(*facs));
 	if (!facs)
 		goto bad;
 
@@ -448,11 +447,16 @@ acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
 		offsetof(struct acpi_table_facs, firmware_waking_vector);
 	acpi_sinfo.vector_width = 32;
 
+	acpi_os_unmap_memory(facs, sizeof(*facs));
+
 	printk(KERN_INFO PREFIX
 	       "            wakeup_vec[%"PRIx64"], vec_size[%x]\n",
 	       acpi_sinfo.wakeup_vector, acpi_sinfo.vector_width);
 	return;
-bad:
+
+ bad:
+	if (facs)
+		acpi_os_unmap_memory(facs, sizeof(*facs));
 	memset(&acpi_sinfo, 0,
 	       offsetof(struct acpi_sleep_info, sleep_control));
 	memset(&acpi_sinfo.sleep_status + 1, 0,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 10:33:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 10:33:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35726.67344 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdg-0007yu-Me; Tue, 24 Nov 2020 10:33:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35726.67344; Tue, 24 Nov 2020 10:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdg-0007ym-JM; Tue, 24 Nov 2020 10:33:36 +0000
Received: by outflank-mailman (input) for mailman id 35726;
 Tue, 24 Nov 2020 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 1khVdf-0007yg-Tj
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdf-0000pZ-Sv
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khVdf-0003qr-RV
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdf-0007yg-Tj
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:35 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tmwRDsrxY+v0BNpzV4OzNz1BvqLkZQ51iZGDGIGKz6c=; b=0aVrhoFsxqUFbbgxN3gbV76LZd
	b92lHyEHT8WMDFQwd/afA6gdZUNpxIQhwVUED6B5l45XohnzRj4CNkEOlW8wgVMQPsUZTKmMBweFF
	nwQ5FM9c1nc1YbLbqAd/ZZt5dXuaF/vQd0ekDhezfXGvgJK20ll1ml4v6q9ZQaZAAiaI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdf-0000pZ-Sv
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdf-0003qr-RV
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/DMI: fix table mapping when one lives above 1Mb
Message-Id: <E1khVdf-0003qr-RV@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 10:33:35 +0000

commit f390941a92f102ebbbbce1b54be206a602187fd7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:26:34 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:26:34 2020 +0100

    x86/DMI: fix table mapping when one lives above 1Mb
    
    Use of __acpi_map_table() is kind of an abuse here, and doesn't work
    anymore for the majority of cases if any of the tables lives outside the
    low first Mb. Keep this (ab)use only prior to reaching SYS_STATE_boot,
    primarily to avoid needing to audit whether any of the calls here can
    happen this early in the first place; quite likely this isn't necessary
    at all - at least dmi_scan_machine() gets called late enough.
    
    For the "normal" case, call __vmap() directly, despite effectively
    duplicating acpi_os_map_memory(). There's one difference though: We
    shouldn't need to establish UC- mappings, WP or r/o WB mappings ought to
    be fine, as the tables are going to live in either RAM or ROM. Short of
    having PAGE_HYPERVISOR_WP and wanting to map the tables r/o anyway, use
    the latter of the two options. The r/o mapping implies some
    constification of code elsewhere in the file. For code touched anyway
    also switch to void (where possible) or uint8_t.
    
    Fixes: 1c4aa69ca1e1 ("xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/dmi_scan.c | 53 ++++++++++++++++++++++++++++++++++---------------
 1 file changed, 37 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index e5930d27ea..d27cd3450a 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -12,8 +12,6 @@
 #include <xen/pci.h>
 #include <xen/pci_regs.h>
 
-#define bt_ioremap(b,l)  ((void *)__acpi_map_table(b,l))
-#define bt_iounmap(b,l)  ((void)0)
 #define memcpy_fromio    memcpy
 #define alloc_bootmem(l) xmalloc_bytes(l)
 
@@ -111,9 +109,32 @@ enum dmi_entry_type {
 #define dmi_printk(x)
 #endif
 
-static char * __init dmi_string(struct dmi_header *dm, u8 s)
+static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
-	char *bp=(char *)dm;
+    mfn_t mfn = _mfn(PFN_DOWN(addr));
+    unsigned int offs = PAGE_OFFSET(addr);
+
+    if ( addr + len <= MB(1) )
+        return __va(addr);
+
+    if ( system_state < SYS_STATE_boot )
+        return __acpi_map_table(addr, len);
+
+    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                  VMAP_DEFAULT) + offs;
+}
+
+static void __init bt_iounmap(const void *ptr, unsigned int len)
+{
+    if ( (unsigned long)ptr < DIRECTMAP_VIRT_START &&
+         system_state >= SYS_STATE_boot )
+        vunmap(ptr);
+}
+
+static const char *__init dmi_string(const struct dmi_header *dm, uint8_t s)
+{
+	const char *bp = (const void *)dm;
+
 	bp+=dm->length;
 	if(!s)
 		return "";
@@ -133,11 +154,10 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s)
  */
  
 static int __init dmi_table(paddr_t base, u32 len, int num,
-			    void (*decode)(struct dmi_header *))
+			    void (*decode)(const struct dmi_header *))
 {
-	u8 *buf;
-	struct dmi_header *dm;
-	u8 *data;
+	const uint8_t *buf, *data;
+	const struct dmi_header *dm;
 	int i=0;
 		
 	buf = bt_ioremap(base, len);
@@ -301,7 +321,7 @@ typedef union {
 
 static int __init _dmi_iterate(const struct dmi_eps *dmi,
 			       const smbios_eps_u smbios,
-			       void (*decode)(struct dmi_header *))
+			       void (*decode)(const struct dmi_header *))
 {
 	int num;
 	u32 len;
@@ -335,7 +355,7 @@ static int __init _dmi_iterate(const struct dmi_eps *dmi,
 	return dmi_table(base, len, num, decode);
 }
 
-static int __init dmi_iterate(void (*decode)(struct dmi_header *))
+static int __init dmi_iterate(void (*decode)(const struct dmi_header *))
 {
 	struct dmi_eps dmi;
 	struct smbios3_eps smbios3;
@@ -370,7 +390,7 @@ static int __init dmi_iterate(void (*decode)(struct dmi_header *))
 	return -1;
 }
 
-static int __init dmi_efi_iterate(void (*decode)(struct dmi_header *))
+static int __init dmi_efi_iterate(void (*decode)(const struct dmi_header *))
 {
 	int ret = -1;
 
@@ -433,10 +453,11 @@ static char *__initdata dmi_ident[DMI_STRING_MAX];
  *	Save a DMI string
  */
  
-static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
+static void __init dmi_save_ident(const struct dmi_header *dm, int slot, int string)
 {
-	char *d = (char*)dm;
-	char *p = dmi_string(dm, d[string]);
+	const char *d = (const void *)dm;
+	const char *p = dmi_string(dm, d[string]);
+
 	if(p==NULL || *p == 0)
 		return;
 	if (dmi_ident[slot])
@@ -629,10 +650,10 @@ static const struct dmi_blacklist __initconstrel dmi_blacklist[] = {
  *	out of here.
  */
 
-static void __init dmi_decode(struct dmi_header *dm)
+static void __init dmi_decode(const struct dmi_header *dm)
 {
 #ifdef DMI_DEBUG
-	u8 *data = (u8 *)dm;
+	const uint8_t *data = (const void *)dm;
 #endif
 	
 	switch(dm->type)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 10:33:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 10:33:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35727.67348 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdr-00080D-O9; Tue, 24 Nov 2020 10:33:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35727.67348; Tue, 24 Nov 2020 10:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVdr-000805-L0; Tue, 24 Nov 2020 10:33:47 +0000
Received: by outflank-mailman (input) for mailman id 35727;
 Tue, 24 Nov 2020 10: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 1khVdq-0007zu-1t
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10: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 1khVdq-0000pi-0a
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khVdp-0003rn-Vp
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVdq-0007zu-1t
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:46 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G2Qe7d1TXVqx1C1DTtunfJd6ALcq84m6MsJLaHEHAwg=; b=qBrgWQ4ndlJi+qFlk/RqcLw2o3
	lMf6GrmhCym4RqC3QOQfdv4npZbFgNG5QONZyBZ1he6kLZpPUTbik/rZxNRjkDPbDdxNcjUqvx+o9
	hOtD0u4D82NR3Gpz/ovaZYc2ckWsImfDQ46LxRW/Wy0M5WwOE/+u5Te61Z04bSea1eh0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdq-0000pi-0a
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVdp-0003rn-Vp
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ns16550: move PCI arrays next to the function using them
Message-Id: <E1khVdp-0003rn-Vp@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 10:33:45 +0000

commit 510cdda6865868080f898543fc44044020efca71
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:27:49 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:27:49 2020 +0100

    ns16550: move PCI arrays next to the function using them
    
    Pure code motion; no functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/char/ns16550.c | 1247 ++++++++++++++++++++++----------------------
 1 file changed, 625 insertions(+), 622 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index d8b52eb813..6f7fad6093 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -153,418 +153,112 @@ struct ns16550_config_param {
     unsigned int uart_offset;
     unsigned int first_offset;
 };
+#endif
 
-/*
- * Create lookup tables for specific devices. It is assumed that if
- * the device found is MMIO, then you have indexed it here. Else, the
- * driver does nothing for MMIO based devices.
- */
-static const struct ns16550_config_param __initconst uart_param[] = {
-    [param_default] = {
-        .reg_width = 1,
-        .lsr_mask = UART_LSR_THRE,
-        .max_ports = 1,
-    },
-    [param_trumanage] = {
-        .reg_shift = 2,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = (UART_LSR_THRE | UART_LSR_TEMT),
-        .mmio = 1,
-        .max_ports = 1,
-    },
-    [param_oxford] = {
-        .base_baud = 4000000,
-        .uart_offset = 0x200,
-        .first_offset = 0x1000,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .mmio = 1,
-        .max_ports = 1, /* It can do more, but we would need more custom code.*/
-    },
-    [param_oxford_2port] = {
-        .base_baud = 4000000,
-        .uart_offset = 0x200,
-        .first_offset = 0x1000,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .mmio = 1,
-        .max_ports = 2,
-    },
-    [param_pericom_1port] = {
-        .base_baud = 921600,
-        .uart_offset = 8,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .bar0 = 1,
-        .max_ports = 1,
-    },
-    [param_pericom_2port] = {
-        .base_baud = 921600,
-        .uart_offset = 8,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .bar0 = 1,
-        .max_ports = 2,
-    },
-    /*
-     * Of the two following ones, we can't really use all of their ports,
-     * unless ns16550_com[] would get grown.
-     */
-    [param_pericom_4port] = {
-        .base_baud = 921600,
-        .uart_offset = 8,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .bar0 = 1,
-        .max_ports = 4,
-    },
-    [param_pericom_8port] = {
-        .base_baud = 921600,
-        .uart_offset = 8,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .bar0 = 1,
-        .max_ports = 8,
-    }
-};
-static const struct ns16550_config __initconst uart_config[] =
+static void ns16550_delayed_resume(void *data);
+
+static u8 ns_read_reg(struct ns16550 *uart, unsigned int reg)
 {
-    /* Broadcom TruManage device */
-    {
-        .vendor_id = PCI_VENDOR_ID_BROADCOM,
-        .dev_id = 0x160a,
-        .param = param_trumanage,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc11b,
-        .param = param_oxford,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc11f,
-        .param = param_oxford,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc138,
-        .param = param_oxford,
-    },
-    /* OXPCIe952 2 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc158,
-        .param = param_oxford_2port,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc13d,
-        .param = param_oxford,
-    },
-    /* OXPCIe952 2 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc15d,
-        .param = param_oxford_2port,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc40b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc40f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
+    void __iomem *addr = uart->remapped_io_base + (reg << uart->reg_shift);
+#ifdef CONFIG_HAS_IOPORTS
+    if ( uart->remapped_io_base == NULL )
+        return inb(uart->io_base + reg);
+#endif
+    switch ( uart->reg_width )
     {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc41b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
+    case 1:
+        return readb(addr);
+    case 4:
+        return readl(addr);
+    default:
+        return 0xff;
+    }
+}
+
+static void ns_write_reg(struct ns16550 *uart, unsigned int reg, u8 c)
+{
+    void __iomem *addr = uart->remapped_io_base + (reg << uart->reg_shift);
+#ifdef CONFIG_HAS_IOPORTS
+    if ( uart->remapped_io_base == NULL )
+        return outb(c, uart->io_base + reg);
+#endif
+    switch ( uart->reg_width )
     {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc41f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
+    case 1:
+        writeb(c, addr);
+        break;
+    case 4:
+        writel(c, addr);
+        break;
+    default:
+        /* Ignored */
+        break;
+    }
+}
+
+static int ns16550_ioport_invalid(struct ns16550 *uart)
+{
+    return ns_read_reg(uart, UART_IER) == 0xff;
+}
+
+static void handle_dw_usr_busy_quirk(struct ns16550 *uart)
+{
+    if ( uart->dw_usr_bsy &&
+         (ns_read_reg(uart, UART_IIR) & UART_IIR_BSY) == UART_IIR_BSY )
     {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc42b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
+        /* DesignWare 8250 detects if LCR is written while the UART is
+         * busy and raises a "busy detect" interrupt. Read the UART
+         * Status Register to clear this state.
+         *
+         * Allwinner/sunxi UART hardware is similar to DesignWare 8250
+         * and also contains a "busy detect" interrupt. So this quirk
+         * fix will also be used for Allwinner UART.
+         */
+        ns_read_reg(uart, UART_USR);
+    }
+}
+
+static void ns16550_interrupt(
+    int irq, void *dev_id, struct cpu_user_regs *regs)
+{
+    struct serial_port *port = dev_id;
+    struct ns16550 *uart = port->uart;
+
+    uart->intr_works = 1;
+
+    while ( !(ns_read_reg(uart, UART_IIR) & UART_IIR_NOINT) )
     {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc42f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc43b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc43f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc44b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc44f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc45b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc45f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc46b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc46f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc47b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc47f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc48b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc48f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc49b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc49f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4ab,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4af,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4bb,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4bf,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4cb,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4cf,
-        .param = param_oxford,
-    },
-    /* Pericom PI7C9X7951 Uno UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_PERICOM,
-        .dev_id = 0x7951,
-        .param = param_pericom_1port
-    },
-    /* Pericom PI7C9X7952 Duo UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_PERICOM,
-        .dev_id = 0x7952,
-        .param = param_pericom_2port
-    },
-    /* Pericom PI7C9X7954 Quad UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_PERICOM,
-        .dev_id = 0x7954,
-        .param = param_pericom_4port
-    },
-    /* Pericom PI7C9X7958 Octal UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_PERICOM,
-        .dev_id = 0x7958,
-        .param = param_pericom_8port
-    }
-};
-#endif
-
-static void ns16550_delayed_resume(void *data);
-
-static u8 ns_read_reg(struct ns16550 *uart, unsigned int reg)
-{
-    void __iomem *addr = uart->remapped_io_base + (reg << uart->reg_shift);
-#ifdef CONFIG_HAS_IOPORTS
-    if ( uart->remapped_io_base == NULL )
-        return inb(uart->io_base + reg);
-#endif
-    switch ( uart->reg_width )
-    {
-    case 1:
-        return readb(addr);
-    case 4:
-        return readl(addr);
-    default:
-        return 0xff;
-    }
-}
-
-static void ns_write_reg(struct ns16550 *uart, unsigned int reg, u8 c)
-{
-    void __iomem *addr = uart->remapped_io_base + (reg << uart->reg_shift);
-#ifdef CONFIG_HAS_IOPORTS
-    if ( uart->remapped_io_base == NULL )
-        return outb(c, uart->io_base + reg);
-#endif
-    switch ( uart->reg_width )
-    {
-    case 1:
-        writeb(c, addr);
-        break;
-    case 4:
-        writel(c, addr);
-        break;
-    default:
-        /* Ignored */
-        break;
-    }
-}
-
-static int ns16550_ioport_invalid(struct ns16550 *uart)
-{
-    return ns_read_reg(uart, UART_IER) == 0xff;
-}
-
-static void handle_dw_usr_busy_quirk(struct ns16550 *uart)
-{
-    if ( uart->dw_usr_bsy &&
-         (ns_read_reg(uart, UART_IIR) & UART_IIR_BSY) == UART_IIR_BSY )
-    {
-        /* DesignWare 8250 detects if LCR is written while the UART is
-         * busy and raises a "busy detect" interrupt. Read the UART
-         * Status Register to clear this state.
-         *
-         * Allwinner/sunxi UART hardware is similar to DesignWare 8250
-         * and also contains a "busy detect" interrupt. So this quirk
-         * fix will also be used for Allwinner UART.
-         */
-        ns_read_reg(uart, UART_USR);
-    }
-}
-
-static void ns16550_interrupt(
-    int irq, void *dev_id, struct cpu_user_regs *regs)
-{
-    struct serial_port *port = dev_id;
-    struct ns16550 *uart = port->uart;
-
-    uart->intr_works = 1;
-
-    while ( !(ns_read_reg(uart, UART_IIR) & UART_IIR_NOINT) )
-    {
-        u8 lsr = ns_read_reg(uart, UART_LSR);
-
-        if ( (lsr & uart->lsr_mask) == uart->lsr_mask )
-            serial_tx_interrupt(port, regs);
-        if ( lsr & UART_LSR_DR )
-            serial_rx_interrupt(port, regs);
-
-        /* A "busy-detect" condition is observed on Allwinner/sunxi UART
-         * after LCR is written during setup. It needs to be cleared at
-         * this point or UART_IIR_NOINT will never be set and this loop
-         * will continue forever.
-         *
-         * This state can be cleared by calling the dw_usr_busy quirk
-         * handler that resolves "busy-detect" for  DesignWare uart.
-         */
-        handle_dw_usr_busy_quirk(uart);
-    }
-}
-
-/* Safe: ns16550_poll() runs as softirq so not reentrant on a given CPU. */
-static DEFINE_PER_CPU(struct serial_port *, poll_port);
-
-static void __ns16550_poll(struct cpu_user_regs *regs)
-{
-    struct serial_port *port = this_cpu(poll_port);
-    struct ns16550 *uart = port->uart;
-
-    if ( uart->intr_works )
-        return; /* Interrupts work - no more polling */
-
-    while ( ns_read_reg(uart, UART_LSR) & UART_LSR_DR )
+        u8 lsr = ns_read_reg(uart, UART_LSR);
+
+        if ( (lsr & uart->lsr_mask) == uart->lsr_mask )
+            serial_tx_interrupt(port, regs);
+        if ( lsr & UART_LSR_DR )
+            serial_rx_interrupt(port, regs);
+
+        /* A "busy-detect" condition is observed on Allwinner/sunxi UART
+         * after LCR is written during setup. It needs to be cleared at
+         * this point or UART_IIR_NOINT will never be set and this loop
+         * will continue forever.
+         *
+         * This state can be cleared by calling the dw_usr_busy quirk
+         * handler that resolves "busy-detect" for  DesignWare uart.
+         */
+        handle_dw_usr_busy_quirk(uart);
+    }
+}
+
+/* Safe: ns16550_poll() runs as softirq so not reentrant on a given CPU. */
+static DEFINE_PER_CPU(struct serial_port *, poll_port);
+
+static void __ns16550_poll(struct cpu_user_regs *regs)
+{
+    struct serial_port *port = this_cpu(poll_port);
+    struct ns16550 *uart = port->uart;
+
+    if ( uart->intr_works )
+        return; /* Interrupts work - no more polling */
+
+    while ( ns_read_reg(uart, UART_LSR) & UART_LSR_DR )
     {
         if ( ns16550_ioport_invalid(uart) )
             goto out;
@@ -825,226 +519,534 @@ static void __init ns16550_init_postirq(struct serial_port *port)
 
     if ( uart->irq > 0 )
     {
-        uart->irqaction.handler = ns16550_interrupt;
-        uart->irqaction.name    = "ns16550";
-        uart->irqaction.dev_id  = port;
-        if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
-            printk("ERROR: Failed to allocate ns16550 IRQ %d\n", uart->irq);
-    }
-
-    ns16550_setup_postirq(uart);
-}
-
-static void ns16550_suspend(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-
-    stop_timer(&uart->timer);
-
-#ifdef CONFIG_HAS_PCI
-    if ( uart->bar )
-       uart->cr = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                  uart->ps_bdf[2]), PCI_COMMAND);
-#endif
-}
-
-static void _ns16550_resume(struct serial_port *port)
-{
-#ifdef CONFIG_HAS_PCI
-    struct ns16550 *uart = port->uart;
-
-    if ( uart->bar )
+        uart->irqaction.handler = ns16550_interrupt;
+        uart->irqaction.name    = "ns16550";
+        uart->irqaction.dev_id  = port;
+        if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
+            printk("ERROR: Failed to allocate ns16550 IRQ %d\n", uart->irq);
+    }
+
+    ns16550_setup_postirq(uart);
+}
+
+static void ns16550_suspend(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+
+    stop_timer(&uart->timer);
+
+#ifdef CONFIG_HAS_PCI
+    if ( uart->bar )
+       uart->cr = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                  uart->ps_bdf[2]), PCI_COMMAND);
+#endif
+}
+
+static void _ns16550_resume(struct serial_port *port)
+{
+#ifdef CONFIG_HAS_PCI
+    struct ns16550 *uart = port->uart;
+
+    if ( uart->bar )
+    {
+       pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                 uart->ps_bdf[2]),
+                        PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
+
+        /* If 64 bit BAR, write higher 32 bits to BAR+4 */
+        if ( uart->bar & PCI_BASE_ADDRESS_MEM_TYPE_64 )
+            pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0],  uart->ps_bdf[1],
+                                      uart->ps_bdf[2]),
+                        PCI_BASE_ADDRESS_0 + (uart->bar_idx+1)*4, uart->bar64);
+
+       pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                 uart->ps_bdf[2]),
+                        PCI_COMMAND, uart->cr);
+    }
+#endif
+
+    ns16550_setup_preirq(port->uart);
+    ns16550_setup_postirq(port->uart);
+}
+
+static int delayed_resume_tries;
+static void ns16550_delayed_resume(void *data)
+{
+    struct serial_port *port = data;
+    struct ns16550 *uart = port->uart;
+
+    if ( ns16550_ioport_invalid(port->uart) && delayed_resume_tries-- )
+        set_timer(&uart->resume_timer, NOW() + RESUME_DELAY);
+    else
+        _ns16550_resume(port);
+}
+
+static void ns16550_resume(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+
+    /*
+     * Check for ioport access, before fully resuming operation.
+     * On some systems, there is a SuperIO card that provides
+     * this legacy ioport on the LPC bus.
+     *
+     * We need to wait for dom0's ACPI processing to run the proper
+     * AML to re-initialize the chip, before we can use the card again.
+     *
+     * This may cause a small amount of garbage to be written
+     * to the serial log while we wait patiently for that AML to
+     * be executed. However, this is preferable to spinning in an
+     * infinite loop, as seen on a Lenovo T430, when serial was enabled.
+     */
+    if ( ns16550_ioport_invalid(uart) )
+    {
+        delayed_resume_tries = RESUME_RETRIES;
+        set_timer(&uart->resume_timer, NOW() + RESUME_DELAY);
+    }
+    else
+        _ns16550_resume(port);
+}
+
+static void __init ns16550_endboot(struct serial_port *port)
+{
+#ifdef CONFIG_HAS_IOPORTS
+    struct ns16550 *uart = port->uart;
+    int rv;
+
+    if ( uart->remapped_io_base )
+        return;
+    rv = ioports_deny_access(hardware_domain, uart->io_base, uart->io_base + 7);
+    if ( rv != 0 )
+        BUG();
+#endif
+}
+
+static int __init ns16550_irq(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+    return ((uart->irq > 0) ? uart->irq : -1);
+}
+
+static void ns16550_start_tx(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+    u8 ier = ns_read_reg(uart, UART_IER);
+
+    /* Unmask transmit holding register empty interrupt if currently masked. */
+    if ( !(ier & UART_IER_ETHREI) )
+        ns_write_reg(uart, UART_IER, ier | UART_IER_ETHREI);
+}
+
+static void ns16550_stop_tx(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+    u8 ier = ns_read_reg(uart, UART_IER);
+
+    /* Mask off transmit holding register empty interrupt if currently unmasked. */
+    if ( ier & UART_IER_ETHREI )
+        ns_write_reg(uart, UART_IER, ier & ~UART_IER_ETHREI);
+}
+
+#ifdef CONFIG_ARM
+static const struct vuart_info *ns16550_vuart_info(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+
+    return &uart->vuart;
+}
+#endif
+
+static struct uart_driver __read_mostly ns16550_driver = {
+    .init_preirq  = ns16550_init_preirq,
+    .init_irq     = ns16550_init_irq,
+    .init_postirq = ns16550_init_postirq,
+    .endboot      = ns16550_endboot,
+    .suspend      = ns16550_suspend,
+    .resume       = ns16550_resume,
+    .tx_ready     = ns16550_tx_ready,
+    .putc         = ns16550_putc,
+    .getc         = ns16550_getc,
+    .irq          = ns16550_irq,
+    .start_tx     = ns16550_start_tx,
+    .stop_tx      = ns16550_stop_tx,
+#ifdef CONFIG_ARM
+    .vuart_info   = ns16550_vuart_info,
+#endif
+};
+
+static int __init parse_parity_char(int c)
+{
+    switch ( c )
+    {
+    case 'n':
+        return UART_PARITY_NONE;
+    case 'o': 
+        return UART_PARITY_ODD;
+    case 'e': 
+        return UART_PARITY_EVEN;
+    case 'm': 
+        return UART_PARITY_MARK;
+    case 's': 
+        return UART_PARITY_SPACE;
+    }
+    return 0;
+}
+
+static int __init check_existence(struct ns16550 *uart)
+{
+    unsigned char status, scratch, scratch2, scratch3;
+
+#ifdef CONFIG_HAS_IOPORTS
+    /*
+     * We can't poke MMIO UARTs until they get I/O remapped later. Assume that
+     * if we're getting MMIO UARTs, the arch code knows what it's doing.
+     */
+    if ( uart->io_base >= 0x10000 )
+        return 1;
+#else
+    return 1; /* Everything is MMIO */
+#endif
+
+#ifdef CONFIG_HAS_PCI
+    pci_serial_early_init(uart);
+#endif
+
+    /*
+     * Do a simple existence test first; if we fail this,
+     * there's no point trying anything else.
+     */
+    scratch = ns_read_reg(uart, UART_IER);
+    ns_write_reg(uart, UART_IER, 0);
+
+    /*
+     * Mask out IER[7:4] bits for test as some UARTs (e.g. TL
+     * 16C754B) allow only to modify them if an EFR bit is set.
+     */
+    scratch2 = ns_read_reg(uart, UART_IER) & 0x0f;
+    ns_write_reg(uart,UART_IER, 0x0F);
+    scratch3 = ns_read_reg(uart, UART_IER) & 0x0f;
+    ns_write_reg(uart, UART_IER, scratch);
+    if ( (scratch2 != 0) || (scratch3 != 0x0F) )
+        return 0;
+
+    /*
+     * Check to see if a UART is really there.
+     * Use loopback test mode.
+     */
+    ns_write_reg(uart, UART_MCR, UART_MCR_LOOP | 0x0A);
+    status = ns_read_reg(uart, UART_MSR) & 0xF0;
+    return (status == 0x90);
+}
+
+#ifdef CONFIG_HAS_PCI
+
+/*
+ * Create lookup tables for specific devices. It is assumed that if
+ * the device found is MMIO, then you have indexed it here. Else, the
+ * driver does nothing for MMIO based devices.
+ */
+static const struct ns16550_config_param __initconst uart_param[] = {
+    [param_default] = {
+        .reg_width = 1,
+        .lsr_mask = UART_LSR_THRE,
+        .max_ports = 1,
+    },
+    [param_trumanage] = {
+        .reg_shift = 2,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = (UART_LSR_THRE | UART_LSR_TEMT),
+        .mmio = 1,
+        .max_ports = 1,
+    },
+    [param_oxford] = {
+        .base_baud = 4000000,
+        .uart_offset = 0x200,
+        .first_offset = 0x1000,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .mmio = 1,
+        .max_ports = 1, /* It can do more, but we would need more custom code.*/
+    },
+    [param_oxford_2port] = {
+        .base_baud = 4000000,
+        .uart_offset = 0x200,
+        .first_offset = 0x1000,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .mmio = 1,
+        .max_ports = 2,
+    },
+    [param_pericom_1port] = {
+        .base_baud = 921600,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = 1,
+        .max_ports = 1,
+    },
+    [param_pericom_2port] = {
+        .base_baud = 921600,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = 1,
+        .max_ports = 2,
+    },
+    /*
+     * Of the two following ones, we can't really use all of their ports,
+     * unless ns16550_com[] would get grown.
+     */
+    [param_pericom_4port] = {
+        .base_baud = 921600,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = 1,
+        .max_ports = 4,
+    },
+    [param_pericom_8port] = {
+        .base_baud = 921600,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = 1,
+        .max_ports = 8,
+    }
+};
+
+static const struct ns16550_config __initconst uart_config[] =
+{
+    /* Broadcom TruManage device */
+    {
+        .vendor_id = PCI_VENDOR_ID_BROADCOM,
+        .dev_id = 0x160a,
+        .param = param_trumanage,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc11b,
+        .param = param_oxford,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc11f,
+        .param = param_oxford,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc138,
+        .param = param_oxford,
+    },
+    /* OXPCIe952 2 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc158,
+        .param = param_oxford_2port,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc13d,
+        .param = param_oxford,
+    },
+    /* OXPCIe952 2 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc15d,
+        .param = param_oxford_2port,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc40b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc40f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc41b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc41f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc42b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc42f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc43b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc43f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc44b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc44f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc45b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc45f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc46b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc46f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc47b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc47f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc48b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc48f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc49b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc49f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4ab,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4af,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4bb,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4bf,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
     {
-       pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
-                        PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
-
-        /* If 64 bit BAR, write higher 32 bits to BAR+4 */
-        if ( uart->bar & PCI_BASE_ADDRESS_MEM_TYPE_64 )
-            pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0],  uart->ps_bdf[1],
-                                      uart->ps_bdf[2]),
-                        PCI_BASE_ADDRESS_0 + (uart->bar_idx+1)*4, uart->bar64);
-
-       pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
-                        PCI_COMMAND, uart->cr);
-    }
-#endif
-
-    ns16550_setup_preirq(port->uart);
-    ns16550_setup_postirq(port->uart);
-}
-
-static int delayed_resume_tries;
-static void ns16550_delayed_resume(void *data)
-{
-    struct serial_port *port = data;
-    struct ns16550 *uart = port->uart;
-
-    if ( ns16550_ioport_invalid(port->uart) && delayed_resume_tries-- )
-        set_timer(&uart->resume_timer, NOW() + RESUME_DELAY);
-    else
-        _ns16550_resume(port);
-}
-
-static void ns16550_resume(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-
-    /*
-     * Check for ioport access, before fully resuming operation.
-     * On some systems, there is a SuperIO card that provides
-     * this legacy ioport on the LPC bus.
-     *
-     * We need to wait for dom0's ACPI processing to run the proper
-     * AML to re-initialize the chip, before we can use the card again.
-     *
-     * This may cause a small amount of garbage to be written
-     * to the serial log while we wait patiently for that AML to
-     * be executed. However, this is preferable to spinning in an
-     * infinite loop, as seen on a Lenovo T430, when serial was enabled.
-     */
-    if ( ns16550_ioport_invalid(uart) )
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4cb,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
     {
-        delayed_resume_tries = RESUME_RETRIES;
-        set_timer(&uart->resume_timer, NOW() + RESUME_DELAY);
-    }
-    else
-        _ns16550_resume(port);
-}
-
-static void __init ns16550_endboot(struct serial_port *port)
-{
-#ifdef CONFIG_HAS_IOPORTS
-    struct ns16550 *uart = port->uart;
-    int rv;
-
-    if ( uart->remapped_io_base )
-        return;
-    rv = ioports_deny_access(hardware_domain, uart->io_base, uart->io_base + 7);
-    if ( rv != 0 )
-        BUG();
-#endif
-}
-
-static int __init ns16550_irq(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-    return ((uart->irq > 0) ? uart->irq : -1);
-}
-
-static void ns16550_start_tx(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-    u8 ier = ns_read_reg(uart, UART_IER);
-
-    /* Unmask transmit holding register empty interrupt if currently masked. */
-    if ( !(ier & UART_IER_ETHREI) )
-        ns_write_reg(uart, UART_IER, ier | UART_IER_ETHREI);
-}
-
-static void ns16550_stop_tx(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-    u8 ier = ns_read_reg(uart, UART_IER);
-
-    /* Mask off transmit holding register empty interrupt if currently unmasked. */
-    if ( ier & UART_IER_ETHREI )
-        ns_write_reg(uart, UART_IER, ier & ~UART_IER_ETHREI);
-}
-
-#ifdef CONFIG_ARM
-static const struct vuart_info *ns16550_vuart_info(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-
-    return &uart->vuart;
-}
-#endif
-
-static struct uart_driver __read_mostly ns16550_driver = {
-    .init_preirq  = ns16550_init_preirq,
-    .init_irq     = ns16550_init_irq,
-    .init_postirq = ns16550_init_postirq,
-    .endboot      = ns16550_endboot,
-    .suspend      = ns16550_suspend,
-    .resume       = ns16550_resume,
-    .tx_ready     = ns16550_tx_ready,
-    .putc         = ns16550_putc,
-    .getc         = ns16550_getc,
-    .irq          = ns16550_irq,
-    .start_tx     = ns16550_start_tx,
-    .stop_tx      = ns16550_stop_tx,
-#ifdef CONFIG_ARM
-    .vuart_info   = ns16550_vuart_info,
-#endif
-};
-
-static int __init parse_parity_char(int c)
-{
-    switch ( c )
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4cf,
+        .param = param_oxford,
+    },
+    /* Pericom PI7C9X7951 Uno UART */
     {
-    case 'n':
-        return UART_PARITY_NONE;
-    case 'o': 
-        return UART_PARITY_ODD;
-    case 'e': 
-        return UART_PARITY_EVEN;
-    case 'm': 
-        return UART_PARITY_MARK;
-    case 's': 
-        return UART_PARITY_SPACE;
+        .vendor_id = PCI_VENDOR_ID_PERICOM,
+        .dev_id = 0x7951,
+        .param = param_pericom_1port
+    },
+    /* Pericom PI7C9X7952 Duo UART */
+    {
+        .vendor_id = PCI_VENDOR_ID_PERICOM,
+        .dev_id = 0x7952,
+        .param = param_pericom_2port
+    },
+    /* Pericom PI7C9X7954 Quad UART */
+    {
+        .vendor_id = PCI_VENDOR_ID_PERICOM,
+        .dev_id = 0x7954,
+        .param = param_pericom_4port
+    },
+    /* Pericom PI7C9X7958 Octal UART */
+    {
+        .vendor_id = PCI_VENDOR_ID_PERICOM,
+        .dev_id = 0x7958,
+        .param = param_pericom_8port
     }
-    return 0;
-}
-
-static int __init check_existence(struct ns16550 *uart)
-{
-    unsigned char status, scratch, scratch2, scratch3;
-
-#ifdef CONFIG_HAS_IOPORTS
-    /*
-     * We can't poke MMIO UARTs until they get I/O remapped later. Assume that
-     * if we're getting MMIO UARTs, the arch code knows what it's doing.
-     */
-    if ( uart->io_base >= 0x10000 )
-        return 1;
-#else
-    return 1; /* Everything is MMIO */
-#endif
-
-#ifdef CONFIG_HAS_PCI
-    pci_serial_early_init(uart);
-#endif
-
-    /*
-     * Do a simple existence test first; if we fail this,
-     * there's no point trying anything else.
-     */
-    scratch = ns_read_reg(uart, UART_IER);
-    ns_write_reg(uart, UART_IER, 0);
-
-    /*
-     * Mask out IER[7:4] bits for test as some UARTs (e.g. TL
-     * 16C754B) allow only to modify them if an EFR bit is set.
-     */
-    scratch2 = ns_read_reg(uart, UART_IER) & 0x0f;
-    ns_write_reg(uart,UART_IER, 0x0F);
-    scratch3 = ns_read_reg(uart, UART_IER) & 0x0f;
-    ns_write_reg(uart, UART_IER, scratch);
-    if ( (scratch2 != 0) || (scratch3 != 0x0F) )
-        return 0;
-
-    /*
-     * Check to see if a UART is really there.
-     * Use loopback test mode.
-     */
-    ns_write_reg(uart, UART_MCR, UART_MCR_LOOP | 0x0A);
-    status = ns_read_reg(uart, UART_MSR) & 0xF0;
-    return (status == 0x90);
-}
+};
 
-#ifdef CONFIG_HAS_PCI
 static int __init
 pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)
 {
@@ -1211,7 +1213,8 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)
 
     return 0;
 }
-#endif
+
+#endif /* CONFIG_HAS_PCI */
 
 /*
  * Used to parse name value pairs and return which value it is along with
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 10:33:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 10:33:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35728.67352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVe1-00081Y-SG; Tue, 24 Nov 2020 10:33:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35728.67352; Tue, 24 Nov 2020 10:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVe1-00081Q-PN; Tue, 24 Nov 2020 10:33:57 +0000
Received: by outflank-mailman (input) for mailman id 35728;
 Tue, 24 Nov 2020 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 1khVe0-00081I-5S
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVe0-0000pn-4i
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khVe0-0003sR-3M
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVe0-00081I-5S
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:56 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4AeknfAAYeuMkkJKOkNEMQIJJeXj1r9maPX7Fu8zdYY=; b=ASJkQRvVAChR1gBDkJLFAmeSsH
	bJ3kMPz1JtZ68a4CT0OUenqlmIQ2ZXxe52/KkombzYt2mbil7EoqMUzI2oKOwG+4JF7xnNbCqaFYd
	MfWisqyc6nAVOjqpE+cUX9Ll1pfrfKdMxkJdnGea1JU5ouks4BWTFJU7CUTicHWj/ZnY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVe0-0000pn-4i
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVe0-0003sR-3M
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:33:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ns16550: "com<N>=" command line options are x86-specific
Message-Id: <E1khVe0-0003sR-3M@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 10:33:56 +0000

commit 2291ad4775b9716244ad96d104122221864f32d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:28:15 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:28:15 2020 +0100

    ns16550: "com<N>=" command line options are x86-specific
    
    Pure code motion (plus the addition of "#ifdef CONFIG_X86); no
    functional change intended.
    
    Reported-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 docs/misc/xen-command-line.pandoc |   4 +-
 xen/drivers/char/ns16550.c        | 142 ++++++++++++++++++++------------------
 2 files changed, 75 insertions(+), 71 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 4ae9391fcd..b4a0d60c11 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -318,8 +318,8 @@ Interrupts.  Specifying zero disables CMCI handling.
 Flag to indicate whether to probe for a CMOS Real Time Clock irrespective of
 ACPI indicating none to be there.
 
-### com1
-### com2
+### com1 (x86)
+### com2 (x86)
 > `= <baud>[/<base-baud>][,[DPS][,[<io-base>|pci|amt][,[<irq>|msi][,[<port-bdf>][,[<bridge-bdf>]]]]]]`
 
 Both option `com1` and `com2` follow the same format.
diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 6f7fad6093..82087c4a7a 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -31,38 +31,6 @@
 #include <asm/fixmap.h>
 #endif
 
-/*
- * Configure serial port with a string:
- *   <baud>[/<base_baud>][,DPS[,<io-base>[,<irq>[,<port-bdf>[,<bridge-bdf>]]]]].
- * The tail of the string can be omitted if platform defaults are sufficient.
- * If the baud rate is pre-configured, perhaps by a bootloader, then 'auto'
- * can be specified in place of a numeric baud rate. Polled mode is specified
- * by requesting irq 0.
- */
-static char __initdata opt_com1[128] = "";
-static char __initdata opt_com2[128] = "";
-string_param("com1", opt_com1);
-string_param("com2", opt_com2);
-
-enum serial_param_type {
-    baud,
-    clock_hz,
-    data_bits,
-    io_base,
-    irq,
-    parity,
-    reg_shift,
-    reg_width,
-    stop_bits,
-#ifdef CONFIG_HAS_PCI
-    bridge_bdf,
-    device,
-    port_bdf,
-#endif
-    /* List all parameters before this line. */
-    num_serial_params
-};
-
 static struct ns16550 {
     int baud, clock_hz, data_bits, parity, stop_bits, fifo_size, irq;
     u64 io_base;   /* I/O port or memory-mapped I/O address. */
@@ -98,32 +66,6 @@ static struct ns16550 {
 #endif
 } ns16550_com[2] = { { 0 } };
 
-struct serial_param_var {
-    char name[12];
-    enum serial_param_type type;
-};
-
-/*
- * Enum struct keeping a table of all accepted parameter names for parsing
- * com_console_options for serial port com1 and com2.
- */
-static const struct serial_param_var __initconst sp_vars[] = {
-    {"baud", baud},
-    {"clock-hz", clock_hz},
-    {"data-bits", data_bits},
-    {"io-base", io_base},
-    {"irq", irq},
-    {"parity", parity},
-    {"reg-shift", reg_shift},
-    {"reg-width", reg_width},
-    {"stop-bits", stop_bits},
-#ifdef CONFIG_HAS_PCI
-    {"bridge", bridge_bdf},
-    {"dev", device},
-    {"port", port_bdf},
-#endif
-};
-
 #ifdef CONFIG_HAS_PCI
 struct ns16550_config {
     u16 vendor_id;
@@ -674,6 +616,19 @@ static struct uart_driver __read_mostly ns16550_driver = {
 #endif
 };
 
+static void ns16550_init_common(struct ns16550 *uart)
+{
+    uart->clock_hz  = UART_CLOCK_HZ;
+
+    /* Default is no transmit FIFO. */
+    uart->fifo_size = 1;
+
+    /* Default lsr_mask = UART_LSR_THRE */
+    uart->lsr_mask  = UART_LSR_THRE;
+}
+
+#ifdef CONFIG_X86
+
 static int __init parse_parity_char(int c)
 {
     switch ( c )
@@ -1216,6 +1171,64 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)
 
 #endif /* CONFIG_HAS_PCI */
 
+/*
+ * Configure serial port with a string:
+ *   <baud>[/<base_baud>][,DPS[,<io-base>[,<irq>[,<port-bdf>[,<bridge-bdf>]]]]].
+ * The tail of the string can be omitted if platform defaults are sufficient.
+ * If the baud rate is pre-configured, perhaps by a bootloader, then 'auto'
+ * can be specified in place of a numeric baud rate. Polled mode is specified
+ * by requesting irq 0.
+ */
+static char __initdata opt_com1[128] = "";
+static char __initdata opt_com2[128] = "";
+string_param("com1", opt_com1);
+string_param("com2", opt_com2);
+
+enum serial_param_type {
+    baud,
+    clock_hz,
+    data_bits,
+    io_base,
+    irq,
+    parity,
+    reg_shift,
+    reg_width,
+    stop_bits,
+#ifdef CONFIG_HAS_PCI
+    bridge_bdf,
+    device,
+    port_bdf,
+#endif
+    /* List all parameters before this line. */
+    num_serial_params
+};
+
+struct serial_param_var {
+    char name[12];
+    enum serial_param_type type;
+};
+
+/*
+ * Enum struct keeping a table of all accepted parameter names for parsing
+ * com_console_options for serial port com1 and com2.
+ */
+static const struct serial_param_var __initconst sp_vars[] = {
+    {"baud", baud},
+    {"clock-hz", clock_hz},
+    {"data-bits", data_bits},
+    {"io-base", io_base},
+    {"irq", irq},
+    {"parity", parity},
+    {"reg-shift", reg_shift},
+    {"reg-width", reg_width},
+    {"stop-bits", stop_bits},
+#ifdef CONFIG_HAS_PCI
+    {"bridge", bridge_bdf},
+    {"dev", device},
+    {"port", port_bdf},
+#endif
+};
+
 /*
  * Used to parse name value pairs and return which value it is along with
  * pointer for the extracted value.
@@ -1504,17 +1517,6 @@ static void __init ns16550_parse_port_config(
     serial_register_uart(uart - ns16550_com, &ns16550_driver, uart);
 }
 
-static void ns16550_init_common(struct ns16550 *uart)
-{
-    uart->clock_hz  = UART_CLOCK_HZ;
-
-    /* Default is no transmit FIFO. */
-    uart->fifo_size = 1;
-
-    /* Default lsr_mask = UART_LSR_THRE */
-    uart->lsr_mask  = UART_LSR_THRE;
-}
-
 void __init ns16550_init(int index, struct ns16550_defaults *defaults)
 {
     struct ns16550 *uart;
@@ -1541,6 +1543,8 @@ void __init ns16550_init(int index, struct ns16550_defaults *defaults)
     ns16550_parse_port_config(uart, (index == 0) ? opt_com1 : opt_com2);
 }
 
+#endif /* CONFIG_X86 */
+
 #ifdef CONFIG_HAS_DEVICE_TREE
 static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
                                        const void *data)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 10:34:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 10:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35729.67356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVeB-00083L-UA; Tue, 24 Nov 2020 10:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35729.67356; Tue, 24 Nov 2020 10:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khVeB-00083D-Qr; Tue, 24 Nov 2020 10:34:07 +0000
Received: by outflank-mailman (input) for mailman id 35729;
 Tue, 24 Nov 2020 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 1khVeA-00082c-9q
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVeA-0000qc-94
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khVeA-0003uo-7Q
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khVeA-00082c-9q
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:34:06 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2/IK5BrefN/2doEGad3wvKCDDNwPRuFH8bGPIk6kDYo=; b=eypUe0aGGTqVF7dB1nM2KXCVK1
	eO7Zm/H7800ARB551geR7Hea61rnw8lvXFOmaE2piBrCa3sq2le4tk62wa6ZZF+Nn50uHSMNr9+Rz
	QFCEbZVSxjZ/thVWUFNLX7k0wjkkLOLNEXXQmqN/2J3KutQ8oQbw5SMkhB+/MEkDWYTE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVeA-0000qc-94
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khVeA-0003uo-7Q
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 10:34:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ns16550: drop stray "#ifdef CONFIG_HAS_PCI"
Message-Id: <E1khVeA-0003uo-7Q@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 10:34:06 +0000

commit 8147e00e4fbfcc43b665dc6bf279b204c501ba04
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:28:41 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:28:41 2020 +0100

    ns16550: drop stray "#ifdef CONFIG_HAS_PCI"
    
    There's no point wrapping the function invocation when
    - the function body is already suitably wrapped,
    - the function itself is unconditionally available.
    
    Reported-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/char/ns16550.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 82087c4a7a..9235d854fe 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -662,9 +662,7 @@ static int __init check_existence(struct ns16550 *uart)
     return 1; /* Everything is MMIO */
 #endif
 
-#ifdef CONFIG_HAS_PCI
     pci_serial_early_init(uart);
-#endif
 
     /*
      * Do a simple existence test first; if we fail this,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 13:11:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 13:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35957.67614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khY66-0007VJ-Ap; Tue, 24 Nov 2020 13:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35957.67614; Tue, 24 Nov 2020 13:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khY66-0007VC-7c; Tue, 24 Nov 2020 13:11:06 +0000
Received: by outflank-mailman (input) for mailman id 35957;
 Tue, 24 Nov 2020 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 1khY65-0007V7-9d
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khY65-000442-7m
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khY65-0001tV-5u
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 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 1khY65-0007V7-9d
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:11:05 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QV23Ln/E495G+GOkImqapHy96QeSj8UHFWyQXyTifxA=; b=zJtR9eLE9bOSUV9fBl8KwioA7I
	F3f0ciWf3ghPg/REeB9ya6bGmUwEPvPBvSsawp0GLOnqYNSbNDnQZdZbKQSQkU1ufyGoCoXxSULzk
	iL8Y3azlRmJyvmySALMEgV5Gvt3OmjyWM3R7d0BkZZHTjB3dzxgkOzfKC5Lbjd9+k5jc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khY65-000442-7m
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khY65-0001tV-5u
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khY65-0001tV-5u@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 13:11:05 +0000

commit 9b156bcc3ffcc7949edd4460b718a241e87ae302
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:01:31 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:01:31 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index df85b550a1..2c86934ae8 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -854,7 +854,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 13:22:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 13:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35966.67630 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYGk-0008UC-DK; Tue, 24 Nov 2020 13:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35966.67630; Tue, 24 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYGk-0008U4-AT; Tue, 24 Nov 2020 13:22:06 +0000
Received: by outflank-mailman (input) for mailman id 35966;
 Tue, 24 Nov 2020 13: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 1khYGj-0008Tz-Dp
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13: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 1khYGj-0004Iz-AO
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khYGj-0002vA-9L
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13: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 1khYGj-0008Tz-Dp
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:05 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4KYnGRKe/ofmToXTQA04ffezBdseT6PHqOfBGFUI4XI=; b=Ec+JXxssCpofCYJSTRlVOuKL0P
	3di7O+EOpJ9dwS0VFNOGPt23kwFNFs8zi52BM9p1H6sT+EDRo+0In+Ob0n3TXF2qtkQHnLovk34yi
	+jTgBqN2tmXmRzwrYItD8NtA/Ii4hn59qO9uBeSn96J14nHgQi6vWG9C0SLbhvH61BS0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYGj-0004Iz-AO
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYGj-0002vA-9L
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khYGj-0002vA-9L@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 13:22:05 +0000

commit 0057b1f8fa79abe8272690341db54b064c8f2b7f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:11:47 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:11:47 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 7075e233aa..5c5075ae41 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -854,7 +854,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 13:22:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 13:22:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35967.67634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYGv-0008Vj-F9; Tue, 24 Nov 2020 13:22:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35967.67634; Tue, 24 Nov 2020 13:22: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYGv-0008Vb-C2; Tue, 24 Nov 2020 13:22:17 +0000
Received: by outflank-mailman (input) for mailman id 35967;
 Tue, 24 Nov 2020 13:22: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 1khYGu-0008VR-1P
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22: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 1khYGu-0004JT-0b
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khYGt-0002wJ-UW
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13: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 1khYGu-0008VR-1P
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:16 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ol8Fd6HuhmmayR3AP/o39CHxwE0admuGrPwJusrlXOs=; b=orBMd2Wt4dhqnFvebfcnefFUF/
	oNxLFUmtfD8atvx5hFZCMqEB1y0k7KxE39UQvp2P2xeJw5GMTf2pKBHC5SP4GR33N6h+OnKn3i+Sw
	n4NEFGtlVSx0zDA/OX7mhCiDJ0H/skWus8UZ5MkyBYKzZCBB5+653Va0h++DmGmecX4w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYGu-0004JT-0b
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYGt-0002wJ-UW
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khYGt-0002wJ-UW@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 13:22:15 +0000

commit 5e4914e60da9a8dfdc00e839278f40c87525b8ae
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:13:29 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:13:29 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 031ed6ecbe..4c982f3db7 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -853,7 +853,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 13:22:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 13:22:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35968.67638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYH5-00005e-Gj; Tue, 24 Nov 2020 13:22:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35968.67638; Tue, 24 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYH5-00005V-Dc; Tue, 24 Nov 2020 13:22:27 +0000
Received: by outflank-mailman (input) for mailman id 35968;
 Tue, 24 Nov 2020 13:22: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 1khYH4-00005M-MQ
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22: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 1khYH4-0004Jd-KP
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khYH4-0002xd-JO
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22: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 1khYH4-00005M-MQ
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:26 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/2soxhMsblotPRYXV56K2fGNBLP2JUnpchCGkBsgIes=; b=rhbKAyMQcQfREJFuB5Mwcp66EG
	ge+mTkA2gp8xArzCbb1wMnpz7Paf4bVImnlq7YfpPmbx2XIWcE4nNG7e9eEx/Ge3hXERxnN278dLm
	4H3HQ1IyM/YeDYHRvx/yuUyFWm9CeuOtFXa+b7ndD6cThjfgkxPB45mZU//VcZAVsiyI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYH4-0004Jd-KP
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYH4-0002xd-JO
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khYH4-0002xd-JO@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 13:22:26 +0000

commit 660254422422f103e797f97545018a1fbc7548e7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:14:41 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:14:41 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index b352a30af6..8aea327df4 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -861,7 +861,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 13:22:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 13:22:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35969.67642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYHG-00006z-IE; Tue, 24 Nov 2020 13:22:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35969.67642; Tue, 24 Nov 2020 13:22: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYHG-00006r-FC; Tue, 24 Nov 2020 13:22:38 +0000
Received: by outflank-mailman (input) for mailman id 35969;
 Tue, 24 Nov 2020 13: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 1khYHF-00006j-9b
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13: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 1khYHF-0004Ju-8o
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khYHF-0002ye-6u
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13: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 1khYHF-00006j-9b
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:37 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Pi+/29kUi+1z4UdHkkyk3ClRAj9npt9sIIeCzVA0cbg=; b=XP2Q3SsqzPeS1aluHdjFjvxtou
	s1uYs5fHJVWB+Q9UpH/Rg0mhot/o+2nGUiQFIsh4bafOfB35PJK5YWiEPMOwnn8OawnKFXleRU22A
	+X0BMJGZ7H45dppCXs+nLu8OpylM5uIF1n6EKR7bEyHBZUbDGEEryuvigdyH3jDJBkyA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYHF-0004Ju-8o
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYHF-0002ye-6u
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.11] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khYHF-0002ye-6u@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 13:22:37 +0000

commit 62aed78b8e0cc6dcd99b80a528650ad0619b3909
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:16:08 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:16:08 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index a4cf496f24..aee4909b35 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -850,7 +850,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 13:22:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 13:22:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.35970.67646 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYHR-00008S-Jg; Tue, 24 Nov 2020 13:22:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 35970.67646; Tue, 24 Nov 2020 13:22:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khYHR-00008J-Gk; Tue, 24 Nov 2020 13:22:49 +0000
Received: by outflank-mailman (input) for mailman id 35970;
 Tue, 24 Nov 2020 13: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 1khYHP-000089-TR
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13: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 1khYHP-0004K2-SZ
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khYHP-0002zx-Rk
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13: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 1khYHP-000089-TR
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:47 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j9/Jtp5cIVWd0UBQYY0tUhDipR97mfAEYKW/BxfPha8=; b=sSXWiaWfTRZJYQ9Wczv3rwMWA3
	gpcKFuMrw1FjFtHcYfH0KBNPsE5iofHfosn7QIoQK557eIZ0/JlZRUahzr6816712xsDqSVd8rXhw
	ek1hlBSA1vwd3rP39/Z7ST5L/2QMoNxuBHskdKaL0X7/B5zaR2+3faKhW5qG6m4DTx20=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYHP-0004K2-SZ
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khYHP-0002zx-Rk
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 13:22:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.10] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khYHP-0002zx-Rk@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 13:22:47 +0000

commit 17ec9b43af072051edb1380a5eb459a382dcafa3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:17:37 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:17:37 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 08fc9252a3..b08c614e39 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -807,7 +807,7 @@ static int xenmem_add_to_physmap(struct domain *d,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Nov 24 23:55:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Nov 2020 23:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37068.69228 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khi9H-00052i-Aj; Tue, 24 Nov 2020 23:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37068.69228; Tue, 24 Nov 2020 23:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khi9H-00052a-7j; Tue, 24 Nov 2020 23:55:03 +0000
Received: by outflank-mailman (input) for mailman id 37068;
 Tue, 24 Nov 2020 23:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khi9G-00052U-Pq
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 23:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khi9G-0001WC-Ny
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 23:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khi9G-00066p-M3
 for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 23:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khi9G-00052U-Pq
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 23:55:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6TkhK4kS1NU8Hm8q+vLkzdbrYrd7LfLetIx6k5He2vw=; b=Ldd0bB3/vYRFFeFaBdXD0vZRtM
	c6MNY1Zx42lCL9ScA0LuVPCe3QzkA9wJF1lc2DP4FRWGAbCE3il0AfviRXqD4K8YCYG46S5rdatUG
	3SkREhlb37roXTedO1jkIcOejw3WmhPlz7DKYtBrMxsRPaT6v+TzdRnWx+KifyiBXOFE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khi9G-0001WC-Ny
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 23:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khi9G-00066p-M3
	for xen-changelog@lists.xenproject.org; Tue, 24 Nov 2020 23:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.10] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khi9G-00066p-M3@xenbits.xenproject.org>
Date: Tue, 24 Nov 2020 23:55:02 +0000

commit 17ec9b43af072051edb1380a5eb459a382dcafa3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:17:37 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:17:37 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 08fc9252a3..b08c614e39 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -807,7 +807,7 @@ static int xenmem_add_to_physmap(struct domain *d,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 06:33:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 06:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37314.69600 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khoMS-0006Ph-B5; Wed, 25 Nov 2020 06:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37314.69600; Wed, 25 Nov 2020 06: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khoMS-0006PZ-83; Wed, 25 Nov 2020 06:33:04 +0000
Received: by outflank-mailman (input) for mailman id 37314;
 Wed, 25 Nov 2020 06:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khoMQ-0006PU-F2
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 06:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khoMQ-00071c-B2
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 06:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khoMQ-00028y-8M
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 06:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khoMQ-0006PU-F2
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 06:33:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q2eHepO3+K3mzwTUQNFsIv+IdJlDpIuGAq60SVS6AGc=; b=sBtQSdCUd/N16Qv2FcaOnYsYWP
	qxUrkAKdyBB9Ce839m+EPeBstufovitspi5p/DWyK2KCVoCcrp1vzlwVdX3TTIkvcewUUvPayZ5Ka
	NrGBV/tnMga8oqQBUyCVenAarnqHBmYZQmoQsavsGzV4KSypi3Lr1TQZKdoW9YoRZThQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khoMQ-00071c-B2
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 06:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khoMQ-00028y-8M
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 06:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.11] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khoMQ-00028y-8M@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 06:33:02 +0000

commit 62aed78b8e0cc6dcd99b80a528650ad0619b3909
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:16:08 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:16:08 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index a4cf496f24..aee4909b35 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -850,7 +850,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 07:11:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 07:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37359.69671 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khoxD-00024T-Il; Wed, 25 Nov 2020 07:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37359.69671; Wed, 25 Nov 2020 07:11:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khoxD-00024L-Fu; Wed, 25 Nov 2020 07:11:03 +0000
Received: by outflank-mailman (input) for mailman id 37359;
 Wed, 25 Nov 2020 07: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 1khoxC-00024G-RC
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 07: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 1khoxC-0007nh-Mc
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 07:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khoxC-0006Lo-Kx
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 07: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 1khoxC-00024G-RC
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 07:11:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7BoO4KVua3MYcnjFAXvJdl2WDlPOrp22DG8BktUWSxo=; b=itJPIdZ+DqPPn4TOXf1uWZPKGm
	6GMNBvQGvLpqmAYiD1rYQEjMZECqxCyazbV8mK1Iy24k5BR+uV7xxatL6INgB+R4nC9o1nsi2HJMV
	D7WeMO8h9NuJ67UE/LGLut+Q78XUGDjpRYeDXZXucyTWfL6bTAbat+ow4qZxTMIXeFXM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khoxC-0007nh-Mc
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 07:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khoxC-0006Lo-Kx
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 07:11:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khoxC-0006Lo-Kx@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 07:11:02 +0000

commit 660254422422f103e797f97545018a1fbc7548e7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:14:41 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:14:41 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index b352a30af6..8aea327df4 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -861,7 +861,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 11:33:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 11:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37597.70037 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kht2o-0003Ap-S9; Wed, 25 Nov 2020 11:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37597.70037; Wed, 25 Nov 2020 11:33: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kht2o-0003Ah-PD; Wed, 25 Nov 2020 11:33:06 +0000
Received: by outflank-mailman (input) for mailman id 37597;
 Wed, 25 Nov 2020 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 1kht2n-0003Ac-MX
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 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 1kht2n-0005Sl-JW
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 11:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kht2n-0008As-I6
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 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 1kht2n-0003Ac-MX
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 11:33:05 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZwK2M4nbAMCFZ4O7nlBhf2/reHfKUStlERsio+72aoo=; b=wNyPu76ximKb7QNULLCrngZpxp
	YbuSEqVeUhwfQNse+yZWfTn09ci97fg58oGL+EDJPZ0ASqoLwK7AXQmCDrFhblcZ+ECK+VqKfNpkp
	UFdeSFoz9OKtocOHUmY5oZe63QHYnDonyFJ64IauntKCpfX2g2Yo5Lw6zvRlSdzo6Inc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kht2n-0005Sl-JW
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 11:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kht2n-0008As-I6
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 11:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Add workaround for Cortex-A55 erratum #1530923
Message-Id: <E1kht2n-0008As-I6@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 11:33:05 +0000

commit fd7479b9aec25885cc17d33b326b9babae59faee
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Nov 24 11:12:15 2020 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Nov 25 11:17:27 2020 +0000

    xen/arm: Add workaround for Cortex-A55 erratum #1530923
    
    On the Cortex A55, TLB entries can be allocated by a speculative AT
    instruction. If this is happening during a guest context switch with an
    inconsistent page table state in the guest, TLBs with wrong values might
    be allocated.
    The ARM64_WORKAROUND_AT_SPECULATE workaround is used as for erratum
    1165522 on Cortex A76 or Neoverse N1.
    
    This change is also introducing the MIDR identifier for the Cortex-A55.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/silicon-errata.txt | 1 +
 xen/arch/arm/cpuerrata.c         | 6 ++++++
 xen/include/asm-arm/processor.h  | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt
index d183ba543f..27bf957ebf 100644
--- a/docs/misc/arm/silicon-errata.txt
+++ b/docs/misc/arm/silicon-errata.txt
@@ -45,6 +45,7 @@ stable hypervisors.
 | ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319    |
 | ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
 | ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
+| ARM            | Cortex-A55      | #1530923        | N/A                     |
 | ARM            | Cortex-A57      | #852523         | N/A                     |
 | ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
 | ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220    |
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index cb4795beec..b398d480f1 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -514,6 +514,12 @@ static const struct arm_cpu_capabilities arm_errata[] = {
         .capability = ARM64_WORKAROUND_AT_SPECULATE,
         MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
     },
+    {
+        /* Cortex-A55 (All versions as erratum is open in SDEN v14) */
+        .desc = "ARM erratum 1530923",
+        .capability = ARM64_WORKAROUND_AT_SPECULATE,
+        MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
+    },
     {},
 };
 
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index d3d12a9d19..87c8136022 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -53,6 +53,7 @@
 #define ARM_CPU_PART_CORTEX_A17     0xC0E
 #define ARM_CPU_PART_CORTEX_A15     0xC0F
 #define ARM_CPU_PART_CORTEX_A53     0xD03
+#define ARM_CPU_PART_CORTEX_A55     0xD05
 #define ARM_CPU_PART_CORTEX_A57     0xD07
 #define ARM_CPU_PART_CORTEX_A72     0xD08
 #define ARM_CPU_PART_CORTEX_A73     0xD09
@@ -64,6 +65,7 @@
 #define MIDR_CORTEX_A17 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A17)
 #define MIDR_CORTEX_A15 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A15)
 #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)
+#define MIDR_CORTEX_A55 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A55)
 #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)
 #define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)
 #define MIDR_CORTEX_A73 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A73)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 12:44:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 12:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37759.70242 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khu9U-0002zO-Hg; Wed, 25 Nov 2020 12:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37759.70242; Wed, 25 Nov 2020 12:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khu9U-0002zH-Ef; Wed, 25 Nov 2020 12:44:04 +0000
Received: by outflank-mailman (input) for mailman id 37759;
 Wed, 25 Nov 2020 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 1khu9S-0002zB-MY
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 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 1khu9S-0006x7-IJ
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 12:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khu9S-0005P8-G0
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 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 1khu9S-0002zB-MY
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 12:44:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1WgSzD9oMbkKIaNivU31KZqYYd5aUO0eIQvnJbvIJHA=; b=pDxppYg+i6oW8iwN0yQxQe5rzd
	7YnPLEQ02PJM31/x2HLSPBDijnL0gUOdbZWOjh8ymDAM4SUNN+5zvVyUkWM16G1oGJipoNy/U4KKP
	CIWrafxhIwc6g4PkJXsFQHstw33eJlSVzcA05GV7qDOm9CpGqijC+d/VA/cGyX6vBQQ4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khu9S-0006x7-IJ
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 12:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khu9S-0005P8-G0
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 12:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khu9S-0005P8-G0@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 12:44:02 +0000

commit 5e4914e60da9a8dfdc00e839278f40c87525b8ae
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:13:29 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:13:29 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 031ed6ecbe..4c982f3db7 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -853,7 +853,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 13:11:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 13:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37769.70259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khuZd-0005fe-OV; Wed, 25 Nov 2020 13:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37769.70259; Wed, 25 Nov 2020 13:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khuZd-0005fW-Ka; Wed, 25 Nov 2020 13:11:05 +0000
Received: by outflank-mailman (input) for mailman id 37769;
 Wed, 25 Nov 2020 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 1khuZd-0005fR-4j
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 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 1khuZd-0007Vn-2V
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khuZd-0007c9-0n
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 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 1khuZd-0005fR-4j
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:05 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fb0jWIvv8CDO63BOSPwKNqFUAE4m/EGR/kt/4qZ1z9Y=; b=czdHJwajWFJ4aXDUe3mXbTrGdi
	TzQNB8Ac/3cog+VohGuC5MJgZzmg0oYO44t/bjMruwlm9oxhRQ/A9bYOfoM/d7v7wM4yUZ7AvZkge
	2OJjVOPCbkqN1xaSdyvKrq+/9hTiTMzPraGjj0VVluobDVVF1L6u7PviJMTjehCInJoE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuZd-0007Vn-2V
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuZd-0007c9-0n
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: fix uninstall rule for header files
Message-Id: <E1khuZd-0007c9-0n@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 13:11:05 +0000

commit 1e6d7bd585232c2526590a348871c40d5b384ac7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 25 14:05:52 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:05:52 2020 +0100

    tools/libs: fix uninstall rule for header files
    
    This again was working right only as long as $(LIBHEADER) consisted of
    just one entry.
    
    Fixes: bc44e2fb3199 ("tools: add a copy of library headers in tools/include")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index b0e785b380..0b3381755a 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -104,7 +104,7 @@ install: build
 .PHONY: uninstall
 uninstall:
 	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/$(LIB_FILE_NAME).pc
-	for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$(LIBHEADER); done
+	for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$$i; done
 	rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so
 	rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 13:11:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 13:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37770.70263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khuZn-0005gU-PU; Wed, 25 Nov 2020 13:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37770.70263; Wed, 25 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khuZn-0005gK-M8; Wed, 25 Nov 2020 13:11:15 +0000
Received: by outflank-mailman (input) for mailman id 37770;
 Wed, 25 Nov 2020 13: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 1khuZn-0005gE-9d
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13: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 1khuZn-0007Vy-7z
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khuZn-0007dA-4r
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13: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 1khuZn-0005gE-9d
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:15 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kgDsBdwmArBwMNK+Gt6foQMt0Yhw3Wg0PeCI11hzMjY=; b=cwthkIBCH/BykpiNfDBWHIUJqC
	pr7NUO3O9l3NwD8PaSOwo9nX+yF/Wt1D1LQ8CKx9Lu+iq1d1QpO8o8ShqgucqaO+AJxdDx8pFLSHO
	bCkSc8act9aA5vDLiEXVjdO2K+toN+iI/FJvBhbnqRVsNXB8VrxarQa4pFJUywimTGJw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuZn-0007Vy-7z
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuZn-0007dA-4r
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/include: import sizeof_field() macro from Linux stddef.h
Message-Id: <E1khuZn-0007dA-4r@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 13:11:15 +0000

commit 758fae24d7b90fcfa7dffbffb5a5cab274caf3fc
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Nov 25 14:06:27 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:06:27 2020 +0100

    xen/include: import sizeof_field() macro from Linux stddef.h
    
    Co-locate it with the definition of offsetof() (since this is also in stddef.h
    in the Linux kernel source). This macro will be needed in a subsequent patch.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/compiler.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index c0e0ee9f27..676c6ea1b0 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -76,6 +76,14 @@
 
 #define offsetof(a,b) __builtin_offsetof(a,b)
 
+/**
+ * sizeof_field(TYPE, MEMBER)
+ *
+ * @TYPE: The structure containing the field of interest
+ * @MEMBER: The field to return the size of
+ */
+#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
+
 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
 #define alignof __alignof__
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 13:11:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 13:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37771.70268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khuZx-0005hq-RQ; Wed, 25 Nov 2020 13:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37771.70268; Wed, 25 Nov 2020 13: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khuZx-0005hg-Nc; Wed, 25 Nov 2020 13:11:25 +0000
Received: by outflank-mailman (input) for mailman id 37771;
 Wed, 25 Nov 2020 13: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 1khuZx-0005hZ-D0
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13: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 1khuZx-0007W5-C5
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khuZx-0007dl-Ab
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13: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 1khuZx-0005hZ-D0
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:25 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f4uZhFTl1PW+pfIYwf6Sc3n2Q8oJbb17SUSNa6gK1TQ=; b=t5C86EGG7lEL+sQIcE4IQAymC5
	Pq/gOgxWMgkY4ArfOa0ucQkVVM+NGOuYk9aUnOb/EoY5OoA7/AWfmSDv5DJ796pnhF9bkCJhjXjQq
	hQ6D0ZtqAPhEQZxf2nCo8qijyaC3VwD5GLHgPJeXiaQQUVgJAx8MzLs08y9Vre/2X5Mk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuZx-0007W5-C5
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuZx-0007dl-Ab
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: replace open-coded occurrences of sizeof_field()...
Message-Id: <E1khuZx-0007dl-Ab@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 13:11:25 +0000

commit 8041317f72f684ee4e64209c0dd4a8b7ea200e0b
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Nov 25 14:06:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:06:42 2020 +0100

    x86: replace open-coded occurrences of sizeof_field()...
    
    ... with macro evaluations, now that it is available.
    
    A recent patch imported the sizeof_field() macro from Linux. This patch makes
    use of it in places where the construct is currently open-coded.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/vpmu_intel.c |  4 ++--
 xen/arch/x86/setup.c          | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 75aa11c6ad..6e97ce7900 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -90,8 +90,8 @@ static uint64_t __read_mostly global_ovf_ctrl_mask, global_ctrl_mask;
 static unsigned int __read_mostly regs_sz;
 /* Offset into context of the beginning of PMU register block */
 static const unsigned int regs_off =
-        sizeof(((struct xen_pmu_intel_ctxt *)0)->fixed_counters) +
-        sizeof(((struct xen_pmu_intel_ctxt *)0)->arch_counters);
+    sizeof_field(struct xen_pmu_intel_ctxt, fixed_counters) +
+    sizeof_field(struct xen_pmu_intel_ctxt, arch_counters);
 
 /*
  * QUIRK to workaround an issue on various family 6 cpus.
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 44c04e2735..30d6f375a3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1617,19 +1617,19 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     total_pages = nr_pages;
 
     /* Sanity check for unwanted bloat of certain hypercall structures. */
-    BUILD_BUG_ON(sizeof(((struct xen_platform_op *)0)->u) !=
-                 sizeof(((struct xen_platform_op *)0)->u.pad));
-    BUILD_BUG_ON(sizeof(((struct xen_domctl *)0)->u) !=
-                 sizeof(((struct xen_domctl *)0)->u.pad));
-    BUILD_BUG_ON(sizeof(((struct xen_sysctl *)0)->u) !=
-                 sizeof(((struct xen_sysctl *)0)->u.pad));
+    BUILD_BUG_ON(sizeof_field(struct xen_platform_op, u) !=
+                 sizeof_field(struct xen_platform_op, u.pad));
+    BUILD_BUG_ON(sizeof_field(struct xen_domctl, u) !=
+                 sizeof_field(struct xen_domctl, u.pad));
+    BUILD_BUG_ON(sizeof_field(struct xen_sysctl, u) !=
+                 sizeof_field(struct xen_sysctl, u.pad));
 
     BUILD_BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct vcpu_info) != 64);
 
-    BUILD_BUG_ON(sizeof(((struct compat_platform_op *)0)->u) !=
-                 sizeof(((struct compat_platform_op *)0)->u.pad));
+    BUILD_BUG_ON(sizeof_field(struct compat_platform_op, u) !=
+                 sizeof_field(struct compat_platform_op, u.pad));
     BUILD_BUG_ON(sizeof(start_info_compat_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct compat_vcpu_info) != 64);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 13:11:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 13:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37772.70270 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khua8-0005jO-SE; Wed, 25 Nov 2020 13:11:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37772.70270; Wed, 25 Nov 2020 13:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khua8-0005jG-P6; Wed, 25 Nov 2020 13:11:36 +0000
Received: by outflank-mailman (input) for mailman id 37772;
 Wed, 25 Nov 2020 13:11:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khua7-0005j7-HU
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khua7-0007Wx-Fq
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khua7-0007eT-Ec
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khua7-0005j7-HU
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:35 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/YRx9AeCrYqHy85f2qzv+hNH4eQhT80fb+/FWCyQkHA=; b=MQKOWK/jASp5n3LNxKDXbEIEcw
	bnheIRVXTBo+PzhEzFJ9bfV3s9AQ7Y0vxnXMWrM01UmIeJrsXMw2hVU/mukG1FeRIdMQwlRdBlGDj
	MR2xdtQ/1SUMIQIPyLK6j6tihQpiW52TaPBXy6sVxdXVCPmc3AFmaVL+dDhtPCOJydCY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khua7-0007Wx-Fq
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khua7-0007eT-Ec
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] mm: check for truncation in vmalloc_type()
Message-Id: <E1khua7-0007eT-Ec@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 13:11:35 +0000

commit 500516fcb9e1c09eae9bbbd3b30bb294c6993853
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 25 14:07:36 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:07:36 2020 +0100

    mm: check for truncation in vmalloc_type()
    
    While it's currently implied from the checking xmalloc_array() does,
    let's make this more explicit in the function itself. As a result both
    involved local variables don't need to have size_t type anymore. This
    brings them in line with the rest of the code in this file.
    
    Requested-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/vmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index faebc1ddf1..4fd6b3067e 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -242,13 +242,15 @@ void vunmap(const void *va)
 static void *vmalloc_type(size_t size, enum vmap_region type)
 {
     mfn_t *mfn;
-    size_t pages, i;
+    unsigned int i, pages = PFN_UP(size);
     struct page_info *pg;
     void *va;
 
     ASSERT(size);
 
-    pages = PFN_UP(size);
+    if ( PFN_DOWN(size) > pages )
+        return NULL;
+
     mfn = xmalloc_array(mfn_t, pages);
     if ( mfn == NULL )
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 13:11:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 13:11:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37773.70274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khuaI-0005l9-Tf; Wed, 25 Nov 2020 13:11:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37773.70274; Wed, 25 Nov 2020 13:11: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khuaI-0005l1-Ql; Wed, 25 Nov 2020 13:11:46 +0000
Received: by outflank-mailman (input) for mailman id 37773;
 Wed, 25 Nov 2020 13:11:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khuaH-0005kt-KO
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khuaH-0007YX-JA
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khuaH-0007fC-IM
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuaH-0005kt-KO
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:45 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+e8I9fZIdoLrzDrniISZqjMy2A0qC6/qmlXElLxBGQM=; b=1VOWMzysaHyTStQ7jKQUEEbWz3
	AeEVtm17GNrrSXqms1aWm1WXEbI0qfF/U6W261RMEGQFUjI2G4JHcqClXnnZyvtDqSt/YTlTM2gOc
	NBDAyd7mC8tJiTew6ROjt9ZEjZpUU9oJJ/h1N9daHdGFTrn167/FEv9WFneMLEGazT7A=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuaH-0007YX-JA
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khuaH-0007fC-IM
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 13:11:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] evtchn: double per-channel locking can't hit identical channels
Message-Id: <E1khuaH-0007fC-IM@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 13:11:45 +0000

commit 181f2c224ccd0a2900d6ae94ec390a546731f593
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 25 14:08:14 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:08:14 2020 +0100

    evtchn: double per-channel locking can't hit identical channels
    
    Inter-domain channels can't possibly be bound to themselves, there's
    always a 2nd channel involved, even when this is a loopback into the
    same domain. As a result we can drop one conditional each from the two
    involved functions.
    
    With this, the number of evtchn_write_lock() invocations can also be
    shrunk by half, swapping the two incoming function arguments instead.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/event_channel.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 54b2e2550e..dbfba62a49 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -326,23 +326,18 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
 
 static void double_evtchn_lock(struct evtchn *lchn, struct evtchn *rchn)
 {
-    if ( lchn <= rchn )
-    {
-        evtchn_write_lock(lchn);
-        if ( lchn != rchn )
-            evtchn_write_lock(rchn);
-    }
-    else
-    {
-        evtchn_write_lock(rchn);
-        evtchn_write_lock(lchn);
-    }
+    ASSERT(lchn != rchn);
+
+    if ( lchn > rchn )
+        SWAP(lchn, rchn);
+
+    evtchn_write_lock(lchn);
+    evtchn_write_lock(rchn);
 }
 
 static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn)
 {
-    if ( lchn != rchn )
-        evtchn_write_unlock(lchn);
+    evtchn_write_unlock(lchn);
     evtchn_write_unlock(rchn);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 16:33:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 16:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.37913.70479 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khxj5-0000SO-Go; Wed, 25 Nov 2020 16:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 37913.70479; Wed, 25 Nov 2020 16:33:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1khxj5-0000SF-Dh; Wed, 25 Nov 2020 16:33:03 +0000
Received: by outflank-mailman (input) for mailman id 37913;
 Wed, 25 Nov 2020 16: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 1khxj4-0000SA-1s
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 16: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 1khxj3-0003sA-Ur
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 16:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1khxj3-0006es-SW
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 16:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khxj4-0000SA-1s
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 16:33:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mfk0W3YgQNKqsAJ0LFawXkw/wiAmt0ccftdEKvrhRPM=; b=wyT2wZognJB+yjseTVVKQWsN4u
	zAF0yvvZ8gsyQbzRYDUXlUzxRu73WFb3W6yE0NjH9nADAgvI8T8nptRnbkmZVJkwiFT35YJjEtvII
	oR02HnnwEEYU9hCYeG/t9/OA8zePmND/eoR5AGvEWRu+Pf+q/Rn45WDlHQi7haHqgw6s=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khxj3-0003sA-Ur
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 16:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1khxj3-0006es-SW
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 16:33:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] memory: fix off-by-one in XSA-346 change
Message-Id: <E1khxj3-0006es-SW@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 16:33:01 +0000

commit 0057b1f8fa79abe8272690341db54b064c8f2b7f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:11:47 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:11:47 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 9b156bcc3ffcc7949edd4460b718a241e87ae302
    master date: 2020-11-24 14:01:31 +0100
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 7075e233aa..5c5075ae41 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -854,7 +854,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 23:33:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 23:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38169.70843 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4HZ-000782-KH; Wed, 25 Nov 2020 23:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38169.70843; Wed, 25 Nov 2020 23: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4HZ-00077u-HN; Wed, 25 Nov 2020 23:33:05 +0000
Received: by outflank-mailman (input) for mailman id 38169;
 Wed, 25 Nov 2020 23:33:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4HX-00077p-GT
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4HX-0004Ds-1H
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4HW-00071p-V7
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 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 1ki4HX-00077p-GT
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:03 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FP+2JxdiheIDnEsgbcxJjUOeNJDlCvcKkOtRcip5GNs=; b=izr9GZNXkSdEdb3EQsEz8dDePs
	hyPovo0rUQiKxiEgTH5+MCpipfKoMoVjI1cu1ZVV3WB58/jraRvaUf5qYYRkFwhJWZM5rtSDRdmfR
	5tlxpBT7mCek0/rnipvUTbBzhUkxz0U1SGytuGUwNrFtA5nQ69gttPwlvt/Wja5TgggY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4HX-0004Ds-1H
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4HW-00071p-V7
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/events: access last_priority and last_vcpu_id together
Message-Id: <E1ki4HW-00071p-V7@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 23:33:02 +0000

commit 1277cb9dc5e966f1faf665bcded02b7533e38078
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Nov 24 11:23:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:23:42 2020 +0100

    xen/events: access last_priority and last_vcpu_id together
    
    The queue for a fifo event is depending on the vcpu_id and the
    priority of the event. When sending an event it might happen the
    event needs to change queues and the old queue needs to be kept for
    keeping the links between queue elements intact. For this purpose
    the event channel contains last_priority and last_vcpu_id values
    elements for being able to identify the old queue.
    
    In order to avoid races always access last_priority and last_vcpu_id
    with a single atomic operation avoiding any inconsistencies.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/event_fifo.c | 25 +++++++++++++++++++------
 xen/include/xen/sched.h |  3 +--
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
index c6e58d2a1a..79090c04ca 100644
--- a/xen/common/event_fifo.c
+++ b/xen/common/event_fifo.c
@@ -42,6 +42,14 @@ struct evtchn_fifo_domain {
     unsigned int num_evtchns;
 };
 
+union evtchn_fifo_lastq {
+    uint32_t raw;
+    struct {
+        uint8_t last_priority;
+        uint16_t last_vcpu_id;
+    };
+};
+
 static inline event_word_t *evtchn_fifo_word_from_port(const struct domain *d,
                                                        unsigned int port)
 {
@@ -86,16 +94,18 @@ static struct evtchn_fifo_queue *lock_old_queue(const struct domain *d,
     struct vcpu *v;
     struct evtchn_fifo_queue *q, *old_q;
     unsigned int try;
+    union evtchn_fifo_lastq lastq;
 
     for ( try = 0; try < 3; try++ )
     {
-        v = d->vcpu[evtchn->last_vcpu_id];
-        old_q = &v->evtchn_fifo->queue[evtchn->last_priority];
+        lastq.raw = read_atomic(&evtchn->fifo_lastq);
+        v = d->vcpu[lastq.last_vcpu_id];
+        old_q = &v->evtchn_fifo->queue[lastq.last_priority];
 
         spin_lock_irqsave(&old_q->lock, *flags);
 
-        v = d->vcpu[evtchn->last_vcpu_id];
-        q = &v->evtchn_fifo->queue[evtchn->last_priority];
+        v = d->vcpu[lastq.last_vcpu_id];
+        q = &v->evtchn_fifo->queue[lastq.last_priority];
 
         if ( old_q == q )
             return old_q;
@@ -246,8 +256,11 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
         /* Moved to a different queue? */
         if ( old_q != q )
         {
-            evtchn->last_vcpu_id = v->vcpu_id;
-            evtchn->last_priority = q->priority;
+            union evtchn_fifo_lastq lastq = { };
+
+            lastq.last_vcpu_id = v->vcpu_id;
+            lastq.last_priority = q->priority;
+            write_atomic(&evtchn->fifo_lastq, lastq.raw);
 
             spin_unlock_irqrestore(&old_q->lock, flags);
             spin_lock_irqsave(&q->lock, flags);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 7251b3ae3e..a345cc01f8 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -117,8 +117,7 @@ struct evtchn
 #ifndef NDEBUG
     u8 old_state;      /* State when taking lock in write mode. */
 #endif
-    u8 last_priority;
-    u16 last_vcpu_id;
+    u32 fifo_lastq;    /* Data for fifo events identifying last queue. */
 #ifdef CONFIG_XSM
     union {
 #ifdef XSM_NEED_GENERIC_EVTCHN_SSID
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 23:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 23:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38170.70847 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4Hi-0007B2-N4; Wed, 25 Nov 2020 23:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38170.70847; Wed, 25 Nov 2020 23: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4Hi-0007Au-Jv; Wed, 25 Nov 2020 23:33:14 +0000
Received: by outflank-mailman (input) for mailman id 38170;
 Wed, 25 Nov 2020 23:33:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4Hh-0007Ai-6c
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4Hh-0004Dy-5e
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4Hh-00072b-43
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4Hh-0007Ai-6c
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:13 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PQX1WoM5L5gEFJRMs2E+8he111VJjHOG0JXE95M8kQY=; b=fqDHatGhzQ1cjdBHJEohOxAt1p
	K3PH28iwC1qo2/tpgeFBXM+o39vZO/FTkzMamMLX4k4KImXJpEd7/TFB2g1cW2bq/yxNrxW26ndBj
	hX/h+4Y4meWKzqEL4BZl3yjHtxSyqQjSVNNMeMroliSEvmoYY2H6/rFVa+IPlRynMePw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4Hh-0004Dy-5e
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4Hh-00072b-43
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/DMI: fix SMBIOS pointer range check
Message-Id: <E1ki4Hh-00072b-43@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 23:33:13 +0000

commit 6befe598706218673b14710d90d00ce90763b372
Author:     Jan Beulich <JBeulich@suse.com>
AuthorDate: Tue Nov 24 11:25:29 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:25:29 2020 +0100

    x86/DMI: fix SMBIOS pointer range check
    
    Forever since its introduction this has been using an inverted relation
    operator.
    
    Fixes: 54057a28f22b ("x86: support SMBIOS v3")
    Signed-off-by: Jan Beulich <JBeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/dmi_scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index d24da1c53a..e5930d27ea 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -357,7 +357,7 @@ static int __init dmi_iterate(void (*decode)(struct dmi_header *))
 			memcpy_fromio(&smbios3, q, sizeof(smbios3));
 			if (memcmp(smbios3.anchor, "_SM3_", 5) ||
 			    smbios3.length < sizeof(smbios3) ||
-			    q < p + 0x10000 - smbios3.length ||
+			    q > p + 0x10000 - smbios3.length ||
 			    !dmi_checksum(q, smbios3.length))
 				smbios3.length = 0;
 		}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 23:33:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 23:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38171.70850 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4Hs-0007CE-OZ; Wed, 25 Nov 2020 23:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38171.70850; Wed, 25 Nov 2020 23:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4Hs-0007C6-Lf; Wed, 25 Nov 2020 23:33:24 +0000
Received: by outflank-mailman (input) for mailman id 38171;
 Wed, 25 Nov 2020 23:33:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4Hr-0007Bn-AI
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4Hr-0004EB-9S
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4Hr-000739-8P
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4Hr-0007Bn-AI
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:23 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kMoS2LWf5K7nuWHLaWE5MsfYlwxezUqqpmc2ivuor7Y=; b=rwSfbbLWUnms8Yv7IHoMs0rkB/
	J6x4v0yMU0nWmX+BO+7DKMFS2ytKnhCAntkgn1xuMiqbcwd6yX+9V/Wrq5SmZTEvv/5ZkU64C0yho
	NznO1NWW9T26ZyYbu4OlGBsgYB2QmIHIIlWtVCyAKR09nHHqwF5yg1JzUePK64DRiu/c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4Hr-0004EB-9S
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4Hr-000739-8P
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ACPI: fix mapping of FACS
Message-Id: <E1ki4Hr-000739-8P@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 23:33:23 +0000

commit 8b6d55c1261820bb9db8d867ce9ee77397d05203
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:26:02 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:26:02 2020 +0100

    x86/ACPI: fix mapping of FACS
    
    acpi_fadt_parse_sleep_info() runs when the system is already in
    SYS_STATE_boot. Hence its direct call to __acpi_map_table() won't work
    anymore. This call should probably have been replaced long ago already,
    as the layering violation hasn't been necessary for quite some time.
    
    Fixes: 1c4aa69ca1e1 ("xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/acpi/boot.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index ed40ce56b4..cecb414681 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -422,8 +422,7 @@ acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
 	if (!facs_pa)
 		goto bad;
 
-	facs = (struct acpi_table_facs *)
-		__acpi_map_table(facs_pa, sizeof(struct acpi_table_facs));
+	facs = acpi_os_map_memory(facs_pa, sizeof(*facs));
 	if (!facs)
 		goto bad;
 
@@ -448,11 +447,16 @@ acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
 		offsetof(struct acpi_table_facs, firmware_waking_vector);
 	acpi_sinfo.vector_width = 32;
 
+	acpi_os_unmap_memory(facs, sizeof(*facs));
+
 	printk(KERN_INFO PREFIX
 	       "            wakeup_vec[%"PRIx64"], vec_size[%x]\n",
 	       acpi_sinfo.wakeup_vector, acpi_sinfo.vector_width);
 	return;
-bad:
+
+ bad:
+	if (facs)
+		acpi_os_unmap_memory(facs, sizeof(*facs));
 	memset(&acpi_sinfo, 0,
 	       offsetof(struct acpi_sleep_info, sleep_control));
 	memset(&acpi_sinfo.sleep_status + 1, 0,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 23:33:33 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 23:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38172.70855 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4I1-0007Ds-Qg; Wed, 25 Nov 2020 23:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38172.70855; Wed, 25 Nov 2020 23:33:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4I1-0007Di-NN; Wed, 25 Nov 2020 23:33:33 +0000
Received: by outflank-mailman (input) for mailman id 38172;
 Wed, 25 Nov 2020 23:33:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4I1-0007Dd-Gr
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4I1-0004EM-EQ
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4I1-00073m-CL
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4I1-0007Dd-Gr
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:33 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MFlAvxuCA9SzuBakuPQcElOYiOxS151f5lRiHEHV0/U=; b=CzOlKP+UUFzkRdBIrCS4StWkPh
	FYsy+TrPolI+lJnR+5QHsy+HKLo41eUAYAW11D4uRxIbrZIUqvTW0IwySygE2tFXCo3ysASKg3/rH
	hKkDuYB1pAJXOIVHLOLcwtjAdMWVtsJ3S/sdiPtqBJ0megnQfVlvprvdJ3qNIPwIz46o=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4I1-0004EM-EQ
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4I1-00073m-CL
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/DMI: fix table mapping when one lives above 1Mb
Message-Id: <E1ki4I1-00073m-CL@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 23:33:33 +0000

commit f390941a92f102ebbbbce1b54be206a602187fd7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:26:34 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:26:34 2020 +0100

    x86/DMI: fix table mapping when one lives above 1Mb
    
    Use of __acpi_map_table() is kind of an abuse here, and doesn't work
    anymore for the majority of cases if any of the tables lives outside the
    low first Mb. Keep this (ab)use only prior to reaching SYS_STATE_boot,
    primarily to avoid needing to audit whether any of the calls here can
    happen this early in the first place; quite likely this isn't necessary
    at all - at least dmi_scan_machine() gets called late enough.
    
    For the "normal" case, call __vmap() directly, despite effectively
    duplicating acpi_os_map_memory(). There's one difference though: We
    shouldn't need to establish UC- mappings, WP or r/o WB mappings ought to
    be fine, as the tables are going to live in either RAM or ROM. Short of
    having PAGE_HYPERVISOR_WP and wanting to map the tables r/o anyway, use
    the latter of the two options. The r/o mapping implies some
    constification of code elsewhere in the file. For code touched anyway
    also switch to void (where possible) or uint8_t.
    
    Fixes: 1c4aa69ca1e1 ("xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/dmi_scan.c | 53 ++++++++++++++++++++++++++++++++++---------------
 1 file changed, 37 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index e5930d27ea..d27cd3450a 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -12,8 +12,6 @@
 #include <xen/pci.h>
 #include <xen/pci_regs.h>
 
-#define bt_ioremap(b,l)  ((void *)__acpi_map_table(b,l))
-#define bt_iounmap(b,l)  ((void)0)
 #define memcpy_fromio    memcpy
 #define alloc_bootmem(l) xmalloc_bytes(l)
 
@@ -111,9 +109,32 @@ enum dmi_entry_type {
 #define dmi_printk(x)
 #endif
 
-static char * __init dmi_string(struct dmi_header *dm, u8 s)
+static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
-	char *bp=(char *)dm;
+    mfn_t mfn = _mfn(PFN_DOWN(addr));
+    unsigned int offs = PAGE_OFFSET(addr);
+
+    if ( addr + len <= MB(1) )
+        return __va(addr);
+
+    if ( system_state < SYS_STATE_boot )
+        return __acpi_map_table(addr, len);
+
+    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                  VMAP_DEFAULT) + offs;
+}
+
+static void __init bt_iounmap(const void *ptr, unsigned int len)
+{
+    if ( (unsigned long)ptr < DIRECTMAP_VIRT_START &&
+         system_state >= SYS_STATE_boot )
+        vunmap(ptr);
+}
+
+static const char *__init dmi_string(const struct dmi_header *dm, uint8_t s)
+{
+	const char *bp = (const void *)dm;
+
 	bp+=dm->length;
 	if(!s)
 		return "";
@@ -133,11 +154,10 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s)
  */
  
 static int __init dmi_table(paddr_t base, u32 len, int num,
-			    void (*decode)(struct dmi_header *))
+			    void (*decode)(const struct dmi_header *))
 {
-	u8 *buf;
-	struct dmi_header *dm;
-	u8 *data;
+	const uint8_t *buf, *data;
+	const struct dmi_header *dm;
 	int i=0;
 		
 	buf = bt_ioremap(base, len);
@@ -301,7 +321,7 @@ typedef union {
 
 static int __init _dmi_iterate(const struct dmi_eps *dmi,
 			       const smbios_eps_u smbios,
-			       void (*decode)(struct dmi_header *))
+			       void (*decode)(const struct dmi_header *))
 {
 	int num;
 	u32 len;
@@ -335,7 +355,7 @@ static int __init _dmi_iterate(const struct dmi_eps *dmi,
 	return dmi_table(base, len, num, decode);
 }
 
-static int __init dmi_iterate(void (*decode)(struct dmi_header *))
+static int __init dmi_iterate(void (*decode)(const struct dmi_header *))
 {
 	struct dmi_eps dmi;
 	struct smbios3_eps smbios3;
@@ -370,7 +390,7 @@ static int __init dmi_iterate(void (*decode)(struct dmi_header *))
 	return -1;
 }
 
-static int __init dmi_efi_iterate(void (*decode)(struct dmi_header *))
+static int __init dmi_efi_iterate(void (*decode)(const struct dmi_header *))
 {
 	int ret = -1;
 
@@ -433,10 +453,11 @@ static char *__initdata dmi_ident[DMI_STRING_MAX];
  *	Save a DMI string
  */
  
-static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
+static void __init dmi_save_ident(const struct dmi_header *dm, int slot, int string)
 {
-	char *d = (char*)dm;
-	char *p = dmi_string(dm, d[string]);
+	const char *d = (const void *)dm;
+	const char *p = dmi_string(dm, d[string]);
+
 	if(p==NULL || *p == 0)
 		return;
 	if (dmi_ident[slot])
@@ -629,10 +650,10 @@ static const struct dmi_blacklist __initconstrel dmi_blacklist[] = {
  *	out of here.
  */
 
-static void __init dmi_decode(struct dmi_header *dm)
+static void __init dmi_decode(const struct dmi_header *dm)
 {
 #ifdef DMI_DEBUG
-	u8 *data = (u8 *)dm;
+	const uint8_t *data = (const void *)dm;
 #endif
 	
 	switch(dm->type)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 23:33:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 23:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38173.70859 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4IC-0007FM-SS; Wed, 25 Nov 2020 23:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38173.70859; Wed, 25 Nov 2020 23:33:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4IC-0007FD-P6; Wed, 25 Nov 2020 23:33:44 +0000
Received: by outflank-mailman (input) for mailman id 38173;
 Wed, 25 Nov 2020 23:33:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IB-0007F4-JC
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IB-0004ET-IH
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IB-000759-HJ
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IB-0007F4-JC
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:43 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zVMiIpnrXcPXO7H3Dox4+87e0P0XONe3f5TyyBMTetE=; b=O8lWdNSC9bGWD6cfTzb6ylm55I
	IyukjCJd/5I5Qw3TyPK19Gh0sX5s835r9FQNDDmn8kLYuxTrdHCEQ42hU5GGDfvV4PxoPJf+ql4UB
	k75kjXHhR5J5LNckjOO5DVw14HGA9YUTWNrG+PO/Nb99ASn8/BWza90mxaltcW+jWSvY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IB-0004ET-IH
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IB-000759-HJ
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ns16550: move PCI arrays next to the function using them
Message-Id: <E1ki4IB-000759-HJ@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 23:33:43 +0000

commit 510cdda6865868080f898543fc44044020efca71
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:27:49 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:27:49 2020 +0100

    ns16550: move PCI arrays next to the function using them
    
    Pure code motion; no functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/char/ns16550.c | 1247 ++++++++++++++++++++++----------------------
 1 file changed, 625 insertions(+), 622 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index d8b52eb813..6f7fad6093 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -153,418 +153,112 @@ struct ns16550_config_param {
     unsigned int uart_offset;
     unsigned int first_offset;
 };
+#endif
 
-/*
- * Create lookup tables for specific devices. It is assumed that if
- * the device found is MMIO, then you have indexed it here. Else, the
- * driver does nothing for MMIO based devices.
- */
-static const struct ns16550_config_param __initconst uart_param[] = {
-    [param_default] = {
-        .reg_width = 1,
-        .lsr_mask = UART_LSR_THRE,
-        .max_ports = 1,
-    },
-    [param_trumanage] = {
-        .reg_shift = 2,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = (UART_LSR_THRE | UART_LSR_TEMT),
-        .mmio = 1,
-        .max_ports = 1,
-    },
-    [param_oxford] = {
-        .base_baud = 4000000,
-        .uart_offset = 0x200,
-        .first_offset = 0x1000,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .mmio = 1,
-        .max_ports = 1, /* It can do more, but we would need more custom code.*/
-    },
-    [param_oxford_2port] = {
-        .base_baud = 4000000,
-        .uart_offset = 0x200,
-        .first_offset = 0x1000,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .mmio = 1,
-        .max_ports = 2,
-    },
-    [param_pericom_1port] = {
-        .base_baud = 921600,
-        .uart_offset = 8,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .bar0 = 1,
-        .max_ports = 1,
-    },
-    [param_pericom_2port] = {
-        .base_baud = 921600,
-        .uart_offset = 8,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .bar0 = 1,
-        .max_ports = 2,
-    },
-    /*
-     * Of the two following ones, we can't really use all of their ports,
-     * unless ns16550_com[] would get grown.
-     */
-    [param_pericom_4port] = {
-        .base_baud = 921600,
-        .uart_offset = 8,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .bar0 = 1,
-        .max_ports = 4,
-    },
-    [param_pericom_8port] = {
-        .base_baud = 921600,
-        .uart_offset = 8,
-        .reg_width = 1,
-        .fifo_size = 16,
-        .lsr_mask = UART_LSR_THRE,
-        .bar0 = 1,
-        .max_ports = 8,
-    }
-};
-static const struct ns16550_config __initconst uart_config[] =
+static void ns16550_delayed_resume(void *data);
+
+static u8 ns_read_reg(struct ns16550 *uart, unsigned int reg)
 {
-    /* Broadcom TruManage device */
-    {
-        .vendor_id = PCI_VENDOR_ID_BROADCOM,
-        .dev_id = 0x160a,
-        .param = param_trumanage,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc11b,
-        .param = param_oxford,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc11f,
-        .param = param_oxford,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc138,
-        .param = param_oxford,
-    },
-    /* OXPCIe952 2 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc158,
-        .param = param_oxford_2port,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc13d,
-        .param = param_oxford,
-    },
-    /* OXPCIe952 2 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc15d,
-        .param = param_oxford_2port,
-    },
-    /* OXPCIe952 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc40b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc40f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
+    void __iomem *addr = uart->remapped_io_base + (reg << uart->reg_shift);
+#ifdef CONFIG_HAS_IOPORTS
+    if ( uart->remapped_io_base == NULL )
+        return inb(uart->io_base + reg);
+#endif
+    switch ( uart->reg_width )
     {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc41b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
+    case 1:
+        return readb(addr);
+    case 4:
+        return readl(addr);
+    default:
+        return 0xff;
+    }
+}
+
+static void ns_write_reg(struct ns16550 *uart, unsigned int reg, u8 c)
+{
+    void __iomem *addr = uart->remapped_io_base + (reg << uart->reg_shift);
+#ifdef CONFIG_HAS_IOPORTS
+    if ( uart->remapped_io_base == NULL )
+        return outb(c, uart->io_base + reg);
+#endif
+    switch ( uart->reg_width )
     {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc41f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
+    case 1:
+        writeb(c, addr);
+        break;
+    case 4:
+        writel(c, addr);
+        break;
+    default:
+        /* Ignored */
+        break;
+    }
+}
+
+static int ns16550_ioport_invalid(struct ns16550 *uart)
+{
+    return ns_read_reg(uart, UART_IER) == 0xff;
+}
+
+static void handle_dw_usr_busy_quirk(struct ns16550 *uart)
+{
+    if ( uart->dw_usr_bsy &&
+         (ns_read_reg(uart, UART_IIR) & UART_IIR_BSY) == UART_IIR_BSY )
     {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc42b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
+        /* DesignWare 8250 detects if LCR is written while the UART is
+         * busy and raises a "busy detect" interrupt. Read the UART
+         * Status Register to clear this state.
+         *
+         * Allwinner/sunxi UART hardware is similar to DesignWare 8250
+         * and also contains a "busy detect" interrupt. So this quirk
+         * fix will also be used for Allwinner UART.
+         */
+        ns_read_reg(uart, UART_USR);
+    }
+}
+
+static void ns16550_interrupt(
+    int irq, void *dev_id, struct cpu_user_regs *regs)
+{
+    struct serial_port *port = dev_id;
+    struct ns16550 *uart = port->uart;
+
+    uart->intr_works = 1;
+
+    while ( !(ns_read_reg(uart, UART_IIR) & UART_IIR_NOINT) )
     {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc42f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc43b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc43f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc44b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc44f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc45b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc45f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc46b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc46f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc47b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc47f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc48b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc48f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc49b,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc49f,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4ab,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4af,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4bb,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4bf,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4cb,
-        .param = param_oxford,
-    },
-    /* OXPCIe200 1 Native UART  */
-    {
-        .vendor_id = PCI_VENDOR_ID_OXSEMI,
-        .dev_id = 0xc4cf,
-        .param = param_oxford,
-    },
-    /* Pericom PI7C9X7951 Uno UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_PERICOM,
-        .dev_id = 0x7951,
-        .param = param_pericom_1port
-    },
-    /* Pericom PI7C9X7952 Duo UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_PERICOM,
-        .dev_id = 0x7952,
-        .param = param_pericom_2port
-    },
-    /* Pericom PI7C9X7954 Quad UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_PERICOM,
-        .dev_id = 0x7954,
-        .param = param_pericom_4port
-    },
-    /* Pericom PI7C9X7958 Octal UART */
-    {
-        .vendor_id = PCI_VENDOR_ID_PERICOM,
-        .dev_id = 0x7958,
-        .param = param_pericom_8port
-    }
-};
-#endif
-
-static void ns16550_delayed_resume(void *data);
-
-static u8 ns_read_reg(struct ns16550 *uart, unsigned int reg)
-{
-    void __iomem *addr = uart->remapped_io_base + (reg << uart->reg_shift);
-#ifdef CONFIG_HAS_IOPORTS
-    if ( uart->remapped_io_base == NULL )
-        return inb(uart->io_base + reg);
-#endif
-    switch ( uart->reg_width )
-    {
-    case 1:
-        return readb(addr);
-    case 4:
-        return readl(addr);
-    default:
-        return 0xff;
-    }
-}
-
-static void ns_write_reg(struct ns16550 *uart, unsigned int reg, u8 c)
-{
-    void __iomem *addr = uart->remapped_io_base + (reg << uart->reg_shift);
-#ifdef CONFIG_HAS_IOPORTS
-    if ( uart->remapped_io_base == NULL )
-        return outb(c, uart->io_base + reg);
-#endif
-    switch ( uart->reg_width )
-    {
-    case 1:
-        writeb(c, addr);
-        break;
-    case 4:
-        writel(c, addr);
-        break;
-    default:
-        /* Ignored */
-        break;
-    }
-}
-
-static int ns16550_ioport_invalid(struct ns16550 *uart)
-{
-    return ns_read_reg(uart, UART_IER) == 0xff;
-}
-
-static void handle_dw_usr_busy_quirk(struct ns16550 *uart)
-{
-    if ( uart->dw_usr_bsy &&
-         (ns_read_reg(uart, UART_IIR) & UART_IIR_BSY) == UART_IIR_BSY )
-    {
-        /* DesignWare 8250 detects if LCR is written while the UART is
-         * busy and raises a "busy detect" interrupt. Read the UART
-         * Status Register to clear this state.
-         *
-         * Allwinner/sunxi UART hardware is similar to DesignWare 8250
-         * and also contains a "busy detect" interrupt. So this quirk
-         * fix will also be used for Allwinner UART.
-         */
-        ns_read_reg(uart, UART_USR);
-    }
-}
-
-static void ns16550_interrupt(
-    int irq, void *dev_id, struct cpu_user_regs *regs)
-{
-    struct serial_port *port = dev_id;
-    struct ns16550 *uart = port->uart;
-
-    uart->intr_works = 1;
-
-    while ( !(ns_read_reg(uart, UART_IIR) & UART_IIR_NOINT) )
-    {
-        u8 lsr = ns_read_reg(uart, UART_LSR);
-
-        if ( (lsr & uart->lsr_mask) == uart->lsr_mask )
-            serial_tx_interrupt(port, regs);
-        if ( lsr & UART_LSR_DR )
-            serial_rx_interrupt(port, regs);
-
-        /* A "busy-detect" condition is observed on Allwinner/sunxi UART
-         * after LCR is written during setup. It needs to be cleared at
-         * this point or UART_IIR_NOINT will never be set and this loop
-         * will continue forever.
-         *
-         * This state can be cleared by calling the dw_usr_busy quirk
-         * handler that resolves "busy-detect" for  DesignWare uart.
-         */
-        handle_dw_usr_busy_quirk(uart);
-    }
-}
-
-/* Safe: ns16550_poll() runs as softirq so not reentrant on a given CPU. */
-static DEFINE_PER_CPU(struct serial_port *, poll_port);
-
-static void __ns16550_poll(struct cpu_user_regs *regs)
-{
-    struct serial_port *port = this_cpu(poll_port);
-    struct ns16550 *uart = port->uart;
-
-    if ( uart->intr_works )
-        return; /* Interrupts work - no more polling */
-
-    while ( ns_read_reg(uart, UART_LSR) & UART_LSR_DR )
+        u8 lsr = ns_read_reg(uart, UART_LSR);
+
+        if ( (lsr & uart->lsr_mask) == uart->lsr_mask )
+            serial_tx_interrupt(port, regs);
+        if ( lsr & UART_LSR_DR )
+            serial_rx_interrupt(port, regs);
+
+        /* A "busy-detect" condition is observed on Allwinner/sunxi UART
+         * after LCR is written during setup. It needs to be cleared at
+         * this point or UART_IIR_NOINT will never be set and this loop
+         * will continue forever.
+         *
+         * This state can be cleared by calling the dw_usr_busy quirk
+         * handler that resolves "busy-detect" for  DesignWare uart.
+         */
+        handle_dw_usr_busy_quirk(uart);
+    }
+}
+
+/* Safe: ns16550_poll() runs as softirq so not reentrant on a given CPU. */
+static DEFINE_PER_CPU(struct serial_port *, poll_port);
+
+static void __ns16550_poll(struct cpu_user_regs *regs)
+{
+    struct serial_port *port = this_cpu(poll_port);
+    struct ns16550 *uart = port->uart;
+
+    if ( uart->intr_works )
+        return; /* Interrupts work - no more polling */
+
+    while ( ns_read_reg(uart, UART_LSR) & UART_LSR_DR )
     {
         if ( ns16550_ioport_invalid(uart) )
             goto out;
@@ -825,226 +519,534 @@ static void __init ns16550_init_postirq(struct serial_port *port)
 
     if ( uart->irq > 0 )
     {
-        uart->irqaction.handler = ns16550_interrupt;
-        uart->irqaction.name    = "ns16550";
-        uart->irqaction.dev_id  = port;
-        if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
-            printk("ERROR: Failed to allocate ns16550 IRQ %d\n", uart->irq);
-    }
-
-    ns16550_setup_postirq(uart);
-}
-
-static void ns16550_suspend(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-
-    stop_timer(&uart->timer);
-
-#ifdef CONFIG_HAS_PCI
-    if ( uart->bar )
-       uart->cr = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                  uart->ps_bdf[2]), PCI_COMMAND);
-#endif
-}
-
-static void _ns16550_resume(struct serial_port *port)
-{
-#ifdef CONFIG_HAS_PCI
-    struct ns16550 *uart = port->uart;
-
-    if ( uart->bar )
+        uart->irqaction.handler = ns16550_interrupt;
+        uart->irqaction.name    = "ns16550";
+        uart->irqaction.dev_id  = port;
+        if ( (rc = setup_irq(uart->irq, 0, &uart->irqaction)) != 0 )
+            printk("ERROR: Failed to allocate ns16550 IRQ %d\n", uart->irq);
+    }
+
+    ns16550_setup_postirq(uart);
+}
+
+static void ns16550_suspend(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+
+    stop_timer(&uart->timer);
+
+#ifdef CONFIG_HAS_PCI
+    if ( uart->bar )
+       uart->cr = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                  uart->ps_bdf[2]), PCI_COMMAND);
+#endif
+}
+
+static void _ns16550_resume(struct serial_port *port)
+{
+#ifdef CONFIG_HAS_PCI
+    struct ns16550 *uart = port->uart;
+
+    if ( uart->bar )
+    {
+       pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                 uart->ps_bdf[2]),
+                        PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
+
+        /* If 64 bit BAR, write higher 32 bits to BAR+4 */
+        if ( uart->bar & PCI_BASE_ADDRESS_MEM_TYPE_64 )
+            pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0],  uart->ps_bdf[1],
+                                      uart->ps_bdf[2]),
+                        PCI_BASE_ADDRESS_0 + (uart->bar_idx+1)*4, uart->bar64);
+
+       pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                 uart->ps_bdf[2]),
+                        PCI_COMMAND, uart->cr);
+    }
+#endif
+
+    ns16550_setup_preirq(port->uart);
+    ns16550_setup_postirq(port->uart);
+}
+
+static int delayed_resume_tries;
+static void ns16550_delayed_resume(void *data)
+{
+    struct serial_port *port = data;
+    struct ns16550 *uart = port->uart;
+
+    if ( ns16550_ioport_invalid(port->uart) && delayed_resume_tries-- )
+        set_timer(&uart->resume_timer, NOW() + RESUME_DELAY);
+    else
+        _ns16550_resume(port);
+}
+
+static void ns16550_resume(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+
+    /*
+     * Check for ioport access, before fully resuming operation.
+     * On some systems, there is a SuperIO card that provides
+     * this legacy ioport on the LPC bus.
+     *
+     * We need to wait for dom0's ACPI processing to run the proper
+     * AML to re-initialize the chip, before we can use the card again.
+     *
+     * This may cause a small amount of garbage to be written
+     * to the serial log while we wait patiently for that AML to
+     * be executed. However, this is preferable to spinning in an
+     * infinite loop, as seen on a Lenovo T430, when serial was enabled.
+     */
+    if ( ns16550_ioport_invalid(uart) )
+    {
+        delayed_resume_tries = RESUME_RETRIES;
+        set_timer(&uart->resume_timer, NOW() + RESUME_DELAY);
+    }
+    else
+        _ns16550_resume(port);
+}
+
+static void __init ns16550_endboot(struct serial_port *port)
+{
+#ifdef CONFIG_HAS_IOPORTS
+    struct ns16550 *uart = port->uart;
+    int rv;
+
+    if ( uart->remapped_io_base )
+        return;
+    rv = ioports_deny_access(hardware_domain, uart->io_base, uart->io_base + 7);
+    if ( rv != 0 )
+        BUG();
+#endif
+}
+
+static int __init ns16550_irq(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+    return ((uart->irq > 0) ? uart->irq : -1);
+}
+
+static void ns16550_start_tx(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+    u8 ier = ns_read_reg(uart, UART_IER);
+
+    /* Unmask transmit holding register empty interrupt if currently masked. */
+    if ( !(ier & UART_IER_ETHREI) )
+        ns_write_reg(uart, UART_IER, ier | UART_IER_ETHREI);
+}
+
+static void ns16550_stop_tx(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+    u8 ier = ns_read_reg(uart, UART_IER);
+
+    /* Mask off transmit holding register empty interrupt if currently unmasked. */
+    if ( ier & UART_IER_ETHREI )
+        ns_write_reg(uart, UART_IER, ier & ~UART_IER_ETHREI);
+}
+
+#ifdef CONFIG_ARM
+static const struct vuart_info *ns16550_vuart_info(struct serial_port *port)
+{
+    struct ns16550 *uart = port->uart;
+
+    return &uart->vuart;
+}
+#endif
+
+static struct uart_driver __read_mostly ns16550_driver = {
+    .init_preirq  = ns16550_init_preirq,
+    .init_irq     = ns16550_init_irq,
+    .init_postirq = ns16550_init_postirq,
+    .endboot      = ns16550_endboot,
+    .suspend      = ns16550_suspend,
+    .resume       = ns16550_resume,
+    .tx_ready     = ns16550_tx_ready,
+    .putc         = ns16550_putc,
+    .getc         = ns16550_getc,
+    .irq          = ns16550_irq,
+    .start_tx     = ns16550_start_tx,
+    .stop_tx      = ns16550_stop_tx,
+#ifdef CONFIG_ARM
+    .vuart_info   = ns16550_vuart_info,
+#endif
+};
+
+static int __init parse_parity_char(int c)
+{
+    switch ( c )
+    {
+    case 'n':
+        return UART_PARITY_NONE;
+    case 'o': 
+        return UART_PARITY_ODD;
+    case 'e': 
+        return UART_PARITY_EVEN;
+    case 'm': 
+        return UART_PARITY_MARK;
+    case 's': 
+        return UART_PARITY_SPACE;
+    }
+    return 0;
+}
+
+static int __init check_existence(struct ns16550 *uart)
+{
+    unsigned char status, scratch, scratch2, scratch3;
+
+#ifdef CONFIG_HAS_IOPORTS
+    /*
+     * We can't poke MMIO UARTs until they get I/O remapped later. Assume that
+     * if we're getting MMIO UARTs, the arch code knows what it's doing.
+     */
+    if ( uart->io_base >= 0x10000 )
+        return 1;
+#else
+    return 1; /* Everything is MMIO */
+#endif
+
+#ifdef CONFIG_HAS_PCI
+    pci_serial_early_init(uart);
+#endif
+
+    /*
+     * Do a simple existence test first; if we fail this,
+     * there's no point trying anything else.
+     */
+    scratch = ns_read_reg(uart, UART_IER);
+    ns_write_reg(uart, UART_IER, 0);
+
+    /*
+     * Mask out IER[7:4] bits for test as some UARTs (e.g. TL
+     * 16C754B) allow only to modify them if an EFR bit is set.
+     */
+    scratch2 = ns_read_reg(uart, UART_IER) & 0x0f;
+    ns_write_reg(uart,UART_IER, 0x0F);
+    scratch3 = ns_read_reg(uart, UART_IER) & 0x0f;
+    ns_write_reg(uart, UART_IER, scratch);
+    if ( (scratch2 != 0) || (scratch3 != 0x0F) )
+        return 0;
+
+    /*
+     * Check to see if a UART is really there.
+     * Use loopback test mode.
+     */
+    ns_write_reg(uart, UART_MCR, UART_MCR_LOOP | 0x0A);
+    status = ns_read_reg(uart, UART_MSR) & 0xF0;
+    return (status == 0x90);
+}
+
+#ifdef CONFIG_HAS_PCI
+
+/*
+ * Create lookup tables for specific devices. It is assumed that if
+ * the device found is MMIO, then you have indexed it here. Else, the
+ * driver does nothing for MMIO based devices.
+ */
+static const struct ns16550_config_param __initconst uart_param[] = {
+    [param_default] = {
+        .reg_width = 1,
+        .lsr_mask = UART_LSR_THRE,
+        .max_ports = 1,
+    },
+    [param_trumanage] = {
+        .reg_shift = 2,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = (UART_LSR_THRE | UART_LSR_TEMT),
+        .mmio = 1,
+        .max_ports = 1,
+    },
+    [param_oxford] = {
+        .base_baud = 4000000,
+        .uart_offset = 0x200,
+        .first_offset = 0x1000,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .mmio = 1,
+        .max_ports = 1, /* It can do more, but we would need more custom code.*/
+    },
+    [param_oxford_2port] = {
+        .base_baud = 4000000,
+        .uart_offset = 0x200,
+        .first_offset = 0x1000,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .mmio = 1,
+        .max_ports = 2,
+    },
+    [param_pericom_1port] = {
+        .base_baud = 921600,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = 1,
+        .max_ports = 1,
+    },
+    [param_pericom_2port] = {
+        .base_baud = 921600,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = 1,
+        .max_ports = 2,
+    },
+    /*
+     * Of the two following ones, we can't really use all of their ports,
+     * unless ns16550_com[] would get grown.
+     */
+    [param_pericom_4port] = {
+        .base_baud = 921600,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = 1,
+        .max_ports = 4,
+    },
+    [param_pericom_8port] = {
+        .base_baud = 921600,
+        .uart_offset = 8,
+        .reg_width = 1,
+        .fifo_size = 16,
+        .lsr_mask = UART_LSR_THRE,
+        .bar0 = 1,
+        .max_ports = 8,
+    }
+};
+
+static const struct ns16550_config __initconst uart_config[] =
+{
+    /* Broadcom TruManage device */
+    {
+        .vendor_id = PCI_VENDOR_ID_BROADCOM,
+        .dev_id = 0x160a,
+        .param = param_trumanage,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc11b,
+        .param = param_oxford,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc11f,
+        .param = param_oxford,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc138,
+        .param = param_oxford,
+    },
+    /* OXPCIe952 2 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc158,
+        .param = param_oxford_2port,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc13d,
+        .param = param_oxford,
+    },
+    /* OXPCIe952 2 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc15d,
+        .param = param_oxford_2port,
+    },
+    /* OXPCIe952 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc40b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc40f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc41b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc41f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc42b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc42f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc43b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc43f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc44b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc44f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc45b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc45f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc46b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc46f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc47b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc47f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc48b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc48f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc49b,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc49f,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4ab,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4af,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4bb,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
+    {
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4bf,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
     {
-       pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
-                        PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
-
-        /* If 64 bit BAR, write higher 32 bits to BAR+4 */
-        if ( uart->bar & PCI_BASE_ADDRESS_MEM_TYPE_64 )
-            pci_conf_write32(PCI_SBDF(0, uart->ps_bdf[0],  uart->ps_bdf[1],
-                                      uart->ps_bdf[2]),
-                        PCI_BASE_ADDRESS_0 + (uart->bar_idx+1)*4, uart->bar64);
-
-       pci_conf_write16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
-                                 uart->ps_bdf[2]),
-                        PCI_COMMAND, uart->cr);
-    }
-#endif
-
-    ns16550_setup_preirq(port->uart);
-    ns16550_setup_postirq(port->uart);
-}
-
-static int delayed_resume_tries;
-static void ns16550_delayed_resume(void *data)
-{
-    struct serial_port *port = data;
-    struct ns16550 *uart = port->uart;
-
-    if ( ns16550_ioport_invalid(port->uart) && delayed_resume_tries-- )
-        set_timer(&uart->resume_timer, NOW() + RESUME_DELAY);
-    else
-        _ns16550_resume(port);
-}
-
-static void ns16550_resume(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-
-    /*
-     * Check for ioport access, before fully resuming operation.
-     * On some systems, there is a SuperIO card that provides
-     * this legacy ioport on the LPC bus.
-     *
-     * We need to wait for dom0's ACPI processing to run the proper
-     * AML to re-initialize the chip, before we can use the card again.
-     *
-     * This may cause a small amount of garbage to be written
-     * to the serial log while we wait patiently for that AML to
-     * be executed. However, this is preferable to spinning in an
-     * infinite loop, as seen on a Lenovo T430, when serial was enabled.
-     */
-    if ( ns16550_ioport_invalid(uart) )
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4cb,
+        .param = param_oxford,
+    },
+    /* OXPCIe200 1 Native UART  */
     {
-        delayed_resume_tries = RESUME_RETRIES;
-        set_timer(&uart->resume_timer, NOW() + RESUME_DELAY);
-    }
-    else
-        _ns16550_resume(port);
-}
-
-static void __init ns16550_endboot(struct serial_port *port)
-{
-#ifdef CONFIG_HAS_IOPORTS
-    struct ns16550 *uart = port->uart;
-    int rv;
-
-    if ( uart->remapped_io_base )
-        return;
-    rv = ioports_deny_access(hardware_domain, uart->io_base, uart->io_base + 7);
-    if ( rv != 0 )
-        BUG();
-#endif
-}
-
-static int __init ns16550_irq(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-    return ((uart->irq > 0) ? uart->irq : -1);
-}
-
-static void ns16550_start_tx(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-    u8 ier = ns_read_reg(uart, UART_IER);
-
-    /* Unmask transmit holding register empty interrupt if currently masked. */
-    if ( !(ier & UART_IER_ETHREI) )
-        ns_write_reg(uart, UART_IER, ier | UART_IER_ETHREI);
-}
-
-static void ns16550_stop_tx(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-    u8 ier = ns_read_reg(uart, UART_IER);
-
-    /* Mask off transmit holding register empty interrupt if currently unmasked. */
-    if ( ier & UART_IER_ETHREI )
-        ns_write_reg(uart, UART_IER, ier & ~UART_IER_ETHREI);
-}
-
-#ifdef CONFIG_ARM
-static const struct vuart_info *ns16550_vuart_info(struct serial_port *port)
-{
-    struct ns16550 *uart = port->uart;
-
-    return &uart->vuart;
-}
-#endif
-
-static struct uart_driver __read_mostly ns16550_driver = {
-    .init_preirq  = ns16550_init_preirq,
-    .init_irq     = ns16550_init_irq,
-    .init_postirq = ns16550_init_postirq,
-    .endboot      = ns16550_endboot,
-    .suspend      = ns16550_suspend,
-    .resume       = ns16550_resume,
-    .tx_ready     = ns16550_tx_ready,
-    .putc         = ns16550_putc,
-    .getc         = ns16550_getc,
-    .irq          = ns16550_irq,
-    .start_tx     = ns16550_start_tx,
-    .stop_tx      = ns16550_stop_tx,
-#ifdef CONFIG_ARM
-    .vuart_info   = ns16550_vuart_info,
-#endif
-};
-
-static int __init parse_parity_char(int c)
-{
-    switch ( c )
+        .vendor_id = PCI_VENDOR_ID_OXSEMI,
+        .dev_id = 0xc4cf,
+        .param = param_oxford,
+    },
+    /* Pericom PI7C9X7951 Uno UART */
     {
-    case 'n':
-        return UART_PARITY_NONE;
-    case 'o': 
-        return UART_PARITY_ODD;
-    case 'e': 
-        return UART_PARITY_EVEN;
-    case 'm': 
-        return UART_PARITY_MARK;
-    case 's': 
-        return UART_PARITY_SPACE;
+        .vendor_id = PCI_VENDOR_ID_PERICOM,
+        .dev_id = 0x7951,
+        .param = param_pericom_1port
+    },
+    /* Pericom PI7C9X7952 Duo UART */
+    {
+        .vendor_id = PCI_VENDOR_ID_PERICOM,
+        .dev_id = 0x7952,
+        .param = param_pericom_2port
+    },
+    /* Pericom PI7C9X7954 Quad UART */
+    {
+        .vendor_id = PCI_VENDOR_ID_PERICOM,
+        .dev_id = 0x7954,
+        .param = param_pericom_4port
+    },
+    /* Pericom PI7C9X7958 Octal UART */
+    {
+        .vendor_id = PCI_VENDOR_ID_PERICOM,
+        .dev_id = 0x7958,
+        .param = param_pericom_8port
     }
-    return 0;
-}
-
-static int __init check_existence(struct ns16550 *uart)
-{
-    unsigned char status, scratch, scratch2, scratch3;
-
-#ifdef CONFIG_HAS_IOPORTS
-    /*
-     * We can't poke MMIO UARTs until they get I/O remapped later. Assume that
-     * if we're getting MMIO UARTs, the arch code knows what it's doing.
-     */
-    if ( uart->io_base >= 0x10000 )
-        return 1;
-#else
-    return 1; /* Everything is MMIO */
-#endif
-
-#ifdef CONFIG_HAS_PCI
-    pci_serial_early_init(uart);
-#endif
-
-    /*
-     * Do a simple existence test first; if we fail this,
-     * there's no point trying anything else.
-     */
-    scratch = ns_read_reg(uart, UART_IER);
-    ns_write_reg(uart, UART_IER, 0);
-
-    /*
-     * Mask out IER[7:4] bits for test as some UARTs (e.g. TL
-     * 16C754B) allow only to modify them if an EFR bit is set.
-     */
-    scratch2 = ns_read_reg(uart, UART_IER) & 0x0f;
-    ns_write_reg(uart,UART_IER, 0x0F);
-    scratch3 = ns_read_reg(uart, UART_IER) & 0x0f;
-    ns_write_reg(uart, UART_IER, scratch);
-    if ( (scratch2 != 0) || (scratch3 != 0x0F) )
-        return 0;
-
-    /*
-     * Check to see if a UART is really there.
-     * Use loopback test mode.
-     */
-    ns_write_reg(uart, UART_MCR, UART_MCR_LOOP | 0x0A);
-    status = ns_read_reg(uart, UART_MSR) & 0xF0;
-    return (status == 0x90);
-}
+};
 
-#ifdef CONFIG_HAS_PCI
 static int __init
 pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)
 {
@@ -1211,7 +1213,8 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)
 
     return 0;
 }
-#endif
+
+#endif /* CONFIG_HAS_PCI */
 
 /*
  * Used to parse name value pairs and return which value it is along with
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 23:33:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 23:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38174.70863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4IM-0007GV-VI; Wed, 25 Nov 2020 23:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38174.70863; Wed, 25 Nov 2020 23:33:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4IM-0007GN-SP; Wed, 25 Nov 2020 23:33:54 +0000
Received: by outflank-mailman (input) for mailman id 38174;
 Wed, 25 Nov 2020 23:33:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IL-0007GH-N4
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IL-0004Ec-MG
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IL-00075q-LK
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IL-0007GH-N4
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:53 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Yjj+/IydWPy9PDdOrRU2BkpNO+c618c0XsRSBAEqBuk=; b=6g4kYeGTu1Lp3y/+cxVU0DFkRT
	GYtmJtvCLZYBeqQB81tTvXjUNX7qpxCYxQ732P43njYX4Da/Bhl/maHZaZYzFkXIVZDf1eGnoG0hs
	If3vDqjd7fw32wX/pk+wJrTHFgNKMbzvFBykviwU83jPlG/qDReapSLFTq629IyYGBCs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IL-0004Ec-MG
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IL-00075q-LK
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:33:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ns16550: "com<N>=" command line options are x86-specific
Message-Id: <E1ki4IL-00075q-LK@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 23:33:53 +0000

commit 2291ad4775b9716244ad96d104122221864f32d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:28:15 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:28:15 2020 +0100

    ns16550: "com<N>=" command line options are x86-specific
    
    Pure code motion (plus the addition of "#ifdef CONFIG_X86); no
    functional change intended.
    
    Reported-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 docs/misc/xen-command-line.pandoc |   4 +-
 xen/drivers/char/ns16550.c        | 142 ++++++++++++++++++++------------------
 2 files changed, 75 insertions(+), 71 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 4ae9391fcd..b4a0d60c11 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -318,8 +318,8 @@ Interrupts.  Specifying zero disables CMCI handling.
 Flag to indicate whether to probe for a CMOS Real Time Clock irrespective of
 ACPI indicating none to be there.
 
-### com1
-### com2
+### com1 (x86)
+### com2 (x86)
 > `= <baud>[/<base-baud>][,[DPS][,[<io-base>|pci|amt][,[<irq>|msi][,[<port-bdf>][,[<bridge-bdf>]]]]]]`
 
 Both option `com1` and `com2` follow the same format.
diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 6f7fad6093..82087c4a7a 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -31,38 +31,6 @@
 #include <asm/fixmap.h>
 #endif
 
-/*
- * Configure serial port with a string:
- *   <baud>[/<base_baud>][,DPS[,<io-base>[,<irq>[,<port-bdf>[,<bridge-bdf>]]]]].
- * The tail of the string can be omitted if platform defaults are sufficient.
- * If the baud rate is pre-configured, perhaps by a bootloader, then 'auto'
- * can be specified in place of a numeric baud rate. Polled mode is specified
- * by requesting irq 0.
- */
-static char __initdata opt_com1[128] = "";
-static char __initdata opt_com2[128] = "";
-string_param("com1", opt_com1);
-string_param("com2", opt_com2);
-
-enum serial_param_type {
-    baud,
-    clock_hz,
-    data_bits,
-    io_base,
-    irq,
-    parity,
-    reg_shift,
-    reg_width,
-    stop_bits,
-#ifdef CONFIG_HAS_PCI
-    bridge_bdf,
-    device,
-    port_bdf,
-#endif
-    /* List all parameters before this line. */
-    num_serial_params
-};
-
 static struct ns16550 {
     int baud, clock_hz, data_bits, parity, stop_bits, fifo_size, irq;
     u64 io_base;   /* I/O port or memory-mapped I/O address. */
@@ -98,32 +66,6 @@ static struct ns16550 {
 #endif
 } ns16550_com[2] = { { 0 } };
 
-struct serial_param_var {
-    char name[12];
-    enum serial_param_type type;
-};
-
-/*
- * Enum struct keeping a table of all accepted parameter names for parsing
- * com_console_options for serial port com1 and com2.
- */
-static const struct serial_param_var __initconst sp_vars[] = {
-    {"baud", baud},
-    {"clock-hz", clock_hz},
-    {"data-bits", data_bits},
-    {"io-base", io_base},
-    {"irq", irq},
-    {"parity", parity},
-    {"reg-shift", reg_shift},
-    {"reg-width", reg_width},
-    {"stop-bits", stop_bits},
-#ifdef CONFIG_HAS_PCI
-    {"bridge", bridge_bdf},
-    {"dev", device},
-    {"port", port_bdf},
-#endif
-};
-
 #ifdef CONFIG_HAS_PCI
 struct ns16550_config {
     u16 vendor_id;
@@ -674,6 +616,19 @@ static struct uart_driver __read_mostly ns16550_driver = {
 #endif
 };
 
+static void ns16550_init_common(struct ns16550 *uart)
+{
+    uart->clock_hz  = UART_CLOCK_HZ;
+
+    /* Default is no transmit FIFO. */
+    uart->fifo_size = 1;
+
+    /* Default lsr_mask = UART_LSR_THRE */
+    uart->lsr_mask  = UART_LSR_THRE;
+}
+
+#ifdef CONFIG_X86
+
 static int __init parse_parity_char(int c)
 {
     switch ( c )
@@ -1216,6 +1171,64 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)
 
 #endif /* CONFIG_HAS_PCI */
 
+/*
+ * Configure serial port with a string:
+ *   <baud>[/<base_baud>][,DPS[,<io-base>[,<irq>[,<port-bdf>[,<bridge-bdf>]]]]].
+ * The tail of the string can be omitted if platform defaults are sufficient.
+ * If the baud rate is pre-configured, perhaps by a bootloader, then 'auto'
+ * can be specified in place of a numeric baud rate. Polled mode is specified
+ * by requesting irq 0.
+ */
+static char __initdata opt_com1[128] = "";
+static char __initdata opt_com2[128] = "";
+string_param("com1", opt_com1);
+string_param("com2", opt_com2);
+
+enum serial_param_type {
+    baud,
+    clock_hz,
+    data_bits,
+    io_base,
+    irq,
+    parity,
+    reg_shift,
+    reg_width,
+    stop_bits,
+#ifdef CONFIG_HAS_PCI
+    bridge_bdf,
+    device,
+    port_bdf,
+#endif
+    /* List all parameters before this line. */
+    num_serial_params
+};
+
+struct serial_param_var {
+    char name[12];
+    enum serial_param_type type;
+};
+
+/*
+ * Enum struct keeping a table of all accepted parameter names for parsing
+ * com_console_options for serial port com1 and com2.
+ */
+static const struct serial_param_var __initconst sp_vars[] = {
+    {"baud", baud},
+    {"clock-hz", clock_hz},
+    {"data-bits", data_bits},
+    {"io-base", io_base},
+    {"irq", irq},
+    {"parity", parity},
+    {"reg-shift", reg_shift},
+    {"reg-width", reg_width},
+    {"stop-bits", stop_bits},
+#ifdef CONFIG_HAS_PCI
+    {"bridge", bridge_bdf},
+    {"dev", device},
+    {"port", port_bdf},
+#endif
+};
+
 /*
  * Used to parse name value pairs and return which value it is along with
  * pointer for the extracted value.
@@ -1504,17 +1517,6 @@ static void __init ns16550_parse_port_config(
     serial_register_uart(uart - ns16550_com, &ns16550_driver, uart);
 }
 
-static void ns16550_init_common(struct ns16550 *uart)
-{
-    uart->clock_hz  = UART_CLOCK_HZ;
-
-    /* Default is no transmit FIFO. */
-    uart->fifo_size = 1;
-
-    /* Default lsr_mask = UART_LSR_THRE */
-    uart->lsr_mask  = UART_LSR_THRE;
-}
-
 void __init ns16550_init(int index, struct ns16550_defaults *defaults)
 {
     struct ns16550 *uart;
@@ -1541,6 +1543,8 @@ void __init ns16550_init(int index, struct ns16550_defaults *defaults)
     ns16550_parse_port_config(uart, (index == 0) ? opt_com1 : opt_com2);
 }
 
+#endif /* CONFIG_X86 */
+
 #ifdef CONFIG_HAS_DEVICE_TREE
 static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
                                        const void *data)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Nov 25 23:34:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Nov 2020 23:34:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38176.70867 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4IX-0007Hz-0k; Wed, 25 Nov 2020 23:34:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38176.70867; Wed, 25 Nov 2020 23:34: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ki4IW-0007Hq-Tv; Wed, 25 Nov 2020 23:34:04 +0000
Received: by outflank-mailman (input) for mailman id 38176;
 Wed, 25 Nov 2020 23:34:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IV-0007Hi-RB
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IV-0004Fa-QO
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ki4IV-00076j-PD
 for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:34:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IV-0007Hi-RB
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:34:03 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gWzt/iIqGGqSrxpw4qKzdHCKR5//SnZjpEY40/JKclU=; b=dPXTIuUNcpADJlPBFwaeKrbKiy
	/58U1Vj8J8deCU36lQNnes7AcEIO5wTsenbMZfMFVA4TTWtu/hr1z5Q+A2APZE78DQ6B8U4WsCsAx
	wHQZt2a5w/ljnFKFxa6VBXAHAVyfe8LUIjW+czL+O+mbylRgDbDMBiob+xWyVl5JvrXg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IV-0004Fa-QO
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1ki4IV-00076j-PD
	for xen-changelog@lists.xenproject.org; Wed, 25 Nov 2020 23:34:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ns16550: drop stray "#ifdef CONFIG_HAS_PCI"
Message-Id: <E1ki4IV-00076j-PD@xenbits.xenproject.org>
Date: Wed, 25 Nov 2020 23:34:03 +0000

commit 8147e00e4fbfcc43b665dc6bf279b204c501ba04
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 11:28:41 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 11:28:41 2020 +0100

    ns16550: drop stray "#ifdef CONFIG_HAS_PCI"
    
    There's no point wrapping the function invocation when
    - the function body is already suitably wrapped,
    - the function itself is unconditionally available.
    
    Reported-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/char/ns16550.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 82087c4a7a..9235d854fe 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -662,9 +662,7 @@ static int __init check_existence(struct ns16550 *uart)
     return 1; /* Everything is MMIO */
 #endif
 
-#ifdef CONFIG_HAS_PCI
     pci_serial_early_init(uart);
-#endif
 
     /*
      * Do a simple existence test first; if we fail this,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 26 10:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Nov 2020 10:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38413.71138 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEvX-0000Ce-LS; Thu, 26 Nov 2020 10:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38413.71138; Thu, 26 Nov 2020 10: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEvX-0000CW-IL; Thu, 26 Nov 2020 10:55:03 +0000
Received: by outflank-mailman (input) for mailman id 38413;
 Thu, 26 Nov 2020 10: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 1kiEvW-0000CP-4T
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEvW-0007WD-2o
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kiEvW-00017g-07
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEvW-0000CP-4T
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hmsVFos235SOGGYfF/XtAf71Anr/kiwLv7ASMmtXT04=; b=vaiW2ocD1jIp5LUieOpByBzP3m
	5vnxEjALNlTQd7AUgoWNw5WDfS2bIufkYtiGxqqW38ESZ7Jv/NYB5OpiNTs8g0DPVjfRV/6xZ9iYp
	cepWXssOhZWKQn6oMcdl0Icf1wPBscQD3ODaTLCmXOtLVkXBYcZ6YSVMaDhbvZn915Tk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEvW-0007WD-2o
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEvW-00017g-07
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] memory: fix off-by-one in XSA-346 change
Message-Id: <E1kiEvW-00017g-07@xenbits.xenproject.org>
Date: Thu, 26 Nov 2020 10:55:02 +0000

commit 9b156bcc3ffcc7949edd4460b718a241e87ae302
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 24 14:01:31 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 24 14:01:31 2020 +0100

    memory: fix off-by-one in XSA-346 change
    
    The comparison against ARRAY_SIZE() needs to be >= in order to avoid
    overrunning the pages[] array.
    
    This is XSA-355.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index df85b550a1..2c86934ae8 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -854,7 +854,7 @@ int xenmem_add_to_physmap(struct domain *d, struct xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done > ARRAY_SIZE(pages) && extra.ppage) ||
+        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
              (xatp->size > done && hypercall_preempt_check()) )
         {
             rc = start + done;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 26 10:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Nov 2020 10:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38415.71156 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEvh-0000HJ-W7; Thu, 26 Nov 2020 10:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38415.71156; Thu, 26 Nov 2020 10: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEvh-0000HA-S0; Thu, 26 Nov 2020 10:55:13 +0000
Received: by outflank-mailman (input) for mailman id 38415;
 Thu, 26 Nov 2020 10: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 1kiEvg-0000Gc-7q
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEvg-0007WS-6D
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kiEvg-00018Z-5M
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEvg-0000Gc-7q
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:12 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9mss0mH2H22qdTdqUYcFqyxN6PLiZfG3f2h2CxS0w6k=; b=6KV2nV9sfeGr11FHq1kI0zbm/9
	RDFBk8EtL8skOzvkh9JLdHn1viyZ+j+0ww31RzEvTbyWyXvefGvrpQQXtsblixNf17RLmaqKpKa5X
	104YMCL0UH9QuElEuiI4pY+LnajXMl8tUAU/3zpuFetNfhIFCCIMrkNdhTJZD1gBdiCA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEvg-0007WS-6D
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEvg-00018Z-5M
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Add workaround for Cortex-A55 erratum #1530923
Message-Id: <E1kiEvg-00018Z-5M@xenbits.xenproject.org>
Date: Thu, 26 Nov 2020 10:55:12 +0000

commit fd7479b9aec25885cc17d33b326b9babae59faee
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Tue Nov 24 11:12:15 2020 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Nov 25 11:17:27 2020 +0000

    xen/arm: Add workaround for Cortex-A55 erratum #1530923
    
    On the Cortex A55, TLB entries can be allocated by a speculative AT
    instruction. If this is happening during a guest context switch with an
    inconsistent page table state in the guest, TLBs with wrong values might
    be allocated.
    The ARM64_WORKAROUND_AT_SPECULATE workaround is used as for erratum
    1165522 on Cortex A76 or Neoverse N1.
    
    This change is also introducing the MIDR identifier for the Cortex-A55.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/silicon-errata.txt | 1 +
 xen/arch/arm/cpuerrata.c         | 6 ++++++
 xen/include/asm-arm/processor.h  | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt
index d183ba543f..27bf957ebf 100644
--- a/docs/misc/arm/silicon-errata.txt
+++ b/docs/misc/arm/silicon-errata.txt
@@ -45,6 +45,7 @@ stable hypervisors.
 | ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319    |
 | ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
 | ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
+| ARM            | Cortex-A55      | #1530923        | N/A                     |
 | ARM            | Cortex-A57      | #852523         | N/A                     |
 | ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
 | ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220    |
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index cb4795beec..b398d480f1 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -514,6 +514,12 @@ static const struct arm_cpu_capabilities arm_errata[] = {
         .capability = ARM64_WORKAROUND_AT_SPECULATE,
         MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
     },
+    {
+        /* Cortex-A55 (All versions as erratum is open in SDEN v14) */
+        .desc = "ARM erratum 1530923",
+        .capability = ARM64_WORKAROUND_AT_SPECULATE,
+        MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
+    },
     {},
 };
 
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index d3d12a9d19..87c8136022 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -53,6 +53,7 @@
 #define ARM_CPU_PART_CORTEX_A17     0xC0E
 #define ARM_CPU_PART_CORTEX_A15     0xC0F
 #define ARM_CPU_PART_CORTEX_A53     0xD03
+#define ARM_CPU_PART_CORTEX_A55     0xD05
 #define ARM_CPU_PART_CORTEX_A57     0xD07
 #define ARM_CPU_PART_CORTEX_A72     0xD08
 #define ARM_CPU_PART_CORTEX_A73     0xD09
@@ -64,6 +65,7 @@
 #define MIDR_CORTEX_A17 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A17)
 #define MIDR_CORTEX_A15 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A15)
 #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)
+#define MIDR_CORTEX_A55 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A55)
 #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)
 #define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)
 #define MIDR_CORTEX_A73 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A73)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 26 10:55:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Nov 2020 10:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38418.71158 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEvs-0000Ks-0U; Thu, 26 Nov 2020 10:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38418.71158; Thu, 26 Nov 2020 10: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEvr-0000Kk-Ta; Thu, 26 Nov 2020 10:55:23 +0000
Received: by outflank-mailman (input) for mailman id 38418;
 Thu, 26 Nov 2020 10: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 1kiEvq-0000KW-Ao
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEvq-0007X6-9J
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kiEvq-000197-8Y
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEvq-0000KW-Ao
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:22 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ceUOANdrnvYpPMfe9hjHCCyZi7hIM9LaJkUoFOCBvRI=; b=ADT7qSMNhCNNKr7s/272ycILIA
	AY9Y2BfL4YGNKTg/CfsOjHUHzEyIC1J6HwPWGSRWMOFgy/rr0CWeNRAyD3l5O2l6Mi12bdATaeQvY
	2Kp7FesL/qlrDEoqW7+6UdtjF87IOIj9a2PBQakKMtF6yTQsjTFSo3qzHEy2OVAGt0AI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEvq-0007X6-9J
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEvq-000197-8Y
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: fix uninstall rule for header files
Message-Id: <E1kiEvq-000197-8Y@xenbits.xenproject.org>
Date: Thu, 26 Nov 2020 10:55:22 +0000

commit 1e6d7bd585232c2526590a348871c40d5b384ac7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 25 14:05:52 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:05:52 2020 +0100

    tools/libs: fix uninstall rule for header files
    
    This again was working right only as long as $(LIBHEADER) consisted of
    just one entry.
    
    Fixes: bc44e2fb3199 ("tools: add a copy of library headers in tools/include")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index b0e785b380..0b3381755a 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -104,7 +104,7 @@ install: build
 .PHONY: uninstall
 uninstall:
 	rm -f $(DESTDIR)$(PKG_INSTALLDIR)/$(LIB_FILE_NAME).pc
-	for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$(LIBHEADER); done
+	for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$$i; done
 	rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so
 	rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 26 10:55:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Nov 2020 10:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38423.71162 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEw2-0000NV-22; Thu, 26 Nov 2020 10:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38423.71162; Thu, 26 Nov 2020 10: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>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEw1-0000NN-V5; Thu, 26 Nov 2020 10:55:33 +0000
Received: by outflank-mailman (input) for mailman id 38423;
 Thu, 26 Nov 2020 10: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 1kiEw0-0000N4-DC
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEw0-0007XD-CQ
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kiEw0-00019q-Bi
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEw0-0000N4-DC
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:32 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TNUwUIg1zi7cUgSXyDuLTWUE84N25tED0K7xwaA4KUY=; b=tG6XvU/ioo8ZK8XK2TrF0aes9B
	ua6lmfuDSTU3daLOUbwjFQp3PMy3yvntYHE4U96zAyeV7d62qLYYGLuG7BKTfrBQafucO7XBaynxu
	jvfPGPmhWYjeIgGP0JOhOsUfVmHv61aCO2FZWgrGpOazS0SKqk9Qq3ntrfrP7oNZCj3M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEw0-0007XD-CQ
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEw0-00019q-Bi
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/include: import sizeof_field() macro from Linux stddef.h
Message-Id: <E1kiEw0-00019q-Bi@xenbits.xenproject.org>
Date: Thu, 26 Nov 2020 10:55:32 +0000

commit 758fae24d7b90fcfa7dffbffb5a5cab274caf3fc
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Nov 25 14:06:27 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:06:27 2020 +0100

    xen/include: import sizeof_field() macro from Linux stddef.h
    
    Co-locate it with the definition of offsetof() (since this is also in stddef.h
    in the Linux kernel source). This macro will be needed in a subsequent patch.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/compiler.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index c0e0ee9f27..676c6ea1b0 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -76,6 +76,14 @@
 
 #define offsetof(a,b) __builtin_offsetof(a,b)
 
+/**
+ * sizeof_field(TYPE, MEMBER)
+ *
+ * @TYPE: The structure containing the field of interest
+ * @MEMBER: The field to return the size of
+ */
+#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
+
 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
 #define alignof __alignof__
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 26 10:55:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Nov 2020 10:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38424.71165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEwC-0000PC-46; Thu, 26 Nov 2020 10:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38424.71165; Thu, 26 Nov 2020 10:55:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEwC-0000P4-0S; Thu, 26 Nov 2020 10:55:44 +0000
Received: by outflank-mailman (input) for mailman id 38424;
 Thu, 26 Nov 2020 10: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 1kiEwA-0000Or-Gc
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEwA-0007XT-Fu
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kiEwA-0001AX-Ev
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEwA-0000Or-Gc
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:42 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=04sAJEnPUFn8ipUQ8qHjwnSt6Oo71ZiehmxK2yV+508=; b=J1YPg9UGtnnBDo//2QUUFKwhTe
	C2k8Aq3Ig2L7vgS4TV3XbZZbfTaT6IAoH/6o+85RjBnxrIhB/zARSdIfk1icjEfBJxKSA9Xvy2gWh
	3OKnFRUkHdro+C1dfgOm3r+srvd9RhKuykTohnI6Zl3QxJfTyJhvCWP7uH4Gs0+ShKVA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEwA-0007XT-Fu
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEwA-0001AX-Ev
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: replace open-coded occurrences of sizeof_field()...
Message-Id: <E1kiEwA-0001AX-Ev@xenbits.xenproject.org>
Date: Thu, 26 Nov 2020 10:55:42 +0000

commit 8041317f72f684ee4e64209c0dd4a8b7ea200e0b
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Nov 25 14:06:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:06:42 2020 +0100

    x86: replace open-coded occurrences of sizeof_field()...
    
    ... with macro evaluations, now that it is available.
    
    A recent patch imported the sizeof_field() macro from Linux. This patch makes
    use of it in places where the construct is currently open-coded.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/vpmu_intel.c |  4 ++--
 xen/arch/x86/setup.c          | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 75aa11c6ad..6e97ce7900 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -90,8 +90,8 @@ static uint64_t __read_mostly global_ovf_ctrl_mask, global_ctrl_mask;
 static unsigned int __read_mostly regs_sz;
 /* Offset into context of the beginning of PMU register block */
 static const unsigned int regs_off =
-        sizeof(((struct xen_pmu_intel_ctxt *)0)->fixed_counters) +
-        sizeof(((struct xen_pmu_intel_ctxt *)0)->arch_counters);
+    sizeof_field(struct xen_pmu_intel_ctxt, fixed_counters) +
+    sizeof_field(struct xen_pmu_intel_ctxt, arch_counters);
 
 /*
  * QUIRK to workaround an issue on various family 6 cpus.
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 44c04e2735..30d6f375a3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1617,19 +1617,19 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     total_pages = nr_pages;
 
     /* Sanity check for unwanted bloat of certain hypercall structures. */
-    BUILD_BUG_ON(sizeof(((struct xen_platform_op *)0)->u) !=
-                 sizeof(((struct xen_platform_op *)0)->u.pad));
-    BUILD_BUG_ON(sizeof(((struct xen_domctl *)0)->u) !=
-                 sizeof(((struct xen_domctl *)0)->u.pad));
-    BUILD_BUG_ON(sizeof(((struct xen_sysctl *)0)->u) !=
-                 sizeof(((struct xen_sysctl *)0)->u.pad));
+    BUILD_BUG_ON(sizeof_field(struct xen_platform_op, u) !=
+                 sizeof_field(struct xen_platform_op, u.pad));
+    BUILD_BUG_ON(sizeof_field(struct xen_domctl, u) !=
+                 sizeof_field(struct xen_domctl, u.pad));
+    BUILD_BUG_ON(sizeof_field(struct xen_sysctl, u) !=
+                 sizeof_field(struct xen_sysctl, u.pad));
 
     BUILD_BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct vcpu_info) != 64);
 
-    BUILD_BUG_ON(sizeof(((struct compat_platform_op *)0)->u) !=
-                 sizeof(((struct compat_platform_op *)0)->u.pad));
+    BUILD_BUG_ON(sizeof_field(struct compat_platform_op, u) !=
+                 sizeof_field(struct compat_platform_op, u.pad));
     BUILD_BUG_ON(sizeof(start_info_compat_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct compat_vcpu_info) != 64);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 26 10:55:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Nov 2020 10:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38426.71170 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEwM-0000R4-7B; Thu, 26 Nov 2020 10:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38426.71170; Thu, 26 Nov 2020 10:55:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEwM-0000Qv-4I; Thu, 26 Nov 2020 10:55:54 +0000
Received: by outflank-mailman (input) for mailman id 38426;
 Thu, 26 Nov 2020 10: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 1kiEwK-0000Ql-Jm
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEwK-0007Xi-Iz
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kiEwK-0001BG-IE
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEwK-0000Ql-Jm
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:52 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q/ZwVzxBwm2n3EXzqt/Idh8tlYCgnDDoi9TtNTZPK+k=; b=VcHU+6EotUDpnBjr6RhcMoCse1
	01+1duieKwPPz/CWQ/17cNW4dbqCNLdS6tshO+/35aaJKpXrDd2p1MsJcOyYk0dgWTp58/beQAHiS
	rfADiaBzLH/IGh5SxV+Db7SkUjuqzBDuMVlRtQA8IYv3RvXtmcuIRjyO3jOkt0Ri6Pw8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEwK-0007Xi-Iz
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEwK-0001BG-IE
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:55:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] mm: check for truncation in vmalloc_type()
Message-Id: <E1kiEwK-0001BG-IE@xenbits.xenproject.org>
Date: Thu, 26 Nov 2020 10:55:52 +0000

commit 500516fcb9e1c09eae9bbbd3b30bb294c6993853
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 25 14:07:36 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:07:36 2020 +0100

    mm: check for truncation in vmalloc_type()
    
    While it's currently implied from the checking xmalloc_array() does,
    let's make this more explicit in the function itself. As a result both
    involved local variables don't need to have size_t type anymore. This
    brings them in line with the rest of the code in this file.
    
    Requested-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/vmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index faebc1ddf1..4fd6b3067e 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -242,13 +242,15 @@ void vunmap(const void *va)
 static void *vmalloc_type(size_t size, enum vmap_region type)
 {
     mfn_t *mfn;
-    size_t pages, i;
+    unsigned int i, pages = PFN_UP(size);
     struct page_info *pg;
     void *va;
 
     ASSERT(size);
 
-    pages = PFN_UP(size);
+    if ( PFN_DOWN(size) > pages )
+        return NULL;
+
     mfn = xmalloc_array(mfn_t, pages);
     if ( mfn == NULL )
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 26 10:56:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Nov 2020 10:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.38427.71174 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEwW-0000Sk-97; Thu, 26 Nov 2020 10:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 38427.71174; Thu, 26 Nov 2020 10:56:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kiEwW-0000Sc-5n; Thu, 26 Nov 2020 10:56:04 +0000
Received: by outflank-mailman (input) for mailman id 38427;
 Thu, 26 Nov 2020 10: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 1kiEwU-0000ST-Nd
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEwU-0007Y4-Mj
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kiEwU-0001CG-La
 for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10: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 1kiEwU-0000ST-Nd
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:56:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fFy8877d3RIuKcMMcD+RQvHt2gc84VOnLeTbE9wubZ8=; b=vyuwv5I4OYn6zgY4alEZodOvHx
	kEYpBGBLHnuvInU8gT3exiwP/VTM7Zyp1WCRdZSzpj4RNAZLeBrD/vTdgNiecaCUyP8rIS40updun
	QtTkhWJUkJvALojFr82YS5PvurWAYJx1T3YzYTefENzUutoIJ7Mv7DlEKwMf79gkylOo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
	by mail.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEwU-0007Y4-Mj
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
	(envelope-from <ian.jackson@eu.citrix.com>)
	id 1kiEwU-0001CG-La
	for xen-changelog@lists.xenproject.org; Thu, 26 Nov 2020 10:56:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] evtchn: double per-channel locking can't hit identical channels
Message-Id: <E1kiEwU-0001CG-La@xenbits.xenproject.org>
Date: Thu, 26 Nov 2020 10:56:02 +0000

commit 181f2c224ccd0a2900d6ae94ec390a546731f593
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 25 14:08:14 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 25 14:08:14 2020 +0100

    evtchn: double per-channel locking can't hit identical channels
    
    Inter-domain channels can't possibly be bound to themselves, there's
    always a 2nd channel involved, even when this is a loopback into the
    same domain. As a result we can drop one conditional each from the two
    involved functions.
    
    With this, the number of evtchn_write_lock() invocations can also be
    shrunk by half, swapping the two incoming function arguments instead.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/event_channel.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 54b2e2550e..dbfba62a49 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -326,23 +326,18 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
 
 static void double_evtchn_lock(struct evtchn *lchn, struct evtchn *rchn)
 {
-    if ( lchn <= rchn )
-    {
-        evtchn_write_lock(lchn);
-        if ( lchn != rchn )
-            evtchn_write_lock(rchn);
-    }
-    else
-    {
-        evtchn_write_lock(rchn);
-        evtchn_write_lock(lchn);
-    }
+    ASSERT(lchn != rchn);
+
+    if ( lchn > rchn )
+        SWAP(lchn, rchn);
+
+    evtchn_write_lock(lchn);
+    evtchn_write_lock(rchn);
 }
 
 static void double_evtchn_unlock(struct evtchn *lchn, struct evtchn *rchn)
 {
-    if ( lchn != rchn )
-        evtchn_write_unlock(lchn);
+    evtchn_write_unlock(lchn);
     evtchn_write_unlock(rchn);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 27 17:11:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Nov 2020 17:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.39682.72654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kihH0-0000oV-H9; Fri, 27 Nov 2020 17:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 39682.72654; Fri, 27 Nov 2020 17:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kihH0-0000oN-EG; Fri, 27 Nov 2020 17:11:06 +0000
Received: by outflank-mailman (input) for mailman id 39682;
 Fri, 27 Nov 2020 17: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 1kihGz-0000oI-B3
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17: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 1kihGz-0001iL-7Y
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kihGz-0006v8-5z
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qmOKZ2t2ZiIIaI1dm1jfeH4ogGSZA2ZJLpqkC1Y0qno=; b=RA78QSDG6yarGsO6ADzog+wJBp
	+2bK40SXsojJfI27RJ/k0oo+Vz4hJY/w1rDxSfoiwhnMJp9abQxA6CAoHjHbSbnaCqx4sBsE+xQdp
	44m2QyjpjgVjE3+aef0y3nAXm/2llyJuADRECb8mIi5kUrbDCRm6AdTB2SHxMihHiFII=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu: remove the share_p2m operation
Message-Id: <E1kihGz-0006v8-5z@xenbits.xenproject.org>
Date: Fri, 27 Nov 2020 17:11:05 +0000

commit 25ccd093425ce1d3a9f33ecd82e92f35952b8496
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Fri Nov 27 18:03:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 27 18:03:42 2020 +0100

    iommu: remove the share_p2m operation
    
    Sharing of HAP tables is now VT-d specific so the operation is never defined
    for AMD IOMMU any more. There's also no need to pro-actively set vtd.pgd_maddr
    when using shared EPT as it is straightforward to simply define a helper
    function to return the appropriate value in the shared and non-shared cases.
    
    NOTE: This patch also modifies unmap_vtd_domain_page() to take a const
          pointer since the only thing it calls, unmap_domain_page(), also takes
          a const pointer.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/mm/p2m.c                 |  3 --
 xen/drivers/passthrough/iommu.c       |  8 ----
 xen/drivers/passthrough/vtd/extern.h  |  2 +-
 xen/drivers/passthrough/vtd/iommu.c   | 90 +++++++++++++++++++----------------
 xen/drivers/passthrough/vtd/x86/vtd.c |  2 +-
 xen/include/xen/iommu.h               |  3 --
 6 files changed, 52 insertions(+), 56 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index d9cc1856bb..db6cc2202d 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -727,9 +727,6 @@ int p2m_alloc_table(struct p2m_domain *p2m)
 
     p2m->phys_table = pagetable_from_mfn(top_mfn);
 
-    if ( hap_enabled(d) )
-        iommu_share_p2m_table(d);
-
     p2m_unlock(p2m);
     return 0;
 }
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 87f9a857bb..a58703d3fa 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -523,14 +523,6 @@ int iommu_do_domctl(
     return ret;
 }
 
-void iommu_share_p2m_table(struct domain* d)
-{
-    ASSERT(hap_enabled(d));
-
-    if ( iommu_use_hap_pt(d) )
-        iommu_get_ops()->share_p2m(d);
-}
-
 void iommu_crash_shutdown(void)
 {
     if ( !iommu_crash_disable )
diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index ad6c5f907b..19a908ab4f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -72,7 +72,7 @@ void flush_all_cache(void);
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node);
 void free_pgtable_maddr(u64 maddr);
 void *map_vtd_domain_page(u64 maddr);
-void unmap_vtd_domain_page(void *va);
+void unmap_vtd_domain_page(const void *va);
 int domain_context_mapping_one(struct domain *domain, struct vtd_iommu *iommu,
                                u8 bus, u8 devfn, const struct pci_dev *);
 int domain_context_unmap_one(struct domain *domain, struct vtd_iommu *iommu,
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index f6c4021fd6..a76e60c99a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -318,6 +318,48 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
     return pte_maddr;
 }
 
+static uint64_t domain_pgd_maddr(struct domain *d, unsigned int nr_pt_levels)
+{
+    struct domain_iommu *hd = dom_iommu(d);
+    uint64_t pgd_maddr;
+    unsigned int agaw;
+
+    ASSERT(spin_is_locked(&hd->arch.mapping_lock));
+
+    if ( iommu_use_hap_pt(d) )
+    {
+        pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d));
+
+        return pagetable_get_paddr(pgt);
+    }
+
+    if ( !hd->arch.vtd.pgd_maddr )
+    {
+        /* Ensure we have pagetables allocated down to leaf PTE. */
+        addr_to_dma_page_maddr(d, 0, 1);
+
+        if ( !hd->arch.vtd.pgd_maddr )
+            return 0;
+    }
+
+    pgd_maddr = hd->arch.vtd.pgd_maddr;
+
+    /* Skip top levels of page tables for 2- and 3-level DRHDs. */
+    for ( agaw = level_to_agaw(4);
+          agaw != level_to_agaw(nr_pt_levels);
+          agaw-- )
+    {
+        const struct dma_pte *p = map_vtd_domain_page(pgd_maddr);
+
+        pgd_maddr = dma_pte_addr(*p);
+        unmap_vtd_domain_page(p);
+        if ( !pgd_maddr )
+            return 0;
+    }
+
+    return pgd_maddr;
+}
+
 static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 {
     u32 val;
@@ -1286,7 +1328,7 @@ int domain_context_mapping_one(
     struct context_entry *context, *context_entries;
     u64 maddr, pgd_maddr;
     u16 seg = iommu->drhd->segment;
-    int agaw, rc, ret;
+    int rc, ret;
     bool_t flush_dev_iotlb;
 
     ASSERT(pcidevs_locked());
@@ -1340,37 +1382,18 @@ int domain_context_mapping_one(
     if ( iommu_hwdom_passthrough && is_hardware_domain(domain) )
     {
         context_set_translation_type(*context, CONTEXT_TT_PASS_THRU);
-        agaw = level_to_agaw(iommu->nr_pt_levels);
     }
     else
     {
         spin_lock(&hd->arch.mapping_lock);
 
-        /* Ensure we have pagetables allocated down to leaf PTE. */
-        if ( hd->arch.vtd.pgd_maddr == 0 )
-        {
-            addr_to_dma_page_maddr(domain, 0, 1);
-            if ( hd->arch.vtd.pgd_maddr == 0 )
-            {
-            nomem:
-                spin_unlock(&hd->arch.mapping_lock);
-                spin_unlock(&iommu->lock);
-                unmap_vtd_domain_page(context_entries);
-                return -ENOMEM;
-            }
-        }
-
-        /* Skip top levels of page tables for 2- and 3-level DRHDs. */
-        pgd_maddr = hd->arch.vtd.pgd_maddr;
-        for ( agaw = level_to_agaw(4);
-              agaw != level_to_agaw(iommu->nr_pt_levels);
-              agaw-- )
+        pgd_maddr = domain_pgd_maddr(domain, iommu->nr_pt_levels);
+        if ( !pgd_maddr )
         {
-            struct dma_pte *p = map_vtd_domain_page(pgd_maddr);
-            pgd_maddr = dma_pte_addr(*p);
-            unmap_vtd_domain_page(p);
-            if ( pgd_maddr == 0 )
-                goto nomem;
+            spin_unlock(&hd->arch.mapping_lock);
+            spin_unlock(&iommu->lock);
+            unmap_vtd_domain_page(context_entries);
+            return -ENOMEM;
         }
 
         context_set_address_root(*context, pgd_maddr);
@@ -1389,7 +1412,7 @@ int domain_context_mapping_one(
         return -EFAULT;
     }
 
-    context_set_address_width(*context, agaw);
+    context_set_address_width(*context, level_to_agaw(iommu->nr_pt_levels));
     context_set_fault_enable(*context);
     context_set_present(*context);
     iommu_sync_cache(context, sizeof(struct context_entry));
@@ -1848,18 +1871,6 @@ static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
            (ept_has_1gb(ept_cap) && opt_hap_1gb) <= cap_sps_1gb(vtd_cap);
 }
 
-/*
- * set VT-d page table directory to EPT table if allowed
- */
-static void iommu_set_pgd(struct domain *d)
-{
-    mfn_t pgd_mfn;
-
-    pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)));
-    dom_iommu(d)->arch.vtd.pgd_maddr =
-        pagetable_get_paddr(pagetable_from_mfn(pgd_mfn));
-}
-
 static int rmrr_identity_mapping(struct domain *d, bool_t map,
                                  const struct acpi_rmrr_unit *rmrr,
                                  u32 flag)
@@ -2718,7 +2729,6 @@ static struct iommu_ops __initdata vtd_ops = {
     .adjust_irq_affinities = adjust_vtd_irq_affinities,
     .suspend = vtd_suspend,
     .resume = vtd_resume,
-    .share_p2m = iommu_set_pgd,
     .crash_shutdown = vtd_crash_shutdown,
     .iotlb_flush = iommu_flush_iotlb_pages,
     .iotlb_flush_all = iommu_flush_iotlb_all,
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index bbe358dc36..6681dccd69 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -42,7 +42,7 @@ void *map_vtd_domain_page(u64 maddr)
     return map_domain_page(_mfn(paddr_to_pfn(maddr)));
 }
 
-void unmap_vtd_domain_page(void *va)
+void unmap_vtd_domain_page(const void *va)
 {
     unmap_domain_page(va);
 }
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 191021870f..8d36f0b2b2 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -277,7 +277,6 @@ struct iommu_ops {
 
     int __must_check (*suspend)(void);
     void (*resume)(void);
-    void (*share_p2m)(struct domain *d);
     void (*crash_shutdown)(void);
     int __must_check (*iotlb_flush)(struct domain *d, dfn_t dfn,
                                     unsigned long page_count,
@@ -354,8 +353,6 @@ void iommu_resume(void);
 void iommu_crash_shutdown(void);
 int iommu_get_reserved_device_memory(iommu_grdm_t *, void *);
 
-void iommu_share_p2m_table(struct domain *d);
-
 #ifdef CONFIG_HAS_PCI
 int iommu_do_pci_domctl(struct xen_domctl *, struct domain *d,
                         XEN_GUEST_HANDLE_PARAM(xen_domctl_t));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 27 17:11:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Nov 2020 17:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.39683.72658 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kihHA-0000po-Ip; Fri, 27 Nov 2020 17:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 39683.72658; Fri, 27 Nov 2020 17: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 1kihHA-0000pg-Fp; Fri, 27 Nov 2020 17:11:16 +0000
Received: by outflank-mailman (input) for mailman id 39683;
 Fri, 27 Nov 2020 17: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 1kihH9-0000pb-CI
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17: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 1kihH9-0001iQ-BR
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kihH9-0006vs-AS
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17: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=pzvCb3xDF+PzKPOs6vbED3wpRFST/7j0jKAeM+aXtfE=; b=bcwM44exlPSS8rZf1gOUqgok93
	HHvgQ+nnSQ20ncqGiy4CQgCty4NyTBTfh1NHyMDJfHZEFzy2uVzqGMuE2kGyn8oZm0gz3wGjfEbP6
	jVmR6WP9fI5r5u2jrtcJUn/BY80Ih1Y0CUMZKva+JGNjvJnv1sfjXfweiUFZNC8AWu+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu: stop calling IOMMU page tables 'p2m tables'
Message-Id: <E1kihH9-0006vs-AS@xenbits.xenproject.org>
Date: Fri, 27 Nov 2020 17:11:15 +0000

commit fcdb988ef1934fe29fa7807dbbc155eb61e428a1
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Fri Nov 27 18:04:47 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 27 18:04:47 2020 +0100

    iommu: stop calling IOMMU page tables 'p2m tables'
    
    It's confusing and not consistent with the terminology introduced with 'dfn_t'.
    Just call them IOMMU page tables.
    
    Also remove a pointless check of the 'acpi_drhd_units' list in
    vtd_dump_page_table_level(). If the list is empty then IOMMU mappings would
    not have been enabled for the domain in the first place.
    
    NOTE: All calls to printk() have also been removed from
          iommu_dump_page_tables(); the implementation specific code is now
          responsible for all output.
          The check for the global 'iommu_enabled' has also been replaced by an
          ASSERT since iommu_dump_page_tables() is not registered as a key handler
          unless IOMMU mappings are enabled.
          Error messages are now prefixed with the name of the function.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c | 20 +++++++++----------
 xen/drivers/passthrough/iommu.c             | 21 +++++---------------
 xen/drivers/passthrough/vtd/iommu.c         | 30 ++++++++++++++++-------------
 xen/include/xen/iommu.h                     |  2 +-
 4 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 64c1fca7b5..42b5a5a9be 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -494,8 +494,8 @@ static int amd_iommu_group_id(u16 seg, u8 bus, u8 devfn)
 
 #include <asm/io_apic.h>
 
-static void amd_dump_p2m_table_level(struct page_info* pg, int level, 
-                                     paddr_t gpa, int indent)
+static void amd_dump_page_table_level(struct page_info *pg, int level,
+                                      paddr_t gpa, int indent)
 {
     paddr_t address;
     const union amd_iommu_pte *table_vaddr;
@@ -507,7 +507,7 @@ static void amd_dump_p2m_table_level(struct page_info* pg, int level,
     table_vaddr = __map_domain_page(pg);
     if ( table_vaddr == NULL )
     {
-        printk("Failed to map IOMMU domain page %"PRIpaddr"\n", 
+        printk("AMD IOMMU failed to map domain page %"PRIpaddr"\n",
                 page_to_maddr(pg));
         return;
     }
@@ -524,7 +524,7 @@ static void amd_dump_p2m_table_level(struct page_info* pg, int level,
 
         if ( pde->next_level && (pde->next_level != (level - 1)) )
         {
-            printk("IOMMU p2m table error. next_level = %d, expected %d\n",
+            printk("AMD IOMMU table error. next_level = %d, expected %d\n",
                    pde->next_level, level - 1);
 
             continue;
@@ -532,7 +532,7 @@ static void amd_dump_p2m_table_level(struct page_info* pg, int level,
 
         address = gpa + amd_offset_level_address(index, level);
         if ( pde->next_level >= 1 )
-            amd_dump_p2m_table_level(
+            amd_dump_page_table_level(
                 mfn_to_page(_mfn(pde->mfn)), pde->next_level,
                 address, indent + 1);
         else
@@ -545,16 +545,16 @@ static void amd_dump_p2m_table_level(struct page_info* pg, int level,
     unmap_domain_page(table_vaddr);
 }
 
-static void amd_dump_p2m_table(struct domain *d)
+static void amd_dump_page_tables(struct domain *d)
 {
     const struct domain_iommu *hd = dom_iommu(d);
 
     if ( !hd->arch.amd.root_table )
         return;
 
-    printk("p2m table has %u levels\n", hd->arch.amd.paging_mode);
-    amd_dump_p2m_table_level(hd->arch.amd.root_table,
-                             hd->arch.amd.paging_mode, 0, 0);
+    printk("AMD IOMMU %pd table has %u levels\n", d, hd->arch.amd.paging_mode);
+    amd_dump_page_table_level(hd->arch.amd.root_table,
+                              hd->arch.amd.paging_mode, 0, 0);
 }
 
 static const struct iommu_ops __initconstrel _iommu_ops = {
@@ -580,7 +580,7 @@ static const struct iommu_ops __initconstrel _iommu_ops = {
     .suspend = amd_iommu_suspend,
     .resume = amd_iommu_resume,
     .crash_shutdown = amd_iommu_crash_shutdown,
-    .dump_p2m_table = amd_dump_p2m_table,
+    .dump_page_tables = amd_dump_page_tables,
 };
 
 static const struct iommu_init_ops __initconstrel _iommu_init_ops = {
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index a58703d3fa..2358b6eb09 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -22,7 +22,7 @@
 #include <xen/keyhandler.h>
 #include <xsm/xsm.h>
 
-static void iommu_dump_p2m_table(unsigned char key);
+static void iommu_dump_page_tables(unsigned char key);
 
 unsigned int __read_mostly iommu_dev_iotlb_timeout = 1000;
 integer_param("iommu_dev_iotlb_timeout", iommu_dev_iotlb_timeout);
@@ -212,7 +212,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
     if ( !is_iommu_enabled(d) )
         return;
 
-    register_keyhandler('o', &iommu_dump_p2m_table, "dump iommu p2m table", 0);
+    register_keyhandler('o', &iommu_dump_page_tables, "dump iommu page tables", 0);
 
     hd->platform_ops->hwdom_init(d);
 }
@@ -558,16 +558,12 @@ bool_t iommu_has_feature(struct domain *d, enum iommu_feature feature)
     return is_iommu_enabled(d) && test_bit(feature, dom_iommu(d)->features);
 }
 
-static void iommu_dump_p2m_table(unsigned char key)
+static void iommu_dump_page_tables(unsigned char key)
 {
     struct domain *d;
     const struct iommu_ops *ops;
 
-    if ( !iommu_enabled )
-    {
-        printk("IOMMU not enabled!\n");
-        return;
-    }
+    ASSERT(iommu_enabled);
 
     ops = iommu_get_ops();
 
@@ -578,14 +574,7 @@ static void iommu_dump_p2m_table(unsigned char key)
         if ( is_hardware_domain(d) || !is_iommu_enabled(d) )
             continue;
 
-        if ( iommu_use_hap_pt(d) )
-        {
-            printk("\ndomain%d IOMMU p2m table shared with MMU: \n", d->domain_id);
-            continue;
-        }
-
-        printk("\ndomain%d IOMMU p2m table: \n", d->domain_id);
-        ops->dump_p2m_table(d);
+        ops->dump_page_tables(d);
     }
 
     rcu_read_unlock(&domlist_read_lock);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index a76e60c99a..d136fe3688 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2582,8 +2582,8 @@ static void vtd_resume(void)
     }
 }
 
-static void vtd_dump_p2m_table_level(paddr_t pt_maddr, int level, paddr_t gpa, 
-                                     int indent)
+static void vtd_dump_page_table_level(paddr_t pt_maddr, int level, paddr_t gpa,
+                                      int indent)
 {
     paddr_t address;
     int i;
@@ -2596,7 +2596,8 @@ static void vtd_dump_p2m_table_level(paddr_t pt_maddr, int level, paddr_t gpa,
     pt_vaddr = map_vtd_domain_page(pt_maddr);
     if ( pt_vaddr == NULL )
     {
-        printk("Failed to map VT-D domain page %"PRIpaddr"\n", pt_maddr);
+        printk(VTDPREFIX " failed to map domain page %"PRIpaddr"\n",
+               pt_maddr);
         return;
     }
 
@@ -2612,8 +2613,8 @@ static void vtd_dump_p2m_table_level(paddr_t pt_maddr, int level, paddr_t gpa,
 
         address = gpa + offset_level_address(i, level);
         if ( next_level >= 1 ) 
-            vtd_dump_p2m_table_level(dma_pte_addr(*pte), next_level, 
-                                     address, indent + 1);
+            vtd_dump_page_table_level(dma_pte_addr(*pte), next_level,
+                                      address, indent + 1);
         else
             printk("%*sdfn: %08lx mfn: %08lx\n",
                    indent, "",
@@ -2624,17 +2625,20 @@ static void vtd_dump_p2m_table_level(paddr_t pt_maddr, int level, paddr_t gpa,
     unmap_vtd_domain_page(pt_vaddr);
 }
 
-static void vtd_dump_p2m_table(struct domain *d)
+static void vtd_dump_page_tables(struct domain *d)
 {
-    const struct domain_iommu *hd;
+    const struct domain_iommu *hd = dom_iommu(d);
 
-    if ( list_empty(&acpi_drhd_units) )
+    if ( iommu_use_hap_pt(d) )
+    {
+        printk(VTDPREFIX " %pd sharing EPT table\n", d);
         return;
+    }
 
-    hd = dom_iommu(d);
-    printk("p2m table has %d levels\n", agaw_to_level(hd->arch.vtd.agaw));
-    vtd_dump_p2m_table_level(hd->arch.vtd.pgd_maddr,
-                             agaw_to_level(hd->arch.vtd.agaw), 0, 0);
+    printk(VTDPREFIX" %pd table has %d levels\n", d,
+           agaw_to_level(hd->arch.vtd.agaw));
+    vtd_dump_page_table_level(hd->arch.vtd.pgd_maddr,
+                              agaw_to_level(hd->arch.vtd.agaw), 0, 0);
 }
 
 static int __init intel_iommu_quarantine_init(struct domain *d)
@@ -2733,7 +2737,7 @@ static struct iommu_ops __initdata vtd_ops = {
     .iotlb_flush = iommu_flush_iotlb_pages,
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
-    .dump_p2m_table = vtd_dump_p2m_table,
+    .dump_page_tables = vtd_dump_page_tables,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 8d36f0b2b2..69af5baf92 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -283,7 +283,7 @@ struct iommu_ops {
                                     unsigned int flush_flags);
     int __must_check (*iotlb_flush_all)(struct domain *d);
     int (*get_reserved_device_memory)(iommu_grdm_t *, void *);
-    void (*dump_p2m_table)(struct domain *d);
+    void (*dump_page_tables)(struct domain *d);
 
 #ifdef CONFIG_HAS_DEVICE_TREE
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 27 17:11:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Nov 2020 17:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.39684.72662 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kihHK-0000r0-Kz; Fri, 27 Nov 2020 17:11:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 39684.72662; Fri, 27 Nov 2020 17: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 1kihHK-0000qt-HQ; Fri, 27 Nov 2020 17:11:26 +0000
Received: by outflank-mailman (input) for mailman id 39684;
 Fri, 27 Nov 2020 17: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 1kihHJ-0000ql-Gv
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17: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 1kihHJ-0001iZ-Fw
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kihHJ-0006wW-ED
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17: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=QPpIor/y5M4xwvVac7VhycIi/eAjoBKAnCBVWxAZeXY=; b=xl2ZkH+2xMnw8i2x/+cPdfoFaq
	CNEfqsy22wC5bUQs7/w4Kzq1H0pK/4HOB6g6SDoQm0byNtYN2kCF4yzeJ8VSHMXVAnwaOf3gvouJu
	OWz5iAmHWEn02uLNut/UNQU4RA69NEYVXEYBHXXuI1cjlbm70sp5R/31hup6GX7itUEU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/pci: move x86 specific code to x86 directory
Message-Id: <E1kihHJ-0006wW-ED@xenbits.xenproject.org>
Date: Fri, 27 Nov 2020 17:11:25 +0000

commit f7e77e55d33b7e52477d65f4c5e67281384b650f
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Fri Nov 27 18:06:04 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 27 18:06:04 2020 +0100

    xen/pci: move x86 specific code to x86 directory
    
    passthrough/pci.c file is common for all architecture, but there is x86
    specific code in this file.
    
    Move x86 specific code to the drivers/passthrough/io.c file to avoid
    compilation error for other architecture.
    
    As drivers/passthrough/io.c is compiled only for x86 move it to
    x86 directory and rename it to hvm.c.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/Makefile     |    3 -
 xen/drivers/passthrough/io.c         | 1127 --------------------------------
 xen/drivers/passthrough/pci.c        |   68 +-
 xen/drivers/passthrough/x86/Makefile |    1 +
 xen/drivers/passthrough/x86/hvm.c    | 1193 ++++++++++++++++++++++++++++++++++
 xen/include/xen/pci.h                |    9 +
 6 files changed, 1204 insertions(+), 1197 deletions(-)

diff --git a/xen/drivers/passthrough/Makefile b/xen/drivers/passthrough/Makefile
index e973e16c74..cc646612c7 100644
--- a/xen/drivers/passthrough/Makefile
+++ b/xen/drivers/passthrough/Makefile
@@ -6,6 +6,3 @@ obj-$(CONFIG_ARM) += arm/
 obj-y += iommu.o
 obj-$(CONFIG_HAS_PCI) += pci.o
 obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
-
-x86-$(CONFIG_HVM) := io.o
-obj-$(CONFIG_X86) += $(x86-y)
diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
deleted file mode 100644
index 6b1305a3e5..0000000000
--- a/xen/drivers/passthrough/io.c
+++ /dev/null
@@ -1,1127 +0,0 @@
-/*
- * Copyright (c) 2006, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- *
- * Copyright (C) Allen Kay <allen.m.kay@intel.com>
- * Copyright (C) Xiaohui Xin <xiaohui.xin@intel.com>
- */
-
-#include <xen/event.h>
-#include <xen/iommu.h>
-#include <xen/cpu.h>
-#include <xen/irq.h>
-#include <asm/hvm/irq.h>
-#include <asm/hvm/support.h>
-#include <asm/io_apic.h>
-
-static DEFINE_PER_CPU(struct list_head, dpci_list);
-
-/*
- * These two bit states help to safely schedule, deschedule, and wait until
- * the softirq has finished.
- *
- * The semantics behind these two bits is as follow:
- *  - STATE_SCHED - whoever modifies it has to ref-count the domain (->dom).
- *  - STATE_RUN - only softirq is allowed to set and clear it. If it has
- *      been set hvm_dirq_assist will RUN with a saved value of the
- *      'struct domain' copied from 'pirq_dpci->dom' before STATE_RUN was set.
- *
- * The usual states are: STATE_SCHED(set) -> STATE_RUN(set) ->
- * STATE_SCHED(unset) -> STATE_RUN(unset).
- *
- * However the states can also diverge such as: STATE_SCHED(set) ->
- * STATE_SCHED(unset) -> STATE_RUN(set) -> STATE_RUN(unset). That means
- * the 'hvm_dirq_assist' never run and that the softirq did not do any
- * ref-counting.
- */
-
-enum {
-    STATE_SCHED,
-    STATE_RUN
-};
-
-/*
- * This can be called multiple times, but the softirq is only raised once.
- * That is until the STATE_SCHED state has been cleared. The state can be
- * cleared by: the 'dpci_softirq' (when it has executed 'hvm_dirq_assist'),
- * or by 'pt_pirq_softirq_reset' (which will try to clear the state before
- * the softirq had a chance to run).
- */
-static void raise_softirq_for(struct hvm_pirq_dpci *pirq_dpci)
-{
-    unsigned long flags;
-
-    if ( test_and_set_bit(STATE_SCHED, &pirq_dpci->state) )
-        return;
-
-    get_knownalive_domain(pirq_dpci->dom);
-
-    local_irq_save(flags);
-    list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
-    local_irq_restore(flags);
-
-    raise_softirq(HVM_DPCI_SOFTIRQ);
-}
-
-/*
- * If we are racing with softirq_dpci (STATE_SCHED) we return
- * true. Otherwise we return false.
- *
- * If it is false, it is the callers responsibility to make sure
- * that the softirq (with the event_lock dropped) has ran.
- */
-bool pt_pirq_softirq_active(struct hvm_pirq_dpci *pirq_dpci)
-{
-    if ( pirq_dpci->state & ((1 << STATE_RUN) | (1 << STATE_SCHED)) )
-        return true;
-
-    /*
-     * If in the future we would call 'raise_softirq_for' right away
-     * after 'pt_pirq_softirq_active' we MUST reset the list (otherwise it
-     * might have stale data).
-     */
-    return false;
-}
-
-/*
- * Reset the pirq_dpci->dom parameter to NULL.
- *
- * This function checks the different states to make sure it can do it
- * at the right time. If it unschedules the 'hvm_dirq_assist' from running
- * it also refcounts (which is what the softirq would have done) properly.
- */
-static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
-{
-    struct domain *d = pirq_dpci->dom;
-
-    ASSERT(spin_is_locked(&d->event_lock));
-
-    switch ( cmpxchg(&pirq_dpci->state, 1 << STATE_SCHED, 0) )
-    {
-    case (1 << STATE_SCHED):
-        /*
-         * We are going to try to de-schedule the softirq before it goes in
-         * STATE_RUN. Whoever clears STATE_SCHED MUST refcount the 'dom'.
-         */
-        put_domain(d);
-        /* fallthrough. */
-    case (1 << STATE_RUN):
-    case (1 << STATE_RUN) | (1 << STATE_SCHED):
-        /*
-         * The reason it is OK to reset 'dom' when STATE_RUN bit is set is due
-         * to a shortcut the 'dpci_softirq' implements. It stashes the 'dom'
-         * in local variable before it sets STATE_RUN - and therefore will not
-         * dereference '->dom' which would crash.
-         */
-        pirq_dpci->dom = NULL;
-        break;
-    }
-    /*
-     * Inhibit 'hvm_dirq_assist' from doing anything useful and at worst
-     * calling 'set_timer' which will blow up (as we have called kill_timer
-     * or never initialized it). Note that we hold the lock that
-     * 'hvm_dirq_assist' could be spinning on.
-     */
-    pirq_dpci->masked = 0;
-}
-
-bool pt_irq_need_timer(uint32_t flags)
-{
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
-                      HVM_IRQ_DPCI_NO_EOI));
-}
-
-static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
-                            void *arg)
-{
-    if ( __test_and_clear_bit(_HVM_IRQ_DPCI_EOI_LATCH_SHIFT,
-                              &pirq_dpci->flags) )
-    {
-        pirq_dpci->masked = 0;
-        pirq_dpci->pending = 0;
-        pirq_guest_eoi(dpci_pirq(pirq_dpci));
-    }
-
-    return 0;
-}
-
-static void pt_irq_time_out(void *data)
-{
-    struct hvm_pirq_dpci *irq_map = data;
-    const struct hvm_irq_dpci *dpci;
-    const struct dev_intx_gsi_link *digl;
-
-    spin_lock(&irq_map->dom->event_lock);
-
-    if ( irq_map->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
-    {
-        ASSERT(is_hardware_domain(irq_map->dom));
-        /*
-         * Identity mapped, no need to iterate over the guest GSI list to find
-         * other pirqs sharing the same guest GSI.
-         *
-         * In the identity mapped case the EOI can also be done now, this way
-         * the iteration over the list of domain pirqs is avoided.
-         */
-        hvm_gsi_deassert(irq_map->dom, dpci_pirq(irq_map)->pirq);
-        irq_map->flags |= HVM_IRQ_DPCI_EOI_LATCH;
-        pt_irq_guest_eoi(irq_map->dom, irq_map, NULL);
-        spin_unlock(&irq_map->dom->event_lock);
-        return;
-    }
-
-    dpci = domain_get_irq_dpci(irq_map->dom);
-    if ( unlikely(!dpci) )
-    {
-        ASSERT_UNREACHABLE();
-        spin_unlock(&irq_map->dom->event_lock);
-        return;
-    }
-    list_for_each_entry ( digl, &irq_map->digl_list, list )
-    {
-        unsigned int guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
-        const struct hvm_girq_dpci_mapping *girq;
-
-        list_for_each_entry ( girq, &dpci->girq[guest_gsi], list )
-        {
-            struct pirq *pirq = pirq_info(irq_map->dom, girq->machine_gsi);
-
-            pirq_dpci(pirq)->flags |= HVM_IRQ_DPCI_EOI_LATCH;
-        }
-        hvm_pci_intx_deassert(irq_map->dom, digl->device, digl->intx);
-    }
-
-    pt_pirq_iterate(irq_map->dom, pt_irq_guest_eoi, NULL);
-
-    spin_unlock(&irq_map->dom->event_lock);
-}
-
-struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *d)
-{
-    if ( !d || !is_hvm_domain(d) )
-        return NULL;
-
-    return hvm_domain_irq(d)->dpci;
-}
-
-void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci)
-{
-    xfree(dpci);
-}
-
-/*
- * This routine handles lowest-priority interrupts using vector-hashing
- * mechanism. As an example, modern Intel CPUs use this method to handle
- * lowest-priority interrupts.
- *
- * Here is the details about the vector-hashing mechanism:
- * 1. For lowest-priority interrupts, store all the possible destination
- *    vCPUs in an array.
- * 2. Use "gvec % max number of destination vCPUs" to find the right
- *    destination vCPU in the array for the lowest-priority interrupt.
- */
-static struct vcpu *vector_hashing_dest(const struct domain *d,
-                                        uint32_t dest_id,
-                                        bool dest_mode,
-                                        uint8_t gvec)
-
-{
-    unsigned long *dest_vcpu_bitmap;
-    unsigned int dest_vcpus = 0;
-    struct vcpu *v, *dest = NULL;
-    unsigned int i;
-
-    dest_vcpu_bitmap = xzalloc_array(unsigned long,
-                                     BITS_TO_LONGS(d->max_vcpus));
-    if ( !dest_vcpu_bitmap )
-        return NULL;
-
-    for_each_vcpu ( d, v )
-    {
-        if ( !vlapic_match_dest(vcpu_vlapic(v), NULL, APIC_DEST_NOSHORT,
-                                dest_id, dest_mode) )
-            continue;
-
-        __set_bit(v->vcpu_id, dest_vcpu_bitmap);
-        dest_vcpus++;
-    }
-
-    if ( dest_vcpus != 0 )
-    {
-        unsigned int mod = gvec % dest_vcpus;
-        unsigned int idx = 0;
-
-        for ( i = 0; i <= mod; i++ )
-        {
-            idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx) + 1;
-            BUG_ON(idx > d->max_vcpus);
-        }
-
-        dest = d->vcpu[idx - 1];
-    }
-
-    xfree(dest_vcpu_bitmap);
-
-    return dest;
-}
-
-int pt_irq_create_bind(
-    struct domain *d, const struct xen_domctl_bind_pt_irq *pt_irq_bind)
-{
-    struct hvm_irq_dpci *hvm_irq_dpci;
-    struct hvm_pirq_dpci *pirq_dpci;
-    struct pirq *info;
-    int rc, pirq = pt_irq_bind->machine_irq;
-
-    if ( pirq < 0 || pirq >= d->nr_pirqs )
-        return -EINVAL;
-
- restart:
-    spin_lock(&d->event_lock);
-
-    hvm_irq_dpci = domain_get_irq_dpci(d);
-    if ( !hvm_irq_dpci && !is_hardware_domain(d) )
-    {
-        unsigned int i;
-
-        /*
-         * NB: the hardware domain doesn't use a hvm_irq_dpci struct because
-         * it's only allowed to identity map GSIs, and so the data contained in
-         * that struct (used to map guest GSIs into machine GSIs and perform
-         * interrupt routing) is completely useless to it.
-         */
-        hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
-        if ( hvm_irq_dpci == NULL )
-        {
-            spin_unlock(&d->event_lock);
-            return -ENOMEM;
-        }
-        for ( i = 0; i < NR_HVM_DOMU_IRQS; i++ )
-            INIT_LIST_HEAD(&hvm_irq_dpci->girq[i]);
-
-        hvm_domain_irq(d)->dpci = hvm_irq_dpci;
-    }
-
-    info = pirq_get_info(d, pirq);
-    if ( !info )
-    {
-        spin_unlock(&d->event_lock);
-        return -ENOMEM;
-    }
-    pirq_dpci = pirq_dpci(info);
-
-    /*
-     * A crude 'while' loop with us dropping the spinlock and giving
-     * the softirq_dpci a chance to run.
-     * We MUST check for this condition as the softirq could be scheduled
-     * and hasn't run yet. Note that this code replaced tasklet_kill which
-     * would have spun forever and would do the same thing (wait to flush out
-     * outstanding hvm_dirq_assist calls.
-     */
-    if ( pt_pirq_softirq_active(pirq_dpci) )
-    {
-        spin_unlock(&d->event_lock);
-        cpu_relax();
-        goto restart;
-    }
-
-    switch ( pt_irq_bind->irq_type )
-    {
-    case PT_IRQ_TYPE_MSI:
-    {
-        uint8_t dest, delivery_mode;
-        bool dest_mode;
-        int dest_vcpu_id;
-        const struct vcpu *vcpu;
-        uint32_t gflags = pt_irq_bind->u.msi.gflags &
-                          ~XEN_DOMCTL_VMSI_X86_UNMASKED;
-
-        if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-        {
-            pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED | HVM_IRQ_DPCI_MACH_MSI |
-                               HVM_IRQ_DPCI_GUEST_MSI;
-            pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
-            pirq_dpci->gmsi.gflags = gflags;
-            /*
-             * 'pt_irq_create_bind' can be called after 'pt_irq_destroy_bind'.
-             * The 'pirq_cleanup_check' which would free the structure is only
-             * called if the event channel for the PIRQ is active. However
-             * OS-es that use event channels usually bind PIRQs to eventds
-             * and unbind them before calling 'pt_irq_destroy_bind' - with the
-             * result that we re-use the 'dpci' structure. This can be
-             * reproduced with unloading and loading the driver for a device.
-             *
-             * As such on every 'pt_irq_create_bind' call we MUST set it.
-             */
-            pirq_dpci->dom = d;
-            /* bind after hvm_irq_dpci is setup to avoid race with irq handler*/
-            rc = pirq_guest_bind(d->vcpu[0], info, 0);
-            if ( rc == 0 && pt_irq_bind->u.msi.gtable )
-            {
-                rc = msixtbl_pt_register(d, info, pt_irq_bind->u.msi.gtable);
-                if ( unlikely(rc) )
-                {
-                    pirq_guest_unbind(d, info);
-                    /*
-                     * Between 'pirq_guest_bind' and before 'pirq_guest_unbind'
-                     * an interrupt can be scheduled. No more of them are going
-                     * to be scheduled but we must deal with the one that may be
-                     * in the queue.
-                     */
-                    pt_pirq_softirq_reset(pirq_dpci);
-                }
-            }
-            if ( unlikely(rc) )
-            {
-                pirq_dpci->gmsi.gflags = 0;
-                pirq_dpci->gmsi.gvec = 0;
-                pirq_dpci->dom = NULL;
-                pirq_dpci->flags = 0;
-                pirq_cleanup_check(info, d);
-                spin_unlock(&d->event_lock);
-                return rc;
-            }
-        }
-        else
-        {
-            uint32_t mask = HVM_IRQ_DPCI_MACH_MSI | HVM_IRQ_DPCI_GUEST_MSI;
-
-            if ( (pirq_dpci->flags & mask) != mask )
-            {
-                spin_unlock(&d->event_lock);
-                return -EBUSY;
-            }
-
-            /* If pirq is already mapped as vmsi, update guest data/addr. */
-            if ( pirq_dpci->gmsi.gvec != pt_irq_bind->u.msi.gvec ||
-                 pirq_dpci->gmsi.gflags != gflags )
-            {
-                /* Directly clear pending EOIs before enabling new MSI info. */
-                pirq_guest_eoi(info);
-
-                pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
-                pirq_dpci->gmsi.gflags = gflags;
-            }
-        }
-        /* Calculate dest_vcpu_id for MSI-type pirq migration. */
-        dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
-                         XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
-        dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
-        delivery_mode = MASK_EXTR(pirq_dpci->gmsi.gflags,
-                                  XEN_DOMCTL_VMSI_X86_DELIV_MASK);
-
-        dest_vcpu_id = hvm_girq_dest_2_vcpu_id(d, dest, dest_mode);
-        pirq_dpci->gmsi.dest_vcpu_id = dest_vcpu_id;
-        spin_unlock(&d->event_lock);
-
-        pirq_dpci->gmsi.posted = false;
-        vcpu = (dest_vcpu_id >= 0) ? d->vcpu[dest_vcpu_id] : NULL;
-        if ( iommu_intpost )
-        {
-            if ( delivery_mode == dest_LowestPrio )
-                vcpu = vector_hashing_dest(d, dest, dest_mode,
-                                           pirq_dpci->gmsi.gvec);
-            if ( vcpu )
-                pirq_dpci->gmsi.posted = true;
-        }
-        if ( vcpu && is_iommu_enabled(d) )
-            hvm_migrate_pirq(pirq_dpci, vcpu);
-
-        /* Use interrupt posting if it is supported. */
-        if ( iommu_intpost )
-            pi_update_irte(vcpu ? &vcpu->arch.hvm.vmx.pi_desc : NULL,
-                           info, pirq_dpci->gmsi.gvec);
-
-        if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
-        {
-            unsigned long flags;
-            struct irq_desc *desc = pirq_spin_lock_irq_desc(info, &flags);
-
-            if ( !desc )
-            {
-                pt_irq_destroy_bind(d, pt_irq_bind);
-                return -EINVAL;
-            }
-
-            guest_mask_msi_irq(desc, false);
-            spin_unlock_irqrestore(&desc->lock, flags);
-        }
-
-        break;
-    }
-
-    case PT_IRQ_TYPE_PCI:
-    case PT_IRQ_TYPE_MSI_TRANSLATE:
-    {
-        struct dev_intx_gsi_link *digl = NULL;
-        struct hvm_girq_dpci_mapping *girq = NULL;
-        unsigned int guest_gsi;
-
-        /*
-         * Mapping GSIs for the hardware domain is different than doing it for
-         * an unpriviledged guest, the hardware domain is only allowed to
-         * identity map GSIs, and as such all the data in the u.pci union is
-         * discarded.
-         */
-        if ( hvm_irq_dpci )
-        {
-            unsigned int link;
-
-            digl = xmalloc(struct dev_intx_gsi_link);
-            girq = xmalloc(struct hvm_girq_dpci_mapping);
-
-            if ( !digl || !girq )
-            {
-                spin_unlock(&d->event_lock);
-                xfree(girq);
-                xfree(digl);
-                return -ENOMEM;
-            }
-
-            girq->bus = digl->bus = pt_irq_bind->u.pci.bus;
-            girq->device = digl->device = pt_irq_bind->u.pci.device;
-            girq->intx = digl->intx = pt_irq_bind->u.pci.intx;
-            list_add_tail(&digl->list, &pirq_dpci->digl_list);
-
-            guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
-            link = hvm_pci_intx_link(digl->device, digl->intx);
-
-            hvm_irq_dpci->link_cnt[link]++;
-
-            girq->machine_gsi = pirq;
-            list_add_tail(&girq->list, &hvm_irq_dpci->girq[guest_gsi]);
-        }
-        else
-        {
-            ASSERT(is_hardware_domain(d));
-
-            /* MSI_TRANSLATE is not supported for the hardware domain. */
-            if ( pt_irq_bind->irq_type != PT_IRQ_TYPE_PCI ||
-                 pirq >= hvm_domain_irq(d)->nr_gsis )
-            {
-                spin_unlock(&d->event_lock);
-
-                return -EINVAL;
-            }
-            guest_gsi = pirq;
-        }
-
-        /* Bind the same mirq once in the same domain */
-        if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-        {
-            unsigned int share;
-
-            /* MUST be set, as the pirq_dpci can be re-used. */
-            pirq_dpci->dom = d;
-            if ( pt_irq_bind->irq_type == PT_IRQ_TYPE_MSI_TRANSLATE )
-            {
-                pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED |
-                                   HVM_IRQ_DPCI_MACH_MSI |
-                                   HVM_IRQ_DPCI_GUEST_PCI |
-                                   HVM_IRQ_DPCI_TRANSLATE;
-                share = 0;
-            }
-            else    /* PT_IRQ_TYPE_PCI */
-            {
-                pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED |
-                                   HVM_IRQ_DPCI_MACH_PCI |
-                                   HVM_IRQ_DPCI_GUEST_PCI;
-                if ( !is_hardware_domain(d) )
-                    share = BIND_PIRQ__WILL_SHARE;
-                else
-                {
-                    int mask = vioapic_get_mask(d, guest_gsi);
-                    int trigger_mode = vioapic_get_trigger_mode(d, guest_gsi);
-
-                    if ( mask < 0 || trigger_mode < 0 )
-                    {
-                        spin_unlock(&d->event_lock);
-
-                        ASSERT_UNREACHABLE();
-                        return -EINVAL;
-                    }
-                    pirq_dpci->flags |= HVM_IRQ_DPCI_IDENTITY_GSI;
-                    /*
-                     * Check if the corresponding vIO APIC pin is configured
-                     * level or edge trigger, level triggered interrupts will
-                     * be marked as shareable.
-                     */
-                    ASSERT(!mask);
-                    share = trigger_mode;
-                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
-                        /*
-                         * Edge IO-APIC interrupt, no EOI or unmask to perform
-                         * and hence no timer needed.
-                         */
-                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
-                }
-            }
-
-            /* Init timer before binding */
-            if ( pt_irq_need_timer(pirq_dpci->flags) )
-                init_timer(&pirq_dpci->timer, pt_irq_time_out, pirq_dpci, 0);
-            /* Deal with gsi for legacy devices */
-            rc = pirq_guest_bind(d->vcpu[0], info, share);
-            if ( unlikely(rc) )
-            {
-                if ( pt_irq_need_timer(pirq_dpci->flags) )
-                    kill_timer(&pirq_dpci->timer);
-                /*
-                 * There is no path for __do_IRQ to schedule softirq as
-                 * IRQ_GUEST is not set. As such we can reset 'dom' directly.
-                 */
-                pirq_dpci->dom = NULL;
-                if ( hvm_irq_dpci )
-                {
-                    unsigned int link;
-
-                    ASSERT(girq && digl);
-                    list_del(&girq->list);
-                    list_del(&digl->list);
-                    link = hvm_pci_intx_link(digl->device, digl->intx);
-                    hvm_irq_dpci->link_cnt[link]--;
-                }
-                pirq_dpci->flags = 0;
-                pirq_cleanup_check(info, d);
-                spin_unlock(&d->event_lock);
-                xfree(girq);
-                xfree(digl);
-                return rc;
-            }
-        }
-
-        spin_unlock(&d->event_lock);
-
-        if ( iommu_verbose )
-        {
-            char buf[24] = "";
-
-            if ( digl )
-                snprintf(buf, ARRAY_SIZE(buf), " dev=%02x.%02x.%u intx=%u",
-                         digl->bus, PCI_SLOT(digl->device),
-                         PCI_FUNC(digl->device), digl->intx);
-
-            printk(XENLOG_G_INFO "d%d: bind: m_gsi=%u g_gsi=%u%s\n",
-                   d->domain_id, pirq, guest_gsi, buf);
-        }
-        break;
-    }
-
-    default:
-        spin_unlock(&d->event_lock);
-        return -EOPNOTSUPP;
-    }
-
-    return 0;
-}
-
-int pt_irq_destroy_bind(
-    struct domain *d, const struct xen_domctl_bind_pt_irq *pt_irq_bind)
-{
-    struct hvm_irq_dpci *hvm_irq_dpci;
-    struct hvm_pirq_dpci *pirq_dpci;
-    unsigned int machine_gsi = pt_irq_bind->machine_irq;
-    struct pirq *pirq;
-    const char *what = NULL;
-
-    switch ( pt_irq_bind->irq_type )
-    {
-    case PT_IRQ_TYPE_PCI:
-    case PT_IRQ_TYPE_MSI_TRANSLATE:
-        if ( iommu_verbose )
-        {
-            unsigned int device = pt_irq_bind->u.pci.device;
-            unsigned int intx = pt_irq_bind->u.pci.intx;
-
-            printk(XENLOG_G_INFO
-                   "d%d: unbind: m_gsi=%u g_gsi=%u dev=%02x:%02x.%u intx=%u\n",
-                   d->domain_id, machine_gsi, hvm_pci_intx_gsi(device, intx),
-                   pt_irq_bind->u.pci.bus,
-                   PCI_SLOT(device), PCI_FUNC(device), intx);
-        }
-        break;
-    case PT_IRQ_TYPE_MSI:
-    {
-        unsigned long flags;
-        struct irq_desc *desc = domain_spin_lock_irq_desc(d, machine_gsi,
-                                                          &flags);
-
-        if ( !desc )
-            return -EINVAL;
-        /*
-         * Leave the MSI masked, so that the state when calling
-         * pt_irq_create_bind is consistent across bind/unbinds.
-         */
-        guest_mask_msi_irq(desc, true);
-        spin_unlock_irqrestore(&desc->lock, flags);
-        break;
-    }
-
-    default:
-        return -EOPNOTSUPP;
-    }
-
-    spin_lock(&d->event_lock);
-
-    hvm_irq_dpci = domain_get_irq_dpci(d);
-
-    if ( !hvm_irq_dpci && !is_hardware_domain(d) )
-    {
-        spin_unlock(&d->event_lock);
-        return -EINVAL;
-    }
-
-    pirq = pirq_info(d, machine_gsi);
-    pirq_dpci = pirq_dpci(pirq);
-
-    if ( hvm_irq_dpci && pt_irq_bind->irq_type != PT_IRQ_TYPE_MSI )
-    {
-        unsigned int bus = pt_irq_bind->u.pci.bus;
-        unsigned int device = pt_irq_bind->u.pci.device;
-        unsigned int intx = pt_irq_bind->u.pci.intx;
-        unsigned int guest_gsi = hvm_pci_intx_gsi(device, intx);
-        unsigned int link = hvm_pci_intx_link(device, intx);
-        struct hvm_girq_dpci_mapping *girq;
-        struct dev_intx_gsi_link *digl, *tmp;
-
-        list_for_each_entry ( girq, &hvm_irq_dpci->girq[guest_gsi], list )
-        {
-            if ( girq->bus         == bus &&
-                 girq->device      == device &&
-                 girq->intx        == intx &&
-                 girq->machine_gsi == machine_gsi )
-            {
-                list_del(&girq->list);
-                xfree(girq);
-                girq = NULL;
-                break;
-            }
-        }
-
-        if ( girq )
-        {
-            spin_unlock(&d->event_lock);
-            return -EINVAL;
-        }
-
-        hvm_irq_dpci->link_cnt[link]--;
-
-        /* clear the mirq info */
-        if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-        {
-            list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
-            {
-                if ( digl->bus    == bus &&
-                     digl->device == device &&
-                     digl->intx   == intx )
-                {
-                    list_del(&digl->list);
-                    xfree(digl);
-                }
-            }
-            what = list_empty(&pirq_dpci->digl_list) ? "final" : "partial";
-        }
-        else
-            what = "bogus";
-    }
-    else if ( pirq_dpci && pirq_dpci->gmsi.posted )
-        pi_update_irte(NULL, pirq, 0);
-
-    if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
-         list_empty(&pirq_dpci->digl_list) )
-    {
-        pirq_guest_unbind(d, pirq);
-        msixtbl_pt_unregister(d, pirq);
-        if ( pt_irq_need_timer(pirq_dpci->flags) )
-            kill_timer(&pirq_dpci->timer);
-        pirq_dpci->flags = 0;
-        /*
-         * See comment in pt_irq_create_bind's PT_IRQ_TYPE_MSI before the
-         * call to pt_pirq_softirq_reset.
-         */
-        pt_pirq_softirq_reset(pirq_dpci);
-
-        pirq_cleanup_check(pirq, d);
-    }
-
-    spin_unlock(&d->event_lock);
-
-    if ( what && iommu_verbose )
-    {
-        unsigned int device = pt_irq_bind->u.pci.device;
-        char buf[24] = "";
-
-        if ( hvm_irq_dpci )
-            snprintf(buf, ARRAY_SIZE(buf), " dev=%02x.%02x.%u intx=%u",
-                     pt_irq_bind->u.pci.bus, PCI_SLOT(device),
-                     PCI_FUNC(device), pt_irq_bind->u.pci.intx);
-
-        printk(XENLOG_G_INFO "d%d %s unmap: m_irq=%u%s\n",
-               d->domain_id, what, machine_gsi, buf);
-    }
-
-    return 0;
-}
-
-void pt_pirq_init(struct domain *d, struct hvm_pirq_dpci *dpci)
-{
-    INIT_LIST_HEAD(&dpci->digl_list);
-    dpci->gmsi.dest_vcpu_id = -1;
-}
-
-bool pt_pirq_cleanup_check(struct hvm_pirq_dpci *dpci)
-{
-    if ( !dpci->flags && !pt_pirq_softirq_active(dpci) )
-    {
-        dpci->dom = NULL;
-        return true;
-    }
-    return false;
-}
-
-int pt_pirq_iterate(struct domain *d,
-                    int (*cb)(struct domain *,
-                              struct hvm_pirq_dpci *, void *),
-                    void *arg)
-{
-    int rc = 0;
-    unsigned int pirq = 0, n, i;
-    struct pirq *pirqs[8];
-
-    ASSERT(spin_is_locked(&d->event_lock));
-
-    do {
-        n = radix_tree_gang_lookup(&d->pirq_tree, (void **)pirqs, pirq,
-                                   ARRAY_SIZE(pirqs));
-        for ( i = 0; i < n; ++i )
-        {
-            struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirqs[i]);
-
-            pirq = pirqs[i]->pirq;
-            if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-                rc = cb(d, pirq_dpci, arg);
-        }
-    } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
-
-    return rc;
-}
-
-int hvm_do_IRQ_dpci(struct domain *d, struct pirq *pirq)
-{
-    struct hvm_irq_dpci *dpci = domain_get_irq_dpci(d);
-    struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirq);
-
-    ASSERT(is_hvm_domain(d));
-
-    if ( !is_iommu_enabled(d) || (!is_hardware_domain(d) && !dpci) ||
-         !pirq_dpci || !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-        return 0;
-
-    pirq_dpci->masked = 1;
-    raise_softirq_for(pirq_dpci);
-    return 1;
-}
-
-/* called with d->event_lock held */
-static void __msi_pirq_eoi(struct hvm_pirq_dpci *pirq_dpci)
-{
-    irq_desc_t *desc;
-
-    if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
-         (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) )
-    {
-        struct pirq *pirq = dpci_pirq(pirq_dpci);
-
-        BUG_ON(!local_irq_is_enabled());
-        desc = pirq_spin_lock_irq_desc(pirq, NULL);
-        if ( !desc )
-            return;
-        desc_guest_eoi(desc, pirq);
-    }
-}
-
-static int _hvm_dpci_msi_eoi(struct domain *d,
-                             struct hvm_pirq_dpci *pirq_dpci, void *arg)
-{
-    int vector = (long)arg;
-
-    if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) &&
-         (pirq_dpci->gmsi.gvec == vector) )
-    {
-        unsigned int dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
-                                      XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
-        bool dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
-
-        if ( vlapic_match_dest(vcpu_vlapic(current), NULL, 0, dest,
-                               dest_mode) )
-        {
-            __msi_pirq_eoi(pirq_dpci);
-            return 1;
-        }
-    }
-
-    return 0;
-}
-
-void hvm_dpci_msi_eoi(struct domain *d, int vector)
-{
-    if ( !is_iommu_enabled(d) ||
-         (!hvm_domain_irq(d)->dpci && !is_hardware_domain(d)) )
-       return;
-
-    spin_lock(&d->event_lock);
-    pt_pirq_iterate(d, _hvm_dpci_msi_eoi, (void *)(long)vector);
-    spin_unlock(&d->event_lock);
-}
-
-static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
-{
-    if ( unlikely(!hvm_domain_irq(d)->dpci) && !is_hardware_domain(d) )
-    {
-        ASSERT_UNREACHABLE();
-        return;
-    }
-
-    spin_lock(&d->event_lock);
-    if ( test_and_clear_bool(pirq_dpci->masked) )
-    {
-        struct pirq *pirq = dpci_pirq(pirq_dpci);
-        const struct dev_intx_gsi_link *digl;
-
-        if ( hvm_domain_use_pirq(d, pirq) )
-        {
-            send_guest_pirq(d, pirq);
-
-            if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-                goto out;
-        }
-
-        if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-        {
-            vmsi_deliver_pirq(d, pirq_dpci);
-            goto out;
-        }
-
-        list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
-        {
-            ASSERT(!(pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI));
-            hvm_pci_intx_assert(d, digl->device, digl->intx);
-            pirq_dpci->pending++;
-        }
-
-        if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
-        {
-            hvm_gsi_assert(d, pirq->pirq);
-            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
-                goto out;
-            pirq_dpci->pending++;
-        }
-
-        if ( pirq_dpci->flags & HVM_IRQ_DPCI_TRANSLATE )
-        {
-            /* for translated MSI to INTx interrupt, eoi as early as possible */
-            __msi_pirq_eoi(pirq_dpci);
-            goto out;
-        }
-
-        /*
-         * Set a timer to see if the guest can finish the interrupt or not. For
-         * example, the guest OS may unmask the PIC during boot, before the
-         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
-         * guest will never deal with the irq, then the physical interrupt line
-         * will never be deasserted.
-         */
-        ASSERT(pt_irq_need_timer(pirq_dpci->flags));
-        set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
-    }
-
- out:
-    spin_unlock(&d->event_lock);
-}
-
-static void hvm_pirq_eoi(struct pirq *pirq,
-                         const union vioapic_redir_entry *ent)
-{
-    struct hvm_pirq_dpci *pirq_dpci;
-
-    if ( !pirq )
-    {
-        ASSERT_UNREACHABLE();
-        return;
-    }
-
-    pirq_dpci = pirq_dpci(pirq);
-
-    /*
-     * No need to get vector lock for timer
-     * since interrupt is still not EOIed
-     */
-    if ( --pirq_dpci->pending ||
-         (ent && ent->fields.mask) ||
-         !pt_irq_need_timer(pirq_dpci->flags) )
-        return;
-
-    stop_timer(&pirq_dpci->timer);
-    pirq_guest_eoi(pirq);
-}
-
-static void __hvm_dpci_eoi(struct domain *d,
-                           const struct hvm_girq_dpci_mapping *girq,
-                           const union vioapic_redir_entry *ent)
-{
-    struct pirq *pirq = pirq_info(d, girq->machine_gsi);
-
-    if ( !hvm_domain_use_pirq(d, pirq) )
-        hvm_pci_intx_deassert(d, girq->device, girq->intx);
-
-    hvm_pirq_eoi(pirq, ent);
-}
-
-static void hvm_gsi_eoi(struct domain *d, unsigned int gsi,
-                        const union vioapic_redir_entry *ent)
-{
-    struct pirq *pirq = pirq_info(d, gsi);
-
-    /* Check if GSI is actually mapped. */
-    if ( !pirq_dpci(pirq) )
-        return;
-
-    hvm_gsi_deassert(d, gsi);
-    hvm_pirq_eoi(pirq, ent);
-}
-
-void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi,
-                  const union vioapic_redir_entry *ent)
-{
-    const struct hvm_irq_dpci *hvm_irq_dpci;
-    const struct hvm_girq_dpci_mapping *girq;
-
-    if ( !is_iommu_enabled(d) )
-        return;
-
-    if ( is_hardware_domain(d) )
-    {
-        spin_lock(&d->event_lock);
-        hvm_gsi_eoi(d, guest_gsi, ent);
-        goto unlock;
-    }
-
-    if ( guest_gsi < NR_ISAIRQS )
-    {
-        hvm_dpci_isairq_eoi(d, guest_gsi);
-        return;
-    }
-
-    spin_lock(&d->event_lock);
-    hvm_irq_dpci = domain_get_irq_dpci(d);
-
-    if ( !hvm_irq_dpci )
-        goto unlock;
-
-    list_for_each_entry ( girq, &hvm_irq_dpci->girq[guest_gsi], list )
-        __hvm_dpci_eoi(d, girq, ent);
-
-unlock:
-    spin_unlock(&d->event_lock);
-}
-
-/*
- * Note: 'pt_pirq_softirq_reset' can clear the STATE_SCHED before we get to
- * doing it. If that is the case we let 'pt_pirq_softirq_reset' do ref-counting.
- */
-static void dpci_softirq(void)
-{
-    unsigned int cpu = smp_processor_id();
-    LIST_HEAD(our_list);
-
-    local_irq_disable();
-    list_splice_init(&per_cpu(dpci_list, cpu), &our_list);
-    local_irq_enable();
-
-    while ( !list_empty(&our_list) )
-    {
-        struct hvm_pirq_dpci *pirq_dpci;
-        struct domain *d;
-
-        pirq_dpci = list_entry(our_list.next, struct hvm_pirq_dpci, softirq_list);
-        list_del(&pirq_dpci->softirq_list);
-
-        d = pirq_dpci->dom;
-        smp_mb(); /* 'd' MUST be saved before we set/clear the bits. */
-        if ( test_and_set_bit(STATE_RUN, &pirq_dpci->state) )
-        {
-            unsigned long flags;
-
-            /* Put back on the list and retry. */
-            local_irq_save(flags);
-            list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
-            local_irq_restore(flags);
-
-            raise_softirq(HVM_DPCI_SOFTIRQ);
-            continue;
-        }
-        /*
-         * The one who clears STATE_SCHED MUST refcount the domain.
-         */
-        if ( test_and_clear_bit(STATE_SCHED, &pirq_dpci->state) )
-        {
-            hvm_dirq_assist(d, pirq_dpci);
-            put_domain(d);
-        }
-        clear_bit(STATE_RUN, &pirq_dpci->state);
-    }
-}
-
-static int cpu_callback(
-    struct notifier_block *nfb, unsigned long action, void *hcpu)
-{
-    unsigned int cpu = (unsigned long)hcpu;
-
-    switch ( action )
-    {
-    case CPU_UP_PREPARE:
-        INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
-        break;
-    case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        /*
-         * On CPU_DYING this callback is called (on the CPU that is dying)
-         * with an possible HVM_DPIC_SOFTIRQ pending - at which point we can
-         * clear out any outstanding domains (by the virtue of the idle loop
-         * calling the softirq later). In CPU_DEAD case the CPU is deaf and
-         * there are no pending softirqs for us to handle so we can chill.
-         */
-        ASSERT(list_empty(&per_cpu(dpci_list, cpu)));
-        break;
-    }
-
-    return NOTIFY_DONE;
-}
-
-static struct notifier_block cpu_nfb = {
-    .notifier_call = cpu_callback,
-};
-
-static int __init setup_dpci_softirq(void)
-{
-    unsigned int cpu;
-
-    for_each_online_cpu(cpu)
-        INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
-
-    open_softirq(HVM_DPCI_SOFTIRQ, dpci_softirq);
-    register_cpu_notifier(&cpu_nfb);
-    return 0;
-}
-__initcall(setup_dpci_softirq);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 51e584127e..ab590ca398 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -24,7 +24,6 @@
 #include <xen/irq.h>
 #include <xen/param.h>
 #include <xen/vm_event.h>
-#include <asm/hvm/irq.h>
 #include <xen/delay.h>
 #include <xen/keyhandler.h>
 #include <xen/event.h>
@@ -842,71 +841,6 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
     return ret;
 }
 
-static int pci_clean_dpci_irq(struct domain *d,
-                              struct hvm_pirq_dpci *pirq_dpci, void *arg)
-{
-    struct dev_intx_gsi_link *digl, *tmp;
-
-    pirq_guest_unbind(d, dpci_pirq(pirq_dpci));
-
-    if ( pt_irq_need_timer(pirq_dpci->flags) )
-        kill_timer(&pirq_dpci->timer);
-
-    list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
-    {
-        list_del(&digl->list);
-        xfree(digl);
-    }
-
-    radix_tree_delete(&d->pirq_tree, dpci_pirq(pirq_dpci)->pirq);
-
-    if ( !pt_pirq_softirq_active(pirq_dpci) )
-        return 0;
-
-    domain_get_irq_dpci(d)->pending_pirq_dpci = pirq_dpci;
-
-    return -ERESTART;
-}
-
-static int pci_clean_dpci_irqs(struct domain *d)
-{
-    struct hvm_irq_dpci *hvm_irq_dpci = NULL;
-
-    if ( !is_iommu_enabled(d) )
-        return 0;
-
-    if ( !is_hvm_domain(d) )
-        return 0;
-
-    spin_lock(&d->event_lock);
-    hvm_irq_dpci = domain_get_irq_dpci(d);
-    if ( hvm_irq_dpci != NULL )
-    {
-        int ret = 0;
-
-        if ( hvm_irq_dpci->pending_pirq_dpci )
-        {
-            if ( pt_pirq_softirq_active(hvm_irq_dpci->pending_pirq_dpci) )
-                 ret = -ERESTART;
-            else
-                 hvm_irq_dpci->pending_pirq_dpci = NULL;
-        }
-
-        if ( !ret )
-            ret = pt_pirq_iterate(d, pci_clean_dpci_irq, NULL);
-        if ( ret )
-        {
-            spin_unlock(&d->event_lock);
-            return ret;
-        }
-
-        hvm_domain_irq(d)->dpci = NULL;
-        free_hvm_irq_dpci(hvm_irq_dpci);
-    }
-    spin_unlock(&d->event_lock);
-    return 0;
-}
-
 /* Caller should hold the pcidevs_lock */
 static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus,
                            uint8_t devfn)
@@ -966,7 +900,7 @@ int pci_release_devices(struct domain *d)
     int ret;
 
     pcidevs_lock();
-    ret = pci_clean_dpci_irqs(d);
+    ret = arch_pci_clean_pirqs(d);
     if ( ret )
     {
         pcidevs_unlock();
diff --git a/xen/drivers/passthrough/x86/Makefile b/xen/drivers/passthrough/x86/Makefile
index a70cf9460d..69284a5d19 100644
--- a/xen/drivers/passthrough/x86/Makefile
+++ b/xen/drivers/passthrough/x86/Makefile
@@ -1,2 +1,3 @@
 obj-y += ats.o
 obj-y += iommu.o
+obj-$(CONFIG_HVM) += hvm.o
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
new file mode 100644
index 0000000000..41cfa2e200
--- /dev/null
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -0,0 +1,1193 @@
+/*
+ * Copyright (c) 2006, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (C) Allen Kay <allen.m.kay@intel.com>
+ * Copyright (C) Xiaohui Xin <xiaohui.xin@intel.com>
+ */
+
+#include <xen/event.h>
+#include <xen/iommu.h>
+#include <xen/cpu.h>
+#include <xen/irq.h>
+#include <asm/hvm/irq.h>
+#include <asm/hvm/support.h>
+#include <asm/io_apic.h>
+
+static DEFINE_PER_CPU(struct list_head, dpci_list);
+
+/*
+ * These two bit states help to safely schedule, deschedule, and wait until
+ * the softirq has finished.
+ *
+ * The semantics behind these two bits is as follow:
+ *  - STATE_SCHED - whoever modifies it has to ref-count the domain (->dom).
+ *  - STATE_RUN - only softirq is allowed to set and clear it. If it has
+ *      been set hvm_dirq_assist will RUN with a saved value of the
+ *      'struct domain' copied from 'pirq_dpci->dom' before STATE_RUN was set.
+ *
+ * The usual states are: STATE_SCHED(set) -> STATE_RUN(set) ->
+ * STATE_SCHED(unset) -> STATE_RUN(unset).
+ *
+ * However the states can also diverge such as: STATE_SCHED(set) ->
+ * STATE_SCHED(unset) -> STATE_RUN(set) -> STATE_RUN(unset). That means
+ * the 'hvm_dirq_assist' never run and that the softirq did not do any
+ * ref-counting.
+ */
+
+enum {
+    STATE_SCHED,
+    STATE_RUN
+};
+
+/*
+ * This can be called multiple times, but the softirq is only raised once.
+ * That is until the STATE_SCHED state has been cleared. The state can be
+ * cleared by: the 'dpci_softirq' (when it has executed 'hvm_dirq_assist'),
+ * or by 'pt_pirq_softirq_reset' (which will try to clear the state before
+ * the softirq had a chance to run).
+ */
+static void raise_softirq_for(struct hvm_pirq_dpci *pirq_dpci)
+{
+    unsigned long flags;
+
+    if ( test_and_set_bit(STATE_SCHED, &pirq_dpci->state) )
+        return;
+
+    get_knownalive_domain(pirq_dpci->dom);
+
+    local_irq_save(flags);
+    list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
+    local_irq_restore(flags);
+
+    raise_softirq(HVM_DPCI_SOFTIRQ);
+}
+
+/*
+ * If we are racing with softirq_dpci (STATE_SCHED) we return
+ * true. Otherwise we return false.
+ *
+ * If it is false, it is the callers responsibility to make sure
+ * that the softirq (with the event_lock dropped) has ran.
+ */
+bool pt_pirq_softirq_active(struct hvm_pirq_dpci *pirq_dpci)
+{
+    if ( pirq_dpci->state & ((1 << STATE_RUN) | (1 << STATE_SCHED)) )
+        return true;
+
+    /*
+     * If in the future we would call 'raise_softirq_for' right away
+     * after 'pt_pirq_softirq_active' we MUST reset the list (otherwise it
+     * might have stale data).
+     */
+    return false;
+}
+
+/*
+ * Reset the pirq_dpci->dom parameter to NULL.
+ *
+ * This function checks the different states to make sure it can do it
+ * at the right time. If it unschedules the 'hvm_dirq_assist' from running
+ * it also refcounts (which is what the softirq would have done) properly.
+ */
+static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
+{
+    struct domain *d = pirq_dpci->dom;
+
+    ASSERT(spin_is_locked(&d->event_lock));
+
+    switch ( cmpxchg(&pirq_dpci->state, 1 << STATE_SCHED, 0) )
+    {
+    case (1 << STATE_SCHED):
+        /*
+         * We are going to try to de-schedule the softirq before it goes in
+         * STATE_RUN. Whoever clears STATE_SCHED MUST refcount the 'dom'.
+         */
+        put_domain(d);
+        /* fallthrough. */
+    case (1 << STATE_RUN):
+    case (1 << STATE_RUN) | (1 << STATE_SCHED):
+        /*
+         * The reason it is OK to reset 'dom' when STATE_RUN bit is set is due
+         * to a shortcut the 'dpci_softirq' implements. It stashes the 'dom'
+         * in local variable before it sets STATE_RUN - and therefore will not
+         * dereference '->dom' which would crash.
+         */
+        pirq_dpci->dom = NULL;
+        break;
+    }
+    /*
+     * Inhibit 'hvm_dirq_assist' from doing anything useful and at worst
+     * calling 'set_timer' which will blow up (as we have called kill_timer
+     * or never initialized it). Note that we hold the lock that
+     * 'hvm_dirq_assist' could be spinning on.
+     */
+    pirq_dpci->masked = 0;
+}
+
+bool pt_irq_need_timer(uint32_t flags)
+{
+    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
+                      HVM_IRQ_DPCI_NO_EOI));
+}
+
+static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
+                            void *arg)
+{
+    if ( __test_and_clear_bit(_HVM_IRQ_DPCI_EOI_LATCH_SHIFT,
+                              &pirq_dpci->flags) )
+    {
+        pirq_dpci->masked = 0;
+        pirq_dpci->pending = 0;
+        pirq_guest_eoi(dpci_pirq(pirq_dpci));
+    }
+
+    return 0;
+}
+
+static void pt_irq_time_out(void *data)
+{
+    struct hvm_pirq_dpci *irq_map = data;
+    const struct hvm_irq_dpci *dpci;
+    const struct dev_intx_gsi_link *digl;
+
+    spin_lock(&irq_map->dom->event_lock);
+
+    if ( irq_map->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
+    {
+        ASSERT(is_hardware_domain(irq_map->dom));
+        /*
+         * Identity mapped, no need to iterate over the guest GSI list to find
+         * other pirqs sharing the same guest GSI.
+         *
+         * In the identity mapped case the EOI can also be done now, this way
+         * the iteration over the list of domain pirqs is avoided.
+         */
+        hvm_gsi_deassert(irq_map->dom, dpci_pirq(irq_map)->pirq);
+        irq_map->flags |= HVM_IRQ_DPCI_EOI_LATCH;
+        pt_irq_guest_eoi(irq_map->dom, irq_map, NULL);
+        spin_unlock(&irq_map->dom->event_lock);
+        return;
+    }
+
+    dpci = domain_get_irq_dpci(irq_map->dom);
+    if ( unlikely(!dpci) )
+    {
+        ASSERT_UNREACHABLE();
+        spin_unlock(&irq_map->dom->event_lock);
+        return;
+    }
+    list_for_each_entry ( digl, &irq_map->digl_list, list )
+    {
+        unsigned int guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
+        const struct hvm_girq_dpci_mapping *girq;
+
+        list_for_each_entry ( girq, &dpci->girq[guest_gsi], list )
+        {
+            struct pirq *pirq = pirq_info(irq_map->dom, girq->machine_gsi);
+
+            pirq_dpci(pirq)->flags |= HVM_IRQ_DPCI_EOI_LATCH;
+        }
+        hvm_pci_intx_deassert(irq_map->dom, digl->device, digl->intx);
+    }
+
+    pt_pirq_iterate(irq_map->dom, pt_irq_guest_eoi, NULL);
+
+    spin_unlock(&irq_map->dom->event_lock);
+}
+
+struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *d)
+{
+    if ( !d || !is_hvm_domain(d) )
+        return NULL;
+
+    return hvm_domain_irq(d)->dpci;
+}
+
+void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci)
+{
+    xfree(dpci);
+}
+
+/*
+ * This routine handles lowest-priority interrupts using vector-hashing
+ * mechanism. As an example, modern Intel CPUs use this method to handle
+ * lowest-priority interrupts.
+ *
+ * Here is the details about the vector-hashing mechanism:
+ * 1. For lowest-priority interrupts, store all the possible destination
+ *    vCPUs in an array.
+ * 2. Use "gvec % max number of destination vCPUs" to find the right
+ *    destination vCPU in the array for the lowest-priority interrupt.
+ */
+static struct vcpu *vector_hashing_dest(const struct domain *d,
+                                        uint32_t dest_id,
+                                        bool dest_mode,
+                                        uint8_t gvec)
+
+{
+    unsigned long *dest_vcpu_bitmap;
+    unsigned int dest_vcpus = 0;
+    struct vcpu *v, *dest = NULL;
+    unsigned int i;
+
+    dest_vcpu_bitmap = xzalloc_array(unsigned long,
+                                     BITS_TO_LONGS(d->max_vcpus));
+    if ( !dest_vcpu_bitmap )
+        return NULL;
+
+    for_each_vcpu ( d, v )
+    {
+        if ( !vlapic_match_dest(vcpu_vlapic(v), NULL, APIC_DEST_NOSHORT,
+                                dest_id, dest_mode) )
+            continue;
+
+        __set_bit(v->vcpu_id, dest_vcpu_bitmap);
+        dest_vcpus++;
+    }
+
+    if ( dest_vcpus != 0 )
+    {
+        unsigned int mod = gvec % dest_vcpus;
+        unsigned int idx = 0;
+
+        for ( i = 0; i <= mod; i++ )
+        {
+            idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx) + 1;
+            BUG_ON(idx > d->max_vcpus);
+        }
+
+        dest = d->vcpu[idx - 1];
+    }
+
+    xfree(dest_vcpu_bitmap);
+
+    return dest;
+}
+
+int pt_irq_create_bind(
+    struct domain *d, const struct xen_domctl_bind_pt_irq *pt_irq_bind)
+{
+    struct hvm_irq_dpci *hvm_irq_dpci;
+    struct hvm_pirq_dpci *pirq_dpci;
+    struct pirq *info;
+    int rc, pirq = pt_irq_bind->machine_irq;
+
+    if ( pirq < 0 || pirq >= d->nr_pirqs )
+        return -EINVAL;
+
+ restart:
+    spin_lock(&d->event_lock);
+
+    hvm_irq_dpci = domain_get_irq_dpci(d);
+    if ( !hvm_irq_dpci && !is_hardware_domain(d) )
+    {
+        unsigned int i;
+
+        /*
+         * NB: the hardware domain doesn't use a hvm_irq_dpci struct because
+         * it's only allowed to identity map GSIs, and so the data contained in
+         * that struct (used to map guest GSIs into machine GSIs and perform
+         * interrupt routing) is completely useless to it.
+         */
+        hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
+        if ( hvm_irq_dpci == NULL )
+        {
+            spin_unlock(&d->event_lock);
+            return -ENOMEM;
+        }
+        for ( i = 0; i < NR_HVM_DOMU_IRQS; i++ )
+            INIT_LIST_HEAD(&hvm_irq_dpci->girq[i]);
+
+        hvm_domain_irq(d)->dpci = hvm_irq_dpci;
+    }
+
+    info = pirq_get_info(d, pirq);
+    if ( !info )
+    {
+        spin_unlock(&d->event_lock);
+        return -ENOMEM;
+    }
+    pirq_dpci = pirq_dpci(info);
+
+    /*
+     * A crude 'while' loop with us dropping the spinlock and giving
+     * the softirq_dpci a chance to run.
+     * We MUST check for this condition as the softirq could be scheduled
+     * and hasn't run yet. Note that this code replaced tasklet_kill which
+     * would have spun forever and would do the same thing (wait to flush out
+     * outstanding hvm_dirq_assist calls.
+     */
+    if ( pt_pirq_softirq_active(pirq_dpci) )
+    {
+        spin_unlock(&d->event_lock);
+        cpu_relax();
+        goto restart;
+    }
+
+    switch ( pt_irq_bind->irq_type )
+    {
+    case PT_IRQ_TYPE_MSI:
+    {
+        uint8_t dest, delivery_mode;
+        bool dest_mode;
+        int dest_vcpu_id;
+        const struct vcpu *vcpu;
+        uint32_t gflags = pt_irq_bind->u.msi.gflags &
+                          ~XEN_DOMCTL_VMSI_X86_UNMASKED;
+
+        if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+        {
+            pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED | HVM_IRQ_DPCI_MACH_MSI |
+                               HVM_IRQ_DPCI_GUEST_MSI;
+            pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
+            pirq_dpci->gmsi.gflags = gflags;
+            /*
+             * 'pt_irq_create_bind' can be called after 'pt_irq_destroy_bind'.
+             * The 'pirq_cleanup_check' which would free the structure is only
+             * called if the event channel for the PIRQ is active. However
+             * OS-es that use event channels usually bind PIRQs to eventds
+             * and unbind them before calling 'pt_irq_destroy_bind' - with the
+             * result that we re-use the 'dpci' structure. This can be
+             * reproduced with unloading and loading the driver for a device.
+             *
+             * As such on every 'pt_irq_create_bind' call we MUST set it.
+             */
+            pirq_dpci->dom = d;
+            /* bind after hvm_irq_dpci is setup to avoid race with irq handler*/
+            rc = pirq_guest_bind(d->vcpu[0], info, 0);
+            if ( rc == 0 && pt_irq_bind->u.msi.gtable )
+            {
+                rc = msixtbl_pt_register(d, info, pt_irq_bind->u.msi.gtable);
+                if ( unlikely(rc) )
+                {
+                    pirq_guest_unbind(d, info);
+                    /*
+                     * Between 'pirq_guest_bind' and before 'pirq_guest_unbind'
+                     * an interrupt can be scheduled. No more of them are going
+                     * to be scheduled but we must deal with the one that may be
+                     * in the queue.
+                     */
+                    pt_pirq_softirq_reset(pirq_dpci);
+                }
+            }
+            if ( unlikely(rc) )
+            {
+                pirq_dpci->gmsi.gflags = 0;
+                pirq_dpci->gmsi.gvec = 0;
+                pirq_dpci->dom = NULL;
+                pirq_dpci->flags = 0;
+                pirq_cleanup_check(info, d);
+                spin_unlock(&d->event_lock);
+                return rc;
+            }
+        }
+        else
+        {
+            uint32_t mask = HVM_IRQ_DPCI_MACH_MSI | HVM_IRQ_DPCI_GUEST_MSI;
+
+            if ( (pirq_dpci->flags & mask) != mask )
+            {
+                spin_unlock(&d->event_lock);
+                return -EBUSY;
+            }
+
+            /* If pirq is already mapped as vmsi, update guest data/addr. */
+            if ( pirq_dpci->gmsi.gvec != pt_irq_bind->u.msi.gvec ||
+                 pirq_dpci->gmsi.gflags != gflags )
+            {
+                /* Directly clear pending EOIs before enabling new MSI info. */
+                pirq_guest_eoi(info);
+
+                pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
+                pirq_dpci->gmsi.gflags = gflags;
+            }
+        }
+        /* Calculate dest_vcpu_id for MSI-type pirq migration. */
+        dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
+                         XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
+        dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
+        delivery_mode = MASK_EXTR(pirq_dpci->gmsi.gflags,
+                                  XEN_DOMCTL_VMSI_X86_DELIV_MASK);
+
+        dest_vcpu_id = hvm_girq_dest_2_vcpu_id(d, dest, dest_mode);
+        pirq_dpci->gmsi.dest_vcpu_id = dest_vcpu_id;
+        spin_unlock(&d->event_lock);
+
+        pirq_dpci->gmsi.posted = false;
+        vcpu = (dest_vcpu_id >= 0) ? d->vcpu[dest_vcpu_id] : NULL;
+        if ( iommu_intpost )
+        {
+            if ( delivery_mode == dest_LowestPrio )
+                vcpu = vector_hashing_dest(d, dest, dest_mode,
+                                           pirq_dpci->gmsi.gvec);
+            if ( vcpu )
+                pirq_dpci->gmsi.posted = true;
+        }
+        if ( vcpu && is_iommu_enabled(d) )
+            hvm_migrate_pirq(pirq_dpci, vcpu);
+
+        /* Use interrupt posting if it is supported. */
+        if ( iommu_intpost )
+            pi_update_irte(vcpu ? &vcpu->arch.hvm.vmx.pi_desc : NULL,
+                           info, pirq_dpci->gmsi.gvec);
+
+        if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
+        {
+            unsigned long flags;
+            struct irq_desc *desc = pirq_spin_lock_irq_desc(info, &flags);
+
+            if ( !desc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return -EINVAL;
+            }
+
+            guest_mask_msi_irq(desc, false);
+            spin_unlock_irqrestore(&desc->lock, flags);
+        }
+
+        break;
+    }
+
+    case PT_IRQ_TYPE_PCI:
+    case PT_IRQ_TYPE_MSI_TRANSLATE:
+    {
+        struct dev_intx_gsi_link *digl = NULL;
+        struct hvm_girq_dpci_mapping *girq = NULL;
+        unsigned int guest_gsi;
+
+        /*
+         * Mapping GSIs for the hardware domain is different than doing it for
+         * an unpriviledged guest, the hardware domain is only allowed to
+         * identity map GSIs, and as such all the data in the u.pci union is
+         * discarded.
+         */
+        if ( hvm_irq_dpci )
+        {
+            unsigned int link;
+
+            digl = xmalloc(struct dev_intx_gsi_link);
+            girq = xmalloc(struct hvm_girq_dpci_mapping);
+
+            if ( !digl || !girq )
+            {
+                spin_unlock(&d->event_lock);
+                xfree(girq);
+                xfree(digl);
+                return -ENOMEM;
+            }
+
+            girq->bus = digl->bus = pt_irq_bind->u.pci.bus;
+            girq->device = digl->device = pt_irq_bind->u.pci.device;
+            girq->intx = digl->intx = pt_irq_bind->u.pci.intx;
+            list_add_tail(&digl->list, &pirq_dpci->digl_list);
+
+            guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
+            link = hvm_pci_intx_link(digl->device, digl->intx);
+
+            hvm_irq_dpci->link_cnt[link]++;
+
+            girq->machine_gsi = pirq;
+            list_add_tail(&girq->list, &hvm_irq_dpci->girq[guest_gsi]);
+        }
+        else
+        {
+            ASSERT(is_hardware_domain(d));
+
+            /* MSI_TRANSLATE is not supported for the hardware domain. */
+            if ( pt_irq_bind->irq_type != PT_IRQ_TYPE_PCI ||
+                 pirq >= hvm_domain_irq(d)->nr_gsis )
+            {
+                spin_unlock(&d->event_lock);
+
+                return -EINVAL;
+            }
+            guest_gsi = pirq;
+        }
+
+        /* Bind the same mirq once in the same domain */
+        if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+        {
+            unsigned int share;
+
+            /* MUST be set, as the pirq_dpci can be re-used. */
+            pirq_dpci->dom = d;
+            if ( pt_irq_bind->irq_type == PT_IRQ_TYPE_MSI_TRANSLATE )
+            {
+                pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED |
+                                   HVM_IRQ_DPCI_MACH_MSI |
+                                   HVM_IRQ_DPCI_GUEST_PCI |
+                                   HVM_IRQ_DPCI_TRANSLATE;
+                share = 0;
+            }
+            else    /* PT_IRQ_TYPE_PCI */
+            {
+                pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED |
+                                   HVM_IRQ_DPCI_MACH_PCI |
+                                   HVM_IRQ_DPCI_GUEST_PCI;
+                if ( !is_hardware_domain(d) )
+                    share = BIND_PIRQ__WILL_SHARE;
+                else
+                {
+                    int mask = vioapic_get_mask(d, guest_gsi);
+                    int trigger_mode = vioapic_get_trigger_mode(d, guest_gsi);
+
+                    if ( mask < 0 || trigger_mode < 0 )
+                    {
+                        spin_unlock(&d->event_lock);
+
+                        ASSERT_UNREACHABLE();
+                        return -EINVAL;
+                    }
+                    pirq_dpci->flags |= HVM_IRQ_DPCI_IDENTITY_GSI;
+                    /*
+                     * Check if the corresponding vIO APIC pin is configured
+                     * level or edge trigger, level triggered interrupts will
+                     * be marked as shareable.
+                     */
+                    ASSERT(!mask);
+                    share = trigger_mode;
+                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
+                        /*
+                         * Edge IO-APIC interrupt, no EOI or unmask to perform
+                         * and hence no timer needed.
+                         */
+                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
+                }
+            }
+
+            /* Init timer before binding */
+            if ( pt_irq_need_timer(pirq_dpci->flags) )
+                init_timer(&pirq_dpci->timer, pt_irq_time_out, pirq_dpci, 0);
+            /* Deal with gsi for legacy devices */
+            rc = pirq_guest_bind(d->vcpu[0], info, share);
+            if ( unlikely(rc) )
+            {
+                if ( pt_irq_need_timer(pirq_dpci->flags) )
+                    kill_timer(&pirq_dpci->timer);
+                /*
+                 * There is no path for __do_IRQ to schedule softirq as
+                 * IRQ_GUEST is not set. As such we can reset 'dom' directly.
+                 */
+                pirq_dpci->dom = NULL;
+                if ( hvm_irq_dpci )
+                {
+                    unsigned int link;
+
+                    ASSERT(girq && digl);
+                    list_del(&girq->list);
+                    list_del(&digl->list);
+                    link = hvm_pci_intx_link(digl->device, digl->intx);
+                    hvm_irq_dpci->link_cnt[link]--;
+                }
+                pirq_dpci->flags = 0;
+                pirq_cleanup_check(info, d);
+                spin_unlock(&d->event_lock);
+                xfree(girq);
+                xfree(digl);
+                return rc;
+            }
+        }
+
+        spin_unlock(&d->event_lock);
+
+        if ( iommu_verbose )
+        {
+            char buf[24] = "";
+
+            if ( digl )
+                snprintf(buf, ARRAY_SIZE(buf), " dev=%02x.%02x.%u intx=%u",
+                         digl->bus, PCI_SLOT(digl->device),
+                         PCI_FUNC(digl->device), digl->intx);
+
+            printk(XENLOG_G_INFO "d%d: bind: m_gsi=%u g_gsi=%u%s\n",
+                   d->domain_id, pirq, guest_gsi, buf);
+        }
+        break;
+    }
+
+    default:
+        spin_unlock(&d->event_lock);
+        return -EOPNOTSUPP;
+    }
+
+    return 0;
+}
+
+int pt_irq_destroy_bind(
+    struct domain *d, const struct xen_domctl_bind_pt_irq *pt_irq_bind)
+{
+    struct hvm_irq_dpci *hvm_irq_dpci;
+    struct hvm_pirq_dpci *pirq_dpci;
+    unsigned int machine_gsi = pt_irq_bind->machine_irq;
+    struct pirq *pirq;
+    const char *what = NULL;
+
+    switch ( pt_irq_bind->irq_type )
+    {
+    case PT_IRQ_TYPE_PCI:
+    case PT_IRQ_TYPE_MSI_TRANSLATE:
+        if ( iommu_verbose )
+        {
+            unsigned int device = pt_irq_bind->u.pci.device;
+            unsigned int intx = pt_irq_bind->u.pci.intx;
+
+            printk(XENLOG_G_INFO
+                   "d%d: unbind: m_gsi=%u g_gsi=%u dev=%02x:%02x.%u intx=%u\n",
+                   d->domain_id, machine_gsi, hvm_pci_intx_gsi(device, intx),
+                   pt_irq_bind->u.pci.bus,
+                   PCI_SLOT(device), PCI_FUNC(device), intx);
+        }
+        break;
+    case PT_IRQ_TYPE_MSI:
+    {
+        unsigned long flags;
+        struct irq_desc *desc = domain_spin_lock_irq_desc(d, machine_gsi,
+                                                          &flags);
+
+        if ( !desc )
+            return -EINVAL;
+        /*
+         * Leave the MSI masked, so that the state when calling
+         * pt_irq_create_bind is consistent across bind/unbinds.
+         */
+        guest_mask_msi_irq(desc, true);
+        spin_unlock_irqrestore(&desc->lock, flags);
+        break;
+    }
+
+    default:
+        return -EOPNOTSUPP;
+    }
+
+    spin_lock(&d->event_lock);
+
+    hvm_irq_dpci = domain_get_irq_dpci(d);
+
+    if ( !hvm_irq_dpci && !is_hardware_domain(d) )
+    {
+        spin_unlock(&d->event_lock);
+        return -EINVAL;
+    }
+
+    pirq = pirq_info(d, machine_gsi);
+    pirq_dpci = pirq_dpci(pirq);
+
+    if ( hvm_irq_dpci && pt_irq_bind->irq_type != PT_IRQ_TYPE_MSI )
+    {
+        unsigned int bus = pt_irq_bind->u.pci.bus;
+        unsigned int device = pt_irq_bind->u.pci.device;
+        unsigned int intx = pt_irq_bind->u.pci.intx;
+        unsigned int guest_gsi = hvm_pci_intx_gsi(device, intx);
+        unsigned int link = hvm_pci_intx_link(device, intx);
+        struct hvm_girq_dpci_mapping *girq;
+        struct dev_intx_gsi_link *digl, *tmp;
+
+        list_for_each_entry ( girq, &hvm_irq_dpci->girq[guest_gsi], list )
+        {
+            if ( girq->bus         == bus &&
+                 girq->device      == device &&
+                 girq->intx        == intx &&
+                 girq->machine_gsi == machine_gsi )
+            {
+                list_del(&girq->list);
+                xfree(girq);
+                girq = NULL;
+                break;
+            }
+        }
+
+        if ( girq )
+        {
+            spin_unlock(&d->event_lock);
+            return -EINVAL;
+        }
+
+        hvm_irq_dpci->link_cnt[link]--;
+
+        /* clear the mirq info */
+        if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+        {
+            list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
+            {
+                if ( digl->bus    == bus &&
+                     digl->device == device &&
+                     digl->intx   == intx )
+                {
+                    list_del(&digl->list);
+                    xfree(digl);
+                }
+            }
+            what = list_empty(&pirq_dpci->digl_list) ? "final" : "partial";
+        }
+        else
+            what = "bogus";
+    }
+    else if ( pirq_dpci && pirq_dpci->gmsi.posted )
+        pi_update_irte(NULL, pirq, 0);
+
+    if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
+         list_empty(&pirq_dpci->digl_list) )
+    {
+        pirq_guest_unbind(d, pirq);
+        msixtbl_pt_unregister(d, pirq);
+        if ( pt_irq_need_timer(pirq_dpci->flags) )
+            kill_timer(&pirq_dpci->timer);
+        pirq_dpci->flags = 0;
+        /*
+         * See comment in pt_irq_create_bind's PT_IRQ_TYPE_MSI before the
+         * call to pt_pirq_softirq_reset.
+         */
+        pt_pirq_softirq_reset(pirq_dpci);
+
+        pirq_cleanup_check(pirq, d);
+    }
+
+    spin_unlock(&d->event_lock);
+
+    if ( what && iommu_verbose )
+    {
+        unsigned int device = pt_irq_bind->u.pci.device;
+        char buf[24] = "";
+
+        if ( hvm_irq_dpci )
+            snprintf(buf, ARRAY_SIZE(buf), " dev=%02x.%02x.%u intx=%u",
+                     pt_irq_bind->u.pci.bus, PCI_SLOT(device),
+                     PCI_FUNC(device), pt_irq_bind->u.pci.intx);
+
+        printk(XENLOG_G_INFO "d%d %s unmap: m_irq=%u%s\n",
+               d->domain_id, what, machine_gsi, buf);
+    }
+
+    return 0;
+}
+
+void pt_pirq_init(struct domain *d, struct hvm_pirq_dpci *dpci)
+{
+    INIT_LIST_HEAD(&dpci->digl_list);
+    dpci->gmsi.dest_vcpu_id = -1;
+}
+
+bool pt_pirq_cleanup_check(struct hvm_pirq_dpci *dpci)
+{
+    if ( !dpci->flags && !pt_pirq_softirq_active(dpci) )
+    {
+        dpci->dom = NULL;
+        return true;
+    }
+    return false;
+}
+
+int pt_pirq_iterate(struct domain *d,
+                    int (*cb)(struct domain *,
+                              struct hvm_pirq_dpci *, void *),
+                    void *arg)
+{
+    int rc = 0;
+    unsigned int pirq = 0, n, i;
+    struct pirq *pirqs[8];
+
+    ASSERT(spin_is_locked(&d->event_lock));
+
+    do {
+        n = radix_tree_gang_lookup(&d->pirq_tree, (void **)pirqs, pirq,
+                                   ARRAY_SIZE(pirqs));
+        for ( i = 0; i < n; ++i )
+        {
+            struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirqs[i]);
+
+            pirq = pirqs[i]->pirq;
+            if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+                rc = cb(d, pirq_dpci, arg);
+        }
+    } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
+
+    return rc;
+}
+
+int hvm_do_IRQ_dpci(struct domain *d, struct pirq *pirq)
+{
+    struct hvm_irq_dpci *dpci = domain_get_irq_dpci(d);
+    struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirq);
+
+    ASSERT(is_hvm_domain(d));
+
+    if ( !is_iommu_enabled(d) || (!is_hardware_domain(d) && !dpci) ||
+         !pirq_dpci || !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+        return 0;
+
+    pirq_dpci->masked = 1;
+    raise_softirq_for(pirq_dpci);
+    return 1;
+}
+
+/* called with d->event_lock held */
+static void __msi_pirq_eoi(struct hvm_pirq_dpci *pirq_dpci)
+{
+    irq_desc_t *desc;
+
+    if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
+         (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) )
+    {
+        struct pirq *pirq = dpci_pirq(pirq_dpci);
+
+        BUG_ON(!local_irq_is_enabled());
+        desc = pirq_spin_lock_irq_desc(pirq, NULL);
+        if ( !desc )
+            return;
+        desc_guest_eoi(desc, pirq);
+    }
+}
+
+static int _hvm_dpci_msi_eoi(struct domain *d,
+                             struct hvm_pirq_dpci *pirq_dpci, void *arg)
+{
+    int vector = (long)arg;
+
+    if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) &&
+         (pirq_dpci->gmsi.gvec == vector) )
+    {
+        unsigned int dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
+                                      XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
+        bool dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
+
+        if ( vlapic_match_dest(vcpu_vlapic(current), NULL, 0, dest,
+                               dest_mode) )
+        {
+            __msi_pirq_eoi(pirq_dpci);
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+void hvm_dpci_msi_eoi(struct domain *d, int vector)
+{
+    if ( !is_iommu_enabled(d) ||
+         (!hvm_domain_irq(d)->dpci && !is_hardware_domain(d)) )
+       return;
+
+    spin_lock(&d->event_lock);
+    pt_pirq_iterate(d, _hvm_dpci_msi_eoi, (void *)(long)vector);
+    spin_unlock(&d->event_lock);
+}
+
+static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
+{
+    if ( unlikely(!hvm_domain_irq(d)->dpci) && !is_hardware_domain(d) )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
+
+    spin_lock(&d->event_lock);
+    if ( test_and_clear_bool(pirq_dpci->masked) )
+    {
+        struct pirq *pirq = dpci_pirq(pirq_dpci);
+        const struct dev_intx_gsi_link *digl;
+
+        if ( hvm_domain_use_pirq(d, pirq) )
+        {
+            send_guest_pirq(d, pirq);
+
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
+                goto out;
+        }
+
+        if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
+        {
+            vmsi_deliver_pirq(d, pirq_dpci);
+            goto out;
+        }
+
+        list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
+        {
+            ASSERT(!(pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI));
+            hvm_pci_intx_assert(d, digl->device, digl->intx);
+            pirq_dpci->pending++;
+        }
+
+        if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
+        {
+            hvm_gsi_assert(d, pirq->pirq);
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
+                goto out;
+            pirq_dpci->pending++;
+        }
+
+        if ( pirq_dpci->flags & HVM_IRQ_DPCI_TRANSLATE )
+        {
+            /* for translated MSI to INTx interrupt, eoi as early as possible */
+            __msi_pirq_eoi(pirq_dpci);
+            goto out;
+        }
+
+        /*
+         * Set a timer to see if the guest can finish the interrupt or not. For
+         * example, the guest OS may unmask the PIC during boot, before the
+         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
+         * guest will never deal with the irq, then the physical interrupt line
+         * will never be deasserted.
+         */
+        ASSERT(pt_irq_need_timer(pirq_dpci->flags));
+        set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
+    }
+
+ out:
+    spin_unlock(&d->event_lock);
+}
+
+static void hvm_pirq_eoi(struct pirq *pirq,
+                         const union vioapic_redir_entry *ent)
+{
+    struct hvm_pirq_dpci *pirq_dpci;
+
+    if ( !pirq )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
+
+    pirq_dpci = pirq_dpci(pirq);
+
+    /*
+     * No need to get vector lock for timer
+     * since interrupt is still not EOIed
+     */
+    if ( --pirq_dpci->pending ||
+         (ent && ent->fields.mask) ||
+         !pt_irq_need_timer(pirq_dpci->flags) )
+        return;
+
+    stop_timer(&pirq_dpci->timer);
+    pirq_guest_eoi(pirq);
+}
+
+static void __hvm_dpci_eoi(struct domain *d,
+                           const struct hvm_girq_dpci_mapping *girq,
+                           const union vioapic_redir_entry *ent)
+{
+    struct pirq *pirq = pirq_info(d, girq->machine_gsi);
+
+    if ( !hvm_domain_use_pirq(d, pirq) )
+        hvm_pci_intx_deassert(d, girq->device, girq->intx);
+
+    hvm_pirq_eoi(pirq, ent);
+}
+
+static void hvm_gsi_eoi(struct domain *d, unsigned int gsi,
+                        const union vioapic_redir_entry *ent)
+{
+    struct pirq *pirq = pirq_info(d, gsi);
+
+    /* Check if GSI is actually mapped. */
+    if ( !pirq_dpci(pirq) )
+        return;
+
+    hvm_gsi_deassert(d, gsi);
+    hvm_pirq_eoi(pirq, ent);
+}
+
+void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi,
+                  const union vioapic_redir_entry *ent)
+{
+    const struct hvm_irq_dpci *hvm_irq_dpci;
+    const struct hvm_girq_dpci_mapping *girq;
+
+    if ( !is_iommu_enabled(d) )
+        return;
+
+    if ( is_hardware_domain(d) )
+    {
+        spin_lock(&d->event_lock);
+        hvm_gsi_eoi(d, guest_gsi, ent);
+        goto unlock;
+    }
+
+    if ( guest_gsi < NR_ISAIRQS )
+    {
+        hvm_dpci_isairq_eoi(d, guest_gsi);
+        return;
+    }
+
+    spin_lock(&d->event_lock);
+    hvm_irq_dpci = domain_get_irq_dpci(d);
+
+    if ( !hvm_irq_dpci )
+        goto unlock;
+
+    list_for_each_entry ( girq, &hvm_irq_dpci->girq[guest_gsi], list )
+        __hvm_dpci_eoi(d, girq, ent);
+
+unlock:
+    spin_unlock(&d->event_lock);
+}
+
+static int pci_clean_dpci_irq(struct domain *d,
+                              struct hvm_pirq_dpci *pirq_dpci, void *arg)
+{
+    struct dev_intx_gsi_link *digl, *tmp;
+
+    pirq_guest_unbind(d, dpci_pirq(pirq_dpci));
+
+    if ( pt_irq_need_timer(pirq_dpci->flags) )
+        kill_timer(&pirq_dpci->timer);
+
+    list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
+    {
+        list_del(&digl->list);
+        xfree(digl);
+    }
+
+    radix_tree_delete(&d->pirq_tree, dpci_pirq(pirq_dpci)->pirq);
+
+    if ( !pt_pirq_softirq_active(pirq_dpci) )
+        return 0;
+
+    domain_get_irq_dpci(d)->pending_pirq_dpci = pirq_dpci;
+
+    return -ERESTART;
+}
+
+int arch_pci_clean_pirqs(struct domain *d)
+{
+    struct hvm_irq_dpci *hvm_irq_dpci = NULL;
+
+    if ( !is_iommu_enabled(d) )
+        return 0;
+
+    if ( !is_hvm_domain(d) )
+        return 0;
+
+    spin_lock(&d->event_lock);
+    hvm_irq_dpci = domain_get_irq_dpci(d);
+    if ( hvm_irq_dpci != NULL )
+    {
+        int ret = 0;
+
+        if ( hvm_irq_dpci->pending_pirq_dpci )
+        {
+            if ( pt_pirq_softirq_active(hvm_irq_dpci->pending_pirq_dpci) )
+                 ret = -ERESTART;
+            else
+                 hvm_irq_dpci->pending_pirq_dpci = NULL;
+        }
+
+        if ( !ret )
+            ret = pt_pirq_iterate(d, pci_clean_dpci_irq, NULL);
+        if ( ret )
+        {
+            spin_unlock(&d->event_lock);
+            return ret;
+        }
+
+        hvm_domain_irq(d)->dpci = NULL;
+        free_hvm_irq_dpci(hvm_irq_dpci);
+    }
+    spin_unlock(&d->event_lock);
+
+    return 0;
+}
+
+/*
+ * Note: 'pt_pirq_softirq_reset' can clear the STATE_SCHED before we get to
+ * doing it. If that is the case we let 'pt_pirq_softirq_reset' do ref-counting.
+ */
+static void dpci_softirq(void)
+{
+    unsigned int cpu = smp_processor_id();
+    LIST_HEAD(our_list);
+
+    local_irq_disable();
+    list_splice_init(&per_cpu(dpci_list, cpu), &our_list);
+    local_irq_enable();
+
+    while ( !list_empty(&our_list) )
+    {
+        struct hvm_pirq_dpci *pirq_dpci;
+        struct domain *d;
+
+        pirq_dpci = list_entry(our_list.next, struct hvm_pirq_dpci, softirq_list);
+        list_del(&pirq_dpci->softirq_list);
+
+        d = pirq_dpci->dom;
+        smp_mb(); /* 'd' MUST be saved before we set/clear the bits. */
+        if ( test_and_set_bit(STATE_RUN, &pirq_dpci->state) )
+        {
+            unsigned long flags;
+
+            /* Put back on the list and retry. */
+            local_irq_save(flags);
+            list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
+            local_irq_restore(flags);
+
+            raise_softirq(HVM_DPCI_SOFTIRQ);
+            continue;
+        }
+        /*
+         * The one who clears STATE_SCHED MUST refcount the domain.
+         */
+        if ( test_and_clear_bit(STATE_SCHED, &pirq_dpci->state) )
+        {
+            hvm_dirq_assist(d, pirq_dpci);
+            put_domain(d);
+        }
+        clear_bit(STATE_RUN, &pirq_dpci->state);
+    }
+}
+
+static int cpu_callback(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)
+{
+    unsigned int cpu = (unsigned long)hcpu;
+
+    switch ( action )
+    {
+    case CPU_UP_PREPARE:
+        INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
+        break;
+    case CPU_UP_CANCELED:
+    case CPU_DEAD:
+        /*
+         * On CPU_DYING this callback is called (on the CPU that is dying)
+         * with an possible HVM_DPIC_SOFTIRQ pending - at which point we can
+         * clear out any outstanding domains (by the virtue of the idle loop
+         * calling the softirq later). In CPU_DEAD case the CPU is deaf and
+         * there are no pending softirqs for us to handle so we can chill.
+         */
+        ASSERT(list_empty(&per_cpu(dpci_list, cpu)));
+        break;
+    }
+
+    return NOTIFY_DONE;
+}
+
+static struct notifier_block cpu_nfb = {
+    .notifier_call = cpu_callback,
+};
+
+static int __init setup_dpci_softirq(void)
+{
+    unsigned int cpu;
+
+    for_each_online_cpu(cpu)
+        INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
+
+    open_softirq(HVM_DPCI_SOFTIRQ, dpci_softirq);
+    register_cpu_notifier(&cpu_nfb);
+    return 0;
+}
+__initcall(setup_dpci_softirq);
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 20a54a5bb4..8e3d4d9454 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -208,4 +208,13 @@ int msixtbl_pt_register(struct domain *, struct pirq *, uint64_t gtable);
 void msixtbl_pt_unregister(struct domain *, struct pirq *);
 void msixtbl_pt_cleanup(struct domain *d);
 
+#ifdef CONFIG_HVM
+int arch_pci_clean_pirqs(struct domain *d);
+#else
+static inline int arch_pci_clean_pirqs(struct domain *d)
+{
+    return 0;
+}
+#endif /* CONFIG_HVM */
+
 #endif /* __XEN_PCI_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 27 17:11:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Nov 2020 17:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.39685.72666 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kihHU-0000sj-PJ; Fri, 27 Nov 2020 17:11:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 39685.72666; Fri, 27 Nov 2020 17:11:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kihHU-0000sb-MS; Fri, 27 Nov 2020 17:11:36 +0000
Received: by outflank-mailman (input) for mailman id 39685;
 Fri, 27 Nov 2020 17:11:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kihHT-0000sU-Ly
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17:11:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kihHT-0001jR-Jw
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kihHT-0006xh-Iu
 for xen-changelog@lists.xenproject.org; Fri, 27 Nov 2020 17:11:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x36W16y3pDWMb9dUMgqeD8I64+VXCEvEyJvgzCsVrs4=; b=Cw8lsNRUAyuaMlLkcoqFDuEg7b
	fBENiXkuRyjFBqA3tABR5YbRPnzoPKLnDF66vt90IQV+FFUcu25HeqtYJ+TnMwr4rZ/uI1JmeGjLk
	GuLvyfmN8c4kY+vSHKFm4zfJa5m1ZbsmFyU7AZaDbTLhnaFdGfuggGwnpc5iMKyKOb3s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/pci: solve compilation error on ARM with HAS_PCI enabled
Message-Id: <E1kihHT-0006xh-Iu@xenbits.xenproject.org>
Date: Fri, 27 Nov 2020 17:11:35 +0000

commit f7d7d53f6464cff94ead4c15d21e79ce4d9173f5
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Fri Nov 27 18:07:50 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 27 18:07:50 2020 +0100

    xen/pci: solve compilation error on ARM with HAS_PCI enabled
    
    If mem-sharing, mem-paging, or log-dirty functionality is not enabled
    for architecture when HAS_PCI is enabled, the compiler will throw an
    error.
    
    Move code to x86 specific file to fix compilation error.
    
    Also, modify the code to use likely() in place of unlikley() for each
    condition to make code more optimized.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/pci.c       |  8 +-------
 xen/drivers/passthrough/x86/iommu.c | 13 +++++++++++++
 xen/include/xen/iommu.h             |  2 ++
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index ab590ca398..705137f8be 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -23,7 +23,6 @@
 #include <xen/iommu.h>
 #include <xen/irq.h>
 #include <xen/param.h>
-#include <xen/vm_event.h>
 #include <xen/delay.h>
 #include <xen/keyhandler.h>
 #include <xen/event.h>
@@ -1421,12 +1420,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
     if ( !is_iommu_enabled(d) )
         return 0;
 
-    /* Prevent device assign if mem paging or mem sharing have been 
-     * enabled for this domain */
-    if ( d != dom_io &&
-         unlikely(mem_sharing_enabled(d) ||
-                  vm_event_check_ring(d->vm_event_paging) ||
-                  p2m_get_hostp2m(d)->global_logdirty) )
+    if ( !arch_iommu_use_permitted(d) )
         return -EXDEV;
 
     /* device_assigned() should already have cleared the device for assignment */
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index f17b1820f4..cea1032b3d 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -18,6 +18,7 @@
 #include <xen/guest_access.h>
 #include <xen/event.h>
 #include <xen/softirq.h>
+#include <xen/vm_event.h>
 #include <xsm/xsm.h>
 
 #include <asm/hvm/io.h>
@@ -308,6 +309,18 @@ struct page_info *iommu_alloc_pgtable(struct domain *d)
     return pg;
 }
 
+bool arch_iommu_use_permitted(const struct domain *d)
+{
+    /*
+     * Prevent device assign if mem paging, mem sharing or log-dirty
+     * have been enabled for this domain.
+     */
+    return d == dom_io ||
+           (likely(!mem_sharing_enabled(d)) &&
+            likely(!vm_event_check_ring(d->vm_event_paging)) &&
+            likely(!p2m_get_hostp2m(d)->global_logdirty));
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 69af5baf92..f0295fd6c3 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -378,6 +378,8 @@ DECLARE_PER_CPU(bool_t, iommu_dont_flush_iotlb);
 extern struct spinlock iommu_pt_cleanup_lock;
 extern struct page_list_head iommu_pt_cleanup_list;
 
+bool arch_iommu_use_permitted(const struct domain *d);
+
 #endif /* _IOMMU_H_ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Nov 28 10:22:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 28 Nov 2020 10:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.39913.72938 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kixMi-000301-9E; Sat, 28 Nov 2020 10:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 39913.72938; Sat, 28 Nov 2020 10:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kixMi-0002zt-5v; Sat, 28 Nov 2020 10:22:04 +0000
Received: by outflank-mailman (input) for mailman id 39913;
 Sat, 28 Nov 2020 10: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 1kixMg-0002zn-Ge
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10: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 1kixMg-0003gU-Fj
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kixMg-0000jr-D7
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10: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=FyVWMZc1u1NOsyQXYE+84uwILjd0rB5u1AmqNnyZV6Y=; b=qwRlAQYNzsVceqlf3GVRuZ/Abc
	jMijfQwbKZpSmpAAeLfxksZ/J0J1ism5HtzLSGt1S5c9dksKbDRVGMce2hsUyTh2FqVfvtS/PNS/o
	51SOiwVNBzPwusjQhN0Z6nB3rvaFTX6liVdLYZCkyPeGXh0GK916IIYrWuGh7GjuqAtI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu: remove the share_p2m operation
Message-Id: <E1kixMg-0000jr-D7@xenbits.xenproject.org>
Date: Sat, 28 Nov 2020 10:22:02 +0000

commit 25ccd093425ce1d3a9f33ecd82e92f35952b8496
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Fri Nov 27 18:03:42 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 27 18:03:42 2020 +0100

    iommu: remove the share_p2m operation
    
    Sharing of HAP tables is now VT-d specific so the operation is never defined
    for AMD IOMMU any more. There's also no need to pro-actively set vtd.pgd_maddr
    when using shared EPT as it is straightforward to simply define a helper
    function to return the appropriate value in the shared and non-shared cases.
    
    NOTE: This patch also modifies unmap_vtd_domain_page() to take a const
          pointer since the only thing it calls, unmap_domain_page(), also takes
          a const pointer.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/mm/p2m.c                 |  3 --
 xen/drivers/passthrough/iommu.c       |  8 ----
 xen/drivers/passthrough/vtd/extern.h  |  2 +-
 xen/drivers/passthrough/vtd/iommu.c   | 90 +++++++++++++++++++----------------
 xen/drivers/passthrough/vtd/x86/vtd.c |  2 +-
 xen/include/xen/iommu.h               |  3 --
 6 files changed, 52 insertions(+), 56 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index d9cc1856bb..db6cc2202d 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -727,9 +727,6 @@ int p2m_alloc_table(struct p2m_domain *p2m)
 
     p2m->phys_table = pagetable_from_mfn(top_mfn);
 
-    if ( hap_enabled(d) )
-        iommu_share_p2m_table(d);
-
     p2m_unlock(p2m);
     return 0;
 }
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 87f9a857bb..a58703d3fa 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -523,14 +523,6 @@ int iommu_do_domctl(
     return ret;
 }
 
-void iommu_share_p2m_table(struct domain* d)
-{
-    ASSERT(hap_enabled(d));
-
-    if ( iommu_use_hap_pt(d) )
-        iommu_get_ops()->share_p2m(d);
-}
-
 void iommu_crash_shutdown(void)
 {
     if ( !iommu_crash_disable )
diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index ad6c5f907b..19a908ab4f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -72,7 +72,7 @@ void flush_all_cache(void);
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node);
 void free_pgtable_maddr(u64 maddr);
 void *map_vtd_domain_page(u64 maddr);
-void unmap_vtd_domain_page(void *va);
+void unmap_vtd_domain_page(const void *va);
 int domain_context_mapping_one(struct domain *domain, struct vtd_iommu *iommu,
                                u8 bus, u8 devfn, const struct pci_dev *);
 int domain_context_unmap_one(struct domain *domain, struct vtd_iommu *iommu,
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index f6c4021fd6..a76e60c99a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -318,6 +318,48 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
     return pte_maddr;
 }
 
+static uint64_t domain_pgd_maddr(struct domain *d, unsigned int nr_pt_levels)
+{
+    struct domain_iommu *hd = dom_iommu(d);
+    uint64_t pgd_maddr;
+    unsigned int agaw;
+
+    ASSERT(spin_is_locked(&hd->arch.mapping_lock));
+
+    if ( iommu_use_hap_pt(d) )
+    {
+        pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d));
+
+        return pagetable_get_paddr(pgt);
+    }
+
+    if ( !hd->arch.vtd.pgd_maddr )
+    {
+        /* Ensure we have pagetables allocated down to leaf PTE. */
+        addr_to_dma_page_maddr(d, 0, 1);
+
+        if ( !hd->arch.vtd.pgd_maddr )
+            return 0;
+    }
+
+    pgd_maddr = hd->arch.vtd.pgd_maddr;
+
+    /* Skip top levels of page tables for 2- and 3-level DRHDs. */
+    for ( agaw = level_to_agaw(4);
+          agaw != level_to_agaw(nr_pt_levels);
+          agaw-- )
+    {
+        const struct dma_pte *p = map_vtd_domain_page(pgd_maddr);
+
+        pgd_maddr = dma_pte_addr(*p);
+        unmap_vtd_domain_page(p);
+        if ( !pgd_maddr )
+            return 0;
+    }
+
+    return pgd_maddr;
+}
+
 static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 {
     u32 val;
@@ -1286,7 +1328,7 @@ int domain_context_mapping_one(
     struct context_entry *context, *context_entries;
     u64 maddr, pgd_maddr;
     u16 seg = iommu->drhd->segment;
-    int agaw, rc, ret;
+    int rc, ret;
     bool_t flush_dev_iotlb;
 
     ASSERT(pcidevs_locked());
@@ -1340,37 +1382,18 @@ int domain_context_mapping_one(
     if ( iommu_hwdom_passthrough && is_hardware_domain(domain) )
     {
         context_set_translation_type(*context, CONTEXT_TT_PASS_THRU);
-        agaw = level_to_agaw(iommu->nr_pt_levels);
     }
     else
     {
         spin_lock(&hd->arch.mapping_lock);
 
-        /* Ensure we have pagetables allocated down to leaf PTE. */
-        if ( hd->arch.vtd.pgd_maddr == 0 )
-        {
-            addr_to_dma_page_maddr(domain, 0, 1);
-            if ( hd->arch.vtd.pgd_maddr == 0 )
-            {
-            nomem:
-                spin_unlock(&hd->arch.mapping_lock);
-                spin_unlock(&iommu->lock);
-                unmap_vtd_domain_page(context_entries);
-                return -ENOMEM;
-            }
-        }
-
-        /* Skip top levels of page tables for 2- and 3-level DRHDs. */
-        pgd_maddr = hd->arch.vtd.pgd_maddr;
-        for ( agaw = level_to_agaw(4);
-              agaw != level_to_agaw(iommu->nr_pt_levels);
-              agaw-- )
+        pgd_maddr = domain_pgd_maddr(domain, iommu->nr_pt_levels);
+        if ( !pgd_maddr )
         {
-            struct dma_pte *p = map_vtd_domain_page(pgd_maddr);
-            pgd_maddr = dma_pte_addr(*p);
-            unmap_vtd_domain_page(p);
-            if ( pgd_maddr == 0 )
-                goto nomem;
+            spin_unlock(&hd->arch.mapping_lock);
+            spin_unlock(&iommu->lock);
+            unmap_vtd_domain_page(context_entries);
+            return -ENOMEM;
         }
 
         context_set_address_root(*context, pgd_maddr);
@@ -1389,7 +1412,7 @@ int domain_context_mapping_one(
         return -EFAULT;
     }
 
-    context_set_address_width(*context, agaw);
+    context_set_address_width(*context, level_to_agaw(iommu->nr_pt_levels));
     context_set_fault_enable(*context);
     context_set_present(*context);
     iommu_sync_cache(context, sizeof(struct context_entry));
@@ -1848,18 +1871,6 @@ static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
            (ept_has_1gb(ept_cap) && opt_hap_1gb) <= cap_sps_1gb(vtd_cap);
 }
 
-/*
- * set VT-d page table directory to EPT table if allowed
- */
-static void iommu_set_pgd(struct domain *d)
-{
-    mfn_t pgd_mfn;
-
-    pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)));
-    dom_iommu(d)->arch.vtd.pgd_maddr =
-        pagetable_get_paddr(pagetable_from_mfn(pgd_mfn));
-}
-
 static int rmrr_identity_mapping(struct domain *d, bool_t map,
                                  const struct acpi_rmrr_unit *rmrr,
                                  u32 flag)
@@ -2718,7 +2729,6 @@ static struct iommu_ops __initdata vtd_ops = {
     .adjust_irq_affinities = adjust_vtd_irq_affinities,
     .suspend = vtd_suspend,
     .resume = vtd_resume,
-    .share_p2m = iommu_set_pgd,
     .crash_shutdown = vtd_crash_shutdown,
     .iotlb_flush = iommu_flush_iotlb_pages,
     .iotlb_flush_all = iommu_flush_iotlb_all,
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index bbe358dc36..6681dccd69 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -42,7 +42,7 @@ void *map_vtd_domain_page(u64 maddr)
     return map_domain_page(_mfn(paddr_to_pfn(maddr)));
 }
 
-void unmap_vtd_domain_page(void *va)
+void unmap_vtd_domain_page(const void *va)
 {
     unmap_domain_page(va);
 }
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 191021870f..8d36f0b2b2 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -277,7 +277,6 @@ struct iommu_ops {
 
     int __must_check (*suspend)(void);
     void (*resume)(void);
-    void (*share_p2m)(struct domain *d);
     void (*crash_shutdown)(void);
     int __must_check (*iotlb_flush)(struct domain *d, dfn_t dfn,
                                     unsigned long page_count,
@@ -354,8 +353,6 @@ void iommu_resume(void);
 void iommu_crash_shutdown(void);
 int iommu_get_reserved_device_memory(iommu_grdm_t *, void *);
 
-void iommu_share_p2m_table(struct domain *d);
-
 #ifdef CONFIG_HAS_PCI
 int iommu_do_pci_domctl(struct xen_domctl *, struct domain *d,
                         XEN_GUEST_HANDLE_PARAM(xen_domctl_t));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 28 10:22:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 28 Nov 2020 10:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.39914.72940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kixMs-000310-Ak; Sat, 28 Nov 2020 10:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 39914.72940; Sat, 28 Nov 2020 10:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kixMs-00030s-7Y; Sat, 28 Nov 2020 10:22:14 +0000
Received: by outflank-mailman (input) for mailman id 39914;
 Sat, 28 Nov 2020 10: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 1kixMq-00030j-KU
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10: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 1kixMq-0003gb-Jf
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kixMq-0000sg-IW
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10: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=cuXcS5thmAQWyNqcnww+8SbVow+aRhUPvJ22j4XzS74=; b=LE4DgfHMgrFGCegwJlWgIOFKq1
	AQVBmK50FPELgyk0PjaV5wUdCWy63miQzdq9wq3YUUAlHzPEn9X5yEhaKtarNmiY8h/L4q3ZOLdsy
	DwHh9qQIy871isDe97hrtHYo0HiMy2PUpUOQDvNFTYOYD3/TX6/n8koUGNjBz5niYIB0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu: stop calling IOMMU page tables 'p2m tables'
Message-Id: <E1kixMq-0000sg-IW@xenbits.xenproject.org>
Date: Sat, 28 Nov 2020 10:22:12 +0000

commit fcdb988ef1934fe29fa7807dbbc155eb61e428a1
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Fri Nov 27 18:04:47 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 27 18:04:47 2020 +0100

    iommu: stop calling IOMMU page tables 'p2m tables'
    
    It's confusing and not consistent with the terminology introduced with 'dfn_t'.
    Just call them IOMMU page tables.
    
    Also remove a pointless check of the 'acpi_drhd_units' list in
    vtd_dump_page_table_level(). If the list is empty then IOMMU mappings would
    not have been enabled for the domain in the first place.
    
    NOTE: All calls to printk() have also been removed from
          iommu_dump_page_tables(); the implementation specific code is now
          responsible for all output.
          The check for the global 'iommu_enabled' has also been replaced by an
          ASSERT since iommu_dump_page_tables() is not registered as a key handler
          unless IOMMU mappings are enabled.
          Error messages are now prefixed with the name of the function.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c | 20 +++++++++----------
 xen/drivers/passthrough/iommu.c             | 21 +++++---------------
 xen/drivers/passthrough/vtd/iommu.c         | 30 ++++++++++++++++-------------
 xen/include/xen/iommu.h                     |  2 +-
 4 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 64c1fca7b5..42b5a5a9be 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -494,8 +494,8 @@ static int amd_iommu_group_id(u16 seg, u8 bus, u8 devfn)
 
 #include <asm/io_apic.h>
 
-static void amd_dump_p2m_table_level(struct page_info* pg, int level, 
-                                     paddr_t gpa, int indent)
+static void amd_dump_page_table_level(struct page_info *pg, int level,
+                                      paddr_t gpa, int indent)
 {
     paddr_t address;
     const union amd_iommu_pte *table_vaddr;
@@ -507,7 +507,7 @@ static void amd_dump_p2m_table_level(struct page_info* pg, int level,
     table_vaddr = __map_domain_page(pg);
     if ( table_vaddr == NULL )
     {
-        printk("Failed to map IOMMU domain page %"PRIpaddr"\n", 
+        printk("AMD IOMMU failed to map domain page %"PRIpaddr"\n",
                 page_to_maddr(pg));
         return;
     }
@@ -524,7 +524,7 @@ static void amd_dump_p2m_table_level(struct page_info* pg, int level,
 
         if ( pde->next_level && (pde->next_level != (level - 1)) )
         {
-            printk("IOMMU p2m table error. next_level = %d, expected %d\n",
+            printk("AMD IOMMU table error. next_level = %d, expected %d\n",
                    pde->next_level, level - 1);
 
             continue;
@@ -532,7 +532,7 @@ static void amd_dump_p2m_table_level(struct page_info* pg, int level,
 
         address = gpa + amd_offset_level_address(index, level);
         if ( pde->next_level >= 1 )
-            amd_dump_p2m_table_level(
+            amd_dump_page_table_level(
                 mfn_to_page(_mfn(pde->mfn)), pde->next_level,
                 address, indent + 1);
         else
@@ -545,16 +545,16 @@ static void amd_dump_p2m_table_level(struct page_info* pg, int level,
     unmap_domain_page(table_vaddr);
 }
 
-static void amd_dump_p2m_table(struct domain *d)
+static void amd_dump_page_tables(struct domain *d)
 {
     const struct domain_iommu *hd = dom_iommu(d);
 
     if ( !hd->arch.amd.root_table )
         return;
 
-    printk("p2m table has %u levels\n", hd->arch.amd.paging_mode);
-    amd_dump_p2m_table_level(hd->arch.amd.root_table,
-                             hd->arch.amd.paging_mode, 0, 0);
+    printk("AMD IOMMU %pd table has %u levels\n", d, hd->arch.amd.paging_mode);
+    amd_dump_page_table_level(hd->arch.amd.root_table,
+                              hd->arch.amd.paging_mode, 0, 0);
 }
 
 static const struct iommu_ops __initconstrel _iommu_ops = {
@@ -580,7 +580,7 @@ static const struct iommu_ops __initconstrel _iommu_ops = {
     .suspend = amd_iommu_suspend,
     .resume = amd_iommu_resume,
     .crash_shutdown = amd_iommu_crash_shutdown,
-    .dump_p2m_table = amd_dump_p2m_table,
+    .dump_page_tables = amd_dump_page_tables,
 };
 
 static const struct iommu_init_ops __initconstrel _iommu_init_ops = {
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index a58703d3fa..2358b6eb09 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -22,7 +22,7 @@
 #include <xen/keyhandler.h>
 #include <xsm/xsm.h>
 
-static void iommu_dump_p2m_table(unsigned char key);
+static void iommu_dump_page_tables(unsigned char key);
 
 unsigned int __read_mostly iommu_dev_iotlb_timeout = 1000;
 integer_param("iommu_dev_iotlb_timeout", iommu_dev_iotlb_timeout);
@@ -212,7 +212,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
     if ( !is_iommu_enabled(d) )
         return;
 
-    register_keyhandler('o', &iommu_dump_p2m_table, "dump iommu p2m table", 0);
+    register_keyhandler('o', &iommu_dump_page_tables, "dump iommu page tables", 0);
 
     hd->platform_ops->hwdom_init(d);
 }
@@ -558,16 +558,12 @@ bool_t iommu_has_feature(struct domain *d, enum iommu_feature feature)
     return is_iommu_enabled(d) && test_bit(feature, dom_iommu(d)->features);
 }
 
-static void iommu_dump_p2m_table(unsigned char key)
+static void iommu_dump_page_tables(unsigned char key)
 {
     struct domain *d;
     const struct iommu_ops *ops;
 
-    if ( !iommu_enabled )
-    {
-        printk("IOMMU not enabled!\n");
-        return;
-    }
+    ASSERT(iommu_enabled);
 
     ops = iommu_get_ops();
 
@@ -578,14 +574,7 @@ static void iommu_dump_p2m_table(unsigned char key)
         if ( is_hardware_domain(d) || !is_iommu_enabled(d) )
             continue;
 
-        if ( iommu_use_hap_pt(d) )
-        {
-            printk("\ndomain%d IOMMU p2m table shared with MMU: \n", d->domain_id);
-            continue;
-        }
-
-        printk("\ndomain%d IOMMU p2m table: \n", d->domain_id);
-        ops->dump_p2m_table(d);
+        ops->dump_page_tables(d);
     }
 
     rcu_read_unlock(&domlist_read_lock);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index a76e60c99a..d136fe3688 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2582,8 +2582,8 @@ static void vtd_resume(void)
     }
 }
 
-static void vtd_dump_p2m_table_level(paddr_t pt_maddr, int level, paddr_t gpa, 
-                                     int indent)
+static void vtd_dump_page_table_level(paddr_t pt_maddr, int level, paddr_t gpa,
+                                      int indent)
 {
     paddr_t address;
     int i;
@@ -2596,7 +2596,8 @@ static void vtd_dump_p2m_table_level(paddr_t pt_maddr, int level, paddr_t gpa,
     pt_vaddr = map_vtd_domain_page(pt_maddr);
     if ( pt_vaddr == NULL )
     {
-        printk("Failed to map VT-D domain page %"PRIpaddr"\n", pt_maddr);
+        printk(VTDPREFIX " failed to map domain page %"PRIpaddr"\n",
+               pt_maddr);
         return;
     }
 
@@ -2612,8 +2613,8 @@ static void vtd_dump_p2m_table_level(paddr_t pt_maddr, int level, paddr_t gpa,
 
         address = gpa + offset_level_address(i, level);
         if ( next_level >= 1 ) 
-            vtd_dump_p2m_table_level(dma_pte_addr(*pte), next_level, 
-                                     address, indent + 1);
+            vtd_dump_page_table_level(dma_pte_addr(*pte), next_level,
+                                      address, indent + 1);
         else
             printk("%*sdfn: %08lx mfn: %08lx\n",
                    indent, "",
@@ -2624,17 +2625,20 @@ static void vtd_dump_p2m_table_level(paddr_t pt_maddr, int level, paddr_t gpa,
     unmap_vtd_domain_page(pt_vaddr);
 }
 
-static void vtd_dump_p2m_table(struct domain *d)
+static void vtd_dump_page_tables(struct domain *d)
 {
-    const struct domain_iommu *hd;
+    const struct domain_iommu *hd = dom_iommu(d);
 
-    if ( list_empty(&acpi_drhd_units) )
+    if ( iommu_use_hap_pt(d) )
+    {
+        printk(VTDPREFIX " %pd sharing EPT table\n", d);
         return;
+    }
 
-    hd = dom_iommu(d);
-    printk("p2m table has %d levels\n", agaw_to_level(hd->arch.vtd.agaw));
-    vtd_dump_p2m_table_level(hd->arch.vtd.pgd_maddr,
-                             agaw_to_level(hd->arch.vtd.agaw), 0, 0);
+    printk(VTDPREFIX" %pd table has %d levels\n", d,
+           agaw_to_level(hd->arch.vtd.agaw));
+    vtd_dump_page_table_level(hd->arch.vtd.pgd_maddr,
+                              agaw_to_level(hd->arch.vtd.agaw), 0, 0);
 }
 
 static int __init intel_iommu_quarantine_init(struct domain *d)
@@ -2733,7 +2737,7 @@ static struct iommu_ops __initdata vtd_ops = {
     .iotlb_flush = iommu_flush_iotlb_pages,
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
-    .dump_p2m_table = vtd_dump_p2m_table,
+    .dump_page_tables = vtd_dump_page_tables,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 8d36f0b2b2..69af5baf92 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -283,7 +283,7 @@ struct iommu_ops {
                                     unsigned int flush_flags);
     int __must_check (*iotlb_flush_all)(struct domain *d);
     int (*get_reserved_device_memory)(iommu_grdm_t *, void *);
-    void (*dump_p2m_table)(struct domain *d);
+    void (*dump_page_tables)(struct domain *d);
 
 #ifdef CONFIG_HAS_DEVICE_TREE
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 28 10:22:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 28 Nov 2020 10:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.39915.72945 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kixN2-00032Q-DM; Sat, 28 Nov 2020 10:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 39915.72945; Sat, 28 Nov 2020 10: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 1kixN2-00032J-9F; Sat, 28 Nov 2020 10:22:24 +0000
Received: by outflank-mailman (input) for mailman id 39915;
 Sat, 28 Nov 2020 10: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 1kixN0-000329-Og
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10: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 1kixN0-0003hB-NO
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kixN0-0000tF-MG
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10: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=7AtdAOTImGAvudrM1PrqPx2GI2gn4OUAUD3NgYwfsWQ=; b=itD1S23Ey/ptYBeuy2mpwpwDDr
	WjxtzHA7ImP1vYpeqt0HwhEqvE+lS49E32S3KoU6OPpAB9xsct68xXmy4HFmRif9cAoogJFRSHFL8
	9EWA1JkqwXnZ1tLd2xs5MedmZAP1sl0AybgcINHU0qDaNtDd9XsXox/CcMS3NT7CjReU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/pci: move x86 specific code to x86 directory
Message-Id: <E1kixN0-0000tF-MG@xenbits.xenproject.org>
Date: Sat, 28 Nov 2020 10:22:22 +0000

commit f7e77e55d33b7e52477d65f4c5e67281384b650f
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Fri Nov 27 18:06:04 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 27 18:06:04 2020 +0100

    xen/pci: move x86 specific code to x86 directory
    
    passthrough/pci.c file is common for all architecture, but there is x86
    specific code in this file.
    
    Move x86 specific code to the drivers/passthrough/io.c file to avoid
    compilation error for other architecture.
    
    As drivers/passthrough/io.c is compiled only for x86 move it to
    x86 directory and rename it to hvm.c.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/Makefile     |    3 -
 xen/drivers/passthrough/io.c         | 1127 --------------------------------
 xen/drivers/passthrough/pci.c        |   68 +-
 xen/drivers/passthrough/x86/Makefile |    1 +
 xen/drivers/passthrough/x86/hvm.c    | 1193 ++++++++++++++++++++++++++++++++++
 xen/include/xen/pci.h                |    9 +
 6 files changed, 1204 insertions(+), 1197 deletions(-)

diff --git a/xen/drivers/passthrough/Makefile b/xen/drivers/passthrough/Makefile
index e973e16c74..cc646612c7 100644
--- a/xen/drivers/passthrough/Makefile
+++ b/xen/drivers/passthrough/Makefile
@@ -6,6 +6,3 @@ obj-$(CONFIG_ARM) += arm/
 obj-y += iommu.o
 obj-$(CONFIG_HAS_PCI) += pci.o
 obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
-
-x86-$(CONFIG_HVM) := io.o
-obj-$(CONFIG_X86) += $(x86-y)
diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
deleted file mode 100644
index 6b1305a3e5..0000000000
--- a/xen/drivers/passthrough/io.c
+++ /dev/null
@@ -1,1127 +0,0 @@
-/*
- * Copyright (c) 2006, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- *
- * Copyright (C) Allen Kay <allen.m.kay@intel.com>
- * Copyright (C) Xiaohui Xin <xiaohui.xin@intel.com>
- */
-
-#include <xen/event.h>
-#include <xen/iommu.h>
-#include <xen/cpu.h>
-#include <xen/irq.h>
-#include <asm/hvm/irq.h>
-#include <asm/hvm/support.h>
-#include <asm/io_apic.h>
-
-static DEFINE_PER_CPU(struct list_head, dpci_list);
-
-/*
- * These two bit states help to safely schedule, deschedule, and wait until
- * the softirq has finished.
- *
- * The semantics behind these two bits is as follow:
- *  - STATE_SCHED - whoever modifies it has to ref-count the domain (->dom).
- *  - STATE_RUN - only softirq is allowed to set and clear it. If it has
- *      been set hvm_dirq_assist will RUN with a saved value of the
- *      'struct domain' copied from 'pirq_dpci->dom' before STATE_RUN was set.
- *
- * The usual states are: STATE_SCHED(set) -> STATE_RUN(set) ->
- * STATE_SCHED(unset) -> STATE_RUN(unset).
- *
- * However the states can also diverge such as: STATE_SCHED(set) ->
- * STATE_SCHED(unset) -> STATE_RUN(set) -> STATE_RUN(unset). That means
- * the 'hvm_dirq_assist' never run and that the softirq did not do any
- * ref-counting.
- */
-
-enum {
-    STATE_SCHED,
-    STATE_RUN
-};
-
-/*
- * This can be called multiple times, but the softirq is only raised once.
- * That is until the STATE_SCHED state has been cleared. The state can be
- * cleared by: the 'dpci_softirq' (when it has executed 'hvm_dirq_assist'),
- * or by 'pt_pirq_softirq_reset' (which will try to clear the state before
- * the softirq had a chance to run).
- */
-static void raise_softirq_for(struct hvm_pirq_dpci *pirq_dpci)
-{
-    unsigned long flags;
-
-    if ( test_and_set_bit(STATE_SCHED, &pirq_dpci->state) )
-        return;
-
-    get_knownalive_domain(pirq_dpci->dom);
-
-    local_irq_save(flags);
-    list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
-    local_irq_restore(flags);
-
-    raise_softirq(HVM_DPCI_SOFTIRQ);
-}
-
-/*
- * If we are racing with softirq_dpci (STATE_SCHED) we return
- * true. Otherwise we return false.
- *
- * If it is false, it is the callers responsibility to make sure
- * that the softirq (with the event_lock dropped) has ran.
- */
-bool pt_pirq_softirq_active(struct hvm_pirq_dpci *pirq_dpci)
-{
-    if ( pirq_dpci->state & ((1 << STATE_RUN) | (1 << STATE_SCHED)) )
-        return true;
-
-    /*
-     * If in the future we would call 'raise_softirq_for' right away
-     * after 'pt_pirq_softirq_active' we MUST reset the list (otherwise it
-     * might have stale data).
-     */
-    return false;
-}
-
-/*
- * Reset the pirq_dpci->dom parameter to NULL.
- *
- * This function checks the different states to make sure it can do it
- * at the right time. If it unschedules the 'hvm_dirq_assist' from running
- * it also refcounts (which is what the softirq would have done) properly.
- */
-static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
-{
-    struct domain *d = pirq_dpci->dom;
-
-    ASSERT(spin_is_locked(&d->event_lock));
-
-    switch ( cmpxchg(&pirq_dpci->state, 1 << STATE_SCHED, 0) )
-    {
-    case (1 << STATE_SCHED):
-        /*
-         * We are going to try to de-schedule the softirq before it goes in
-         * STATE_RUN. Whoever clears STATE_SCHED MUST refcount the 'dom'.
-         */
-        put_domain(d);
-        /* fallthrough. */
-    case (1 << STATE_RUN):
-    case (1 << STATE_RUN) | (1 << STATE_SCHED):
-        /*
-         * The reason it is OK to reset 'dom' when STATE_RUN bit is set is due
-         * to a shortcut the 'dpci_softirq' implements. It stashes the 'dom'
-         * in local variable before it sets STATE_RUN - and therefore will not
-         * dereference '->dom' which would crash.
-         */
-        pirq_dpci->dom = NULL;
-        break;
-    }
-    /*
-     * Inhibit 'hvm_dirq_assist' from doing anything useful and at worst
-     * calling 'set_timer' which will blow up (as we have called kill_timer
-     * or never initialized it). Note that we hold the lock that
-     * 'hvm_dirq_assist' could be spinning on.
-     */
-    pirq_dpci->masked = 0;
-}
-
-bool pt_irq_need_timer(uint32_t flags)
-{
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
-                      HVM_IRQ_DPCI_NO_EOI));
-}
-
-static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
-                            void *arg)
-{
-    if ( __test_and_clear_bit(_HVM_IRQ_DPCI_EOI_LATCH_SHIFT,
-                              &pirq_dpci->flags) )
-    {
-        pirq_dpci->masked = 0;
-        pirq_dpci->pending = 0;
-        pirq_guest_eoi(dpci_pirq(pirq_dpci));
-    }
-
-    return 0;
-}
-
-static void pt_irq_time_out(void *data)
-{
-    struct hvm_pirq_dpci *irq_map = data;
-    const struct hvm_irq_dpci *dpci;
-    const struct dev_intx_gsi_link *digl;
-
-    spin_lock(&irq_map->dom->event_lock);
-
-    if ( irq_map->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
-    {
-        ASSERT(is_hardware_domain(irq_map->dom));
-        /*
-         * Identity mapped, no need to iterate over the guest GSI list to find
-         * other pirqs sharing the same guest GSI.
-         *
-         * In the identity mapped case the EOI can also be done now, this way
-         * the iteration over the list of domain pirqs is avoided.
-         */
-        hvm_gsi_deassert(irq_map->dom, dpci_pirq(irq_map)->pirq);
-        irq_map->flags |= HVM_IRQ_DPCI_EOI_LATCH;
-        pt_irq_guest_eoi(irq_map->dom, irq_map, NULL);
-        spin_unlock(&irq_map->dom->event_lock);
-        return;
-    }
-
-    dpci = domain_get_irq_dpci(irq_map->dom);
-    if ( unlikely(!dpci) )
-    {
-        ASSERT_UNREACHABLE();
-        spin_unlock(&irq_map->dom->event_lock);
-        return;
-    }
-    list_for_each_entry ( digl, &irq_map->digl_list, list )
-    {
-        unsigned int guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
-        const struct hvm_girq_dpci_mapping *girq;
-
-        list_for_each_entry ( girq, &dpci->girq[guest_gsi], list )
-        {
-            struct pirq *pirq = pirq_info(irq_map->dom, girq->machine_gsi);
-
-            pirq_dpci(pirq)->flags |= HVM_IRQ_DPCI_EOI_LATCH;
-        }
-        hvm_pci_intx_deassert(irq_map->dom, digl->device, digl->intx);
-    }
-
-    pt_pirq_iterate(irq_map->dom, pt_irq_guest_eoi, NULL);
-
-    spin_unlock(&irq_map->dom->event_lock);
-}
-
-struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *d)
-{
-    if ( !d || !is_hvm_domain(d) )
-        return NULL;
-
-    return hvm_domain_irq(d)->dpci;
-}
-
-void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci)
-{
-    xfree(dpci);
-}
-
-/*
- * This routine handles lowest-priority interrupts using vector-hashing
- * mechanism. As an example, modern Intel CPUs use this method to handle
- * lowest-priority interrupts.
- *
- * Here is the details about the vector-hashing mechanism:
- * 1. For lowest-priority interrupts, store all the possible destination
- *    vCPUs in an array.
- * 2. Use "gvec % max number of destination vCPUs" to find the right
- *    destination vCPU in the array for the lowest-priority interrupt.
- */
-static struct vcpu *vector_hashing_dest(const struct domain *d,
-                                        uint32_t dest_id,
-                                        bool dest_mode,
-                                        uint8_t gvec)
-
-{
-    unsigned long *dest_vcpu_bitmap;
-    unsigned int dest_vcpus = 0;
-    struct vcpu *v, *dest = NULL;
-    unsigned int i;
-
-    dest_vcpu_bitmap = xzalloc_array(unsigned long,
-                                     BITS_TO_LONGS(d->max_vcpus));
-    if ( !dest_vcpu_bitmap )
-        return NULL;
-
-    for_each_vcpu ( d, v )
-    {
-        if ( !vlapic_match_dest(vcpu_vlapic(v), NULL, APIC_DEST_NOSHORT,
-                                dest_id, dest_mode) )
-            continue;
-
-        __set_bit(v->vcpu_id, dest_vcpu_bitmap);
-        dest_vcpus++;
-    }
-
-    if ( dest_vcpus != 0 )
-    {
-        unsigned int mod = gvec % dest_vcpus;
-        unsigned int idx = 0;
-
-        for ( i = 0; i <= mod; i++ )
-        {
-            idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx) + 1;
-            BUG_ON(idx > d->max_vcpus);
-        }
-
-        dest = d->vcpu[idx - 1];
-    }
-
-    xfree(dest_vcpu_bitmap);
-
-    return dest;
-}
-
-int pt_irq_create_bind(
-    struct domain *d, const struct xen_domctl_bind_pt_irq *pt_irq_bind)
-{
-    struct hvm_irq_dpci *hvm_irq_dpci;
-    struct hvm_pirq_dpci *pirq_dpci;
-    struct pirq *info;
-    int rc, pirq = pt_irq_bind->machine_irq;
-
-    if ( pirq < 0 || pirq >= d->nr_pirqs )
-        return -EINVAL;
-
- restart:
-    spin_lock(&d->event_lock);
-
-    hvm_irq_dpci = domain_get_irq_dpci(d);
-    if ( !hvm_irq_dpci && !is_hardware_domain(d) )
-    {
-        unsigned int i;
-
-        /*
-         * NB: the hardware domain doesn't use a hvm_irq_dpci struct because
-         * it's only allowed to identity map GSIs, and so the data contained in
-         * that struct (used to map guest GSIs into machine GSIs and perform
-         * interrupt routing) is completely useless to it.
-         */
-        hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
-        if ( hvm_irq_dpci == NULL )
-        {
-            spin_unlock(&d->event_lock);
-            return -ENOMEM;
-        }
-        for ( i = 0; i < NR_HVM_DOMU_IRQS; i++ )
-            INIT_LIST_HEAD(&hvm_irq_dpci->girq[i]);
-
-        hvm_domain_irq(d)->dpci = hvm_irq_dpci;
-    }
-
-    info = pirq_get_info(d, pirq);
-    if ( !info )
-    {
-        spin_unlock(&d->event_lock);
-        return -ENOMEM;
-    }
-    pirq_dpci = pirq_dpci(info);
-
-    /*
-     * A crude 'while' loop with us dropping the spinlock and giving
-     * the softirq_dpci a chance to run.
-     * We MUST check for this condition as the softirq could be scheduled
-     * and hasn't run yet. Note that this code replaced tasklet_kill which
-     * would have spun forever and would do the same thing (wait to flush out
-     * outstanding hvm_dirq_assist calls.
-     */
-    if ( pt_pirq_softirq_active(pirq_dpci) )
-    {
-        spin_unlock(&d->event_lock);
-        cpu_relax();
-        goto restart;
-    }
-
-    switch ( pt_irq_bind->irq_type )
-    {
-    case PT_IRQ_TYPE_MSI:
-    {
-        uint8_t dest, delivery_mode;
-        bool dest_mode;
-        int dest_vcpu_id;
-        const struct vcpu *vcpu;
-        uint32_t gflags = pt_irq_bind->u.msi.gflags &
-                          ~XEN_DOMCTL_VMSI_X86_UNMASKED;
-
-        if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-        {
-            pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED | HVM_IRQ_DPCI_MACH_MSI |
-                               HVM_IRQ_DPCI_GUEST_MSI;
-            pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
-            pirq_dpci->gmsi.gflags = gflags;
-            /*
-             * 'pt_irq_create_bind' can be called after 'pt_irq_destroy_bind'.
-             * The 'pirq_cleanup_check' which would free the structure is only
-             * called if the event channel for the PIRQ is active. However
-             * OS-es that use event channels usually bind PIRQs to eventds
-             * and unbind them before calling 'pt_irq_destroy_bind' - with the
-             * result that we re-use the 'dpci' structure. This can be
-             * reproduced with unloading and loading the driver for a device.
-             *
-             * As such on every 'pt_irq_create_bind' call we MUST set it.
-             */
-            pirq_dpci->dom = d;
-            /* bind after hvm_irq_dpci is setup to avoid race with irq handler*/
-            rc = pirq_guest_bind(d->vcpu[0], info, 0);
-            if ( rc == 0 && pt_irq_bind->u.msi.gtable )
-            {
-                rc = msixtbl_pt_register(d, info, pt_irq_bind->u.msi.gtable);
-                if ( unlikely(rc) )
-                {
-                    pirq_guest_unbind(d, info);
-                    /*
-                     * Between 'pirq_guest_bind' and before 'pirq_guest_unbind'
-                     * an interrupt can be scheduled. No more of them are going
-                     * to be scheduled but we must deal with the one that may be
-                     * in the queue.
-                     */
-                    pt_pirq_softirq_reset(pirq_dpci);
-                }
-            }
-            if ( unlikely(rc) )
-            {
-                pirq_dpci->gmsi.gflags = 0;
-                pirq_dpci->gmsi.gvec = 0;
-                pirq_dpci->dom = NULL;
-                pirq_dpci->flags = 0;
-                pirq_cleanup_check(info, d);
-                spin_unlock(&d->event_lock);
-                return rc;
-            }
-        }
-        else
-        {
-            uint32_t mask = HVM_IRQ_DPCI_MACH_MSI | HVM_IRQ_DPCI_GUEST_MSI;
-
-            if ( (pirq_dpci->flags & mask) != mask )
-            {
-                spin_unlock(&d->event_lock);
-                return -EBUSY;
-            }
-
-            /* If pirq is already mapped as vmsi, update guest data/addr. */
-            if ( pirq_dpci->gmsi.gvec != pt_irq_bind->u.msi.gvec ||
-                 pirq_dpci->gmsi.gflags != gflags )
-            {
-                /* Directly clear pending EOIs before enabling new MSI info. */
-                pirq_guest_eoi(info);
-
-                pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
-                pirq_dpci->gmsi.gflags = gflags;
-            }
-        }
-        /* Calculate dest_vcpu_id for MSI-type pirq migration. */
-        dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
-                         XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
-        dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
-        delivery_mode = MASK_EXTR(pirq_dpci->gmsi.gflags,
-                                  XEN_DOMCTL_VMSI_X86_DELIV_MASK);
-
-        dest_vcpu_id = hvm_girq_dest_2_vcpu_id(d, dest, dest_mode);
-        pirq_dpci->gmsi.dest_vcpu_id = dest_vcpu_id;
-        spin_unlock(&d->event_lock);
-
-        pirq_dpci->gmsi.posted = false;
-        vcpu = (dest_vcpu_id >= 0) ? d->vcpu[dest_vcpu_id] : NULL;
-        if ( iommu_intpost )
-        {
-            if ( delivery_mode == dest_LowestPrio )
-                vcpu = vector_hashing_dest(d, dest, dest_mode,
-                                           pirq_dpci->gmsi.gvec);
-            if ( vcpu )
-                pirq_dpci->gmsi.posted = true;
-        }
-        if ( vcpu && is_iommu_enabled(d) )
-            hvm_migrate_pirq(pirq_dpci, vcpu);
-
-        /* Use interrupt posting if it is supported. */
-        if ( iommu_intpost )
-            pi_update_irte(vcpu ? &vcpu->arch.hvm.vmx.pi_desc : NULL,
-                           info, pirq_dpci->gmsi.gvec);
-
-        if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
-        {
-            unsigned long flags;
-            struct irq_desc *desc = pirq_spin_lock_irq_desc(info, &flags);
-
-            if ( !desc )
-            {
-                pt_irq_destroy_bind(d, pt_irq_bind);
-                return -EINVAL;
-            }
-
-            guest_mask_msi_irq(desc, false);
-            spin_unlock_irqrestore(&desc->lock, flags);
-        }
-
-        break;
-    }
-
-    case PT_IRQ_TYPE_PCI:
-    case PT_IRQ_TYPE_MSI_TRANSLATE:
-    {
-        struct dev_intx_gsi_link *digl = NULL;
-        struct hvm_girq_dpci_mapping *girq = NULL;
-        unsigned int guest_gsi;
-
-        /*
-         * Mapping GSIs for the hardware domain is different than doing it for
-         * an unpriviledged guest, the hardware domain is only allowed to
-         * identity map GSIs, and as such all the data in the u.pci union is
-         * discarded.
-         */
-        if ( hvm_irq_dpci )
-        {
-            unsigned int link;
-
-            digl = xmalloc(struct dev_intx_gsi_link);
-            girq = xmalloc(struct hvm_girq_dpci_mapping);
-
-            if ( !digl || !girq )
-            {
-                spin_unlock(&d->event_lock);
-                xfree(girq);
-                xfree(digl);
-                return -ENOMEM;
-            }
-
-            girq->bus = digl->bus = pt_irq_bind->u.pci.bus;
-            girq->device = digl->device = pt_irq_bind->u.pci.device;
-            girq->intx = digl->intx = pt_irq_bind->u.pci.intx;
-            list_add_tail(&digl->list, &pirq_dpci->digl_list);
-
-            guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
-            link = hvm_pci_intx_link(digl->device, digl->intx);
-
-            hvm_irq_dpci->link_cnt[link]++;
-
-            girq->machine_gsi = pirq;
-            list_add_tail(&girq->list, &hvm_irq_dpci->girq[guest_gsi]);
-        }
-        else
-        {
-            ASSERT(is_hardware_domain(d));
-
-            /* MSI_TRANSLATE is not supported for the hardware domain. */
-            if ( pt_irq_bind->irq_type != PT_IRQ_TYPE_PCI ||
-                 pirq >= hvm_domain_irq(d)->nr_gsis )
-            {
-                spin_unlock(&d->event_lock);
-
-                return -EINVAL;
-            }
-            guest_gsi = pirq;
-        }
-
-        /* Bind the same mirq once in the same domain */
-        if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-        {
-            unsigned int share;
-
-            /* MUST be set, as the pirq_dpci can be re-used. */
-            pirq_dpci->dom = d;
-            if ( pt_irq_bind->irq_type == PT_IRQ_TYPE_MSI_TRANSLATE )
-            {
-                pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED |
-                                   HVM_IRQ_DPCI_MACH_MSI |
-                                   HVM_IRQ_DPCI_GUEST_PCI |
-                                   HVM_IRQ_DPCI_TRANSLATE;
-                share = 0;
-            }
-            else    /* PT_IRQ_TYPE_PCI */
-            {
-                pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED |
-                                   HVM_IRQ_DPCI_MACH_PCI |
-                                   HVM_IRQ_DPCI_GUEST_PCI;
-                if ( !is_hardware_domain(d) )
-                    share = BIND_PIRQ__WILL_SHARE;
-                else
-                {
-                    int mask = vioapic_get_mask(d, guest_gsi);
-                    int trigger_mode = vioapic_get_trigger_mode(d, guest_gsi);
-
-                    if ( mask < 0 || trigger_mode < 0 )
-                    {
-                        spin_unlock(&d->event_lock);
-
-                        ASSERT_UNREACHABLE();
-                        return -EINVAL;
-                    }
-                    pirq_dpci->flags |= HVM_IRQ_DPCI_IDENTITY_GSI;
-                    /*
-                     * Check if the corresponding vIO APIC pin is configured
-                     * level or edge trigger, level triggered interrupts will
-                     * be marked as shareable.
-                     */
-                    ASSERT(!mask);
-                    share = trigger_mode;
-                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
-                        /*
-                         * Edge IO-APIC interrupt, no EOI or unmask to perform
-                         * and hence no timer needed.
-                         */
-                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
-                }
-            }
-
-            /* Init timer before binding */
-            if ( pt_irq_need_timer(pirq_dpci->flags) )
-                init_timer(&pirq_dpci->timer, pt_irq_time_out, pirq_dpci, 0);
-            /* Deal with gsi for legacy devices */
-            rc = pirq_guest_bind(d->vcpu[0], info, share);
-            if ( unlikely(rc) )
-            {
-                if ( pt_irq_need_timer(pirq_dpci->flags) )
-                    kill_timer(&pirq_dpci->timer);
-                /*
-                 * There is no path for __do_IRQ to schedule softirq as
-                 * IRQ_GUEST is not set. As such we can reset 'dom' directly.
-                 */
-                pirq_dpci->dom = NULL;
-                if ( hvm_irq_dpci )
-                {
-                    unsigned int link;
-
-                    ASSERT(girq && digl);
-                    list_del(&girq->list);
-                    list_del(&digl->list);
-                    link = hvm_pci_intx_link(digl->device, digl->intx);
-                    hvm_irq_dpci->link_cnt[link]--;
-                }
-                pirq_dpci->flags = 0;
-                pirq_cleanup_check(info, d);
-                spin_unlock(&d->event_lock);
-                xfree(girq);
-                xfree(digl);
-                return rc;
-            }
-        }
-
-        spin_unlock(&d->event_lock);
-
-        if ( iommu_verbose )
-        {
-            char buf[24] = "";
-
-            if ( digl )
-                snprintf(buf, ARRAY_SIZE(buf), " dev=%02x.%02x.%u intx=%u",
-                         digl->bus, PCI_SLOT(digl->device),
-                         PCI_FUNC(digl->device), digl->intx);
-
-            printk(XENLOG_G_INFO "d%d: bind: m_gsi=%u g_gsi=%u%s\n",
-                   d->domain_id, pirq, guest_gsi, buf);
-        }
-        break;
-    }
-
-    default:
-        spin_unlock(&d->event_lock);
-        return -EOPNOTSUPP;
-    }
-
-    return 0;
-}
-
-int pt_irq_destroy_bind(
-    struct domain *d, const struct xen_domctl_bind_pt_irq *pt_irq_bind)
-{
-    struct hvm_irq_dpci *hvm_irq_dpci;
-    struct hvm_pirq_dpci *pirq_dpci;
-    unsigned int machine_gsi = pt_irq_bind->machine_irq;
-    struct pirq *pirq;
-    const char *what = NULL;
-
-    switch ( pt_irq_bind->irq_type )
-    {
-    case PT_IRQ_TYPE_PCI:
-    case PT_IRQ_TYPE_MSI_TRANSLATE:
-        if ( iommu_verbose )
-        {
-            unsigned int device = pt_irq_bind->u.pci.device;
-            unsigned int intx = pt_irq_bind->u.pci.intx;
-
-            printk(XENLOG_G_INFO
-                   "d%d: unbind: m_gsi=%u g_gsi=%u dev=%02x:%02x.%u intx=%u\n",
-                   d->domain_id, machine_gsi, hvm_pci_intx_gsi(device, intx),
-                   pt_irq_bind->u.pci.bus,
-                   PCI_SLOT(device), PCI_FUNC(device), intx);
-        }
-        break;
-    case PT_IRQ_TYPE_MSI:
-    {
-        unsigned long flags;
-        struct irq_desc *desc = domain_spin_lock_irq_desc(d, machine_gsi,
-                                                          &flags);
-
-        if ( !desc )
-            return -EINVAL;
-        /*
-         * Leave the MSI masked, so that the state when calling
-         * pt_irq_create_bind is consistent across bind/unbinds.
-         */
-        guest_mask_msi_irq(desc, true);
-        spin_unlock_irqrestore(&desc->lock, flags);
-        break;
-    }
-
-    default:
-        return -EOPNOTSUPP;
-    }
-
-    spin_lock(&d->event_lock);
-
-    hvm_irq_dpci = domain_get_irq_dpci(d);
-
-    if ( !hvm_irq_dpci && !is_hardware_domain(d) )
-    {
-        spin_unlock(&d->event_lock);
-        return -EINVAL;
-    }
-
-    pirq = pirq_info(d, machine_gsi);
-    pirq_dpci = pirq_dpci(pirq);
-
-    if ( hvm_irq_dpci && pt_irq_bind->irq_type != PT_IRQ_TYPE_MSI )
-    {
-        unsigned int bus = pt_irq_bind->u.pci.bus;
-        unsigned int device = pt_irq_bind->u.pci.device;
-        unsigned int intx = pt_irq_bind->u.pci.intx;
-        unsigned int guest_gsi = hvm_pci_intx_gsi(device, intx);
-        unsigned int link = hvm_pci_intx_link(device, intx);
-        struct hvm_girq_dpci_mapping *girq;
-        struct dev_intx_gsi_link *digl, *tmp;
-
-        list_for_each_entry ( girq, &hvm_irq_dpci->girq[guest_gsi], list )
-        {
-            if ( girq->bus         == bus &&
-                 girq->device      == device &&
-                 girq->intx        == intx &&
-                 girq->machine_gsi == machine_gsi )
-            {
-                list_del(&girq->list);
-                xfree(girq);
-                girq = NULL;
-                break;
-            }
-        }
-
-        if ( girq )
-        {
-            spin_unlock(&d->event_lock);
-            return -EINVAL;
-        }
-
-        hvm_irq_dpci->link_cnt[link]--;
-
-        /* clear the mirq info */
-        if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-        {
-            list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
-            {
-                if ( digl->bus    == bus &&
-                     digl->device == device &&
-                     digl->intx   == intx )
-                {
-                    list_del(&digl->list);
-                    xfree(digl);
-                }
-            }
-            what = list_empty(&pirq_dpci->digl_list) ? "final" : "partial";
-        }
-        else
-            what = "bogus";
-    }
-    else if ( pirq_dpci && pirq_dpci->gmsi.posted )
-        pi_update_irte(NULL, pirq, 0);
-
-    if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
-         list_empty(&pirq_dpci->digl_list) )
-    {
-        pirq_guest_unbind(d, pirq);
-        msixtbl_pt_unregister(d, pirq);
-        if ( pt_irq_need_timer(pirq_dpci->flags) )
-            kill_timer(&pirq_dpci->timer);
-        pirq_dpci->flags = 0;
-        /*
-         * See comment in pt_irq_create_bind's PT_IRQ_TYPE_MSI before the
-         * call to pt_pirq_softirq_reset.
-         */
-        pt_pirq_softirq_reset(pirq_dpci);
-
-        pirq_cleanup_check(pirq, d);
-    }
-
-    spin_unlock(&d->event_lock);
-
-    if ( what && iommu_verbose )
-    {
-        unsigned int device = pt_irq_bind->u.pci.device;
-        char buf[24] = "";
-
-        if ( hvm_irq_dpci )
-            snprintf(buf, ARRAY_SIZE(buf), " dev=%02x.%02x.%u intx=%u",
-                     pt_irq_bind->u.pci.bus, PCI_SLOT(device),
-                     PCI_FUNC(device), pt_irq_bind->u.pci.intx);
-
-        printk(XENLOG_G_INFO "d%d %s unmap: m_irq=%u%s\n",
-               d->domain_id, what, machine_gsi, buf);
-    }
-
-    return 0;
-}
-
-void pt_pirq_init(struct domain *d, struct hvm_pirq_dpci *dpci)
-{
-    INIT_LIST_HEAD(&dpci->digl_list);
-    dpci->gmsi.dest_vcpu_id = -1;
-}
-
-bool pt_pirq_cleanup_check(struct hvm_pirq_dpci *dpci)
-{
-    if ( !dpci->flags && !pt_pirq_softirq_active(dpci) )
-    {
-        dpci->dom = NULL;
-        return true;
-    }
-    return false;
-}
-
-int pt_pirq_iterate(struct domain *d,
-                    int (*cb)(struct domain *,
-                              struct hvm_pirq_dpci *, void *),
-                    void *arg)
-{
-    int rc = 0;
-    unsigned int pirq = 0, n, i;
-    struct pirq *pirqs[8];
-
-    ASSERT(spin_is_locked(&d->event_lock));
-
-    do {
-        n = radix_tree_gang_lookup(&d->pirq_tree, (void **)pirqs, pirq,
-                                   ARRAY_SIZE(pirqs));
-        for ( i = 0; i < n; ++i )
-        {
-            struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirqs[i]);
-
-            pirq = pirqs[i]->pirq;
-            if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-                rc = cb(d, pirq_dpci, arg);
-        }
-    } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
-
-    return rc;
-}
-
-int hvm_do_IRQ_dpci(struct domain *d, struct pirq *pirq)
-{
-    struct hvm_irq_dpci *dpci = domain_get_irq_dpci(d);
-    struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirq);
-
-    ASSERT(is_hvm_domain(d));
-
-    if ( !is_iommu_enabled(d) || (!is_hardware_domain(d) && !dpci) ||
-         !pirq_dpci || !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
-        return 0;
-
-    pirq_dpci->masked = 1;
-    raise_softirq_for(pirq_dpci);
-    return 1;
-}
-
-/* called with d->event_lock held */
-static void __msi_pirq_eoi(struct hvm_pirq_dpci *pirq_dpci)
-{
-    irq_desc_t *desc;
-
-    if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
-         (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) )
-    {
-        struct pirq *pirq = dpci_pirq(pirq_dpci);
-
-        BUG_ON(!local_irq_is_enabled());
-        desc = pirq_spin_lock_irq_desc(pirq, NULL);
-        if ( !desc )
-            return;
-        desc_guest_eoi(desc, pirq);
-    }
-}
-
-static int _hvm_dpci_msi_eoi(struct domain *d,
-                             struct hvm_pirq_dpci *pirq_dpci, void *arg)
-{
-    int vector = (long)arg;
-
-    if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) &&
-         (pirq_dpci->gmsi.gvec == vector) )
-    {
-        unsigned int dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
-                                      XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
-        bool dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
-
-        if ( vlapic_match_dest(vcpu_vlapic(current), NULL, 0, dest,
-                               dest_mode) )
-        {
-            __msi_pirq_eoi(pirq_dpci);
-            return 1;
-        }
-    }
-
-    return 0;
-}
-
-void hvm_dpci_msi_eoi(struct domain *d, int vector)
-{
-    if ( !is_iommu_enabled(d) ||
-         (!hvm_domain_irq(d)->dpci && !is_hardware_domain(d)) )
-       return;
-
-    spin_lock(&d->event_lock);
-    pt_pirq_iterate(d, _hvm_dpci_msi_eoi, (void *)(long)vector);
-    spin_unlock(&d->event_lock);
-}
-
-static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
-{
-    if ( unlikely(!hvm_domain_irq(d)->dpci) && !is_hardware_domain(d) )
-    {
-        ASSERT_UNREACHABLE();
-        return;
-    }
-
-    spin_lock(&d->event_lock);
-    if ( test_and_clear_bool(pirq_dpci->masked) )
-    {
-        struct pirq *pirq = dpci_pirq(pirq_dpci);
-        const struct dev_intx_gsi_link *digl;
-
-        if ( hvm_domain_use_pirq(d, pirq) )
-        {
-            send_guest_pirq(d, pirq);
-
-            if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-                goto out;
-        }
-
-        if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-        {
-            vmsi_deliver_pirq(d, pirq_dpci);
-            goto out;
-        }
-
-        list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
-        {
-            ASSERT(!(pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI));
-            hvm_pci_intx_assert(d, digl->device, digl->intx);
-            pirq_dpci->pending++;
-        }
-
-        if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
-        {
-            hvm_gsi_assert(d, pirq->pirq);
-            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
-                goto out;
-            pirq_dpci->pending++;
-        }
-
-        if ( pirq_dpci->flags & HVM_IRQ_DPCI_TRANSLATE )
-        {
-            /* for translated MSI to INTx interrupt, eoi as early as possible */
-            __msi_pirq_eoi(pirq_dpci);
-            goto out;
-        }
-
-        /*
-         * Set a timer to see if the guest can finish the interrupt or not. For
-         * example, the guest OS may unmask the PIC during boot, before the
-         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
-         * guest will never deal with the irq, then the physical interrupt line
-         * will never be deasserted.
-         */
-        ASSERT(pt_irq_need_timer(pirq_dpci->flags));
-        set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
-    }
-
- out:
-    spin_unlock(&d->event_lock);
-}
-
-static void hvm_pirq_eoi(struct pirq *pirq,
-                         const union vioapic_redir_entry *ent)
-{
-    struct hvm_pirq_dpci *pirq_dpci;
-
-    if ( !pirq )
-    {
-        ASSERT_UNREACHABLE();
-        return;
-    }
-
-    pirq_dpci = pirq_dpci(pirq);
-
-    /*
-     * No need to get vector lock for timer
-     * since interrupt is still not EOIed
-     */
-    if ( --pirq_dpci->pending ||
-         (ent && ent->fields.mask) ||
-         !pt_irq_need_timer(pirq_dpci->flags) )
-        return;
-
-    stop_timer(&pirq_dpci->timer);
-    pirq_guest_eoi(pirq);
-}
-
-static void __hvm_dpci_eoi(struct domain *d,
-                           const struct hvm_girq_dpci_mapping *girq,
-                           const union vioapic_redir_entry *ent)
-{
-    struct pirq *pirq = pirq_info(d, girq->machine_gsi);
-
-    if ( !hvm_domain_use_pirq(d, pirq) )
-        hvm_pci_intx_deassert(d, girq->device, girq->intx);
-
-    hvm_pirq_eoi(pirq, ent);
-}
-
-static void hvm_gsi_eoi(struct domain *d, unsigned int gsi,
-                        const union vioapic_redir_entry *ent)
-{
-    struct pirq *pirq = pirq_info(d, gsi);
-
-    /* Check if GSI is actually mapped. */
-    if ( !pirq_dpci(pirq) )
-        return;
-
-    hvm_gsi_deassert(d, gsi);
-    hvm_pirq_eoi(pirq, ent);
-}
-
-void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi,
-                  const union vioapic_redir_entry *ent)
-{
-    const struct hvm_irq_dpci *hvm_irq_dpci;
-    const struct hvm_girq_dpci_mapping *girq;
-
-    if ( !is_iommu_enabled(d) )
-        return;
-
-    if ( is_hardware_domain(d) )
-    {
-        spin_lock(&d->event_lock);
-        hvm_gsi_eoi(d, guest_gsi, ent);
-        goto unlock;
-    }
-
-    if ( guest_gsi < NR_ISAIRQS )
-    {
-        hvm_dpci_isairq_eoi(d, guest_gsi);
-        return;
-    }
-
-    spin_lock(&d->event_lock);
-    hvm_irq_dpci = domain_get_irq_dpci(d);
-
-    if ( !hvm_irq_dpci )
-        goto unlock;
-
-    list_for_each_entry ( girq, &hvm_irq_dpci->girq[guest_gsi], list )
-        __hvm_dpci_eoi(d, girq, ent);
-
-unlock:
-    spin_unlock(&d->event_lock);
-}
-
-/*
- * Note: 'pt_pirq_softirq_reset' can clear the STATE_SCHED before we get to
- * doing it. If that is the case we let 'pt_pirq_softirq_reset' do ref-counting.
- */
-static void dpci_softirq(void)
-{
-    unsigned int cpu = smp_processor_id();
-    LIST_HEAD(our_list);
-
-    local_irq_disable();
-    list_splice_init(&per_cpu(dpci_list, cpu), &our_list);
-    local_irq_enable();
-
-    while ( !list_empty(&our_list) )
-    {
-        struct hvm_pirq_dpci *pirq_dpci;
-        struct domain *d;
-
-        pirq_dpci = list_entry(our_list.next, struct hvm_pirq_dpci, softirq_list);
-        list_del(&pirq_dpci->softirq_list);
-
-        d = pirq_dpci->dom;
-        smp_mb(); /* 'd' MUST be saved before we set/clear the bits. */
-        if ( test_and_set_bit(STATE_RUN, &pirq_dpci->state) )
-        {
-            unsigned long flags;
-
-            /* Put back on the list and retry. */
-            local_irq_save(flags);
-            list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
-            local_irq_restore(flags);
-
-            raise_softirq(HVM_DPCI_SOFTIRQ);
-            continue;
-        }
-        /*
-         * The one who clears STATE_SCHED MUST refcount the domain.
-         */
-        if ( test_and_clear_bit(STATE_SCHED, &pirq_dpci->state) )
-        {
-            hvm_dirq_assist(d, pirq_dpci);
-            put_domain(d);
-        }
-        clear_bit(STATE_RUN, &pirq_dpci->state);
-    }
-}
-
-static int cpu_callback(
-    struct notifier_block *nfb, unsigned long action, void *hcpu)
-{
-    unsigned int cpu = (unsigned long)hcpu;
-
-    switch ( action )
-    {
-    case CPU_UP_PREPARE:
-        INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
-        break;
-    case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        /*
-         * On CPU_DYING this callback is called (on the CPU that is dying)
-         * with an possible HVM_DPIC_SOFTIRQ pending - at which point we can
-         * clear out any outstanding domains (by the virtue of the idle loop
-         * calling the softirq later). In CPU_DEAD case the CPU is deaf and
-         * there are no pending softirqs for us to handle so we can chill.
-         */
-        ASSERT(list_empty(&per_cpu(dpci_list, cpu)));
-        break;
-    }
-
-    return NOTIFY_DONE;
-}
-
-static struct notifier_block cpu_nfb = {
-    .notifier_call = cpu_callback,
-};
-
-static int __init setup_dpci_softirq(void)
-{
-    unsigned int cpu;
-
-    for_each_online_cpu(cpu)
-        INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
-
-    open_softirq(HVM_DPCI_SOFTIRQ, dpci_softirq);
-    register_cpu_notifier(&cpu_nfb);
-    return 0;
-}
-__initcall(setup_dpci_softirq);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 51e584127e..ab590ca398 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -24,7 +24,6 @@
 #include <xen/irq.h>
 #include <xen/param.h>
 #include <xen/vm_event.h>
-#include <asm/hvm/irq.h>
 #include <xen/delay.h>
 #include <xen/keyhandler.h>
 #include <xen/event.h>
@@ -842,71 +841,6 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
     return ret;
 }
 
-static int pci_clean_dpci_irq(struct domain *d,
-                              struct hvm_pirq_dpci *pirq_dpci, void *arg)
-{
-    struct dev_intx_gsi_link *digl, *tmp;
-
-    pirq_guest_unbind(d, dpci_pirq(pirq_dpci));
-
-    if ( pt_irq_need_timer(pirq_dpci->flags) )
-        kill_timer(&pirq_dpci->timer);
-
-    list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
-    {
-        list_del(&digl->list);
-        xfree(digl);
-    }
-
-    radix_tree_delete(&d->pirq_tree, dpci_pirq(pirq_dpci)->pirq);
-
-    if ( !pt_pirq_softirq_active(pirq_dpci) )
-        return 0;
-
-    domain_get_irq_dpci(d)->pending_pirq_dpci = pirq_dpci;
-
-    return -ERESTART;
-}
-
-static int pci_clean_dpci_irqs(struct domain *d)
-{
-    struct hvm_irq_dpci *hvm_irq_dpci = NULL;
-
-    if ( !is_iommu_enabled(d) )
-        return 0;
-
-    if ( !is_hvm_domain(d) )
-        return 0;
-
-    spin_lock(&d->event_lock);
-    hvm_irq_dpci = domain_get_irq_dpci(d);
-    if ( hvm_irq_dpci != NULL )
-    {
-        int ret = 0;
-
-        if ( hvm_irq_dpci->pending_pirq_dpci )
-        {
-            if ( pt_pirq_softirq_active(hvm_irq_dpci->pending_pirq_dpci) )
-                 ret = -ERESTART;
-            else
-                 hvm_irq_dpci->pending_pirq_dpci = NULL;
-        }
-
-        if ( !ret )
-            ret = pt_pirq_iterate(d, pci_clean_dpci_irq, NULL);
-        if ( ret )
-        {
-            spin_unlock(&d->event_lock);
-            return ret;
-        }
-
-        hvm_domain_irq(d)->dpci = NULL;
-        free_hvm_irq_dpci(hvm_irq_dpci);
-    }
-    spin_unlock(&d->event_lock);
-    return 0;
-}
-
 /* Caller should hold the pcidevs_lock */
 static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus,
                            uint8_t devfn)
@@ -966,7 +900,7 @@ int pci_release_devices(struct domain *d)
     int ret;
 
     pcidevs_lock();
-    ret = pci_clean_dpci_irqs(d);
+    ret = arch_pci_clean_pirqs(d);
     if ( ret )
     {
         pcidevs_unlock();
diff --git a/xen/drivers/passthrough/x86/Makefile b/xen/drivers/passthrough/x86/Makefile
index a70cf9460d..69284a5d19 100644
--- a/xen/drivers/passthrough/x86/Makefile
+++ b/xen/drivers/passthrough/x86/Makefile
@@ -1,2 +1,3 @@
 obj-y += ats.o
 obj-y += iommu.o
+obj-$(CONFIG_HVM) += hvm.o
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
new file mode 100644
index 0000000000..41cfa2e200
--- /dev/null
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -0,0 +1,1193 @@
+/*
+ * Copyright (c) 2006, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (C) Allen Kay <allen.m.kay@intel.com>
+ * Copyright (C) Xiaohui Xin <xiaohui.xin@intel.com>
+ */
+
+#include <xen/event.h>
+#include <xen/iommu.h>
+#include <xen/cpu.h>
+#include <xen/irq.h>
+#include <asm/hvm/irq.h>
+#include <asm/hvm/support.h>
+#include <asm/io_apic.h>
+
+static DEFINE_PER_CPU(struct list_head, dpci_list);
+
+/*
+ * These two bit states help to safely schedule, deschedule, and wait until
+ * the softirq has finished.
+ *
+ * The semantics behind these two bits is as follow:
+ *  - STATE_SCHED - whoever modifies it has to ref-count the domain (->dom).
+ *  - STATE_RUN - only softirq is allowed to set and clear it. If it has
+ *      been set hvm_dirq_assist will RUN with a saved value of the
+ *      'struct domain' copied from 'pirq_dpci->dom' before STATE_RUN was set.
+ *
+ * The usual states are: STATE_SCHED(set) -> STATE_RUN(set) ->
+ * STATE_SCHED(unset) -> STATE_RUN(unset).
+ *
+ * However the states can also diverge such as: STATE_SCHED(set) ->
+ * STATE_SCHED(unset) -> STATE_RUN(set) -> STATE_RUN(unset). That means
+ * the 'hvm_dirq_assist' never run and that the softirq did not do any
+ * ref-counting.
+ */
+
+enum {
+    STATE_SCHED,
+    STATE_RUN
+};
+
+/*
+ * This can be called multiple times, but the softirq is only raised once.
+ * That is until the STATE_SCHED state has been cleared. The state can be
+ * cleared by: the 'dpci_softirq' (when it has executed 'hvm_dirq_assist'),
+ * or by 'pt_pirq_softirq_reset' (which will try to clear the state before
+ * the softirq had a chance to run).
+ */
+static void raise_softirq_for(struct hvm_pirq_dpci *pirq_dpci)
+{
+    unsigned long flags;
+
+    if ( test_and_set_bit(STATE_SCHED, &pirq_dpci->state) )
+        return;
+
+    get_knownalive_domain(pirq_dpci->dom);
+
+    local_irq_save(flags);
+    list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
+    local_irq_restore(flags);
+
+    raise_softirq(HVM_DPCI_SOFTIRQ);
+}
+
+/*
+ * If we are racing with softirq_dpci (STATE_SCHED) we return
+ * true. Otherwise we return false.
+ *
+ * If it is false, it is the callers responsibility to make sure
+ * that the softirq (with the event_lock dropped) has ran.
+ */
+bool pt_pirq_softirq_active(struct hvm_pirq_dpci *pirq_dpci)
+{
+    if ( pirq_dpci->state & ((1 << STATE_RUN) | (1 << STATE_SCHED)) )
+        return true;
+
+    /*
+     * If in the future we would call 'raise_softirq_for' right away
+     * after 'pt_pirq_softirq_active' we MUST reset the list (otherwise it
+     * might have stale data).
+     */
+    return false;
+}
+
+/*
+ * Reset the pirq_dpci->dom parameter to NULL.
+ *
+ * This function checks the different states to make sure it can do it
+ * at the right time. If it unschedules the 'hvm_dirq_assist' from running
+ * it also refcounts (which is what the softirq would have done) properly.
+ */
+static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
+{
+    struct domain *d = pirq_dpci->dom;
+
+    ASSERT(spin_is_locked(&d->event_lock));
+
+    switch ( cmpxchg(&pirq_dpci->state, 1 << STATE_SCHED, 0) )
+    {
+    case (1 << STATE_SCHED):
+        /*
+         * We are going to try to de-schedule the softirq before it goes in
+         * STATE_RUN. Whoever clears STATE_SCHED MUST refcount the 'dom'.
+         */
+        put_domain(d);
+        /* fallthrough. */
+    case (1 << STATE_RUN):
+    case (1 << STATE_RUN) | (1 << STATE_SCHED):
+        /*
+         * The reason it is OK to reset 'dom' when STATE_RUN bit is set is due
+         * to a shortcut the 'dpci_softirq' implements. It stashes the 'dom'
+         * in local variable before it sets STATE_RUN - and therefore will not
+         * dereference '->dom' which would crash.
+         */
+        pirq_dpci->dom = NULL;
+        break;
+    }
+    /*
+     * Inhibit 'hvm_dirq_assist' from doing anything useful and at worst
+     * calling 'set_timer' which will blow up (as we have called kill_timer
+     * or never initialized it). Note that we hold the lock that
+     * 'hvm_dirq_assist' could be spinning on.
+     */
+    pirq_dpci->masked = 0;
+}
+
+bool pt_irq_need_timer(uint32_t flags)
+{
+    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
+                      HVM_IRQ_DPCI_NO_EOI));
+}
+
+static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
+                            void *arg)
+{
+    if ( __test_and_clear_bit(_HVM_IRQ_DPCI_EOI_LATCH_SHIFT,
+                              &pirq_dpci->flags) )
+    {
+        pirq_dpci->masked = 0;
+        pirq_dpci->pending = 0;
+        pirq_guest_eoi(dpci_pirq(pirq_dpci));
+    }
+
+    return 0;
+}
+
+static void pt_irq_time_out(void *data)
+{
+    struct hvm_pirq_dpci *irq_map = data;
+    const struct hvm_irq_dpci *dpci;
+    const struct dev_intx_gsi_link *digl;
+
+    spin_lock(&irq_map->dom->event_lock);
+
+    if ( irq_map->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
+    {
+        ASSERT(is_hardware_domain(irq_map->dom));
+        /*
+         * Identity mapped, no need to iterate over the guest GSI list to find
+         * other pirqs sharing the same guest GSI.
+         *
+         * In the identity mapped case the EOI can also be done now, this way
+         * the iteration over the list of domain pirqs is avoided.
+         */
+        hvm_gsi_deassert(irq_map->dom, dpci_pirq(irq_map)->pirq);
+        irq_map->flags |= HVM_IRQ_DPCI_EOI_LATCH;
+        pt_irq_guest_eoi(irq_map->dom, irq_map, NULL);
+        spin_unlock(&irq_map->dom->event_lock);
+        return;
+    }
+
+    dpci = domain_get_irq_dpci(irq_map->dom);
+    if ( unlikely(!dpci) )
+    {
+        ASSERT_UNREACHABLE();
+        spin_unlock(&irq_map->dom->event_lock);
+        return;
+    }
+    list_for_each_entry ( digl, &irq_map->digl_list, list )
+    {
+        unsigned int guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
+        const struct hvm_girq_dpci_mapping *girq;
+
+        list_for_each_entry ( girq, &dpci->girq[guest_gsi], list )
+        {
+            struct pirq *pirq = pirq_info(irq_map->dom, girq->machine_gsi);
+
+            pirq_dpci(pirq)->flags |= HVM_IRQ_DPCI_EOI_LATCH;
+        }
+        hvm_pci_intx_deassert(irq_map->dom, digl->device, digl->intx);
+    }
+
+    pt_pirq_iterate(irq_map->dom, pt_irq_guest_eoi, NULL);
+
+    spin_unlock(&irq_map->dom->event_lock);
+}
+
+struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *d)
+{
+    if ( !d || !is_hvm_domain(d) )
+        return NULL;
+
+    return hvm_domain_irq(d)->dpci;
+}
+
+void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci)
+{
+    xfree(dpci);
+}
+
+/*
+ * This routine handles lowest-priority interrupts using vector-hashing
+ * mechanism. As an example, modern Intel CPUs use this method to handle
+ * lowest-priority interrupts.
+ *
+ * Here is the details about the vector-hashing mechanism:
+ * 1. For lowest-priority interrupts, store all the possible destination
+ *    vCPUs in an array.
+ * 2. Use "gvec % max number of destination vCPUs" to find the right
+ *    destination vCPU in the array for the lowest-priority interrupt.
+ */
+static struct vcpu *vector_hashing_dest(const struct domain *d,
+                                        uint32_t dest_id,
+                                        bool dest_mode,
+                                        uint8_t gvec)
+
+{
+    unsigned long *dest_vcpu_bitmap;
+    unsigned int dest_vcpus = 0;
+    struct vcpu *v, *dest = NULL;
+    unsigned int i;
+
+    dest_vcpu_bitmap = xzalloc_array(unsigned long,
+                                     BITS_TO_LONGS(d->max_vcpus));
+    if ( !dest_vcpu_bitmap )
+        return NULL;
+
+    for_each_vcpu ( d, v )
+    {
+        if ( !vlapic_match_dest(vcpu_vlapic(v), NULL, APIC_DEST_NOSHORT,
+                                dest_id, dest_mode) )
+            continue;
+
+        __set_bit(v->vcpu_id, dest_vcpu_bitmap);
+        dest_vcpus++;
+    }
+
+    if ( dest_vcpus != 0 )
+    {
+        unsigned int mod = gvec % dest_vcpus;
+        unsigned int idx = 0;
+
+        for ( i = 0; i <= mod; i++ )
+        {
+            idx = find_next_bit(dest_vcpu_bitmap, d->max_vcpus, idx) + 1;
+            BUG_ON(idx > d->max_vcpus);
+        }
+
+        dest = d->vcpu[idx - 1];
+    }
+
+    xfree(dest_vcpu_bitmap);
+
+    return dest;
+}
+
+int pt_irq_create_bind(
+    struct domain *d, const struct xen_domctl_bind_pt_irq *pt_irq_bind)
+{
+    struct hvm_irq_dpci *hvm_irq_dpci;
+    struct hvm_pirq_dpci *pirq_dpci;
+    struct pirq *info;
+    int rc, pirq = pt_irq_bind->machine_irq;
+
+    if ( pirq < 0 || pirq >= d->nr_pirqs )
+        return -EINVAL;
+
+ restart:
+    spin_lock(&d->event_lock);
+
+    hvm_irq_dpci = domain_get_irq_dpci(d);
+    if ( !hvm_irq_dpci && !is_hardware_domain(d) )
+    {
+        unsigned int i;
+
+        /*
+         * NB: the hardware domain doesn't use a hvm_irq_dpci struct because
+         * it's only allowed to identity map GSIs, and so the data contained in
+         * that struct (used to map guest GSIs into machine GSIs and perform
+         * interrupt routing) is completely useless to it.
+         */
+        hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
+        if ( hvm_irq_dpci == NULL )
+        {
+            spin_unlock(&d->event_lock);
+            return -ENOMEM;
+        }
+        for ( i = 0; i < NR_HVM_DOMU_IRQS; i++ )
+            INIT_LIST_HEAD(&hvm_irq_dpci->girq[i]);
+
+        hvm_domain_irq(d)->dpci = hvm_irq_dpci;
+    }
+
+    info = pirq_get_info(d, pirq);
+    if ( !info )
+    {
+        spin_unlock(&d->event_lock);
+        return -ENOMEM;
+    }
+    pirq_dpci = pirq_dpci(info);
+
+    /*
+     * A crude 'while' loop with us dropping the spinlock and giving
+     * the softirq_dpci a chance to run.
+     * We MUST check for this condition as the softirq could be scheduled
+     * and hasn't run yet. Note that this code replaced tasklet_kill which
+     * would have spun forever and would do the same thing (wait to flush out
+     * outstanding hvm_dirq_assist calls.
+     */
+    if ( pt_pirq_softirq_active(pirq_dpci) )
+    {
+        spin_unlock(&d->event_lock);
+        cpu_relax();
+        goto restart;
+    }
+
+    switch ( pt_irq_bind->irq_type )
+    {
+    case PT_IRQ_TYPE_MSI:
+    {
+        uint8_t dest, delivery_mode;
+        bool dest_mode;
+        int dest_vcpu_id;
+        const struct vcpu *vcpu;
+        uint32_t gflags = pt_irq_bind->u.msi.gflags &
+                          ~XEN_DOMCTL_VMSI_X86_UNMASKED;
+
+        if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+        {
+            pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED | HVM_IRQ_DPCI_MACH_MSI |
+                               HVM_IRQ_DPCI_GUEST_MSI;
+            pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
+            pirq_dpci->gmsi.gflags = gflags;
+            /*
+             * 'pt_irq_create_bind' can be called after 'pt_irq_destroy_bind'.
+             * The 'pirq_cleanup_check' which would free the structure is only
+             * called if the event channel for the PIRQ is active. However
+             * OS-es that use event channels usually bind PIRQs to eventds
+             * and unbind them before calling 'pt_irq_destroy_bind' - with the
+             * result that we re-use the 'dpci' structure. This can be
+             * reproduced with unloading and loading the driver for a device.
+             *
+             * As such on every 'pt_irq_create_bind' call we MUST set it.
+             */
+            pirq_dpci->dom = d;
+            /* bind after hvm_irq_dpci is setup to avoid race with irq handler*/
+            rc = pirq_guest_bind(d->vcpu[0], info, 0);
+            if ( rc == 0 && pt_irq_bind->u.msi.gtable )
+            {
+                rc = msixtbl_pt_register(d, info, pt_irq_bind->u.msi.gtable);
+                if ( unlikely(rc) )
+                {
+                    pirq_guest_unbind(d, info);
+                    /*
+                     * Between 'pirq_guest_bind' and before 'pirq_guest_unbind'
+                     * an interrupt can be scheduled. No more of them are going
+                     * to be scheduled but we must deal with the one that may be
+                     * in the queue.
+                     */
+                    pt_pirq_softirq_reset(pirq_dpci);
+                }
+            }
+            if ( unlikely(rc) )
+            {
+                pirq_dpci->gmsi.gflags = 0;
+                pirq_dpci->gmsi.gvec = 0;
+                pirq_dpci->dom = NULL;
+                pirq_dpci->flags = 0;
+                pirq_cleanup_check(info, d);
+                spin_unlock(&d->event_lock);
+                return rc;
+            }
+        }
+        else
+        {
+            uint32_t mask = HVM_IRQ_DPCI_MACH_MSI | HVM_IRQ_DPCI_GUEST_MSI;
+
+            if ( (pirq_dpci->flags & mask) != mask )
+            {
+                spin_unlock(&d->event_lock);
+                return -EBUSY;
+            }
+
+            /* If pirq is already mapped as vmsi, update guest data/addr. */
+            if ( pirq_dpci->gmsi.gvec != pt_irq_bind->u.msi.gvec ||
+                 pirq_dpci->gmsi.gflags != gflags )
+            {
+                /* Directly clear pending EOIs before enabling new MSI info. */
+                pirq_guest_eoi(info);
+
+                pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
+                pirq_dpci->gmsi.gflags = gflags;
+            }
+        }
+        /* Calculate dest_vcpu_id for MSI-type pirq migration. */
+        dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
+                         XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
+        dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
+        delivery_mode = MASK_EXTR(pirq_dpci->gmsi.gflags,
+                                  XEN_DOMCTL_VMSI_X86_DELIV_MASK);
+
+        dest_vcpu_id = hvm_girq_dest_2_vcpu_id(d, dest, dest_mode);
+        pirq_dpci->gmsi.dest_vcpu_id = dest_vcpu_id;
+        spin_unlock(&d->event_lock);
+
+        pirq_dpci->gmsi.posted = false;
+        vcpu = (dest_vcpu_id >= 0) ? d->vcpu[dest_vcpu_id] : NULL;
+        if ( iommu_intpost )
+        {
+            if ( delivery_mode == dest_LowestPrio )
+                vcpu = vector_hashing_dest(d, dest, dest_mode,
+                                           pirq_dpci->gmsi.gvec);
+            if ( vcpu )
+                pirq_dpci->gmsi.posted = true;
+        }
+        if ( vcpu && is_iommu_enabled(d) )
+            hvm_migrate_pirq(pirq_dpci, vcpu);
+
+        /* Use interrupt posting if it is supported. */
+        if ( iommu_intpost )
+            pi_update_irte(vcpu ? &vcpu->arch.hvm.vmx.pi_desc : NULL,
+                           info, pirq_dpci->gmsi.gvec);
+
+        if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
+        {
+            unsigned long flags;
+            struct irq_desc *desc = pirq_spin_lock_irq_desc(info, &flags);
+
+            if ( !desc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return -EINVAL;
+            }
+
+            guest_mask_msi_irq(desc, false);
+            spin_unlock_irqrestore(&desc->lock, flags);
+        }
+
+        break;
+    }
+
+    case PT_IRQ_TYPE_PCI:
+    case PT_IRQ_TYPE_MSI_TRANSLATE:
+    {
+        struct dev_intx_gsi_link *digl = NULL;
+        struct hvm_girq_dpci_mapping *girq = NULL;
+        unsigned int guest_gsi;
+
+        /*
+         * Mapping GSIs for the hardware domain is different than doing it for
+         * an unpriviledged guest, the hardware domain is only allowed to
+         * identity map GSIs, and as such all the data in the u.pci union is
+         * discarded.
+         */
+        if ( hvm_irq_dpci )
+        {
+            unsigned int link;
+
+            digl = xmalloc(struct dev_intx_gsi_link);
+            girq = xmalloc(struct hvm_girq_dpci_mapping);
+
+            if ( !digl || !girq )
+            {
+                spin_unlock(&d->event_lock);
+                xfree(girq);
+                xfree(digl);
+                return -ENOMEM;
+            }
+
+            girq->bus = digl->bus = pt_irq_bind->u.pci.bus;
+            girq->device = digl->device = pt_irq_bind->u.pci.device;
+            girq->intx = digl->intx = pt_irq_bind->u.pci.intx;
+            list_add_tail(&digl->list, &pirq_dpci->digl_list);
+
+            guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
+            link = hvm_pci_intx_link(digl->device, digl->intx);
+
+            hvm_irq_dpci->link_cnt[link]++;
+
+            girq->machine_gsi = pirq;
+            list_add_tail(&girq->list, &hvm_irq_dpci->girq[guest_gsi]);
+        }
+        else
+        {
+            ASSERT(is_hardware_domain(d));
+
+            /* MSI_TRANSLATE is not supported for the hardware domain. */
+            if ( pt_irq_bind->irq_type != PT_IRQ_TYPE_PCI ||
+                 pirq >= hvm_domain_irq(d)->nr_gsis )
+            {
+                spin_unlock(&d->event_lock);
+
+                return -EINVAL;
+            }
+            guest_gsi = pirq;
+        }
+
+        /* Bind the same mirq once in the same domain */
+        if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+        {
+            unsigned int share;
+
+            /* MUST be set, as the pirq_dpci can be re-used. */
+            pirq_dpci->dom = d;
+            if ( pt_irq_bind->irq_type == PT_IRQ_TYPE_MSI_TRANSLATE )
+            {
+                pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED |
+                                   HVM_IRQ_DPCI_MACH_MSI |
+                                   HVM_IRQ_DPCI_GUEST_PCI |
+                                   HVM_IRQ_DPCI_TRANSLATE;
+                share = 0;
+            }
+            else    /* PT_IRQ_TYPE_PCI */
+            {
+                pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED |
+                                   HVM_IRQ_DPCI_MACH_PCI |
+                                   HVM_IRQ_DPCI_GUEST_PCI;
+                if ( !is_hardware_domain(d) )
+                    share = BIND_PIRQ__WILL_SHARE;
+                else
+                {
+                    int mask = vioapic_get_mask(d, guest_gsi);
+                    int trigger_mode = vioapic_get_trigger_mode(d, guest_gsi);
+
+                    if ( mask < 0 || trigger_mode < 0 )
+                    {
+                        spin_unlock(&d->event_lock);
+
+                        ASSERT_UNREACHABLE();
+                        return -EINVAL;
+                    }
+                    pirq_dpci->flags |= HVM_IRQ_DPCI_IDENTITY_GSI;
+                    /*
+                     * Check if the corresponding vIO APIC pin is configured
+                     * level or edge trigger, level triggered interrupts will
+                     * be marked as shareable.
+                     */
+                    ASSERT(!mask);
+                    share = trigger_mode;
+                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
+                        /*
+                         * Edge IO-APIC interrupt, no EOI or unmask to perform
+                         * and hence no timer needed.
+                         */
+                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
+                }
+            }
+
+            /* Init timer before binding */
+            if ( pt_irq_need_timer(pirq_dpci->flags) )
+                init_timer(&pirq_dpci->timer, pt_irq_time_out, pirq_dpci, 0);
+            /* Deal with gsi for legacy devices */
+            rc = pirq_guest_bind(d->vcpu[0], info, share);
+            if ( unlikely(rc) )
+            {
+                if ( pt_irq_need_timer(pirq_dpci->flags) )
+                    kill_timer(&pirq_dpci->timer);
+                /*
+                 * There is no path for __do_IRQ to schedule softirq as
+                 * IRQ_GUEST is not set. As such we can reset 'dom' directly.
+                 */
+                pirq_dpci->dom = NULL;
+                if ( hvm_irq_dpci )
+                {
+                    unsigned int link;
+
+                    ASSERT(girq && digl);
+                    list_del(&girq->list);
+                    list_del(&digl->list);
+                    link = hvm_pci_intx_link(digl->device, digl->intx);
+                    hvm_irq_dpci->link_cnt[link]--;
+                }
+                pirq_dpci->flags = 0;
+                pirq_cleanup_check(info, d);
+                spin_unlock(&d->event_lock);
+                xfree(girq);
+                xfree(digl);
+                return rc;
+            }
+        }
+
+        spin_unlock(&d->event_lock);
+
+        if ( iommu_verbose )
+        {
+            char buf[24] = "";
+
+            if ( digl )
+                snprintf(buf, ARRAY_SIZE(buf), " dev=%02x.%02x.%u intx=%u",
+                         digl->bus, PCI_SLOT(digl->device),
+                         PCI_FUNC(digl->device), digl->intx);
+
+            printk(XENLOG_G_INFO "d%d: bind: m_gsi=%u g_gsi=%u%s\n",
+                   d->domain_id, pirq, guest_gsi, buf);
+        }
+        break;
+    }
+
+    default:
+        spin_unlock(&d->event_lock);
+        return -EOPNOTSUPP;
+    }
+
+    return 0;
+}
+
+int pt_irq_destroy_bind(
+    struct domain *d, const struct xen_domctl_bind_pt_irq *pt_irq_bind)
+{
+    struct hvm_irq_dpci *hvm_irq_dpci;
+    struct hvm_pirq_dpci *pirq_dpci;
+    unsigned int machine_gsi = pt_irq_bind->machine_irq;
+    struct pirq *pirq;
+    const char *what = NULL;
+
+    switch ( pt_irq_bind->irq_type )
+    {
+    case PT_IRQ_TYPE_PCI:
+    case PT_IRQ_TYPE_MSI_TRANSLATE:
+        if ( iommu_verbose )
+        {
+            unsigned int device = pt_irq_bind->u.pci.device;
+            unsigned int intx = pt_irq_bind->u.pci.intx;
+
+            printk(XENLOG_G_INFO
+                   "d%d: unbind: m_gsi=%u g_gsi=%u dev=%02x:%02x.%u intx=%u\n",
+                   d->domain_id, machine_gsi, hvm_pci_intx_gsi(device, intx),
+                   pt_irq_bind->u.pci.bus,
+                   PCI_SLOT(device), PCI_FUNC(device), intx);
+        }
+        break;
+    case PT_IRQ_TYPE_MSI:
+    {
+        unsigned long flags;
+        struct irq_desc *desc = domain_spin_lock_irq_desc(d, machine_gsi,
+                                                          &flags);
+
+        if ( !desc )
+            return -EINVAL;
+        /*
+         * Leave the MSI masked, so that the state when calling
+         * pt_irq_create_bind is consistent across bind/unbinds.
+         */
+        guest_mask_msi_irq(desc, true);
+        spin_unlock_irqrestore(&desc->lock, flags);
+        break;
+    }
+
+    default:
+        return -EOPNOTSUPP;
+    }
+
+    spin_lock(&d->event_lock);
+
+    hvm_irq_dpci = domain_get_irq_dpci(d);
+
+    if ( !hvm_irq_dpci && !is_hardware_domain(d) )
+    {
+        spin_unlock(&d->event_lock);
+        return -EINVAL;
+    }
+
+    pirq = pirq_info(d, machine_gsi);
+    pirq_dpci = pirq_dpci(pirq);
+
+    if ( hvm_irq_dpci && pt_irq_bind->irq_type != PT_IRQ_TYPE_MSI )
+    {
+        unsigned int bus = pt_irq_bind->u.pci.bus;
+        unsigned int device = pt_irq_bind->u.pci.device;
+        unsigned int intx = pt_irq_bind->u.pci.intx;
+        unsigned int guest_gsi = hvm_pci_intx_gsi(device, intx);
+        unsigned int link = hvm_pci_intx_link(device, intx);
+        struct hvm_girq_dpci_mapping *girq;
+        struct dev_intx_gsi_link *digl, *tmp;
+
+        list_for_each_entry ( girq, &hvm_irq_dpci->girq[guest_gsi], list )
+        {
+            if ( girq->bus         == bus &&
+                 girq->device      == device &&
+                 girq->intx        == intx &&
+                 girq->machine_gsi == machine_gsi )
+            {
+                list_del(&girq->list);
+                xfree(girq);
+                girq = NULL;
+                break;
+            }
+        }
+
+        if ( girq )
+        {
+            spin_unlock(&d->event_lock);
+            return -EINVAL;
+        }
+
+        hvm_irq_dpci->link_cnt[link]--;
+
+        /* clear the mirq info */
+        if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+        {
+            list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
+            {
+                if ( digl->bus    == bus &&
+                     digl->device == device &&
+                     digl->intx   == intx )
+                {
+                    list_del(&digl->list);
+                    xfree(digl);
+                }
+            }
+            what = list_empty(&pirq_dpci->digl_list) ? "final" : "partial";
+        }
+        else
+            what = "bogus";
+    }
+    else if ( pirq_dpci && pirq_dpci->gmsi.posted )
+        pi_update_irte(NULL, pirq, 0);
+
+    if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
+         list_empty(&pirq_dpci->digl_list) )
+    {
+        pirq_guest_unbind(d, pirq);
+        msixtbl_pt_unregister(d, pirq);
+        if ( pt_irq_need_timer(pirq_dpci->flags) )
+            kill_timer(&pirq_dpci->timer);
+        pirq_dpci->flags = 0;
+        /*
+         * See comment in pt_irq_create_bind's PT_IRQ_TYPE_MSI before the
+         * call to pt_pirq_softirq_reset.
+         */
+        pt_pirq_softirq_reset(pirq_dpci);
+
+        pirq_cleanup_check(pirq, d);
+    }
+
+    spin_unlock(&d->event_lock);
+
+    if ( what && iommu_verbose )
+    {
+        unsigned int device = pt_irq_bind->u.pci.device;
+        char buf[24] = "";
+
+        if ( hvm_irq_dpci )
+            snprintf(buf, ARRAY_SIZE(buf), " dev=%02x.%02x.%u intx=%u",
+                     pt_irq_bind->u.pci.bus, PCI_SLOT(device),
+                     PCI_FUNC(device), pt_irq_bind->u.pci.intx);
+
+        printk(XENLOG_G_INFO "d%d %s unmap: m_irq=%u%s\n",
+               d->domain_id, what, machine_gsi, buf);
+    }
+
+    return 0;
+}
+
+void pt_pirq_init(struct domain *d, struct hvm_pirq_dpci *dpci)
+{
+    INIT_LIST_HEAD(&dpci->digl_list);
+    dpci->gmsi.dest_vcpu_id = -1;
+}
+
+bool pt_pirq_cleanup_check(struct hvm_pirq_dpci *dpci)
+{
+    if ( !dpci->flags && !pt_pirq_softirq_active(dpci) )
+    {
+        dpci->dom = NULL;
+        return true;
+    }
+    return false;
+}
+
+int pt_pirq_iterate(struct domain *d,
+                    int (*cb)(struct domain *,
+                              struct hvm_pirq_dpci *, void *),
+                    void *arg)
+{
+    int rc = 0;
+    unsigned int pirq = 0, n, i;
+    struct pirq *pirqs[8];
+
+    ASSERT(spin_is_locked(&d->event_lock));
+
+    do {
+        n = radix_tree_gang_lookup(&d->pirq_tree, (void **)pirqs, pirq,
+                                   ARRAY_SIZE(pirqs));
+        for ( i = 0; i < n; ++i )
+        {
+            struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirqs[i]);
+
+            pirq = pirqs[i]->pirq;
+            if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+                rc = cb(d, pirq_dpci, arg);
+        }
+    } while ( !rc && ++pirq < d->nr_pirqs && n == ARRAY_SIZE(pirqs) );
+
+    return rc;
+}
+
+int hvm_do_IRQ_dpci(struct domain *d, struct pirq *pirq)
+{
+    struct hvm_irq_dpci *dpci = domain_get_irq_dpci(d);
+    struct hvm_pirq_dpci *pirq_dpci = pirq_dpci(pirq);
+
+    ASSERT(is_hvm_domain(d));
+
+    if ( !is_iommu_enabled(d) || (!is_hardware_domain(d) && !dpci) ||
+         !pirq_dpci || !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
+        return 0;
+
+    pirq_dpci->masked = 1;
+    raise_softirq_for(pirq_dpci);
+    return 1;
+}
+
+/* called with d->event_lock held */
+static void __msi_pirq_eoi(struct hvm_pirq_dpci *pirq_dpci)
+{
+    irq_desc_t *desc;
+
+    if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
+         (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) )
+    {
+        struct pirq *pirq = dpci_pirq(pirq_dpci);
+
+        BUG_ON(!local_irq_is_enabled());
+        desc = pirq_spin_lock_irq_desc(pirq, NULL);
+        if ( !desc )
+            return;
+        desc_guest_eoi(desc, pirq);
+    }
+}
+
+static int _hvm_dpci_msi_eoi(struct domain *d,
+                             struct hvm_pirq_dpci *pirq_dpci, void *arg)
+{
+    int vector = (long)arg;
+
+    if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) &&
+         (pirq_dpci->gmsi.gvec == vector) )
+    {
+        unsigned int dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
+                                      XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
+        bool dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
+
+        if ( vlapic_match_dest(vcpu_vlapic(current), NULL, 0, dest,
+                               dest_mode) )
+        {
+            __msi_pirq_eoi(pirq_dpci);
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+void hvm_dpci_msi_eoi(struct domain *d, int vector)
+{
+    if ( !is_iommu_enabled(d) ||
+         (!hvm_domain_irq(d)->dpci && !is_hardware_domain(d)) )
+       return;
+
+    spin_lock(&d->event_lock);
+    pt_pirq_iterate(d, _hvm_dpci_msi_eoi, (void *)(long)vector);
+    spin_unlock(&d->event_lock);
+}
+
+static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
+{
+    if ( unlikely(!hvm_domain_irq(d)->dpci) && !is_hardware_domain(d) )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
+
+    spin_lock(&d->event_lock);
+    if ( test_and_clear_bool(pirq_dpci->masked) )
+    {
+        struct pirq *pirq = dpci_pirq(pirq_dpci);
+        const struct dev_intx_gsi_link *digl;
+
+        if ( hvm_domain_use_pirq(d, pirq) )
+        {
+            send_guest_pirq(d, pirq);
+
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
+                goto out;
+        }
+
+        if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
+        {
+            vmsi_deliver_pirq(d, pirq_dpci);
+            goto out;
+        }
+
+        list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
+        {
+            ASSERT(!(pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI));
+            hvm_pci_intx_assert(d, digl->device, digl->intx);
+            pirq_dpci->pending++;
+        }
+
+        if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
+        {
+            hvm_gsi_assert(d, pirq->pirq);
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
+                goto out;
+            pirq_dpci->pending++;
+        }
+
+        if ( pirq_dpci->flags & HVM_IRQ_DPCI_TRANSLATE )
+        {
+            /* for translated MSI to INTx interrupt, eoi as early as possible */
+            __msi_pirq_eoi(pirq_dpci);
+            goto out;
+        }
+
+        /*
+         * Set a timer to see if the guest can finish the interrupt or not. For
+         * example, the guest OS may unmask the PIC during boot, before the
+         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
+         * guest will never deal with the irq, then the physical interrupt line
+         * will never be deasserted.
+         */
+        ASSERT(pt_irq_need_timer(pirq_dpci->flags));
+        set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
+    }
+
+ out:
+    spin_unlock(&d->event_lock);
+}
+
+static void hvm_pirq_eoi(struct pirq *pirq,
+                         const union vioapic_redir_entry *ent)
+{
+    struct hvm_pirq_dpci *pirq_dpci;
+
+    if ( !pirq )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
+
+    pirq_dpci = pirq_dpci(pirq);
+
+    /*
+     * No need to get vector lock for timer
+     * since interrupt is still not EOIed
+     */
+    if ( --pirq_dpci->pending ||
+         (ent && ent->fields.mask) ||
+         !pt_irq_need_timer(pirq_dpci->flags) )
+        return;
+
+    stop_timer(&pirq_dpci->timer);
+    pirq_guest_eoi(pirq);
+}
+
+static void __hvm_dpci_eoi(struct domain *d,
+                           const struct hvm_girq_dpci_mapping *girq,
+                           const union vioapic_redir_entry *ent)
+{
+    struct pirq *pirq = pirq_info(d, girq->machine_gsi);
+
+    if ( !hvm_domain_use_pirq(d, pirq) )
+        hvm_pci_intx_deassert(d, girq->device, girq->intx);
+
+    hvm_pirq_eoi(pirq, ent);
+}
+
+static void hvm_gsi_eoi(struct domain *d, unsigned int gsi,
+                        const union vioapic_redir_entry *ent)
+{
+    struct pirq *pirq = pirq_info(d, gsi);
+
+    /* Check if GSI is actually mapped. */
+    if ( !pirq_dpci(pirq) )
+        return;
+
+    hvm_gsi_deassert(d, gsi);
+    hvm_pirq_eoi(pirq, ent);
+}
+
+void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi,
+                  const union vioapic_redir_entry *ent)
+{
+    const struct hvm_irq_dpci *hvm_irq_dpci;
+    const struct hvm_girq_dpci_mapping *girq;
+
+    if ( !is_iommu_enabled(d) )
+        return;
+
+    if ( is_hardware_domain(d) )
+    {
+        spin_lock(&d->event_lock);
+        hvm_gsi_eoi(d, guest_gsi, ent);
+        goto unlock;
+    }
+
+    if ( guest_gsi < NR_ISAIRQS )
+    {
+        hvm_dpci_isairq_eoi(d, guest_gsi);
+        return;
+    }
+
+    spin_lock(&d->event_lock);
+    hvm_irq_dpci = domain_get_irq_dpci(d);
+
+    if ( !hvm_irq_dpci )
+        goto unlock;
+
+    list_for_each_entry ( girq, &hvm_irq_dpci->girq[guest_gsi], list )
+        __hvm_dpci_eoi(d, girq, ent);
+
+unlock:
+    spin_unlock(&d->event_lock);
+}
+
+static int pci_clean_dpci_irq(struct domain *d,
+                              struct hvm_pirq_dpci *pirq_dpci, void *arg)
+{
+    struct dev_intx_gsi_link *digl, *tmp;
+
+    pirq_guest_unbind(d, dpci_pirq(pirq_dpci));
+
+    if ( pt_irq_need_timer(pirq_dpci->flags) )
+        kill_timer(&pirq_dpci->timer);
+
+    list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
+    {
+        list_del(&digl->list);
+        xfree(digl);
+    }
+
+    radix_tree_delete(&d->pirq_tree, dpci_pirq(pirq_dpci)->pirq);
+
+    if ( !pt_pirq_softirq_active(pirq_dpci) )
+        return 0;
+
+    domain_get_irq_dpci(d)->pending_pirq_dpci = pirq_dpci;
+
+    return -ERESTART;
+}
+
+int arch_pci_clean_pirqs(struct domain *d)
+{
+    struct hvm_irq_dpci *hvm_irq_dpci = NULL;
+
+    if ( !is_iommu_enabled(d) )
+        return 0;
+
+    if ( !is_hvm_domain(d) )
+        return 0;
+
+    spin_lock(&d->event_lock);
+    hvm_irq_dpci = domain_get_irq_dpci(d);
+    if ( hvm_irq_dpci != NULL )
+    {
+        int ret = 0;
+
+        if ( hvm_irq_dpci->pending_pirq_dpci )
+        {
+            if ( pt_pirq_softirq_active(hvm_irq_dpci->pending_pirq_dpci) )
+                 ret = -ERESTART;
+            else
+                 hvm_irq_dpci->pending_pirq_dpci = NULL;
+        }
+
+        if ( !ret )
+            ret = pt_pirq_iterate(d, pci_clean_dpci_irq, NULL);
+        if ( ret )
+        {
+            spin_unlock(&d->event_lock);
+            return ret;
+        }
+
+        hvm_domain_irq(d)->dpci = NULL;
+        free_hvm_irq_dpci(hvm_irq_dpci);
+    }
+    spin_unlock(&d->event_lock);
+
+    return 0;
+}
+
+/*
+ * Note: 'pt_pirq_softirq_reset' can clear the STATE_SCHED before we get to
+ * doing it. If that is the case we let 'pt_pirq_softirq_reset' do ref-counting.
+ */
+static void dpci_softirq(void)
+{
+    unsigned int cpu = smp_processor_id();
+    LIST_HEAD(our_list);
+
+    local_irq_disable();
+    list_splice_init(&per_cpu(dpci_list, cpu), &our_list);
+    local_irq_enable();
+
+    while ( !list_empty(&our_list) )
+    {
+        struct hvm_pirq_dpci *pirq_dpci;
+        struct domain *d;
+
+        pirq_dpci = list_entry(our_list.next, struct hvm_pirq_dpci, softirq_list);
+        list_del(&pirq_dpci->softirq_list);
+
+        d = pirq_dpci->dom;
+        smp_mb(); /* 'd' MUST be saved before we set/clear the bits. */
+        if ( test_and_set_bit(STATE_RUN, &pirq_dpci->state) )
+        {
+            unsigned long flags;
+
+            /* Put back on the list and retry. */
+            local_irq_save(flags);
+            list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
+            local_irq_restore(flags);
+
+            raise_softirq(HVM_DPCI_SOFTIRQ);
+            continue;
+        }
+        /*
+         * The one who clears STATE_SCHED MUST refcount the domain.
+         */
+        if ( test_and_clear_bit(STATE_SCHED, &pirq_dpci->state) )
+        {
+            hvm_dirq_assist(d, pirq_dpci);
+            put_domain(d);
+        }
+        clear_bit(STATE_RUN, &pirq_dpci->state);
+    }
+}
+
+static int cpu_callback(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)
+{
+    unsigned int cpu = (unsigned long)hcpu;
+
+    switch ( action )
+    {
+    case CPU_UP_PREPARE:
+        INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
+        break;
+    case CPU_UP_CANCELED:
+    case CPU_DEAD:
+        /*
+         * On CPU_DYING this callback is called (on the CPU that is dying)
+         * with an possible HVM_DPIC_SOFTIRQ pending - at which point we can
+         * clear out any outstanding domains (by the virtue of the idle loop
+         * calling the softirq later). In CPU_DEAD case the CPU is deaf and
+         * there are no pending softirqs for us to handle so we can chill.
+         */
+        ASSERT(list_empty(&per_cpu(dpci_list, cpu)));
+        break;
+    }
+
+    return NOTIFY_DONE;
+}
+
+static struct notifier_block cpu_nfb = {
+    .notifier_call = cpu_callback,
+};
+
+static int __init setup_dpci_softirq(void)
+{
+    unsigned int cpu;
+
+    for_each_online_cpu(cpu)
+        INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
+
+    open_softirq(HVM_DPCI_SOFTIRQ, dpci_softirq);
+    register_cpu_notifier(&cpu_nfb);
+    return 0;
+}
+__initcall(setup_dpci_softirq);
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 20a54a5bb4..8e3d4d9454 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -208,4 +208,13 @@ int msixtbl_pt_register(struct domain *, struct pirq *, uint64_t gtable);
 void msixtbl_pt_unregister(struct domain *, struct pirq *);
 void msixtbl_pt_cleanup(struct domain *d);
 
+#ifdef CONFIG_HVM
+int arch_pci_clean_pirqs(struct domain *d);
+#else
+static inline int arch_pci_clean_pirqs(struct domain *d)
+{
+    return 0;
+}
+#endif /* CONFIG_HVM */
+
 #endif /* __XEN_PCI_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 28 10:22:33 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 28 Nov 2020 10:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.39916.72949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kixNB-00033h-Hp; Sat, 28 Nov 2020 10:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 39916.72949; Sat, 28 Nov 2020 10: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 1kixNB-00033Z-EX; Sat, 28 Nov 2020 10:22:33 +0000
Received: by outflank-mailman (input) for mailman id 39916;
 Sat, 28 Nov 2020 10: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 1kixNA-00033S-Tb
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10: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 1kixNA-0003hN-S0
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kixNA-0000tl-QB
 for xen-changelog@lists.xenproject.org; Sat, 28 Nov 2020 10: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=pf/OtMBPQnpjQJN+bDcEvTZ8EXK+KkR8SGbM233vSpA=; b=g8hXGWuLnx7B6azqLTuJ6uayR9
	ItRdcakmtus/RwGxRcBSr+32EqYQE/MHcw8BUpj+SwpAKuC0BEhR3hgM1gnI+xbkiIlZgLGB/it1c
	7JETzdj4rzvv768CoX5FtlANhJYkqSn8/Tms3vEkVSrfYSx4ccKpgveTPcJ4B1UU7xVc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/pci: solve compilation error on ARM with HAS_PCI enabled
Message-Id: <E1kixNA-0000tl-QB@xenbits.xenproject.org>
Date: Sat, 28 Nov 2020 10:22:32 +0000

commit f7d7d53f6464cff94ead4c15d21e79ce4d9173f5
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Fri Nov 27 18:07:50 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 27 18:07:50 2020 +0100

    xen/pci: solve compilation error on ARM with HAS_PCI enabled
    
    If mem-sharing, mem-paging, or log-dirty functionality is not enabled
    for architecture when HAS_PCI is enabled, the compiler will throw an
    error.
    
    Move code to x86 specific file to fix compilation error.
    
    Also, modify the code to use likely() in place of unlikley() for each
    condition to make code more optimized.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/pci.c       |  8 +-------
 xen/drivers/passthrough/x86/iommu.c | 13 +++++++++++++
 xen/include/xen/iommu.h             |  2 ++
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index ab590ca398..705137f8be 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -23,7 +23,6 @@
 #include <xen/iommu.h>
 #include <xen/irq.h>
 #include <xen/param.h>
-#include <xen/vm_event.h>
 #include <xen/delay.h>
 #include <xen/keyhandler.h>
 #include <xen/event.h>
@@ -1421,12 +1420,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
     if ( !is_iommu_enabled(d) )
         return 0;
 
-    /* Prevent device assign if mem paging or mem sharing have been 
-     * enabled for this domain */
-    if ( d != dom_io &&
-         unlikely(mem_sharing_enabled(d) ||
-                  vm_event_check_ring(d->vm_event_paging) ||
-                  p2m_get_hostp2m(d)->global_logdirty) )
+    if ( !arch_iommu_use_permitted(d) )
         return -EXDEV;
 
     /* device_assigned() should already have cleared the device for assignment */
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index f17b1820f4..cea1032b3d 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -18,6 +18,7 @@
 #include <xen/guest_access.h>
 #include <xen/event.h>
 #include <xen/softirq.h>
+#include <xen/vm_event.h>
 #include <xsm/xsm.h>
 
 #include <asm/hvm/io.h>
@@ -308,6 +309,18 @@ struct page_info *iommu_alloc_pgtable(struct domain *d)
     return pg;
 }
 
+bool arch_iommu_use_permitted(const struct domain *d)
+{
+    /*
+     * Prevent device assign if mem paging, mem sharing or log-dirty
+     * have been enabled for this domain.
+     */
+    return d == dom_io ||
+           (likely(!mem_sharing_enabled(d)) &&
+            likely(!vm_event_check_ring(d->vm_event_paging)) &&
+            likely(!p2m_get_hostp2m(d)->global_logdirty));
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 69af5baf92..f0295fd6c3 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -378,6 +378,8 @@ DECLARE_PER_CPU(bool_t, iommu_dont_flush_iotlb);
 extern struct spinlock iommu_pt_cleanup_lock;
 extern struct page_list_head iommu_pt_cleanup_list;
 
+bool arch_iommu_use_permitted(const struct domain *d);
+
 #endif /* _IOMMU_H_ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Nov 30 13:11:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Nov 2020 13:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.41141.74255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kjixP-0003fw-9B; Mon, 30 Nov 2020 13:11:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 41141.74255; Mon, 30 Nov 2020 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 1kjixP-0003fo-66; Mon, 30 Nov 2020 13:11:07 +0000
Received: by outflank-mailman (input) for mailman id 41141;
 Mon, 30 Nov 2020 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 1kjixN-0003fj-Pc
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 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 1kjixN-0004kT-LT
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 13:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kjixN-0006AX-KN
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 13:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F1BJcnGfcqPDGCsWahqABTmD/tUZNdkW+wqcURBviNA=; b=2m9iJ/OiQQ/HYUtNeXnPKkYAaq
	8MFchbWfCdR6NQaEw3+mH9HeOI7qOaQbx2edwEPB62QOMppDPzNOXGRNHOHhrEww8mfAl6tOokfuH
	MxC9n5mY7m9qqyvOHwDTsmNbq7EBJdG2nU8O+LVjadYNHyeTMSLBLSvRWffUvlxxLbKA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/events: modify struct evtchn layout
Message-Id: <E1kjixN-0006AX-KN@xenbits.xenproject.org>
Date: Mon, 30 Nov 2020 13:11:05 +0000

commit 43803dc0240f11a4b72c373f16e89508c23dcaa9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Nov 30 14:04:34 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Nov 30 14:04:34 2020 +0100

    xen/events: modify struct evtchn layout
    
    In order to avoid latent races when updating an event channel put
    xen_consumer and pending fields in different bytes. This is no problem
    right now, but especially the pending indicator isn't used only when
    initializing an event channel (unlike xen_consumer), so any future
    addition to this byte would need to be done with a potential race kept
    in mind.
    
    At the same time move some other fields around to have less implicit
    paddings and to keep related fields more closely together.
    
    Finally switch struct evtchn to no longer use fixed sized types where
    not needed.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_fifo.c |  4 ++--
 xen/include/xen/sched.h | 34 ++++++++++++++++++----------------
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
index 79090c04ca..f39e61105f 100644
--- a/xen/common/event_fifo.c
+++ b/xen/common/event_fifo.c
@@ -200,7 +200,7 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
      */
     if ( unlikely(!word) )
     {
-        evtchn->pending = 1;
+        evtchn->pending = true;
         return;
     }
 
@@ -535,7 +535,7 @@ static void setup_ports(struct domain *d, unsigned int prev_evtchns)
         evtchn = evtchn_from_port(d, port);
 
         if ( guest_test_bit(d, port, &shared_info(d, evtchn_pending)) )
-            evtchn->pending = 1;
+            evtchn->pending = true;
 
         evtchn_fifo_set_priority(d, evtchn, EVTCHN_FIFO_PRIORITY_DEFAULT);
     }
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index a345cc01f8..4c380fd4b2 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -93,31 +93,33 @@ struct evtchn
 #define ECS_PIRQ         4 /* Channel is bound to a physical IRQ line.       */
 #define ECS_VIRQ         5 /* Channel is bound to a virtual IRQ line.        */
 #define ECS_IPI          6 /* Channel is bound to a virtual IPI line.        */
-    u8  state;             /* ECS_* */
-    u8  xen_consumer:XEN_CONSUMER_BITS; /* Consumer in Xen if nonzero */
-    u8  pending:1;
-    u16 notify_vcpu_id;    /* VCPU for local delivery notification */
-    u32 port;
+    unsigned char state;   /* ECS_* */
+#ifndef NDEBUG
+    unsigned char old_state; /* State when taking lock in write mode. */
+#endif
+    unsigned char xen_consumer:XEN_CONSUMER_BITS; /* Consumer in Xen if != 0 */
+    evtchn_port_t port;
     union {
         struct {
             domid_t remote_domid;
-        } unbound;     /* state == ECS_UNBOUND */
+        } unbound;          /* state == ECS_UNBOUND */
         struct {
             evtchn_port_t  remote_port;
             struct domain *remote_dom;
-        } interdomain; /* state == ECS_INTERDOMAIN */
+        } interdomain;      /* state == ECS_INTERDOMAIN */
         struct {
-            u32            irq;
+            unsigned int   irq;
             evtchn_port_t  next_port;
             evtchn_port_t  prev_port;
-        } pirq;        /* state == ECS_PIRQ */
-        u16 virq;      /* state == ECS_VIRQ */
+        } pirq;             /* state == ECS_PIRQ */
+        unsigned int virq;  /* state == ECS_VIRQ */
     } u;
-    u8 priority;
-#ifndef NDEBUG
-    u8 old_state;      /* State when taking lock in write mode. */
-#endif
-    u32 fifo_lastq;    /* Data for fifo events identifying last queue. */
+
+    bool pending;                  /* FIFO event channels only. */
+    unsigned char priority;        /* FIFO event channels only. */
+    unsigned short notify_vcpu_id; /* VCPU for local delivery notification */
+    uint32_t fifo_lastq;           /* Data for identifying last queue. */
+
 #ifdef CONFIG_XSM
     union {
 #ifdef XSM_NEED_GENERIC_EVTCHN_SSID
@@ -133,7 +135,7 @@ struct evtchn
          * allocations, and on 64-bit platforms with only FLASK enabled,
          * reduces the size of struct evtchn.
          */
-        u32 flask_sid;
+        uint32_t flask_sid;
 #endif
     } ssid;
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 30 13:11:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Nov 2020 13:11:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.41142.74259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kjixZ-0003gf-Ag; Mon, 30 Nov 2020 13:11:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 41142.74259; Mon, 30 Nov 2020 13:11: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 1kjixZ-0003gX-7j; Mon, 30 Nov 2020 13:11:17 +0000
Received: by outflank-mailman (input) for mailman id 41142;
 Mon, 30 Nov 2020 13: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 1kjixX-0003gS-Rh
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 13: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 1kjixX-0004kY-QP
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 13:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kjixX-0006BZ-Nz
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 13: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=VSCT7QXmcY5ebX1a96OJggvrel0yAYB2CSWdUdlQP6M=; b=CqIm7Yf50/H0EJTrhckVBh9mtI
	TO+uEMU2SoqfVHHYN5xAs7ljKnczjPk1pSIFwO1ir4p9aYllwOv0cfK7h+iOAkFXr74tNiL9V3JAv
	AU1mNmR/cX/5f3gSTgG86w0dB2vBRDqkSemu6KyvSn412u74UpI1kYtqoJ8L0rQnLXjI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/events: rework fifo queue locking
Message-Id: <E1kjixX-0006BZ-Nz@xenbits.xenproject.org>
Date: Mon, 30 Nov 2020 13:11:15 +0000

commit 71ac522909e9302350a88bc378be99affa87067c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Nov 30 14:05:39 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Nov 30 14:05:39 2020 +0100

    xen/events: rework fifo queue locking
    
    Two cpus entering evtchn_fifo_set_pending() for the same event channel
    can race in case the first one gets interrupted after setting
    EVTCHN_FIFO_PENDING and when the other one manages to set
    EVTCHN_FIFO_LINKED before the first one is testing that bit. This can
    lead to evtchn_check_pollers() being called before the event is put
    properly into the queue, resulting eventually in the guest not seeing
    the event pending and thus blocking forever afterwards.
    
    Note that commit 5f2df45ead7c1195 ("xen/evtchn: rework per event channel
    lock") made the race just more obvious, while the fifo event channel
    implementation had this race forever since the introduction and use of
    per-channel locks, when an unmask operation was running in parallel with
    an event channel send operation.
    
    Using a spinlock for the per event channel lock had turned out
    problematic due to some paths needing to take the lock are called with
    interrupts off, so the lock would need to disable interrupts, which in
    turn broke some use cases related to vm events.
    
    For avoiding this race the queue locking in evtchn_fifo_set_pending()
    needs to be reworked to cover the test of EVTCHN_FIFO_PENDING,
    EVTCHN_FIFO_MASKED and EVTCHN_FIFO_LINKED, too. Additionally when an
    event channel needs to change queues both queues need to be locked
    initially, in order to avoid having a window with no lock held at all.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Fixes: 5f2df45ead7c1195 ("xen/evtchn: rework per event channel lock")
    Fixes: de6acb78bf0e137c ("evtchn: use a per-event channel lock for sending events")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_fifo.c | 128 ++++++++++++++++++++++++++----------------------
 1 file changed, 70 insertions(+), 58 deletions(-)

diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
index f39e61105f..a6cca4798d 100644
--- a/xen/common/event_fifo.c
+++ b/xen/common/event_fifo.c
@@ -87,38 +87,6 @@ static void evtchn_fifo_init(struct domain *d, struct evtchn *evtchn)
                  d->domain_id, evtchn->port);
 }
 
-static struct evtchn_fifo_queue *lock_old_queue(const struct domain *d,
-                                                struct evtchn *evtchn,
-                                                unsigned long *flags)
-{
-    struct vcpu *v;
-    struct evtchn_fifo_queue *q, *old_q;
-    unsigned int try;
-    union evtchn_fifo_lastq lastq;
-
-    for ( try = 0; try < 3; try++ )
-    {
-        lastq.raw = read_atomic(&evtchn->fifo_lastq);
-        v = d->vcpu[lastq.last_vcpu_id];
-        old_q = &v->evtchn_fifo->queue[lastq.last_priority];
-
-        spin_lock_irqsave(&old_q->lock, *flags);
-
-        v = d->vcpu[lastq.last_vcpu_id];
-        q = &v->evtchn_fifo->queue[lastq.last_priority];
-
-        if ( old_q == q )
-            return old_q;
-
-        spin_unlock_irqrestore(&old_q->lock, *flags);
-    }
-
-    gprintk(XENLOG_WARNING,
-            "dom%d port %d lost event (too many queue changes)\n",
-            d->domain_id, evtchn->port);
-    return NULL;
-}          
-
 static int try_set_link(event_word_t *word, event_word_t *w, uint32_t link)
 {
     event_word_t new, old;
@@ -190,6 +158,9 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
     event_word_t *word;
     unsigned long flags;
     bool_t was_pending;
+    struct evtchn_fifo_queue *q, *old_q;
+    unsigned int try;
+    bool linked = true;
 
     port = evtchn->port;
     word = evtchn_fifo_word_from_port(d, port);
@@ -204,17 +175,67 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
         return;
     }
 
+    /*
+     * Lock all queues related to the event channel (in case of a queue change
+     * this might be two).
+     * It is mandatory to do that before setting and testing the PENDING bit
+     * and to hold the current queue lock until the event has been put into the
+     * list of pending events in order to avoid waking up a guest without the
+     * event being visibly pending in the guest.
+     */
+    for ( try = 0; try < 3; try++ )
+    {
+        union evtchn_fifo_lastq lastq;
+        const struct vcpu *old_v;
+
+        lastq.raw = read_atomic(&evtchn->fifo_lastq);
+        old_v = d->vcpu[lastq.last_vcpu_id];
+
+        q = &v->evtchn_fifo->queue[evtchn->priority];
+        old_q = &old_v->evtchn_fifo->queue[lastq.last_priority];
+
+        if ( q == old_q )
+            spin_lock_irqsave(&q->lock, flags);
+        else if ( q < old_q )
+        {
+            spin_lock_irqsave(&q->lock, flags);
+            spin_lock(&old_q->lock);
+        }
+        else
+        {
+            spin_lock_irqsave(&old_q->lock, flags);
+            spin_lock(&q->lock);
+        }
+
+        lastq.raw = read_atomic(&evtchn->fifo_lastq);
+        old_v = d->vcpu[lastq.last_vcpu_id];
+        if ( q == &v->evtchn_fifo->queue[evtchn->priority] &&
+             old_q == &old_v->evtchn_fifo->queue[lastq.last_priority] )
+            break;
+
+        if ( q != old_q )
+            spin_unlock(&old_q->lock);
+        spin_unlock_irqrestore(&q->lock, flags);
+    }
+
     was_pending = guest_test_and_set_bit(d, EVTCHN_FIFO_PENDING, word);
 
+    /* If we didn't get the lock bail out. */
+    if ( try == 3 )
+    {
+        gprintk(XENLOG_WARNING,
+                "%pd port %u lost event (too many queue changes)\n",
+                d, evtchn->port);
+        goto done;
+    }
+
     /*
      * Link the event if it unmasked and not already linked.
      */
     if ( !guest_test_bit(d, EVTCHN_FIFO_MASKED, word) &&
          !guest_test_bit(d, EVTCHN_FIFO_LINKED, word) )
     {
-        struct evtchn_fifo_queue *q, *old_q;
         event_word_t *tail_word;
-        bool_t linked = 0;
 
         /*
          * Control block not mapped.  The guest must not unmask an
@@ -225,25 +246,11 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
         {
             printk(XENLOG_G_WARNING
                    "%pv has no FIFO event channel control block\n", v);
-            goto done;
+            goto unlock;
         }
 
-        /*
-         * No locking around getting the queue. This may race with
-         * changing the priority but we are allowed to signal the
-         * event once on the old priority.
-         */
-        q = &v->evtchn_fifo->queue[evtchn->priority];
-
-        old_q = lock_old_queue(d, evtchn, &flags);
-        if ( !old_q )
-            goto done;
-
         if ( guest_test_and_set_bit(d, EVTCHN_FIFO_LINKED, word) )
-        {
-            spin_unlock_irqrestore(&old_q->lock, flags);
-            goto done;
-        }
+            goto unlock;
 
         /*
          * If this event was a tail, the old queue is now empty and
@@ -262,8 +269,8 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
             lastq.last_priority = q->priority;
             write_atomic(&evtchn->fifo_lastq, lastq.raw);
 
-            spin_unlock_irqrestore(&old_q->lock, flags);
-            spin_lock_irqsave(&q->lock, flags);
+            spin_unlock(&old_q->lock);
+            old_q = q;
         }
 
         /*
@@ -276,6 +283,7 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
          * If the queue is empty (i.e., we haven't linked to the new
          * event), head must be updated.
          */
+        linked = false;
         if ( q->tail )
         {
             tail_word = evtchn_fifo_word_from_port(d, q->tail);
@@ -284,15 +292,19 @@ static void evtchn_fifo_set_pending(struct vcpu *v, struct evtchn *evtchn)
         if ( !linked )
             write_atomic(q->head, port);
         q->tail = port;
+    }
 
-        spin_unlock_irqrestore(&q->lock, flags);
+ unlock:
+    if ( q != old_q )
+        spin_unlock(&old_q->lock);
+    spin_unlock_irqrestore(&q->lock, flags);
 
-        if ( !linked
-             && !guest_test_and_set_bit(d, q->priority,
-                                        &v->evtchn_fifo->control_block->ready) )
-            vcpu_mark_events_pending(v);
-    }
  done:
+    if ( !linked &&
+         !guest_test_and_set_bit(d, q->priority,
+                                 &v->evtchn_fifo->control_block->ready) )
+        vcpu_mark_events_pending(v);
+
     if ( !was_pending )
         evtchn_check_pollers(d, port);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 30 13:11:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Nov 2020 13:11:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.41143.74262 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1kjixj-0003iA-DS; Mon, 30 Nov 2020 13:11:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 41143.74262; Mon, 30 Nov 2020 13:11: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 1kjixj-0003i1-9N; Mon, 30 Nov 2020 13:11:27 +0000
Received: by outflank-mailman (input) for mailman id 41143;
 Mon, 30 Nov 2020 13:11: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 1kjixi-0003hl-0V
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 13:11: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 1kjixh-0004kg-V7
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 13:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1kjixh-0006Cc-T4
 for xen-changelog@lists.xenproject.org; Mon, 30 Nov 2020 13: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=SfpNDte8ZtIo0V6mfBkvU92QOgs48wM9FUMw2+g+xCw=; b=Eo4JoNi2ISIZrAMp56ssnS0PK7
	X/+Iay0KqNdAJwyRxEmNZWxoTq38X7kPyttPo1HZG5GlGKZFl4HFQCmA7gayJPAFoLJmP4A11LXeR
	odQnHa6QSEvg5gz+EGSsEXGzrw2NuXVL1CzWaBqL7Ltph2UvZY5BC40E9nFpRTkA7id8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vioapic: fix usage of index in place of GSI in vioapic_write_redirent
Message-Id: <E1kjixh-0006Cc-T4@xenbits.xenproject.org>
Date: Mon, 30 Nov 2020 13:11:25 +0000

commit 3ae469af8e680df31eecd0a2ac6a83b58ad7ce53
Author:     Roger Pau Monné <roge.rpau@citrix.com>
AuthorDate: Mon Nov 30 14:06:38 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Nov 30 14:06:38 2020 +0100

    x86/vioapic: fix usage of index in place of GSI in vioapic_write_redirent
    
    The usage of idx instead of the GSI in vioapic_write_redirent when
    accessing gsi_assert_count can cause a PVH dom0 with multiple
    vIO-APICs to lose interrupts in case a pin of a IO-APIC different than
    the first one is unmasked with pending interrupts.
    
    Switch to use gsi instead to fix the issue.
    
    Fixes: 9f44b08f7d0e4 ('x86/vioapic: introduce support for multiple vIO APICS')
    Reported-by: Manuel Bouyer <bouyer@antioche.eu.org>
    Signed-off-by: Roger Pau Monné <roge.rpau@citrix.com>
    Tested-by: Manuel Bouyer <bouyer@antioche.eu.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vioapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 67d4a6237f..e64abee7a9 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -260,7 +260,7 @@ static void vioapic_write_redirent(
         pent->fields.remote_irr = 0;
     else if ( !ent.fields.mask &&
               !ent.fields.remote_irr &&
-              hvm_irq->gsi_assert_count[idx] )
+              hvm_irq->gsi_assert_count[gsi] )
     {
         pent->fields.remote_irr = 1;
         vioapic_deliver(vioapic, idx);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


